aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-10-17 23:50:14 -0300
committerJames Almer <jamrial@gmail.com>2016-10-18 20:39:07 -0300
commit47ee6f1a59b1f345f4f9d8e79c30d66df12b72e7 (patch)
treea0dbf568f34f2343392e39856a32de4df43a9a2c
parentd2ae5f77c61a29c3c63cc4c41c74ccfca4167649 (diff)
downloadffmpeg-47ee6f1a59b1f345f4f9d8e79c30d66df12b72e7.tar.gz
avformat/matroskadec: support parsing Chroma Location elements
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/matroska.h14
-rw-r--r--libavformat/matroskadec.c8
2 files changed, 22 insertions, 0 deletions
diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 8ad89da2de..13155e5ed0 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -317,6 +317,20 @@ typedef enum {
MATROSKA_VIDEO_DISPLAYUNIT_UNKNOWN = 4,
} MatroskaVideoDisplayUnit;
+typedef enum {
+ MATROSKA_COLOUR_CHROMASITINGHORZ_UNDETERMINED = 0,
+ MATROSKA_COLOUR_CHROMASITINGHORZ_LEFT = 1,
+ MATROSKA_COLOUR_CHROMASITINGHORZ_HALF = 2,
+ MATROSKA_COLOUR_CHROMASITINGHORZ_NB
+} MatroskaColourChromaSitingHorz;
+
+typedef enum {
+ MATROSKA_COLOUR_CHROMASITINGVERT_UNDETERMINED = 0,
+ MATROSKA_COLOUR_CHROMASITINGVERT_TOP = 1,
+ MATROSKA_COLOUR_CHROMASITINGVERT_HALF = 2,
+ MATROSKA_COLOUR_CHROMASITINGVERT_NB
+} MatroskaColourChromaSitingVert;
+
/*
* Matroska Codec IDs, strings
*/
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a5d3c0e543..13a819680a 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1827,6 +1827,14 @@ static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track) {
if (track->video.color.range != AVCOL_RANGE_UNSPECIFIED &&
track->video.color.range <= AVCOL_RANGE_JPEG)
st->codecpar->color_range = track->video.color.range;
+ if (track->video.color.chroma_siting_horz != MATROSKA_COLOUR_CHROMASITINGHORZ_UNDETERMINED &&
+ track->video.color.chroma_siting_vert != MATROSKA_COLOUR_CHROMASITINGVERT_UNDETERMINED &&
+ track->video.color.chroma_siting_horz < MATROSKA_COLOUR_CHROMASITINGHORZ_NB &&
+ track->video.color.chroma_siting_vert < MATROSKA_COLOUR_CHROMASITINGVERT_NB) {
+ st->codecpar->chroma_location =
+ avcodec_chroma_pos_to_enum((track->video.color.chroma_siting_horz - 1) << 7,
+ (track->video.color.chroma_siting_vert - 1) << 7);
+ }
if (has_mastering_primaries || has_mastering_luminance) {
// Use similar rationals as other standards.