summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/avcodec.h4
-rw-r--r--libavcodec/rawdec.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5e77fb3592..ffc2e07ce8 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1121,8 +1121,10 @@ typedef struct AVCodecContext {
/**
* 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.
- * - decoding: Set by libavcodec.
+ * - decoding: Set by user if known, overridden by libavcodec if known
*/
enum PixelFormat pix_fmt;
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index ab13bdc59e..ce1febbf94 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -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);
else if (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);
context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);