summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-15 00:57:04 +0200
committerwm4 <wm4@nowhere>2013-07-15 01:49:26 +0200
commit88e813aae6f2a91177b450a46c04a26db276c422 (patch)
tree9eb84e4ec3efa8df6ef5e7c50d9711f91adea082 /video
parent17ab38bc664308ea6fe17249b9ddd434b6e05d8e (diff)
downloadmpv-88e813aae6f2a91177b450a46c04a26db276c422.tar.bz2
mpv-88e813aae6f2a91177b450a46c04a26db276c422.tar.xz
vf: add vf_control wrapper
Slightly cleaner, although rather redundant. But still, why wasn't this added 10 years ago?
Diffstat (limited to 'video')
-rw-r--r--video/decode/dec_video.c12
-rw-r--r--video/filter/vf.c5
-rw-r--r--video/filter/vf.h1
3 files changed, 12 insertions, 6 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index ac351db6b6..93359196eb 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -55,7 +55,7 @@ int get_video_quality_max(sh_video_t *sh_video)
{
vf_instance_t *vf = sh_video->vfilter;
if (vf) {
- int ret = vf->control(vf, VFCTRL_QUERY_MAX_PP_LEVEL, NULL);
+ int ret = vf_control(vf, VFCTRL_QUERY_MAX_PP_LEVEL, NULL);
if (ret > 0) {
mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[PP] Using external postprocessing filter, max q = %d.\n", ret);
return ret;
@@ -74,7 +74,7 @@ int set_video_colors(sh_video_t *sh_video, const char *item, int value)
mp_dbg(MSGT_DECVIDEO, MSGL_V, "set video colors %s=%d \n", item, value);
if (vf) {
- int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, &data);
+ int ret = vf_control(vf, VFCTRL_SET_EQUALIZER, &data);
if (ret == CONTROL_TRUE)
return 1;
}
@@ -92,7 +92,7 @@ int get_video_colors(sh_video_t *sh_video, const char *item, int *value)
mp_dbg(MSGT_DECVIDEO, MSGL_V, "get video colors %s \n", item);
if (vf) {
- int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, &data);
+ int ret = vf_control(vf, VFCTRL_GET_EQUALIZER, &data);
if (ret == CONTROL_TRUE) {
*value = data.value;
return 1;
@@ -129,10 +129,10 @@ void set_video_colorspace(struct sh_video *sh)
struct mp_csp_details requested;
get_detected_video_colorspace(sh, &requested);
- vf->control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested);
+ vf_control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested);
struct mp_csp_details actual = MP_CSP_DETAILS_DEFAULTS;
- vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual);
+ vf_control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual);
int success = actual.format == requested.format
&& actual.levels_in == requested.levels_in
@@ -146,7 +146,7 @@ void set_video_colorspace(struct sh_video *sh)
&& requested.format == MP_CSP_SMPTE_240M) {
// BT.709 is pretty close, much better than BT.601
requested.format = MP_CSP_BT_709;
- vf->control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested);
+ vf_control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested);
}
}
diff --git a/video/filter/vf.c b/video/filter/vf.c
index 1402ad3efc..1570e8402c 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -123,6 +123,11 @@ const m_obj_list_t vf_obj_list = {
M_ST_OFF(vf_info_t, opts)
};
+int vf_control(struct vf_instance *vf, int cmd, void *arg)
+{
+ return vf->control(vf, cmd, arg);
+}
+
// Get a new image for filter output, with size and pixel format according to
// the last vf_config call.
struct mp_image *vf_alloc_out_image(struct vf_instance *vf)
diff --git a/video/filter/vf.h b/video/filter/vf.h
index 638fc30a61..be1243e3a4 100644
--- a/video/filter/vf.h
+++ b/video/filter/vf.h
@@ -109,6 +109,7 @@ typedef struct vf_seteq {
#define VFCTRL_SET_YUV_COLORSPACE 22 // arg is struct mp_csp_details*
#define VFCTRL_GET_YUV_COLORSPACE 23 // arg is struct mp_csp_details*
+int vf_control(struct vf_instance *vf, int cmd, void *arg);
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);