summaryrefslogtreecommitdiffstats
path: root/libavfilter/af_aiir.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-11-08 12:51:12 +0100
committerPaul B Mahol <onemda@gmail.com>2018-11-08 13:05:08 +0100
commit0f0f84071659d68a5dd048e59a0af9d64980013c (patch)
tree1598efc6d11bec98894e674fdfc183b0dd475bf4 /libavfilter/af_aiir.c
parent1d9fe1fdf65b5eebe9d1981fd96b4930f0855a68 (diff)
downloadffmpeg-streaming-0f0f84071659d68a5dd048e59a0af9d64980013c.zip
ffmpeg-streaming-0f0f84071659d68a5dd048e59a0af9d64980013c.tar.gz
avfilter/af_aiir: implement rate option
Diffstat (limited to 'libavfilter/af_aiir.c')
-rw-r--r--libavfilter/af_aiir.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index 845d542..20dea98 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -63,6 +63,7 @@ typedef struct AudioIIRContext {
int response;
int w, h;
int ir_channel;
+ AVRational rate;
AVFrame *video;
@@ -939,11 +940,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
if (s->response) {
AVFilterLink *outlink = ctx->outputs[1];
+ int64_t old_pts = s->video->pts;
+ int64_t new_pts = av_rescale_q(out->pts, ctx->inputs[0]->time_base, outlink->time_base);
- s->video->pts = out->pts;
- ret = ff_filter_frame(outlink, av_frame_clone(s->video));
- if (ret < 0)
- return ret;
+ if (new_pts > old_pts) {
+ s->video->pts = new_pts;
+ ret = ff_filter_frame(outlink, av_frame_clone(s->video));
+ if (ret < 0)
+ return ret;
+ }
}
return ff_filter_frame(outlink, out);
@@ -957,6 +962,8 @@ static int config_video(AVFilterLink *outlink)
outlink->sample_aspect_ratio = (AVRational){1,1};
outlink->w = s->w;
outlink->h = s->h;
+ outlink->frame_rate = s->rate;
+ outlink->time_base = av_inv_q(outlink->frame_rate);
return 0;
}
@@ -1070,6 +1077,7 @@ static const AVOption aiir_options[] = {
{ "response", "show IR frequency response", OFFSET(response), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },
{ "channel", "set IR channel to display frequency response", OFFSET(ir_channel), AV_OPT_TYPE_INT, {.i64=0}, 0, 1024, VF },
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "hd720"}, 0, 0, VF },
+ { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT32_MAX, VF },
{ NULL },
};
OpenPOWER on IntegriCloud