summaryrefslogtreecommitdiffstats
path: root/video/filter/vf.h
diff options
context:
space:
mode:
Diffstat (limited to 'video/filter/vf.h')
-rw-r--r--video/filter/vf.h57
1 files changed, 28 insertions, 29 deletions
diff --git a/video/filter/vf.h b/video/filter/vf.h
index 1a850995f3..ac9394024f 100644
--- a/video/filter/vf.h
+++ b/video/filter/vf.h
@@ -41,19 +41,9 @@ typedef struct vf_info {
const void *opts;
} vf_info_t;
-#define NUM_NUMBERED_MPI 50
-
-struct vf_image_context {
- mp_image_t *static_images[2];
- mp_image_t *temp_images[1];
- mp_image_t *export_images[1];
- mp_image_t *numbered_images[NUM_NUMBERED_MPI];
- int static_idx;
-};
-
-struct vf_format_context {
- int have_configured;
- int orig_width, orig_height, orig_fmt;
+struct vf_format {
+ int configured;
+ int w, h, fmt;
};
typedef struct vf_instance {
@@ -64,22 +54,31 @@ typedef struct vf_instance {
unsigned int flags, unsigned int outfmt);
int (*control)(struct vf_instance *vf, int request, void *data);
int (*query_format)(struct vf_instance *vf, unsigned int fmt);
- void (*get_image)(struct vf_instance *vf, mp_image_t *mpi);
- int (*put_image)(struct vf_instance *vf, mp_image_t *mpi, double pts);
+
+ // Filter mpi and return the result. The input mpi reference is owned by
+ // the filter, the returned reference is owned by the caller.
+ // Return NULL if the output frame is skipped.
+ struct mp_image *(*filter)(struct vf_instance *vf, struct mp_image *mpi);
+
+ // Like filter(), but can return an error code ( >= 0 means success). This
+ // callback is also more practical when the filter can return multiple
+ // output images. Use vf_add_output_frame() to queue output frames.
+ int (*filter_ext)(struct vf_instance *vf, struct mp_image *mpi);
+
void (*uninit)(struct vf_instance *vf);
- int (*continue_buffered_image)(struct vf_instance *vf);
// caps:
unsigned int default_caps; // used by default query_format()
- unsigned int default_reqs; // used by default config()
// data:
- int w, h;
- struct vf_image_context imgctx;
- struct vf_format_context fmt;
+ struct vf_format fmt_in, fmt_out;
struct vf_instance *next;
- mp_image_t *dmpi;
+
+ struct mp_image_pool *out_pool;
struct vf_priv_s *priv;
struct MPOpts *opts;
+
+ struct mp_image **out_queued;
+ int num_out_queued;
} vf_instance_t;
typedef struct vf_seteq {
@@ -98,7 +97,7 @@ struct vf_ctrl_screenshot {
#define VFCTRL_SET_EQUALIZER 6 // set color options (brightness,contrast etc)
#define VFCTRL_GET_EQUALIZER 8 // get color options (brightness,contrast etc)
#define VFCTRL_HWDEC_DECODER_RENDER 9 // vdpau hw decoding
-#define VFCTRL_HWDEC_GET_SURFACE 10 // vdpau hw decoding
+#define VFCTRL_HWDEC_ALLOC_SURFACE 10 // vdpau hw decoding
#define VFCTRL_SCREENSHOT 14 // Take screenshot, arg is vf_ctrl_screenshot
#define VFCTRL_INIT_OSD 15 // Filter OSD renderer present?
#define VFCTRL_SET_DEINTERLACE 18 // Set deinterlacing status
@@ -111,8 +110,13 @@ struct vf_ctrl_screenshot {
// functions:
void vf_mpi_clear(mp_image_t *mpi, int x0, int y0, int w, int h);
-mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
- int mp_imgtype, int mp_imgflag, int w, int h);
+
+struct mp_image *vf_alloc_out_image(struct vf_instance *vf);
+void vf_make_out_image_writeable(struct vf_instance *vf, struct mp_image *img);
+void vf_add_output_frame(struct vf_instance *vf, struct mp_image *img);
+
+int vf_filter_frame(struct vf_instance *vf, struct mp_image *img);
+struct mp_image *vf_chain_output_queued_frame(struct vf_instance *vf);
vf_instance_t *vf_open_plugin(struct MPOpts *opts,
const vf_info_t * const *filter_list, vf_instance_t *next,
@@ -123,14 +127,10 @@ struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
vf_instance_t *vf_open_filter(struct MPOpts *opts, vf_instance_t *next,
const char *name, char **args);
vf_instance_t *vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
-vf_instance_t *vf_open_encoder(struct MPOpts *opts, vf_instance_t *next,
- const char *name, char *args);
unsigned int vf_match_csp(vf_instance_t **vfp, const unsigned int *list,
unsigned int preferred);
void vf_clone_mpi_attributes(mp_image_t *dst, mp_image_t *src);
-void vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
-int vf_output_queued_frame(vf_instance_t *vf);
// default wrappers:
int vf_next_config(struct vf_instance *vf,
@@ -138,7 +138,6 @@ int vf_next_config(struct vf_instance *vf,
unsigned int flags, unsigned int outfmt);
int vf_next_control(struct vf_instance *vf, int request, void *data);
int vf_next_query_format(struct vf_instance *vf, unsigned int fmt);
-int vf_next_put_image(struct vf_instance *vf, mp_image_t *mpi, double pts);
struct m_obj_settings;
vf_instance_t *append_filters(vf_instance_t *last,