diff mbox

[FFmpeg-devel,1/2] avfilter/video: pick sar from link

Message ID 20171210205209.9456-1-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol Dec. 10, 2017, 8:52 p.m. UTC
It should not be needed for each filter that sets sample aspect ratio
to set it explicitly also for each and every frame, instead that is
automatically done in get_buffer call.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/video.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Dec. 15, 2017, 7:10 p.m. UTC | #1
On 12/10/17, Paul B Mahol <onemda@gmail.com> wrote:
> It should not be needed for each filter that sets sample aspect ratio
> to set it explicitly also for each and every frame, instead that is
> automatically done in get_buffer call.
>
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/video.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/video.c b/libavfilter/video.c
> index 6f9020b9fe..7a8e587798 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,13 @@ 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->sample_aspect_ratio = link->sample_aspect_ratio;
> +
> +    return frame;
>  }
>
>  AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
> --
> 2.11.0
>
>

Will apply this 2 sample aspect ratio patches really soon.
diff mbox

Patch

diff --git a/libavfilter/video.c b/libavfilter/video.c
index 6f9020b9fe..7a8e587798 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,13 @@  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->sample_aspect_ratio = link->sample_aspect_ratio;
+
+    return frame;
 }
 
 AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)