]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/logo.c
s/vout_Destroy/vlc_object_release/ - A cat is a cat
[vlc] / modules / video_filter / logo.c
index 49aad2d64991e252dad774cf8a87afc326b2b8cd..6fcedca0213adf294ff7eb4e6eacf00a26d12590 100644 (file)
@@ -30,7 +30,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_vout.h>
 
 #include "vlc_filter.h"
@@ -94,39 +95,39 @@ static int LogoCallback( vlc_object_t *, char const *,
 
 #define CFG_PREFIX "logo-"
 
-static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-static const char *ppsz_pos_descriptions[] =
+static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const char *const ppsz_pos_descriptions[] =
 { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
   N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
 
 vlc_module_begin();
-    set_description( _("Logo video filter") );
+    set_description( N_("Logo video filter") );
     set_capability( "video filter", 0 );
-    set_shortname( _("Logo overlay") );
+    set_shortname( N_("Logo overlay") );
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_SUBPIC );
     add_shortcut( "logo" );
     set_callbacks( Create, Destroy );
 
-    add_file( CFG_PREFIX "file", NULL, NULL, FILE_TEXT, FILE_LONGTEXT, VLC_FALSE );
-    add_integer( CFG_PREFIX "x", 0, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE );
-    add_integer( CFG_PREFIX "y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE );
+    add_file( CFG_PREFIX "file", NULL, NULL, FILE_TEXT, FILE_LONGTEXT, false );
+    add_integer( CFG_PREFIX "x", 0, NULL, POSX_TEXT, POSX_LONGTEXT, true );
+    add_integer( CFG_PREFIX "y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, true );
     /* default to 1000 ms per image, continuously cycle through them */
-    add_integer( CFG_PREFIX "delay", 1000, NULL, DELAY_TEXT, DELAY_LONGTEXT, VLC_TRUE );
-    add_integer( CFG_PREFIX "repeat", -1, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_TRUE );
+    add_integer( CFG_PREFIX "delay", 1000, NULL, DELAY_TEXT, DELAY_LONGTEXT, true );
+    add_integer( CFG_PREFIX "repeat", -1, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, true );
     add_integer_with_range( CFG_PREFIX "transparency", 255, 0, 255, NULL,
-        TRANS_TEXT, TRANS_LONGTEXT, VLC_FALSE );
-    add_integer( CFG_PREFIX "position", -1, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
+        TRANS_TEXT, TRANS_LONGTEXT, false );
+    add_integer( CFG_PREFIX "position", -1, NULL, POS_TEXT, POS_LONGTEXT, false );
         change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
 
     /* subpicture filter submodule */
     add_submodule();
     set_capability( "sub filter", 0 );
     set_callbacks( CreateFilter, DestroyFilter );
-    set_description( _("Logo sub filter") );
+    set_description( N_("Logo sub filter") );
 vlc_module_end();
 
-static const char *ppsz_filter_options[] = {
+static const char *const ppsz_filter_options[] = {
     "file", "x", "y", "delay", "repeat", "transparency", "position", NULL
 };
 
@@ -417,7 +418,7 @@ static int Init( vout_thread_t *p_vout )
     {
         msg_Err( p_vout, "can't open blending filter, aborting" );
         vlc_object_detach( p_sys->p_blend );
-        vlc_object_destroy( p_sys->p_blend );
+        vlc_object_release( p_sys->p_blend );
         return VLC_EGENERIC;
     }
 
@@ -488,17 +489,14 @@ static void End( vout_thread_t *p_vout )
     var_DelCallback( p_sys->p_vout, "mouse-x", MouseEvent, p_vout);
     var_DelCallback( p_sys->p_vout, "mouse-y", MouseEvent, p_vout);
 
-    if( p_sys->p_vout )
-    {
-        DEL_CALLBACKS( p_sys->p_vout, SendEvents );
-        vlc_object_detach( p_sys->p_vout );
-        vout_Destroy( p_sys->p_vout );
-    }
+    DEL_CALLBACKS( p_sys->p_vout, SendEvents );
+    vlc_object_detach( p_sys->p_vout );
+    vlc_object_release( p_sys->p_vout );
 
     if( p_sys->p_blend->p_module )
         module_Unneed( p_sys->p_blend, p_sys->p_blend->p_module );
     vlc_object_detach( p_sys->p_blend );
-    vlc_object_destroy( p_sys->p_blend );
+    vlc_object_release( p_sys->p_blend );
 }
 
 /*****************************************************************************
@@ -689,11 +687,11 @@ struct filter_sys_t
 
     int pos, posx, posy;
 
-    vlc_bool_t b_absolute;
+    bool b_absolute;
     mtime_t i_last_date;
 
     /* On the fly control variable */
-    vlc_bool_t b_need_update;
+    bool b_need_update;
 };
 
 static subpicture_t *Filter( filter_t *, mtime_t );
@@ -753,7 +751,7 @@ static int CreateFilter( vlc_object_t *p_this )
     var_AddCallback( p_filter, "logo-transparency", LogoCallback, p_sys );
     var_AddCallback( p_filter, "logo-repeat", LogoCallback, p_sys );
 
-    vlc_mutex_init( p_filter, &p_logo_list->lock );
+    vlc_mutex_init( &p_logo_list->lock );
     vlc_mutex_lock( &p_logo_list->lock );
 
     LoadLogoList( p_this, p_logo_list );
@@ -762,7 +760,7 @@ static int CreateFilter( vlc_object_t *p_this )
 
     /* Misc init */
     p_filter->pf_sub_filter = Filter;
-    p_sys->b_need_update = VLC_TRUE;
+    p_sys->b_need_update = true;
 
     p_sys->i_last_date = 0;
 
@@ -838,9 +836,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     p_spu->b_absolute = p_sys->b_absolute;
     p_spu->i_start = p_sys->i_last_date = date;
     p_spu->i_stop = 0;
-    p_spu->b_ephemer = VLC_TRUE;
+    p_spu->b_ephemer = true;
 
-    p_sys->b_need_update = VLC_FALSE;
+    p_sys->b_need_update = false;
     p_logo_list->i_next_pic = date +
     ( p_logo->i_delay != -1 ? p_logo->i_delay : p_logo_list->i_delay ) * 1000;
 
@@ -887,12 +885,12 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     if( p_sys->pos < 0 )
     {   /*  set to an absolute xy */
         p_region->i_align = OSD_ALIGN_RIGHT | OSD_ALIGN_TOP;
-        p_spu->b_absolute = VLC_TRUE;
+        p_spu->b_absolute = true;
     }
     else
     {   /* set to one of the 9 relative locations */
         p_region->i_align = p_sys->pos;
-        p_spu->b_absolute = VLC_FALSE;
+        p_spu->b_absolute = false;
     }
 
     p_spu->i_x = p_sys->posx;
@@ -923,7 +921,7 @@ static int LogoCallback( vlc_object_t *p_this, char const *psz_var,
         p_logo_list->psz_filename = strdup( newval.psz_string );
         LoadLogoList( p_this, p_logo_list );
         vlc_mutex_unlock( &p_logo_list->lock );
-        p_sys->b_need_update = VLC_TRUE;
+        p_sys->b_need_update = true;
     }
     else if ( !strncmp( psz_var, "logo-x", 6 ) )
     {
@@ -949,6 +947,6 @@ static int LogoCallback( vlc_object_t *p_this, char const *psz_var,
         p_logo_list->i_repeat = newval.i_int;
         vlc_mutex_unlock( &p_logo_list->lock );
     }
-    p_sys->b_need_update = VLC_TRUE;
+    p_sys->b_need_update = true;
     return VLC_SUCCESS;
 }