diff options
author | Nicolas George <george@nsup.org> | 2017-07-30 16:58:49 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2017-08-29 10:19:04 +0200 |
commit | 05a23b2565849c9ad96526c9e2ccdb9272add565 (patch) | |
tree | 4497dafb1582ed28dbe755a0a323ef547f2e8e8c /libavfilter/framesync2.h | |
parent | dfa3aaa22a2bac6c98ed0eb4a42cd93347d9a954 (diff) | |
download | ffmpeg-05a23b2565849c9ad96526c9e2ccdb9272add565.tar.gz |
lavfi/framesync2: add common options.
Also add functions and macros to help filters chaining these
options to their own.
Diffstat (limited to 'libavfilter/framesync2.h')
-rw-r--r-- | libavfilter/framesync2.h | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/libavfilter/framesync2.h b/libavfilter/framesync2.h index 9a54b2b701..745e896bc8 100644 --- a/libavfilter/framesync2.h +++ b/libavfilter/framesync2.h @@ -196,12 +196,30 @@ typedef struct FFFrameSync { */ FFFrameSyncIn *in; + int opt_repeatlast; + int opt_shortest; + int opt_eof_action; + } FFFrameSync; /** - * Initialize a frame sync structure. + * Get the class for the framesync2 object. + */ +const AVClass *framesync2_get_class(void); + +/** + * Pre-initialize a frame sync structure. * + * It sets the class pointer and inits the options to their default values. * The entire structure is expected to be already set to 0. + * This step is optional, but necessary to use the options. + */ +void ff_framesync2_preinit(FFFrameSync *fs); + +/** + * Initialize a frame sync structure. + * + * The entire structure is expected to be already set to 0 or preinited. * * @param fs frame sync structure to initialize * @param parent parent AVFilterContext object @@ -270,4 +288,28 @@ int ff_framesync2_dualinput_get(FFFrameSync *fs, AVFrame **f0, AVFrame **f1); */ int ff_framesync2_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame **f1); +#define FRAMESYNC_DEFINE_CLASS(name, context, field) \ +static int name##_framesync_preinit(AVFilterContext *ctx) { \ + context *s = ctx->priv; \ + ff_framesync2_preinit(&s->field); \ + return 0; \ +} \ +static const AVClass *name##_child_class_next(const AVClass *prev) { \ + return prev ? NULL : framesync2_get_class(); \ +} \ +static void *name##_child_next(void *obj, void *prev) { \ + context *s = obj; \ + s->fs.class = framesync2_get_class(); /* FIXME */ \ + return prev ? NULL : &s->field; \ +} \ +static const AVClass name##_class = { \ + .class_name = #name, \ + .item_name = av_default_item_name, \ + .option = name##_options, \ + .version = LIBAVUTIL_VERSION_INT, \ + .category = AV_CLASS_CATEGORY_FILTER, \ + .child_class_next = name##_child_class_next, \ + .child_next = name##_child_next, \ +} + #endif /* AVFILTER_FRAMESYNC2_H */ |