| OLD | NEW |
| 1 /* Copyright (c) 2011 Xiph.Org Foundation | 1 /* Copyright (c) 2011 Xiph.Org Foundation |
| 2 Written by Jean-Marc Valin */ | 2 Written by Jean-Marc Valin */ |
| 3 /* | 3 /* |
| 4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
| 6 are met: | 6 are met: |
| 7 | 7 |
| 8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
| 9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
| 10 | 10 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 return ret; | 230 return ret; |
| 231 } else if (ret > frame_size) | 231 } else if (ret > frame_size) |
| 232 { | 232 { |
| 233 RESTORE_STACK; | 233 RESTORE_STACK; |
| 234 return OPUS_BUFFER_TOO_SMALL; | 234 return OPUS_BUFFER_TOO_SMALL; |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 for (s=0;s<st->layout.nb_streams;s++) | 237 for (s=0;s<st->layout.nb_streams;s++) |
| 238 { | 238 { |
| 239 OpusDecoder *dec; | 239 OpusDecoder *dec; |
| 240 int packet_offset, ret; | 240 opus_int32 packet_offset; |
| 241 int ret; |
| 241 | 242 |
| 242 dec = (OpusDecoder*)ptr; | 243 dec = (OpusDecoder*)ptr; |
| 243 ptr += (s < st->layout.nb_coupled_streams) ? align(coupled_size) : align(m
ono_size); | 244 ptr += (s < st->layout.nb_coupled_streams) ? align(coupled_size) : align(m
ono_size); |
| 244 | 245 |
| 245 if (!do_plc && len<=0) | 246 if (!do_plc && len<=0) |
| 246 { | 247 { |
| 247 RESTORE_STACK; | 248 RESTORE_STACK; |
| 248 return OPUS_INTERNAL_ERROR; | 249 return OPUS_INTERNAL_ERROR; |
| 249 } | 250 } |
| 250 packet_offset = 0; | 251 packet_offset = 0; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 419 |
| 419 coupled_size = opus_decoder_get_size(2); | 420 coupled_size = opus_decoder_get_size(2); |
| 420 mono_size = opus_decoder_get_size(1); | 421 mono_size = opus_decoder_get_size(1); |
| 421 ptr = (char*)st + align(sizeof(OpusMSDecoder)); | 422 ptr = (char*)st + align(sizeof(OpusMSDecoder)); |
| 422 switch (request) | 423 switch (request) |
| 423 { | 424 { |
| 424 case OPUS_GET_BANDWIDTH_REQUEST: | 425 case OPUS_GET_BANDWIDTH_REQUEST: |
| 425 case OPUS_GET_SAMPLE_RATE_REQUEST: | 426 case OPUS_GET_SAMPLE_RATE_REQUEST: |
| 426 case OPUS_GET_GAIN_REQUEST: | 427 case OPUS_GET_GAIN_REQUEST: |
| 427 case OPUS_GET_LAST_PACKET_DURATION_REQUEST: | 428 case OPUS_GET_LAST_PACKET_DURATION_REQUEST: |
| 429 case OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST: |
| 428 { | 430 { |
| 429 OpusDecoder *dec; | 431 OpusDecoder *dec; |
| 430 /* For int32* GET params, just query the first stream */ | 432 /* For int32* GET params, just query the first stream */ |
| 431 opus_int32 *value = va_arg(ap, opus_int32*); | 433 opus_int32 *value = va_arg(ap, opus_int32*); |
| 432 dec = (OpusDecoder*)ptr; | 434 dec = (OpusDecoder*)ptr; |
| 433 ret = opus_decoder_ctl(dec, request, value); | 435 ret = opus_decoder_ctl(dec, request, value); |
| 434 } | 436 } |
| 435 break; | 437 break; |
| 436 case OPUS_GET_FINAL_RANGE_REQUEST: | 438 case OPUS_GET_FINAL_RANGE_REQUEST: |
| 437 { | 439 { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 { | 494 { |
| 493 if (s < st->layout.nb_coupled_streams) | 495 if (s < st->layout.nb_coupled_streams) |
| 494 ptr += align(coupled_size); | 496 ptr += align(coupled_size); |
| 495 else | 497 else |
| 496 ptr += align(mono_size); | 498 ptr += align(mono_size); |
| 497 } | 499 } |
| 498 *value = (OpusDecoder*)ptr; | 500 *value = (OpusDecoder*)ptr; |
| 499 } | 501 } |
| 500 break; | 502 break; |
| 501 case OPUS_SET_GAIN_REQUEST: | 503 case OPUS_SET_GAIN_REQUEST: |
| 504 case OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST: |
| 502 { | 505 { |
| 503 int s; | 506 int s; |
| 504 /* This works for int32 params */ | 507 /* This works for int32 params */ |
| 505 opus_int32 value = va_arg(ap, opus_int32); | 508 opus_int32 value = va_arg(ap, opus_int32); |
| 506 for (s=0;s<st->layout.nb_streams;s++) | 509 for (s=0;s<st->layout.nb_streams;s++) |
| 507 { | 510 { |
| 508 OpusDecoder *dec; | 511 OpusDecoder *dec; |
| 509 | 512 |
| 510 dec = (OpusDecoder*)ptr; | 513 dec = (OpusDecoder*)ptr; |
| 511 if (s < st->layout.nb_coupled_streams) | 514 if (s < st->layout.nb_coupled_streams) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 528 bad_arg: | 531 bad_arg: |
| 529 va_end(ap); | 532 va_end(ap); |
| 530 return OPUS_BAD_ARG; | 533 return OPUS_BAD_ARG; |
| 531 } | 534 } |
| 532 | 535 |
| 533 | 536 |
| 534 void opus_multistream_decoder_destroy(OpusMSDecoder *st) | 537 void opus_multistream_decoder_destroy(OpusMSDecoder *st) |
| 535 { | 538 { |
| 536 opus_free(st); | 539 opus_free(st); |
| 537 } | 540 } |
| OLD | NEW |