summaryrefslogtreecommitdiff
path: root/libavformat/yuv4mpegdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/yuv4mpegdec.c')
-rw-r--r--libavformat/yuv4mpegdec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index eff7fc518e..855fadbb31 100644
--- a/libavformat/yuv4mpegdec.c
+++ b/libavformat/yuv4mpegdec.c
@@ -41,6 +41,7 @@ static int yuv4_read_header(AVFormatContext *s)
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE, alt_pix_fmt = AV_PIX_FMT_NONE;
enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
enum AVFieldOrder field_order = AV_FIELD_UNKNOWN;
+ enum AVColorRange color_range = AVCOL_RANGE_UNSPECIFIED;
AVStream *st;
for (i = 0; i < MAX_YUV4_HEADER; i++) {
@@ -220,6 +221,12 @@ static int yuv4_read_header(AVFormatContext *s)
alt_pix_fmt = AV_PIX_FMT_YUV422P;
else if (strncmp("444", tokstart, 3) == 0)
alt_pix_fmt = AV_PIX_FMT_YUV444P;
+ } else if (strncmp("COLORRANGE=", tokstart, 11) == 0) {
+ tokstart += 11;
+ if (strncmp("FULL",tokstart, 4) == 0)
+ color_range = AVCOL_RANGE_JPEG;
+ else if (strncmp("LIMITED", tokstart, 7) == 0)
+ color_range = AVCOL_RANGE_MPEG;
}
while (tokstart < header_end && *tokstart != 0x20)
tokstart++;
@@ -263,6 +270,7 @@ static int yuv4_read_header(AVFormatContext *s)
st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
st->sample_aspect_ratio = (AVRational){ aspectn, aspectd };
st->codecpar->chroma_location = chroma_sample_location;
+ st->codecpar->color_range = color_range;
st->codecpar->field_order = field_order;
s->packet_size = av_image_get_buffer_size(st->codecpar->format, width, height, 1) + Y4M_FRAME_MAGIC_LEN;
if ((int) s->packet_size < 0)