[FFmpeg-devel] [PATCH] Bink file demuxer and audio decoder

Daniel Verkamp daniel
Sun Jun 21 02:03:07 CEST 2009


On Sat, Jun 20, 2009 at 9:49 AM, Peter Ross <pross at xvid.org> wrote:
> On Mon, Jan 19, 2009 at 02:34:07PM +0100, Michael Niedermayer wrote:
[...]
> > > + ? ?if (bink->num_audio_tracks) {
> >
> > the if() seems useless
>
> This is crucial as the audio header only exists when num_audio_tracks > 0.
>

If num_audio_tracks is 0, the url_fskip will skip nothing and the for
loop won't execute any iterations, so i think it will be the same,
although I also think the if() makes it clearer...

> > > + ? ? ? ?url_fskip(pb, 4 * bink->num_audio_tracks);
> > > +
> > > + ? ? ? ?for (i = 0; i < bink->num_audio_tracks; i++) {
> > > + ? ? ? ? ? ?ast = av_new_stream(s, 1);
> > > + ? ? ? ? ? ?if (!ast)
> > > + ? ? ? ? ? ? ? ?return AVERROR(ENOMEM);
> > > + ? ? ? ? ? ?ast->codec->codec_type ?= CODEC_TYPE_AUDIO;
> > > + ? ? ? ? ? ?ast->codec->codec_id ? ?= CODEC_ID_BINKAUDIO;
> > > + ? ? ? ? ? ?ast->codec->codec_tag ? = 0;
> > > + ? ? ? ? ? ?ast->codec->sample_rate = get_le16(pb);
> > > + ? ? ? ? ? ?av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
> >
> > > + ? ? ? ? ? ?audio_flags = get_le16(pb);
> > > + ? ? ? ? ? ?ast->codec->channels = audio_flags & BINK_AUD_STEREO ? 2 : 1;
> > > + ? ? ? ? ? ?if (audio_flags & BINK_AUD_USEDCT) {
> > > + ? ? ? ? ? ? ? ?ast->codec->extradata = av_malloc(BINK_EXTRADATA_SIZE);
> > > + ? ? ? ? ? ? ? ?ast->codec->extradata_size = BINK_EXTRADATA_SIZE;
> > > + ? ? ? ? ? ? ? ?*ast->codec->extradata = 1;
> > > + ? ? ? ? ? ?}
[...]

-- Daniel Verkamp



More information about the ffmpeg-devel mailing list