MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / parse_adts_extradata

Function parse_adts_extradata

libhb/decavcodec.c:765–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

763}
764
765static int parse_adts_extradata( hb_audio_t * audio, AVCodecContext * context,
766 AVPacket * pkt )
767{
768 const AVBitStreamFilter * bsf;
769 AVBSFContext * ctx = NULL;
770 int ret;
771
772 if (audio == NULL)
773 {
774 return 1;
775 }
776
777 bsf = av_bsf_get_by_name("aac_adtstoasc");
778 ret = av_bsf_alloc(bsf, &ctx);
779 if (ret < 0)
780 {
781 hb_error("decavcodec: bitstream filter alloc failure");
782 return ret;
783 }
784 ctx->time_base_in.num = 1;
785 ctx->time_base_in.den = audio->config.out.samplerate;
786 avcodec_parameters_from_context(ctx->par_in, context);
787 ret = av_bsf_init(ctx);
788 if (ret < 0)
789 {
790 hb_error("decavcodec: bitstream filter init failure");
791 av_bsf_free(&ctx);
792 return ret;
793 }
794
795 ret = av_bsf_send_packet(ctx, pkt);
796 if (ret < 0)
797 {
798 hb_error("decavcodec: av_bsf_send_packet failure");
799 av_bsf_free(&ctx);
800 return ret;
801 }
802
803 ret = av_bsf_receive_packet(ctx, pkt);
804 av_bsf_free(&ctx);
805 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
806 {
807 return 0;
808 }
809 else if (ret < 0)
810 {
811 if (ret != AVERROR_INVALIDDATA)
812 {
813 hb_error("decavcodec: av_bsf_receive_packet failure %x", -ret);
814 }
815 return ret;
816 }
817
818 if (audio->priv.extradata == NULL ||
819 (audio->priv.extradata && audio->priv.extradata->size == 0))
820 {
821 const uint8_t * extradata;
822 size_t size;

Callers 1

decavcodecaBSInfoFunction · 0.85

Calls 2

hb_errorFunction · 0.85
hb_set_extradataFunction · 0.85

Tested by

no test coverage detected