Commit 867ae7aa authored by Stefano Sabatini's avatar Stefano Sabatini

Add a time_base field to AVFilterLink.

This is required for allowing a filter to use a time base different
from AV_TIME_BASE_Q, as it was previously assumed.

Originally committed as revision 25441 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent d256d21e
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "libavcodec/audioconvert.c" #include "libavcodec/audioconvert.c"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#include "libavutil/rational.h"
#include "libavcore/imgutils.h" #include "libavcore/imgutils.h"
#include "avfilter.h" #include "avfilter.h"
#include "internal.h" #include "internal.h"
...@@ -180,6 +181,9 @@ int avfilter_config_links(AVFilterContext *filter) ...@@ -180,6 +181,9 @@ int avfilter_config_links(AVFilterContext *filter)
if ((ret = config_link(link)) < 0) if ((ret = config_link(link)) < 0)
return ret; return ret;
if (link->time_base.num == 0 && link->time_base.den == 0)
link->time_base = AV_TIME_BASE_Q;
if ((config_link = link->dstpad->config_props)) if ((config_link = link->dstpad->config_props))
if ((ret = config_link(link)) < 0) if ((ret = config_link(link)) < 0)
return ret; return ret;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 1 #define LIBAVFILTER_VERSION_MAJOR 1
#define LIBAVFILTER_VERSION_MINOR 48 #define LIBAVFILTER_VERSION_MINOR 49
#define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...@@ -127,7 +127,12 @@ typedef struct AVFilterBufferRef { ...@@ -127,7 +127,12 @@ typedef struct AVFilterBufferRef {
int linesize[8]; ///< number of bytes per line int linesize[8]; ///< number of bytes per line
int format; ///< media format int format; ///< media format
int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE /**
* presentation timestamp. The time unit may change during
* filtering, as it is specified in the link and the filter code
* may need to rescale the PTS accordingly.
*/
int64_t pts;
int64_t pos; ///< byte position in stream, -1 if unknown int64_t pos; ///< byte position in stream, -1 if unknown
int perms; ///< permissions, see the AV_PERM_* flags int perms; ///< permissions, see the AV_PERM_* flags
...@@ -598,6 +603,15 @@ struct AVFilterLink { ...@@ -598,6 +603,15 @@ struct AVFilterLink {
AVFilterBufferRef *cur_buf; AVFilterBufferRef *cur_buf;
AVFilterBufferRef *out_buf; AVFilterBufferRef *out_buf;
/**
* Define the time base used by the PTS of the frames/samples
* which will pass through this link.
* During the configuration stage, each filter is supposed to
* change only the output timebase, while the timebase of the
* input link is assumed to be an unchangeable property.
*/
AVRational time_base;
}; };
/** /**
......
...@@ -235,6 +235,7 @@ int avfilter_default_config_output_link(AVFilterLink *link) ...@@ -235,6 +235,7 @@ int avfilter_default_config_output_link(AVFilterLink *link)
if (link->type == AVMEDIA_TYPE_VIDEO) { if (link->type == AVMEDIA_TYPE_VIDEO) {
link->w = link->src->inputs[0]->w; link->w = link->src->inputs[0]->w;
link->h = link->src->inputs[0]->h; link->h = link->src->inputs[0]->h;
link->time_base = link->src->inputs[0]->time_base;
} else if (link->type == AVMEDIA_TYPE_AUDIO) { } else if (link->type == AVMEDIA_TYPE_AUDIO) {
link->channel_layout = link->src->inputs[0]->channel_layout; link->channel_layout = link->src->inputs[0]->channel_layout;
link->sample_rate = link->src->inputs[0]->sample_rate; link->sample_rate = link->src->inputs[0]->sample_rate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment