diff mbox series

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

Message ID 1633515251-5156-8-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/8] avcodec/bitpacked: check av_buffer_ref result
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. 6, 2021, 10:14 a.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(+)

Comments

Limin Wang Oct. 11, 2021, 2:54 p.m. UTC | #1
On Wed, Oct 06, 2021 at 06:14:11PM +0800, lance.lmwang@gmail.com wrote:
> 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 --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
> 

will apply the patch set tomorrow unless there are objections.
diff mbox series

Patch

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;
     }