[FFmpeg-devel] [PATCH 7/7] Add check in av_write_header() which validates the rawvideo codec tag.
Tue Jun 1 19:29:34 CEST 2010
On date Tuesday 2010-06-01 17:53:36 +0200, Michael Niedermayer encoded:
> On Tue, Jun 01, 2010 at 12:39:41PM +0200, Stefano Sabatini wrote:
> > 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.
> you are confused.
> codec_tag must be 0 for rgb in avi. and the first entry is 0
> if rgb in avi is stored with non 0 codec_tag currently then you
> introduced a very serious bug. And the fix is to override it in
> riff.c as i said multiple times.
I have not the faintest idea about what "rgb in avi" is, there are
tons of RGB pixel formats which can fit in rawvideo, also I have no
idea what you mean by "override it in riff.c" and I'm quite tired of
playing at mind-guessing.
What the code currently implements is just wrong for both AVI and NUT,
in the case of AVI if the pixel format cannot be mapped to any codec
tag, codec_tag is set to 0, which when reading it is interpreted as
YUV420P, for NUT the first entry with codec_id == RAWVIDEO from the
codec_tag map is choosen, which is RGB15.
FFmpeg = Fostering Foolish Mega Prodigious Enhancing Gymnast
More information about the ffmpeg-devel