[FFmpeg-devel] [PATCH] extend ac3 parser to fetch more values
Justin Ruggles
justin.ruggles
Mon Sep 1 00:24:00 CEST 2008
Baptiste Coudurier wrote:
> Hi
>
> $subject, these fields are needed to be put in extradata in mp4, don't
> ask me why see with ETSI :(
>
>
> Index: libavcodec/ac3_parser.c
> ===================================================================
> --- libavcodec/ac3_parser.c (revision 15046)
> +++ libavcodec/ac3_parser.c (working copy)
> @@ -62,13 +62,13 @@
> if(hdr->sr_code == 3)
> return AC3_PARSE_ERROR_SAMPLE_RATE;
>
> - frame_size_code = get_bits(gbc, 6);
> - if(frame_size_code > 37)
> + hdr->frame_size_code = get_bits(gbc, 6);
> + if(hdr->frame_size_code > 37)
> return AC3_PARSE_ERROR_FRAME_SIZE;
>
> skip_bits(gbc, 5); // skip bsid, already got it
>
> - skip_bits(gbc, 3); // skip bitstream mode
> + hdr->bitstream_mode = get_bits(gbc, 3);
> hdr->channel_mode = get_bits(gbc, 3);
>
> if(hdr->channel_mode == AC3_CHMODE_STEREO) {
> @@ -83,9 +83,9 @@
>
> hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
> hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
> - hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift;
> + hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->frame_size_code>>1] * 1000) >> hdr->sr_shift;
> hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
> - hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
> + hdr->frame_size = ff_ac3_frame_size_tab[hdr->frame_size_code][hdr->sr_code] * 2;
> hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
> hdr->substreamid = 0;
> } else {
> Index: libavcodec/ac3.h
> ===================================================================
> --- libavcodec/ac3.h (revision 15046)
> +++ libavcodec/ac3.h (working copy)
> @@ -81,7 +81,9 @@
> uint16_t sync_word;
> uint16_t crc1;
> uint8_t sr_code;
> + uint8_t frame_size_code;
> uint8_t bitstream_id;
> + uint8_t bitstream_mode;
> uint8_t channel_mode;
> uint8_t lfe_on;
> uint8_t frame_type;
patch ok.
-Justin
More information about the ffmpeg-devel
mailing list