History

avfilter/vf_zoompan: fix pts handling

Now output pts have some sense.

Paul B Mahol committed 10 years ago

Commit f42eae91 parent 8a343442 files · +8 −2Browse files

Unified · Split

2 files
  1. doc/filters.texi +3 −0
  2. libavfilter/vf_zoompan.c +5 −2
doc/filters.texi+3−0
@@ -12582,6 +12582,9 @@ single input image. · 12581 unmodified lines
1258212582
1258312583 @item s
1258412584 Set the output image size, default is 'hd720'.
12585+
12586+@item fps
12587+Set the output frame rate, default is '25'.
1258512588 @end table
1258612589
1258712590 Each expression can contain the following constants:
libavfilter/vf_zoompan.c+5−2
@@ -92,6 +92,7 @@ typedef struct ZPcontext { · 91 unmodified lines
9292 int nb_frames;
9393 int current_frame;
9494 int finished;
95+ AVRational framerate;
9596 } ZPContext;
9697
9798 #define OFFSET(x) offsetof(ZPContext, x)
@@ -103,6 +104,7 @@ static const AVOption zoompan_options[] = { · 5 unmodified lines
103104 { "y", "set the y expression", OFFSET(y_expr_str), AV_OPT_TYPE_STRING, {.str="0"}, .flags = FLAGS },
104105 { "d", "set the duration expression", OFFSET(duration_expr_str), AV_OPT_TYPE_STRING, {.str="90"}, .flags = FLAGS },
105106 { "s", "set the output image size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, .flags = FLAGS },
107+ { "fps", "set the output framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, .flags = FLAGS },
106108 { NULL }
107109 };
108110
@@ -123,6 +125,8 @@ static int config_output(AVFilterLink *outlink) · 14 unmodified lines
123125
124126 outlink->w = s->w;
125127 outlink->h = s->h;
128+ outlink->time_base = av_inv_q(s->framerate);
129+ outlink->frame_rate = s->framerate;
126130 s->desc = av_pix_fmt_desc_get(outlink->format);
127131
128132 return 0;
@@ -133,8 +137,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va · 4 unmodified lines
133137 {
134138 ZPContext *s = ctx->priv;
135139 AVFilterLink *outlink = ctx->outputs[0];
136− int64_t pts = av_rescale_q(in->pts, ctx->inputs[0]->time_base,
137− outlink->time_base) + s->frame_count;
140+ int64_t pts = s->frame_count;
138141 int k, x, y, w, h, ret = 0;
139142 uint8_t *input[4];
140143 int px[4], py[4];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t