[FFmpeg-devel] [PATCH 02/25] avfilter/avfilter: add color_range to AVFilterLink struct

Paul B Mahol onemda at gmail.com
Sat Dec 16 12:12:22 EET 2017


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavfilter/avfilter.c | 2 ++
 libavfilter/avfilter.h | 2 ++
 libavfilter/video.c    | 8 +++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index b98b32bacb..4a579bb49d 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -336,6 +336,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 47546c15e5..40ad28ffd8 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -584,6 +584,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 6f9020b9fe..8f12cb7080 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -43,6 +43,7 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
 
 AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
 {
+    AVFrame *frame = NULL;
     int pool_width = 0;
     int pool_height = 0;
     int pool_align = 0;
@@ -86,7 +87,12 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
         }
     }
 
-    return ff_frame_pool_get(link->frame_pool);
+    frame = ff_frame_pool_get(link->frame_pool);
+    if (!frame)
+        return NULL;
+    frame->color_range = link->color_range;
+
+    return frame;
 }
 
 AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
-- 
2.11.0



More information about the ffmpeg-devel mailing list