]> git.sesse.net Git - vlc/blobdiff - modules/access/dvdnav.c
playlist: Don't allow pl_Release(p_playlist) and pl_Yield(p_playlist).
[vlc] / modules / access / dvdnav.c
index f9df8aa02e50126b081aca02a28ad932b52c8209..99644665da29c6d53c01fabd7ad39439675e5c00 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_access.h>
 #include <vlc_demux.h>
+#include <vlc_charset.h>
 
 #include <vlc_interface.h>
 
@@ -50,7 +52,7 @@
 #endif
 
 #include "vlc_keys.h"
-#include "iso_lang.h"
+#include "vlc_iso_lang.h"
 
 /* FIXME we should find a better way than including that */
 #include "../../src/text/iso-639_def.h"
@@ -82,8 +84,8 @@ static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 vlc_module_begin();
-    set_shortname( _("DVD with menus") );
-    set_description( _("DVDnav Input") );
+    set_shortname( N_("DVD with menus") );
+    set_description( N_("DVDnav Input") );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_ACCESS );
     add_integer( "dvdnav-angle", 1, NULL, ANGLE_TEXT,
@@ -189,7 +191,7 @@ static int Open( vlc_object_t *p_this )
         }
     }
     else
-        psz_name = strdup( p_demux->psz_path );
+        psz_name = ToLocaleDup( p_demux->psz_path );
 
 #ifdef WIN32
     if( psz_name[0] && psz_name[1] == ':' &&
@@ -730,11 +732,11 @@ static int Demux( demux_t *p_demux )
         msg_Dbg( p_demux, "DVDNAV_CELL_CHANGE" );
         msg_Dbg( p_demux, "     - cellN=%d", event->cellN );
         msg_Dbg( p_demux, "     - pgN=%d", event->pgN );
-        msg_Dbg( p_demux, "     - cell_length="I64Fd, event->cell_length );
-        msg_Dbg( p_demux, "     - pg_length="I64Fd, event->pg_length );
-        msg_Dbg( p_demux, "     - pgc_length="I64Fd, event->pgc_length );
-        msg_Dbg( p_demux, "     - cell_start="I64Fd, event->cell_start );
-        msg_Dbg( p_demux, "     - pg_start="I64Fd, event->pg_start );
+        msg_Dbg( p_demux, "     - cell_length=%"PRId64, event->cell_length );
+        msg_Dbg( p_demux, "     - pg_length=%"PRId64, event->pg_length );
+        msg_Dbg( p_demux, "     - pgc_length=%"PRId64, event->pgc_length );
+        msg_Dbg( p_demux, "     - cell_start=%"PRId64, event->cell_start );
+        msg_Dbg( p_demux, "     - pg_start=%"PRId64, event->pg_start );
 
         /* Store the lenght in time of the current PGC */
         p_sys->i_pgc_length = event->pgc_length / 90 * 1000;
@@ -927,6 +929,7 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode )
         vlc_mutex_t *p_mutex = val.p_address;
         dvdnav_highlight_area_t hl;
         int32_t i_button;
+        bool    b_button_ok;
 
         if( dvdnav_get_current_highlight( p_sys->dvdnav, &i_button )
             != DVDNAV_STATUS_OK )
@@ -935,18 +938,20 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode )
             return;
         }
 
+        b_button_ok = false;
         if( i_button > 0 && i_title ==  0 )
         {
-            int i;
             pci_t *pci = dvdnav_get_current_nav_pci( p_sys->dvdnav );
 
-            dvdnav_get_highlight_area( pci, i_button, b_mode, &hl );
-
+            b_button_ok = dvdnav_get_highlight_area( pci, i_button, b_mode, &hl ) == DVDNAV_STATUS_OK;
+        }
+        if( b_button_ok )
+        {
+            int i;
             for( i = 0; i < 4; i++ )
             {
                 uint32_t i_yuv = p_sys->clut[(hl.palette>>(16+i*4))&0x0f];
-                uint8_t i_alpha = (hl.palette>>(i*4))&0x0f;
-                i_alpha = i_alpha == 0xf ? 0xff : i_alpha << 4;
+                uint8_t i_alpha = ( (hl.palette>>(i*4))&0x0f ) * 0xff / 0xf;
 
                 p_sys->palette[i][0] = (i_yuv >> 16) & 0xff;
                 p_sys->palette[i][1] = (i_yuv >> 0) & 0xff;
@@ -1222,7 +1227,7 @@ static int EventThread( vlc_object_t *p_this )
     demux_sys_t    *p_sys = p_ev->p_demux->p_sys;
     vlc_object_t   *p_vout = NULL;
 
-    vlc_mutex_init( p_ev, &p_ev->lock );
+    vlc_mutex_init( &p_ev->lock );
     p_ev->b_moved   = false;
     p_ev->b_clicked = false;
     p_ev->i_key_action = 0;
@@ -1232,7 +1237,7 @@ static int EventThread( vlc_object_t *p_this )
     var_AddCallback( p_ev->p_libvlc, "key-action", EventKey, p_ev );
 
     /* main loop */
-    while( !p_ev->b_die )
+    while( vlc_object_alive (p_ev) )
     {
         bool b_activated = false;
 
@@ -1241,9 +1246,6 @@ static int EventThread( vlc_object_t *p_this )
         {
             pci_t *pci = dvdnav_get_current_nav_pci( p_sys->dvdnav );
 
-            vlc_value_t valk;
-            int i;
-
             vlc_mutex_lock( &p_ev->lock );
             switch( p_ev->i_key_action )
             {
@@ -1298,7 +1300,7 @@ static int EventThread( vlc_object_t *p_this )
             p_ev->b_clicked = false;
             vlc_mutex_unlock( &p_ev->lock );
         }
-        if( p_vout && p_vout->b_die )
+        if( p_vout && !vlc_object_alive (p_vout) )
         {
             var_DelCallback( p_vout, "mouse-moved", EventMouse, p_ev );
             var_DelCallback( p_vout, "mouse-clicked", EventMouse, p_ev );