[02/12] buffersrc: accept the frame rate as argument.

Message ID 1445977054-15625-3-git-send-email-stebbins@jetheaddev.com
State New
Headers show

Commit Message

John Stebbins Oct. 27, 2015, 8:17 p.m.
From: Nicolas George <nicolas.george@normalesup.org>

(cherry picked from commit 9ca440679dc535b31edd569393d8d3dda59db90e)
---
 libavfilter/buffersrc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Luca Barbato Oct. 27, 2015, 9:02 p.m. | #1
On 27/10/15 21:17, John Stebbins wrote:
> +    { "frame_rate",    NULL,                     OFFSET(frame_rate),       AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, V },

INT_MAX or DBL_MAX ?

lu
Luca Barbato Oct. 27, 2015, 9:08 p.m. | #2
On 27/10/15 22:02, Luca Barbato wrote:
> On 27/10/15 21:17, John Stebbins wrote:
>> +    { "frame_rate",    NULL,                     OFFSET(frame_rate),       AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, V },
> 
> INT_MAX or DBL_MAX ?
> 

other filters parse the framerate string, I wonder if the end result is
the same though.

Patch

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index a9b893c..ac14d54 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -44,6 +44,7 @@  typedef struct BufferSourceContext {
     const AVClass    *class;
     AVFifoBuffer     *fifo;
     AVRational        time_base;     ///< time_base to set in the output link
+    AVRational        frame_rate;    ///< frame_rate to set in the output link
 
     /* video only */
     int               h, w;
@@ -191,6 +192,7 @@  static const AVOption video_options[] = {
 #endif
     { "sar",           "sample aspect ratio",    OFFSET(pixel_aspect),     AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, DBL_MAX, V },
     { "time_base",     NULL,                     OFFSET(time_base),        AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
+    { "frame_rate",    NULL,                     OFFSET(frame_rate),       AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, V },
     { NULL },
 };
 
@@ -308,6 +310,7 @@  static int config_props(AVFilterLink *link)
     }
 
     link->time_base = c->time_base;
+    link->frame_rate = c->frame_rate;
     return 0;
 }