summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/dec_video.c5
-rw-r--r--libmpcodecs/dec_video.h5
-rw-r--r--libmpcodecs/vf.h3
-rw-r--r--libmpcodecs/vf_expand.c24
-rw-r--r--libmpcodecs/vf_vo.c2
5 files changed, 25 insertions, 14 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index 9293ee4b8d..9c9de3b51e 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -446,7 +446,8 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
return mpi;
}
-int filter_video(sh_video_t *sh_video, void *frame, double pts)
+int filter_video(sh_video_t *sh_video, void *frame, double pts,
+ struct osd_state *osd)
{
mp_image_t *mpi = frame;
unsigned int t2 = GetTimer();
@@ -454,7 +455,7 @@ int filter_video(sh_video_t *sh_video, void *frame, double pts)
// apply video filters and call the leaf vo/ve
int ret = vf->put_image(vf, mpi, pts);
if (ret > 0) {
- vf->control(vf, VFCTRL_DRAW_OSD, NULL);
+ vf->control(vf, VFCTRL_DRAW_OSD, osd);
#ifdef USE_ASS
vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
#endif
diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h
index 3cd8f832bf..271d08850e 100644
--- a/libmpcodecs/dec_video.h
+++ b/libmpcodecs/dec_video.h
@@ -3,6 +3,8 @@
#include "libmpdemux/stheader.h"
+struct osd_state;
+
// dec_video.c:
extern void vfm_help(void);
@@ -10,7 +12,8 @@ extern int init_best_video_codec(sh_video_t *sh_video,char** video_codec_list,ch
extern void uninit_video(sh_video_t *sh_video);
extern void *decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts);
-extern int filter_video(sh_video_t *sh_video, void *frame, double pts);
+extern int filter_video(sh_video_t *sh_video, void *frame, double pts,
+ struct osd_state *osd);
extern int get_video_quality_max(sh_video_t *sh_video);
extern void set_video_quality(sh_video_t *sh_video,int quality);
diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h
index 58cb74188a..504c616a73 100644
--- a/libmpcodecs/vf.h
+++ b/libmpcodecs/vf.h
@@ -88,6 +88,9 @@ typedef struct vf_seteq_s
#define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
#define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
#define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
+/* Hack to make the OSD state object available to vf_expand which accesses
+ * the OSD state outside of normal OSD draw time. */
+#define VFCTRL_SET_OSD_OBJ 20
#include "vfcap.h"
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index 46ab7790cd..cdde44f82b 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -28,12 +28,13 @@
static struct vf_priv_s {
int exp_w,exp_h;
int exp_x,exp_y;
- int osd;
+ int osd_enabled;
double aspect;
int round;
unsigned char* fb_ptr;
int passthrough;
int first_slice;
+ struct osd_state *osd;
} const vf_priv_dflt = {
-1,-1,
-1,-1,
@@ -172,10 +173,10 @@ static void draw_osd(struct vf_instance* vf_,int w,int h){
remove_func_2(vf->priv->exp_x+w,vf->priv->exp_y,vf->priv->exp_w-w-vf->priv->exp_x,h);
} else {
// partial clear:
- vo_remove_text(vf->priv->exp_w,vf->priv->exp_h,remove_func);
+ osd_remove_text(vf->priv->osd, vf->priv->exp_w,vf->priv->exp_h,remove_func);
}
}
- osd_draw_text(vf->priv->exp_w,vf->priv->exp_h,draw_func, NULL);
+ osd_draw_text(vf->priv->osd, vf->priv->exp_w,vf->priv->exp_h,draw_func, NULL);
// save buffer pointer for double buffering detection - yes, i know it's
// ugly method, but note that codecs with DR support does the same...
if(vf->dmpi)
@@ -241,9 +242,9 @@ static int config(struct vf_instance* vf,
static void get_image(struct vf_instance* vf, mp_image_t *mpi){
// if(mpi->type==MP_IMGTYPE_IPB) return; // not yet working
#ifdef OSD_SUPPORT
- if(vf->priv->osd && (mpi->flags&MP_IMGFLAG_PRESERVE)){
+ if(vf->priv->osd_enabled && (mpi->flags&MP_IMGFLAG_PRESERVE)){
// check if we have to render osd!
- vo_update_osd(vf->priv->exp_w, vf->priv->exp_h);
+ osd_update(vf->priv->osd, vf->priv->exp_w, vf->priv->exp_h);
if(vo_osd_check_range_update(vf->priv->exp_x,vf->priv->exp_y,
vf->priv->exp_x+mpi->w,vf->priv->exp_y+mpi->h)) return;
}
@@ -368,7 +369,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if(!vf->dmpi) { mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_FunWhydowegetNULL); return 0; }
mpi->priv=NULL;
#ifdef OSD_SUPPORT
- if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
+ if(vf->priv->osd_enabled) draw_osd(vf,mpi->w,mpi->h);
#endif
// we've used DR, so we're ready...
if(!(mpi->flags&MP_IMGFLAG_PLANAR))
@@ -403,7 +404,7 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette
}
#ifdef OSD_SUPPORT
- if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
+ if(vf->priv->osd_enabled) draw_osd(vf,mpi->w,mpi->h);
#endif
return vf_next_put_image(vf,vf->dmpi, pts);
}
@@ -413,8 +414,11 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
static int control(struct vf_instance* vf, int request, void* data){
#ifdef OSD_SUPPORT
switch(request){
+ case VFCTRL_SET_OSD_OBJ:
+ vf->priv->osd = data;
+ break;
case VFCTRL_DRAW_OSD:
- if(vf->priv->osd) return CONTROL_TRUE;
+ if(vf->priv->osd_enabled) return CONTROL_TRUE;
}
#endif
return vf_next_control(vf,request,data);
@@ -437,7 +441,7 @@ static int open(vf_instance_t *vf, char* args){
vf->priv->exp_h,
vf->priv->exp_x,
vf->priv->exp_y,
- vf->priv->osd,
+ vf->priv->osd_enabled,
vf->priv->aspect,
vf->priv->round);
return 1;
@@ -449,7 +453,7 @@ static const m_option_t vf_opts_fields[] = {
{"h", ST_OFF(exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL},
{"x", ST_OFF(exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
{"y", ST_OFF(exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
- {"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
+ {"osd", ST_OFF(osd_enabled), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
{"aspect", ST_OFF(aspect), CONF_TYPE_DOUBLE, M_OPT_MIN, 0, 0, NULL},
{"round", ST_OFF(round), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
index 9e1cba7076..ac249345ed 100644
--- a/libmpcodecs/vf_vo.c
+++ b/libmpcodecs/vf_vo.c
@@ -86,7 +86,7 @@ static int control(struct vf_instance* vf, int request, void* data)
}
case VFCTRL_DRAW_OSD:
if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
- vo_draw_osd(video_out);
+ vo_draw_osd(video_out, data);
return CONTROL_TRUE;
case VFCTRL_FLIP_PAGE:
{