[Mplayer-cvslog] CVS: main/libmpcodecs vf_expand.c,1.22,1.23

Alban Bedel CVS albeu at mplayerhq.hu
Sat Mar 15 19:49:49 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv20610/libmpcodecs

Modified Files:
	vf_expand.c 
Log Message:
Add support for the new option stuff.
Add some check as sometimes we get a NULL dmpi ?? We should take a
look at that, i suspect the slices stuff


Index: vf_expand.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_expand.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- vf_expand.c	15 Mar 2003 18:01:02 -0000	1.22
+++ vf_expand.c	15 Mar 2003 18:49:33 -0000	1.23
@@ -18,14 +18,23 @@
 #include "../libvo/osd.h"
 #endif
 
+#include "m_option.h"
+#include "m_struct.h"
+
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 
-struct vf_priv_s {
+static struct vf_priv_s {
     int exp_w,exp_h;
     int exp_x,exp_y;
     mp_image_t *dmpi;
     int osd;
     unsigned char* fb_ptr;
+} vf_priv_dflt = {
+  -1,-1,
+  -1,-1,
+  NULL,
+  0,
+  NULL
 };
 
 extern int opt_screen_size_x;
@@ -143,7 +152,8 @@
     vo_draw_text(vf->priv->exp_w,vf->priv->exp_h,draw_func);
     // save buffer pointer for double buffering detection - yes, i know it's
     // ugly method, but note that codecs with DR support does the same...
-    vf->priv->fb_ptr=vf->priv->dmpi->planes[0];
+    if(vf->priv->dmpi)
+      vf->priv->fb_ptr=vf->priv->dmpi->planes[0];
 }
 
 #endif
@@ -255,6 +265,7 @@
 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
     if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
 	vf->priv->dmpi=mpi->priv;
+	if(!vf->priv->dmpi) { printf("Why do we get NULL \n"); return 0; }
 	mpi->priv=NULL;
 	if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
 	    if(vf->priv->exp_y>0)
@@ -325,6 +336,7 @@
     vf->draw_slice=draw_slice;
     vf->get_image=get_image;
     vf->put_image=put_image;
+    if(!vf->priv) {
     vf->priv=malloc(sizeof(struct vf_priv_s));
     vf->priv->exp_x=
     vf->priv->exp_y=
@@ -332,6 +344,7 @@
     vf->priv->exp_h=-1;
     vf->priv->osd=0;
     //  parse args ->
+    } // if(!vf->priv)
     if(args) sscanf(args, "%d:%d:%d:%d:%d", 
     &vf->priv->exp_w,
     &vf->priv->exp_h,
@@ -347,6 +360,25 @@
     return 1;
 }
 
+#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
+static m_option_t vf_opts_fields[] = {
+  {"w", ST_OFF(exp_w), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
+  {"h", ST_OFF(exp_h), CONF_TYPE_INT, M_OPT_MIN,1 ,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},
+  { NULL, NULL, 0, 0, 0, 0,  NULL }
+};
+
+static m_struct_t vf_opts = {
+  "expand",
+  sizeof(struct vf_priv_s),
+  &vf_priv_dflt,
+  vf_opts_fields
+};
+
+
+
 vf_info_t vf_info_expand = {
 #ifdef OSD_SUPPORT
     "expanding & osd",
@@ -357,7 +389,7 @@
     "A'rpi",
     "",
     open,
-    NULL
+    &vf_opts
 };
 
 //===========================================================================//



More information about the MPlayer-cvslog mailing list