[FFmpeg-devel] [PATCH 8/8] avformat/rtpdec_rfc4175: add support for RANGE

lance.lmwang at gmail.com lance.lmwang at gmail.com
Wed Oct 6 13:14:11 EEST 2021


From: Limin Wang <lance.lmwang at gmail.com>

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

diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
index 23a3f4f..86ffb38 100644
--- a/libavformat/rtpdec_rfc4175.c
+++ b/libavformat/rtpdec_rfc4175.c
@@ -32,6 +32,7 @@ struct PayloadContext {
     char *framerate;
     char *TCS;
     char *colorimetry;
+    char *range;
     int depth;
     int width;
     int height;
@@ -97,6 +98,13 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data)
         stream->codecpar->color_space     = AVCOL_SPC_BT2020_NCL;
     }
 
+    if (!data->range)
+        stream->codecpar->color_range = AVCOL_RANGE_MPEG;
+    else if (!strncmp(data->range, "NARROW", 6))
+        stream->codecpar->color_range = AVCOL_RANGE_MPEG;
+    else if (!strncmp(data->range, "FULL", 4))
+        stream->codecpar->color_range = AVCOL_RANGE_JPEG;
+
     desc = av_pix_fmt_desc_get(pixfmt);
     stream->codecpar->format = pixfmt;
     stream->codecpar->codec_tag = tag;
@@ -132,6 +140,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream,
         data->TCS = av_strdup(value);
     else if (!strncmp(attr, "colorimetry", 11))
         data->colorimetry = av_strdup(value);
+    else if (!strncmp(attr, "RANGE", 5))
+        data->range = av_strdup(value);
 
     return 0;
 }
@@ -163,6 +173,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index,
         av_freep(&data->framerate);
         av_freep(&data->TCS);
         av_freep(&data->colorimetry);
+        av_freep(&data->range);
 
         return ret;
     }
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list