Now output pts have some sense.
Unified · Split
| @@ -12582,6 +12582,9 @@ single input image. · 12581 unmodified lines | |||
| 12582 | 12582 | ||
| 12583 | @item s | 12583 | @item s |
| 12584 | Set the output image size, default is 'hd720'. | 12584 | Set the output image size, default is 'hd720'. |
| 12585 | |||
| 12586 | @item fps | ||
| 12587 | Set the output frame rate, default is '25'. | ||
| 12585 | @end table | 12588 | @end table |
| 12586 | 12589 | ||
| 12587 | Each expression can contain the following constants: | 12590 | Each expression can contain the following constants: |
| @@ -92,6 +92,7 @@ typedef struct ZPcontext { · 91 unmodified lines | |||
| 92 | int nb_frames; | 92 | int nb_frames; |
| 93 | int current_frame; | 93 | int current_frame; |
| 94 | int finished; | 94 | int finished; |
| 95 | AVRational framerate; | ||
| 95 | } ZPContext; | 96 | } ZPContext; |
| 96 | 97 | ||
| 97 | #define OFFSET(x) offsetof(ZPContext, x) | 98 | #define OFFSET(x) offsetof(ZPContext, x) |
| @@ -103,6 +104,7 @@ static const AVOption zoompan_options[] = { · 5 unmodified lines | |||
| 103 | { "y", "set the y expression", OFFSET(y_expr_str), AV_OPT_TYPE_STRING, {.str="0"}, .flags = FLAGS }, | 104 | { "y", "set the y expression", OFFSET(y_expr_str), AV_OPT_TYPE_STRING, {.str="0"}, .flags = FLAGS }, |
| 104 | { "d", "set the duration expression", OFFSET(duration_expr_str), AV_OPT_TYPE_STRING, {.str="90"}, .flags = FLAGS }, | 105 | { "d", "set the duration expression", OFFSET(duration_expr_str), AV_OPT_TYPE_STRING, {.str="90"}, .flags = FLAGS }, |
| 105 | { "s", "set the output image size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, .flags = FLAGS }, | 106 | { "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 }, | ||
| 106 | { NULL } | 108 | { NULL } |
| 107 | }; | 109 | }; |
| 108 | 110 | ||
| @@ -123,6 +125,8 @@ static int config_output(AVFilterLink *outlink) · 14 unmodified lines | |||
| 123 | 125 | ||
| 124 | outlink->w = s->w; | 126 | outlink->w = s->w; |
| 125 | outlink->h = s->h; | 127 | outlink->h = s->h; |
| 128 | outlink->time_base = av_inv_q(s->framerate); | ||
| 129 | outlink->frame_rate = s->framerate; | ||
| 126 | s->desc = av_pix_fmt_desc_get(outlink->format); | 130 | s->desc = av_pix_fmt_desc_get(outlink->format); |
| 127 | 131 | ||
| 128 | return 0; | 132 | return 0; |
| @@ -133,8 +137,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va · 4 unmodified lines | |||
| 133 | { | 137 | { |
| 134 | ZPContext *s = ctx->priv; | 138 | ZPContext *s = ctx->priv; |
| 135 | AVFilterLink *outlink = ctx->outputs[0]; | 139 | AVFilterLink *outlink = ctx->outputs[0]; |
| 136 | int64_t pts = av_rescale_q(in->pts, ctx->inputs[0]->time_base, | 140 | int64_t pts = s->frame_count; |
| 137 | outlink->time_base) + s->frame_count; | ||
| 138 | int k, x, y, w, h, ret = 0; | 141 | int k, x, y, w, h, ret = 0; |
| 139 | uint8_t *input[4]; | 142 | uint8_t *input[4]; |
| 140 | int px[4], py[4]; | 143 | int px[4], py[4]; |