[FFmpeg-devel,02/24] avfilter/avfilter: add color_range to AVFilterLink struct

Submitted by Paul B Mahol on May 1, 2018, 7:39 p.m.

Details

Message ID 20180501194013.9552-2-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol May 1, 2018, 7:39 p.m.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/avfilter.c | 2 ++
 libavfilter/avfilter.h | 2 ++
 libavfilter/video.c    | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index ed8161136c..3f0dc14d01 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -338,6 +338,8 @@  int avfilter_config_links(AVFilterContext *filter)
                         link->w = inlink->w;
                     if (!link->h)
                         link->h = inlink->h;
+                    if (!link->color_range)
+                        link->color_range = inlink->color_range;
                 } else if (!link->w || !link->h) {
                     av_log(link->src, AV_LOG_ERROR,
                            "Video source filters must set their output link's "
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 9d70e7118b..11cd586bae 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -600,6 +600,8 @@  struct AVFilterLink {
      */
     AVBufferRef *hw_frames_ctx;
 
+    enum AVColorRange color_range;    ///< color range type, video only
+
 #ifndef FF_INTERNAL_FIELDS
 
     /**
diff --git a/libavfilter/video.c b/libavfilter/video.c
index 7a8e587798..64d8c3b3aa 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -90,8 +90,8 @@  AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
     frame = ff_frame_pool_get(link->frame_pool);
     if (!frame)
         return NULL;
-
     frame->sample_aspect_ratio = link->sample_aspect_ratio;
+    frame->color_range = link->color_range;
 
     return frame;
 }