* Decode audio specific configuration; reference: table 1.13. * * @param data pointer to AVCodecContext extradata * @param data_size size of AVCCodecContext extradata * * @return Returns error status. 0 - OK, !0 - error */
| 460 | * @return Returns error status. 0 - OK, !0 - error |
| 461 | */ |
| 462 | static int decode_audio_specific_config(AACContext *ac, void *data, |
| 463 | int data_size) |
| 464 | { |
| 465 | GetBitContext gb; |
| 466 | int i; |
| 467 | |
| 468 | init_get_bits(&gb, data, data_size * 8); |
| 469 | |
| 470 | if ((i = ff_mpeg4audio_get_config(&ac->m4ac, data, data_size)) < 0) |
| 471 | return -1; |
| 472 | if (ac->m4ac.sampling_index > 12) { |
| 473 | av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); |
| 474 | return -1; |
| 475 | } |
| 476 | if (ac->m4ac.sbr == 1 && ac->m4ac.ps == -1) |
| 477 | ac->m4ac.ps = 1; |
| 478 | |
| 479 | skip_bits_long(&gb, i); |
| 480 | |
| 481 | switch (ac->m4ac.object_type) { |
| 482 | case AOT_AAC_MAIN: |
| 483 | case AOT_AAC_LC: |
| 484 | if (decode_ga_specific_config(ac, &gb, ac->m4ac.chan_config)) |
| 485 | return -1; |
| 486 | break; |
| 487 | default: |
| 488 | av_log(ac->avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n", |
| 489 | ac->m4ac.sbr == 1? "SBR+" : "", ac->m4ac.object_type); |
| 490 | return -1; |
| 491 | } |
| 492 | return 0; |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * linear congruential pseudorandom number generator |
no test coverage detected