[FFmpeg-devel] [PATCH] BFI demuxer

Sisir Koppaka sisir.koppaka
Sat Apr 12 21:48:56 CEST 2008


On Sun, Apr 13, 2008 at 1:06 AM, Michael Niedermayer <michaelni at gmx.at>
wrote:

> On Sun, Apr 13, 2008 at 12:34:10AM +0530, Sisir Koppaka wrote:
> > Updated patch attached. Made the superfluous () change  and edited the
> close
> > function. Is this one ok?
> >
> > On Sun, Apr 13, 2008 at 12:17 AM, Michael Niedermayer <michaelni at gmx.at>
> > wrote:
> >
> > > On Sat, Apr 12, 2008 at 11:22:07PM +0530, Sisir Koppaka wrote:
> > > > I suppose it's wrong because it's only supposed to close the stream
> and
> > > not
> > > > free AVFormatContext etc...I saw some of the other demuxers and they
> are
> > > > freeing any pointers that they created in their local structures(in
> > > > priv_data) but since I didn't do any, can I just return 0; ?
> > >
> > > yes
> > >
> > Fixed :)
> [...]
> > +static int bfi_read_header(AVFormatContext * s, AVFormatParameters *
> ap)
> > +{
> > +    BFIContext *bfi = s->priv_data;
> > +    ByteIOContext *pb = s->pb;
> > +    AVStream *vstream;
> > +    AVStream *astream;
> > +    int fps, chunk_header;
> > +
> > +    /* Initialize the video codec... */
> > +    vstream = av_new_stream(s, 0);
> > +    if (!vstream)
> > +        return AVERROR(ENOMEM);
> > +
> > +    /* Initialize the audio codec... */
> > +    astream = av_new_stream(s, 0);
> > +    if (!astream)
> > +        return AVERROR(ENOMEM);
> > +
> > +    /* Set the total number of frames. */
> > +    url_fskip(pb, 8);
> > +    chunk_header     = get_le32(pb);
> > +    bfi->nframes     = get_le32(pb);
>
> > +    bfi->audio_frame = 0;
> > +    bfi->video_frame = 0;
>
> The context is automatically initalized to 0 thus these are unneeded.
>
Sorry this missed me. Fixed.

>
>
> [...]
> > +static int bfi_read_close(AVFormatContext *s)
> > +{
> > +    return 0;
> > +}
> > +
> > +AVInputFormat bfi_demuxer = {
> > +    "bfi",
> > +    "Brute Force & Ignorance",
> > +    sizeof(BFIContext),
> > +    bfi_probe,
> > +    bfi_read_header,
> > +    bfi_read_packet,
> > +    bfi_read_close,
>
> as bfi_read_close() does nothing now, you can as well just use NULL
> instead
> of it. And trailing NULL in a struct initalization can be omited.
>
Shall I remove the definition as well or is the return value of 0 necessary
somewhere else?

-----------------
Sisir Koppaka




More information about the ffmpeg-devel mailing list