[FFmpeg-devel] [PATCH 6/8] avformat/rtpdec_rfc4175: add support for TCS
lance.lmwang at gmail.com
lance.lmwang at gmail.com
Wed Oct 6 13:14:09 EEST 2021
From: Limin Wang <lance.lmwang at gmail.com>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
libavformat/rtpdec_rfc4175.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
index 367567d..db6b9b8 100644
--- a/libavformat/rtpdec_rfc4175.c
+++ b/libavformat/rtpdec_rfc4175.c
@@ -30,6 +30,7 @@
struct PayloadContext {
char *sampling;
char *framerate;
+ char *TCS;
int depth;
int width;
int height;
@@ -66,6 +67,21 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data)
return AVERROR_INVALIDDATA;
}
+ if (!data->TCS)
+ stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED;
+ else if (!strncmp(data->TCS, "SDR", 3))
+ stream->codecpar->color_trc = AVCOL_TRC_BT709;
+ else if (!strncmp(data->TCS, "PQ", 2))
+ stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084;
+ else if (!strncmp(data->TCS, "HLG", 3))
+ stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67;
+ else if (!strncmp(data->TCS, "LINEAR", 6))
+ stream->codecpar->color_trc = AVCOL_TRC_LINEAR;
+ else if (!strncmp(data->TCS, "ST428-1", 7))
+ stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1;
+ else if (!strncmp(data->TCS, "UNSPECIFIED", 11))
+ stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED;
+
desc = av_pix_fmt_desc_get(pixfmt);
stream->codecpar->format = pixfmt;
stream->codecpar->codec_tag = tag;
@@ -97,6 +113,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream,
data->depth = atoi(value);
else if (!strncmp(attr, "exactframerate", 14))
data->framerate = av_strdup(value);
+ else if (!strncmp(attr, "TCS", 3))
+ data->TCS = av_strdup(value);
return 0;
}
@@ -126,6 +144,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index,
ret = rfc4175_parse_format(stream, data);
av_freep(&data->sampling);
av_freep(&data->framerate);
+ av_freep(&data->TCS);
return ret;
}
--
1.8.3.1
More information about the ffmpeg-devel
mailing list