changeset 20906:160974ca8bf2

Use vf control for reading pts from vf_vo
author uau
date Tue, 14 Nov 2006 14:02:55 +0000
parents d53ae91d8662
children eb6a62406a20
files libmpcodecs/vf.h libmpcodecs/vf_vo.c mplayer.c
diffstat 3 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf.h	Tue Nov 14 14:00:58 2006 +0000
+++ b/libmpcodecs/vf.h	Tue Nov 14 14:02:55 2006 +0000
@@ -79,6 +79,7 @@
 #define VFCTRL_SCREENSHOT      14 /* Make a screenshot */
 #define VFCTRL_INIT_EOSD       15 /* Select EOSD renderer */
 #define VFCTRL_DRAW_EOSD       16 /* Render EOSD */
+#define VFCTRL_GET_PTS         17 /* Return last pts value that reached vf_vo*/
 
 #include "vfcap.h"
 
--- a/libmpcodecs/vf_vo.c	Tue Nov 14 14:00:58 2006 +0000
+++ b/libmpcodecs/vf_vo.c	Tue Nov 14 14:02:55 2006 +0000
@@ -21,18 +21,14 @@
 extern int sub_visibility;
 extern float sub_delay;
 
-typedef struct vf_vo_data_s {
+struct vf_priv_s {
     double pts;
     vo_functions_t *vo;
-} vf_vo_data_t;
-
-struct vf_priv_s {
-    vf_vo_data_t* vf_vo_data;
 #ifdef USE_ASS
     ass_renderer_t* ass_priv;
 #endif
 };
-#define video_out (vf->priv->vf_vo_data->vo)
+#define video_out (vf->priv->vo)
 
 static int query_format(struct vf_instance_s* vf, unsigned int fmt); /* forward declaration */
 
@@ -115,7 +111,7 @@
     case VFCTRL_DRAW_EOSD:
     {
         ass_image_t* images = 0;
-        double pts = vf->priv->vf_vo_data->pts;
+        double pts = vf->priv->pts;
         if (!vo_config_count || !vf->priv->ass_priv) return CONTROL_FALSE;
         if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) {
             mp_eosd_res_t res;
@@ -130,6 +126,11 @@
         return (video_out->control(VOCTRL_DRAW_EOSD, images) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
     }
 #endif
+    case VFCTRL_GET_PTS:
+    {
+	*(double *)data = vf->priv->pts;
+	return CONTROL_TRUE;
+    }
     }
     // return video_out->control(request,data);
     return CONTROL_UNKNOWN;
@@ -154,7 +155,7 @@
         mp_image_t *mpi, double pts){
   if(!vo_config_count) return 0; // vo not configured?
   // record pts (potentially modified by filters) for main loop
-  vf->priv->vf_vo_data->pts = pts;
+  vf->priv->pts = pts;
   // first check, maybe the vo/vf plugin implements draw_image using mpi:
   if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
   // nope, fallback to old draw_frame/draw_slice:
@@ -203,7 +204,7 @@
     vf->start_slice=start_slice;
     vf->uninit=uninit;
     vf->priv=calloc(1, sizeof(struct vf_priv_s));
-    vf->priv->vf_vo_data=(vf_vo_data_t*)args;
+    vf->priv->vo = (vo_functions_t *)args;
     if(!video_out) return 0; // no vo ?
 //    if(video_out->preinit(args)) return 0; // preinit failed
     return 1;
--- a/mplayer.c	Tue Nov 14 14:00:58 2006 +0000
+++ b/mplayer.c	Tue Nov 14 14:02:55 2006 +0000
@@ -3084,8 +3084,6 @@
 
 int gui_no_filename=0;
 
-struct {double pts; vo_functions_t *vo;} vf_vo_data;
-
   srand((int) time(NULL)); 
 
   InitTimer();
@@ -4107,10 +4105,9 @@
 inited_flags|=INITED_VO;
 }
 
-vf_vo_data.vo = video_out;
 current_module="init_video_filters";
 {
-  char* vf_arg[] = { "_oldargs_", (char*)&vf_vo_data , NULL };
+  char* vf_arg[] = { "_oldargs_", (char*)video_out , NULL };
   sh_video->vfilter=(void*)vf_open_filter(NULL,"vo",vf_arg);
 }
 #ifdef HAVE_MENU
@@ -4385,7 +4382,8 @@
 	    eof = 1;
 	    break;
 	}
-	sh_video->pts = vf_vo_data.pts;
+	((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter,
+					      VFCTRL_GET_PTS, &sh_video->pts);
 	if (sh_video->pts == MP_NOPTS_VALUE) {
 	    mp_msg(MSGT_CPLAYER, MSGL_ERR, "pts after filters MISSING\n");
 	    sh_video->pts = last_pts;