[FFmpeg-soc] [soc]: r1052 - in libavfilter: avfilter.h vf_overlay.c vf_scale.c
koorogi
subversion at mplayerhq.hu
Mon Aug 20 16:33:24 CEST 2007
Author: koorogi
Date: Mon Aug 20 16:33:24 2007
New Revision: 1052
Log:
Add pixel aspect ratio to AVFilterPicRef structure
Modified:
libavfilter/avfilter.h
libavfilter/vf_overlay.c
libavfilter/vf_scale.c
Modified: libavfilter/avfilter.h
==============================================================================
--- libavfilter/avfilter.h (original)
+++ libavfilter/avfilter.h Mon Aug 20 16:33:24 2007
@@ -74,6 +74,8 @@ typedef struct AVFilterPicRef
int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE
+ AVRational pixel_aspect; ///< pixel aspect ratio
+
int perms; ///< permissions
#define AV_PERM_READ 0x01 ///< can read from the buffer
#define AV_PERM_WRITE 0x02 ///< can write to the buffer
Modified: libavfilter/vf_overlay.c
==============================================================================
--- libavfilter/vf_overlay.c (original)
+++ libavfilter/vf_overlay.c Mon Aug 20 16:33:24 2007
@@ -192,9 +192,11 @@ static int request_frame(AVFilterLink *l
/* we draw the output frame */
pic = avfilter_get_video_buffer(link, AV_PERM_WRITE);
- if(over->pics[0][0])
+ if(over->pics[0][0]) {
+ pic->pixel_aspect = over->pics[0][0]->pixel_aspect;
copy_image(pic, 0, 0, over->pics[0][0], link->w, link->h,
over->bpp, over->hsub, over->vsub);
+ }
x = FFMIN(over->x, link->w-1);
y = FFMIN(over->y, link->h-1);
w = FFMIN(link->w-x, over->pics[1][0]->w);
Modified: libavfilter/vf_scale.c
==============================================================================
--- libavfilter/vf_scale.c (original)
+++ libavfilter/vf_scale.c Mon Aug 20 16:33:24 2007
@@ -111,6 +111,20 @@ static int config_props(AVFilterLink *li
return !scale->sws;
}
+static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
+{
+ AVFilterLink *out = link->dst->outputs[0];
+
+ out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE);
+ out->outpic->pts = picref->pts;
+
+ out->outpic->pixel_aspect.num = picref->pixel_aspect.num * out->h;
+ out->outpic->pixel_aspect.den = picref->pixel_aspect.den * out->w;
+
+ avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
+}
+
+
/* TODO: figure out the swscale API well enough to scale slice at a time */
static void end_frame(AVFilterLink *link)
{
@@ -142,6 +156,7 @@ AVFilter avfilter_vf_scale =
.inputs = (AVFilterPad[]) {{ .name = "default",
.type = AV_PAD_VIDEO,
+ .start_frame = start_frame,
.draw_slice = draw_slice,
.end_frame = end_frame,
.query_formats = query_formats,
More information about the FFmpeg-soc
mailing list