Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel mapping 255 and Ambisonics mapping 2 and 3 #45

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Guard and check in opus_head_parse with map3
chris-hld committed Feb 6, 2024
commit f2398273d24790cd9e91ba3205b84f6f0eda2348
6 changes: 6 additions & 0 deletions src/info.c
Original file line number Diff line number Diff line change
@@ -110,6 +110,7 @@ int opus_head_parse(OpusHead *_head,const unsigned char *_data,size_t _len){
/*Use channel mapping 3 for orders {1, 2, 3} with 4 to 18 channels
(including the non-diegetic stereo track). For other orders with no
demixing matrices currently available, use channel mapping 2.*/
#ifdef OPUS_HAVE_OPUS_PROJECTION_H
size_t size;
size_t dmatrix_size;
int i;
@@ -131,11 +132,16 @@ int opus_head_parse(OpusHead *_head,const unsigned char *_data,size_t _len){

dmatrix_size = head.channel_count*(head.stream_count+head.coupled_count) *
sizeof(opus_int16);
if (dmatrix_size > OPUS_DEMIXING_MATRIX_SIZE_MAX)
return OP_EBADHEADER;
memcpy(_head->dmatrix, _data + 21, dmatrix_size);
if (_head != NULL){
for (i = 0; i < head.channel_count; i++)
_head->mapping[i] = i;
}
#else
return OP_EIMPL;
#endif
}
/*General purpose players should not attempt to play back content with
channel mapping family 255.*/