]> git.sesse.net Git - vlc/commitdiff
* modules/video_filter/logo.c: implemented --logo-position for old filter as well.
authorGildas Bazin <gbazin@videolan.org>
Mon, 27 Sep 2004 09:13:49 +0000 (09:13 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 27 Sep 2004 09:13:49 +0000 (09:13 +0000)
modules/video_filter/logo.c

index 7e01c1e193c9def15d84b991edfffdf17ab1e5c0..e3ddb24a2e2153b84c6a30f6646178d598e0b906 100644 (file)
@@ -226,7 +226,7 @@ struct vout_sys_t
     picture_t *p_pic;
 
     int i_width, i_height;
-    int posx, posy;
+    int pos, posx, posy;
 };
 
 /*****************************************************************************
@@ -253,12 +253,15 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_display = NULL;
     p_vout->pf_control = Control;
 
+    var_Create( p_this, "logo-position", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Get( p_this, "logo-position", &val );
+    p_sys->pos = val.i_int;
     var_Create( p_this, "logo-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
     var_Get( p_this, "logo-x", &val );
-    p_sys->posx = val.i_int >= 0 ? val.i_int : 0;
+    p_sys->posx = val.i_int;
     var_Create( p_this, "logo-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
     var_Get( p_this, "logo-y", &val );
-    p_sys->posy = val.i_int >= 0 ? val.i_int : 0;
+    p_sys->posy = val.i_int;
 
     p_sys->p_pic = LoadPNG( p_this );
     if( !p_sys->p_pic )
@@ -324,6 +327,29 @@ static int Init( vout_thread_t *p_vout )
         return VLC_EGENERIC;
     }
 
+    if( p_sys->posx < 0 || p_sys->posy < 0 )
+    {
+        p_sys->posx = 0; p_sys->posy = 0;
+
+        if( p_sys->pos & SUBPICTURE_ALIGN_BOTTOM )
+        {
+            p_sys->posy = p_vout->render.i_height - p_sys->i_height;
+        }
+        else if ( !(p_sys->pos & SUBPICTURE_ALIGN_TOP) )
+        {
+            p_sys->posy = p_vout->render.i_height / 2 - p_sys->i_height / 2;
+        }
+
+        if( p_sys->pos & SUBPICTURE_ALIGN_RIGHT )
+        {
+            p_sys->posx = p_vout->render.i_width - p_sys->i_width;
+        }
+        else if ( !(p_sys->pos & SUBPICTURE_ALIGN_LEFT) )
+        {
+            p_sys->posx = p_vout->render.i_width / 2 - p_sys->i_width / 2;
+        }
+    }
+
     /* Try to open the real video output */
     msg_Dbg( p_vout, "spawning the real video output" );