Commit a98d9bc4 authored by thardin's avatar thardin

avcodec.h: Clarify AVCodecContext::pix_fmt documentation since its value may be set by the demuxer

rawdec.c: Only perform bits_per_coded_sample -> pix_fmt guesswork if pix_fmt hasn't been set

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23561 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent cdc531fb
...@@ -1121,8 +1121,10 @@ typedef struct AVCodecContext { ...@@ -1121,8 +1121,10 @@ typedef struct AVCodecContext {
/** /**
* Pixel format, see PIX_FMT_xxx. * Pixel format, see PIX_FMT_xxx.
* May be set by the demuxer if known from headers.
* May be overriden by the decoder if it knows better.
* - encoding: Set by user. * - encoding: Set by user.
* - decoding: Set by libavcodec. * - decoding: Set by user if known, overridden by libavcodec if known
*/ */
enum PixelFormat pix_fmt; enum PixelFormat pix_fmt;
......
...@@ -77,7 +77,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) ...@@ -77,7 +77,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_mov, avctx->bits_per_coded_sample); avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_mov, avctx->bits_per_coded_sample);
else if (avctx->codec_tag) else if (avctx->codec_tag)
avctx->pix_fmt = find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag); avctx->pix_fmt = find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag);
else if (avctx->bits_per_coded_sample) else if (avctx->pix_fmt == PIX_FMT_NONE && avctx->bits_per_coded_sample)
avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample); avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample);
context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment