[FFmpeg-devel] [PATCH 7/7] Add check in av_write_header() which validates the rawvideo codec tag.

Stefano Sabatini stefano.sabatini-lala
Tue Jun 1 12:39:41 CEST 2010


On date Thursday 2010-05-27 21:59:52 +0200, Michael Niedermayer encoded:
> On Thu, May 27, 2010 at 12:28:28AM +0200, Stefano Sabatini wrote:
> > Make the function fail if there is no codec tag associated to that
> > pixel format.
> > ---
> >  libavformat/utils.c |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> this patch requires as prereqesite avienc/riff to override codec_tag
> so its 0 for rgb formats

The problem with the current code is that if
avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt) in rawenc.c returns 0,
then av_write_header() does:
st->codec->codec_tag= av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id);

which sets the codec tag to the first entry with codec id == RAWVIDEO,
which may have nothing to do with the pixel format of the output
stream.

See new patch, regards.
-- 
FFmpeg = Fierce and Forgiving Most Proud Enhanced Gadget



More information about the ffmpeg-devel mailing list