diff mbox series

[FFmpeg-devel,v2,3/4] avformat/rtpdec_rfc4175: add support for colorimetry

Message ID 1633969392-17937-3-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit bad48dfe9ae345966a94852b45d4deb327895372
Headers show
Series [FFmpeg-devel,v2,1/4] avformat/rtpdec_rfc4175: add support for exactframerate
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Limin Wang Oct. 11, 2021, 4:23 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/rtpdec_rfc4175.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
index d45530e..93607d7 100644
--- a/libavformat/rtpdec_rfc4175.c
+++ b/libavformat/rtpdec_rfc4175.c
@@ -107,6 +107,17 @@  static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream,
             stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1;
         else
             stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED;
+    } else if (!strncmp(attr, "colorimetry", 11)) {
+        if (!strncmp(value, "BT601", 5)) {
+            stream->codecpar->color_primaries = AVCOL_PRI_BT470BG;
+            stream->codecpar->color_space     = AVCOL_SPC_BT470BG;
+        } else if (!strncmp(value, "BT709", 5)) {
+            stream->codecpar->color_primaries = AVCOL_PRI_BT709;
+            stream->codecpar->color_space     = AVCOL_SPC_BT709;
+        } else if (!strncmp(value, "BT2020", 6)) {
+            stream->codecpar->color_primaries = AVCOL_PRI_BT2020;
+            stream->codecpar->color_space     = AVCOL_SPC_BT2020_NCL;
+        }
     }
 
     return 0;