[FFmpeg-devel] [PATCH 11/13] Make nut muxer try to get the codec id from ff_raw_pixelFormatTags if ff_codec_get_id() cannot find it.

Stefano Sabatini stefano.sabatini-lala
Fri May 21 01:19:06 CEST 2010


On date Monday 2010-05-17 01:15:26 +0200, Michael Niedermayer encoded:
> On Sat, May 15, 2010 at 04:43:31PM +0200, Stefano Sabatini wrote:
> > On date Monday 2010-05-10 00:14:47 +0200, Michael Niedermayer encoded:
> > > On Sun, May 09, 2010 at 04:29:29PM +0200, Stefano Sabatini wrote:
> > > > This allows the muxer to use the Nut rawvideo pixel formats codec tags
> > > > specified in ff_raw_pixelFormatTags.
> > > > ---
> > > >  libavformat/nutdec.c |    4 ++++
> > > >  1 files changed, 4 insertions(+), 0 deletions(-)
> > > > 
> > > > diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
> > > > index 522affb..c480b9e 100644
> > > > --- a/libavformat/nutdec.c
> > > > +++ b/libavformat/nutdec.c
> > > > @@ -21,6 +21,7 @@
> > > >   */
> > > >  
> > > >  #include <strings.h>
> > > > +#include "libavcodec/internal.h"
> > > >  #include "libavutil/avstring.h"
> > > >  #include "libavutil/bswap.h"
> > > >  #include "libavutil/tree.h"
> > > > @@ -317,6 +318,9 @@ static int decode_stream_header(NUTContext *nut){
> > > >          case 0:
> > > >              st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
> > > >              st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tmp);
> > > > +            if (!st->codec->codec_id &&
> > > > +                ff_get_pix_fmt_from_codec_tag(ff_raw_pixelFormatTags, tmp) != PIX_FMT_NONE)
> > > > +                st->codec->codec_id = CODEC_ID_RAWVIDEO;
> > > 
> > > the codec tag/id mapping must be in AVOutputFormat.codec_tag
> > 
> > Yes but what about codec tag/pix_fmt mapping?
> 
> the pixel format is more or less a decoder output property
> and an encoder input property
> its not really a demuxer level property.

The code here tries to understand if the codec id is RAWVIDEO, is not
trying to get the pixel format (that is computed in rawdec.c), but in
order to do that it's using the mapping in ff_raw_pixelFormatTags.

Alternatively we could just assume RAWVIDEO by default, really can't
say if that would be better.

Regards.
-- 
FFmpeg = Foolish and Friendly Meaningless Powerful Elastic Glue



More information about the ffmpeg-devel mailing list