API changes, most recent first:
+2011-01-31 - X - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio
+ Add sample_aspect_ratio field to AVFilterLink.
+
2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples.
link->time_base = link->src && link->src->input_count ?
link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
+ if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0)
+ link->sample_aspect_ratio = link->src->input_count ?
+ link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
+
if ((config_link = link->dstpad->config_props))
if ((ret = config_link(link)) < 0)
return ret;
#include "libavcore/samplefmt.h"
#define LIBAVFILTER_VERSION_MAJOR 1
-#define LIBAVFILTER_VERSION_MINOR 74
+#define LIBAVFILTER_VERSION_MINOR 75
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
enum AVMediaType type; ///< filter media type
- /* These two parameters apply only to video */
+ /* These parameters apply only to video */
int w; ///< agreed upon image width
int h; ///< agreed upon image height
+ AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
/* These two parameters apply only to audio */
int64_t channel_layout; ///< channel layout of current buffer (see libavcore/audioconvert.h)
int64_t sample_rate; ///< samples per second
av_log(inlink->dst, AV_LOG_INFO, "w:%d h:%d -> dar:%d/%d par:%d/%d\n",
inlink->w, inlink->h, dar.num, dar.den, aspect->aspect.num, aspect->aspect.den);
+
+ inlink->sample_aspect_ratio = aspect->aspect;
+
return 0;
}
#endif /* CONFIG_SETDAR_FILTER */
#if CONFIG_SETSAR_FILTER
+/* for setdar filter, convert from frame aspect ratio to pixel aspect ratio */
+static int setsar_config_props(AVFilterLink *inlink)
+{
+ AspectContext *aspect = inlink->dst->priv;
+
+ inlink->sample_aspect_ratio = aspect->aspect;
+
+ return 0;
+}
+
AVFilter avfilter_vf_setsar = {
.name = "setsar",
.description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
.inputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
+ .config_props = setsar_config_props,
.get_video_buffer = avfilter_null_get_video_buffer,
.start_frame = start_frame,
.end_frame = avfilter_null_end_frame },
outlink->w = inlink->h;
outlink->h = inlink->w;
+ if (inlink->sample_aspect_ratio.num){
+ outlink->sample_aspect_ratio = av_div_q((AVRational){1,1}, inlink->sample_aspect_ratio);
+ } else
+ outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
+
av_log(ctx, AV_LOG_INFO, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
inlink->w, inlink->h, trans->dir, outlink->w, outlink->h,
trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise",