History

lavfi/f_streamselect: convert to framesync2.

Nicolas George committed 9 years ago

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

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
67OBJS-$(CONFIG_ASIDEDATA_FILTER) += f_sidedata.o67OBJS-$(CONFIG_ASIDEDATA_FILTER) += f_sidedata.o
68OBJS-$(CONFIG_ASPLIT_FILTER) += split.o68OBJS-$(CONFIG_ASPLIT_FILTER) += split.o
69OBJS-$(CONFIG_ASTATS_FILTER) += af_astats.o69OBJS-$(CONFIG_ASTATS_FILTER) += af_astats.o
70OBJS-$(CONFIG_ASTREAMSELECT_FILTER) += f_streamselect.o70OBJS-$(CONFIG_ASTREAMSELECT_FILTER) += f_streamselect.o framesync2.o
71OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o71OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o
72OBJS-$(CONFIG_ATRIM_FILTER) += trim.o72OBJS-$(CONFIG_ATRIM_FILTER) += trim.o
73OBJS-$(CONFIG_AZMQ_FILTER) += f_zmq.o73OBJS-$(CONFIG_AZMQ_FILTER) += f_zmq.o
@@ -303,7 +303,7 @@ OBJS-$(CONFIG_SPLIT_FILTER) += split.o · 229 unmodified lines
303OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o303OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o
304OBJS-$(CONFIG_SSIM_FILTER) += vf_ssim.o dualinput.o framesync.o304OBJS-$(CONFIG_SSIM_FILTER) += vf_ssim.o dualinput.o framesync.o
305OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o305OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o
306OBJS-$(CONFIG_STREAMSELECT_FILTER) += f_streamselect.o306OBJS-$(CONFIG_STREAMSELECT_FILTER) += f_streamselect.o framesync2.o
307OBJS-$(CONFIG_SUBTITLES_FILTER) += vf_subtitles.o307OBJS-$(CONFIG_SUBTITLES_FILTER) += vf_subtitles.o
308OBJS-$(CONFIG_SUPER2XSAI_FILTER) += vf_super2xsai.o308OBJS-$(CONFIG_SUPER2XSAI_FILTER) += vf_super2xsai.o
309OBJS-$(CONFIG_SWAPRECT_FILTER) += vf_swaprect.o309OBJS-$(CONFIG_SWAPRECT_FILTER) += vf_swaprect.o
libavfilter/f_streamselect.c+13−20
@@ -22,7 +22,7 @@ · 21 unmodified lines
22#include "avfilter.h"22#include "avfilter.h"
23#include "audio.h"23#include "audio.h"
24#include "formats.h"24#include "formats.h"
25#include "framesync.h"25#include "framesync2.h"
26#include "internal.h"26#include "internal.h"
27#include "video.h"27#include "video.h"
28 28
@@ -48,12 +48,6 @@ static const AVOption streamselect_options[] = { · 19 unmodified lines
48 48
49AVFILTER_DEFINE_CLASS(streamselect);49AVFILTER_DEFINE_CLASS(streamselect);
50 50
51static 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
57static int process_frame(FFFrameSync *fs)51static int process_frame(FFFrameSync *fs)
58{52{
59 AVFilterContext *ctx = fs->parent;53 AVFilterContext *ctx = fs->parent;
@@ -62,7 +56,7 @@ static int process_frame(FFFrameSync *fs) · 2 unmodified lines
62 int i, j, ret = 0;56 int i, j, ret = 0;
63 57
64 for (i = 0; i < ctx->nb_inputs; i++) {58 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)
66 return ret;60 return ret;
67 }61 }
68 62
@@ -90,10 +84,10 @@ static int process_frame(FFFrameSync *fs) · 21 unmodified lines
90 return ret;84 return ret;
91}85}
92 86
93static int request_frame(AVFilterLink *outlink)87static int activate(AVFilterContext *ctx)
94{88{
95 StreamSelectContext *s = outlink->src->priv;89 StreamSelectContext *s = ctx->priv;
96 return ff_framesync_request_frame(&s->fs, outlink);90 return ff_framesync2_activate(&s->fs);
97}91}
98 92
99static int config_output(AVFilterLink *outlink)93static int config_output(AVFilterLink *outlink)
@@ -130,7 +124,7 @@ static int config_output(AVFilterLink *outlink) · 30 unmodified lines
130 if (s->fs.opaque == s)124 if (s->fs.opaque == s)
131 return 0;125 return 0;
132 126
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)
134 return ret;128 return ret;
135 129
136 in = s->fs.in;130 in = s->fs.in;
@@ -148,12 +142,11 @@ static int config_output(AVFilterLink *outlink) · 11 unmodified lines
148 if (!s->frames)142 if (!s->frames)
149 return AVERROR(ENOMEM);143 return AVERROR(ENOMEM);
150 144
151 return ff_framesync_configure(&s->fs);145 return ff_framesync2_configure(&s->fs);
152}146}
153 147
154static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_frame, int is_audio)148static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int is_audio)
155{149{
156 const int is_input = !!filter_frame;
157 const char *padtype = is_input ? "in" : "out";150 const char *padtype = is_input ? "in" : "out";
158 int i = 0, ret = 0;151 int i = 0, ret = 0;
159 152
@@ -169,11 +162,9 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_fram · 9 unmodified lines
169 av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name);162 av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name);
170 163
171 if (is_input) {164 if (is_input) {
172 pad.filter_frame = filter_frame;
173 ret = ff_insert_inpad(ctx, i, &pad);165 ret = ff_insert_inpad(ctx, i, &pad);
174 } else {166 } else {
175 pad.config_props = config_output;167 pad.config_props = config_output;
176 pad.request_frame = request_frame;
177 ret = ff_insert_outpad(ctx, i, &pad);168 ret = ff_insert_outpad(ctx, i, &pad);
178 }169 }
179 170
@@ -281,8 +272,8 @@ static av_cold int init(AVFilterContext *ctx) · 101 unmodified lines
281 if (!s->last_pts)272 if (!s->last_pts)
282 return AVERROR(ENOMEM);273 return AVERROR(ENOMEM);
283 274
284 if ((ret = parse_definition(ctx, s->nb_inputs, filter_frame, s->is_audio)) < 0 ||275 if ((ret = parse_definition(ctx, s->nb_inputs, 1, s->is_audio)) < 0 ||
285 (ret = parse_definition(ctx, nb_outputs, NULL, s->is_audio)) < 0)276 (ret = parse_definition(ctx, nb_outputs, 0, s->is_audio)) < 0)
286 return ret;277 return ret;
287 278
288 av_log(ctx, AV_LOG_DEBUG, "Configured with %d inpad and %d outpad\n",279 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
298 av_freep(&s->last_pts);289 av_freep(&s->last_pts);
299 av_freep(&s->map);290 av_freep(&s->map);
300 av_freep(&s->frames);291 av_freep(&s->frames);
301 ff_framesync_uninit(&s->fs);292 ff_framesync2_uninit(&s->fs);
302}293}
303 294
304static int query_formats(AVFilterContext *ctx)295static int query_formats(AVFilterContext *ctx)
@@ -332,6 +323,7 @@ AVFilter ff_vf_streamselect = { · 27 unmodified lines
332 .query_formats = query_formats,323 .query_formats = query_formats,
333 .process_command = process_command,324 .process_command = process_command,
334 .uninit = uninit,325 .uninit = uninit,
326 .activate = activate,
335 .priv_size = sizeof(StreamSelectContext),327 .priv_size = sizeof(StreamSelectContext),
336 .priv_class = &streamselect_class,328 .priv_class = &streamselect_class,
337 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,329 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,
@@ -347,6 +339,7 @@ AVFilter ff_af_astreamselect = { · 9 unmodified lines
347 .query_formats = query_formats,339 .query_formats = query_formats,
348 .process_command = process_command,340 .process_command = process_command,
349 .uninit = uninit,341 .uninit = uninit,
342 .activate = activate,
350 .priv_size = sizeof(StreamSelectContext),343 .priv_size = sizeof(StreamSelectContext),
351 .priv_class = &astreamselect_class,344 .priv_class = &astreamselect_class,
352 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,345 .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