History

lavfi/f_streamselect: convert to framesync2.

Nicolas George committed 9 years ago

Commit 6bde4751 parent 95a6de52 files · +15 −22Browse files

Showing the changes to libavfilter (2 of 2 files). Show all

Unified · Split

2 files
  1. libavfilter/Makefile +2 −2
  2. libavfilter/f_streamselect.c +13 −20
libavfilter/Makefile+2−2
@@ -67,7 +67,7 @@ OBJS-$(CONFIG_ASHOWINFO_FILTER) += af_ashowinfo.o · 66 unmodified lines
6767 OBJS-$(CONFIG_ASIDEDATA_FILTER) += f_sidedata.o
6868 OBJS-$(CONFIG_ASPLIT_FILTER) += split.o
6969 OBJS-$(CONFIG_ASTATS_FILTER) += af_astats.o
70−OBJS-$(CONFIG_ASTREAMSELECT_FILTER) += f_streamselect.o
70+OBJS-$(CONFIG_ASTREAMSELECT_FILTER) += f_streamselect.o framesync2.o
7171 OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o
7272 OBJS-$(CONFIG_ATRIM_FILTER) += trim.o
7373 OBJS-$(CONFIG_AZMQ_FILTER) += f_zmq.o
@@ -303,7 +303,7 @@ OBJS-$(CONFIG_SPLIT_FILTER) += split.o · 229 unmodified lines
303303 OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o
304304 OBJS-$(CONFIG_SSIM_FILTER) += vf_ssim.o dualinput.o framesync.o
305305 OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o
306−OBJS-$(CONFIG_STREAMSELECT_FILTER) += f_streamselect.o
306+OBJS-$(CONFIG_STREAMSELECT_FILTER) += f_streamselect.o framesync2.o
307307 OBJS-$(CONFIG_SUBTITLES_FILTER) += vf_subtitles.o
308308 OBJS-$(CONFIG_SUPER2XSAI_FILTER) += vf_super2xsai.o
309309 OBJS-$(CONFIG_SWAPRECT_FILTER) += vf_swaprect.o
libavfilter/f_streamselect.c+13−20
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #include "avfilter.h"
2323 #include "audio.h"
2424 #include "formats.h"
25−#include "framesync.h"
25+#include "framesync2.h"
2626 #include "internal.h"
2727 #include "video.h"
2828
@@ -48,12 +48,6 @@ static const AVOption streamselect_options[] = { · 19 unmodified lines
4848
4949 AVFILTER_DEFINE_CLASS(streamselect);
5050
51−static int filter_frame(AVFilterLink *inlink, AVFrame *in)
52−{
53− StreamSelectContext *s = inlink->dst->priv;
54− return ff_framesync_filter_frame(&s->fs, inlink, in);
55−}
56−
5751 static int process_frame(FFFrameSync *fs)
5852 {
5953 AVFilterContext *ctx = fs->parent;
@@ -62,7 +56,7 @@ static int process_frame(FFFrameSync *fs) · 2 unmodified lines
6256 int i, j, ret = 0;
6357
6458 for (i = 0; i < ctx->nb_inputs; i++) {
65− if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0)
59+ if ((ret = ff_framesync2_get_frame(&s->fs, i, &in[i], 0)) < 0)
6660 return ret;
6761 }
6862
@@ -90,10 +84,10 @@ static int process_frame(FFFrameSync *fs) · 21 unmodified lines
9084 return ret;
9185 }
9286
93−static int request_frame(AVFilterLink *outlink)
87+static int activate(AVFilterContext *ctx)
9488 {
95− StreamSelectContext *s = outlink->src->priv;
96− return ff_framesync_request_frame(&s->fs, outlink);
89+ StreamSelectContext *s = ctx->priv;
90+ return ff_framesync2_activate(&s->fs);
9791 }
9892
9993 static int config_output(AVFilterLink *outlink)
@@ -130,7 +124,7 @@ static int config_output(AVFilterLink *outlink) · 30 unmodified lines
130124 if (s->fs.opaque == s)
131125 return 0;
132126
133− if ((ret = ff_framesync_init(&s->fs, ctx, ctx->nb_inputs)) < 0)
127+ if ((ret = ff_framesync2_init(&s->fs, ctx, ctx->nb_inputs)) < 0)
134128 return ret;
135129
136130 in = s->fs.in;
@@ -148,12 +142,11 @@ static int config_output(AVFilterLink *outlink) · 11 unmodified lines
148142 if (!s->frames)
149143 return AVERROR(ENOMEM);
150144
151− return ff_framesync_configure(&s->fs);
145+ return ff_framesync2_configure(&s->fs);
152146 }
153147
154−static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_frame, int is_audio)
148+static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int is_audio)
155149 {
156− const int is_input = !!filter_frame;
157150 const char *padtype = is_input ? "in" : "out";
158151 int i = 0, ret = 0;
159152
@@ -169,11 +162,9 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_fram · 9 unmodified lines
169162 av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name);
170163
171164 if (is_input) {
172− pad.filter_frame = filter_frame;
173165 ret = ff_insert_inpad(ctx, i, &pad);
174166 } else {
175167 pad.config_props = config_output;
176− pad.request_frame = request_frame;
177168 ret = ff_insert_outpad(ctx, i, &pad);
178169 }
179170
@@ -281,8 +272,8 @@ static av_cold int init(AVFilterContext *ctx) · 101 unmodified lines
281272 if (!s->last_pts)
282273 return AVERROR(ENOMEM);
283274
284− if ((ret = parse_definition(ctx, s->nb_inputs, filter_frame, s->is_audio)) < 0 ||
285− (ret = parse_definition(ctx, nb_outputs, NULL, s->is_audio)) < 0)
275+ if ((ret = parse_definition(ctx, s->nb_inputs, 1, s->is_audio)) < 0 ||
276+ (ret = parse_definition(ctx, nb_outputs, 0, s->is_audio)) < 0)
286277 return ret;
287278
288279 av_log(ctx, AV_LOG_DEBUG, "Configured with %d inpad and %d outpad\n",
@@ -298,7 +289,7 @@ static av_cold void uninit(AVFilterContext *ctx) · 9 unmodified lines
298289 av_freep(&s->last_pts);
299290 av_freep(&s->map);
300291 av_freep(&s->frames);
301− ff_framesync_uninit(&s->fs);
292+ ff_framesync2_uninit(&s->fs);
302293 }
303294
304295 static int query_formats(AVFilterContext *ctx)
@@ -332,6 +323,7 @@ AVFilter ff_vf_streamselect = { · 27 unmodified lines
332323 .query_formats = query_formats,
333324 .process_command = process_command,
334325 .uninit = uninit,
326+ .activate = activate,
335327 .priv_size = sizeof(StreamSelectContext),
336328 .priv_class = &streamselect_class,
337329 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,
@@ -347,6 +339,7 @@ AVFilter ff_af_astreamselect = { · 9 unmodified lines
347339 .query_formats = query_formats,
348340 .process_command = process_command,
349341 .uninit = uninit,
342+ .activate = activate,
350343 .priv_size = sizeof(StreamSelectContext),
351344 .priv_class = &astreamselect_class,
352345 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,

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