]> git.sesse.net Git - vlc/blobdiff - modules/access/dvdnav.c
misc/objects.c: Don't rely on vlc_object_destroy() to destroy objects, but expects...
[vlc] / modules / access / dvdnav.c
index 8a768e3b56ce1644b1409da2f225c5b7d5318a03..79fe01dd05210a57a3f4f0e1a767c41b6f648648 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc_interaction.h>
+#include <vlc_input.h>
+#include <vlc_access.h>
+#include <vlc_demux.h>
+
+#include <vlc_interface.h>
 
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
@@ -47,7 +53,7 @@
 #include "iso_lang.h"
 
 /* FIXME we should find a better way than including that */
-#include "../../src/misc/iso-639_def.h"
+#include "../../src/text/iso-639_def.h"
 
 
 #include <dvdnav/dvdnav.h>
@@ -156,7 +162,7 @@ static void ButtonUpdate( demux_t *, vlc_bool_t );
 static void ESNew( demux_t *, int );
 static int ProbeDVD( demux_t *, char * );
 
-static char *DemuxGetLanguageCode( demux_t *p_demux, char *psz_var );
+static char *DemuxGetLanguageCode( demux_t *p_demux, const char *psz_var );
 
 /*****************************************************************************
  * DemuxOpen:
@@ -207,7 +213,7 @@ static int Open( vlc_object_t *p_this )
     free( psz_name );
 
     /* Fill p_demux field */
-    STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+    DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
     p_sys->dvdnav = p_dvdnav;
 
     ps_track_init( p_sys->tk );
@@ -249,7 +255,7 @@ static int Open( vlc_object_t *p_this )
     /* Set menu language ("en")
      * XXX: maybe it would be better to set it like audio/spu
      * or to create a --menu-language option */
-    if( dvdnav_menu_language_select( p_sys->dvdnav,LANGUAGE_DEFAULT ) !=
+    if( dvdnav_menu_language_select( p_sys->dvdnav, LANGUAGE_DEFAULT ) !=
         DVDNAV_STATUS_OK )
     {
         msg_Warn( p_demux, "can't set menu language to '%s' (%s)",
@@ -293,7 +299,7 @@ static int Open( vlc_object_t *p_this )
         if( dvdnav_title_play( p_sys->dvdnav, 1 ) != DVDNAV_STATUS_OK )
         {
             msg_Err( p_demux, "cannot set title (can't decrypt DVD?)" );
-            intf_UserFatal( p_demux, VLC_FALSE, _("Playback failure"), 
+            intf_UserFatal( p_demux, VLC_FALSE, _("Playback failure"),
                             _("VLC cannot set the DVD's title. It possibly "
                               "cannot decrypt the entire disk.") );
             dvdnav_close( p_sys->dvdnav );
@@ -349,9 +355,9 @@ static void Close( vlc_object_t *p_this )
     int i;
 
     /* stop the event handler */
-    p_sys->p_ev->b_die = VLC_TRUE;
+    vlc_object_kill( p_sys->p_ev );
     vlc_thread_join( p_sys->p_ev );
-    vlc_object_destroy( p_sys->p_ev );
+    vlc_object_release( p_sys->p_ev );
 
     var_Destroy( p_sys->p_input, "highlight-mutex" );
     var_Destroy( p_sys->p_input, "highlight" );
@@ -445,6 +451,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         /* Special for access_demux */
         case DEMUX_CAN_PAUSE:
+        case DEMUX_CAN_SEEK:
         case DEMUX_CAN_CONTROL_PACE:
             /* TODO */
             pb = (vlc_bool_t*)va_arg( args, vlc_bool_t * );
@@ -545,7 +552,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             if( (NULL != title_name) && ('\0' != title_name[0]) )
             {
                 vlc_meta_t *p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
-                vlc_meta_SetTitle( p_meta, title_name );
+                vlc_meta_Set( p_meta, vlc_meta_Title, title_name );
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -758,7 +765,7 @@ static int Demux( demux_t *p_demux )
          *  - ...
          */
         DemuxBlock( p_demux, packet, i_len );
-        if( p_sys->b_spu_change ) 
+        if( p_sys->b_spu_change )
         {
             ButtonUpdate( p_demux, VLC_FALSE );
             p_sys->b_spu_change = VLC_FALSE;
@@ -812,7 +819,7 @@ static int Demux( demux_t *p_demux )
 /* Get a 2 char code
  * FIXME: partiallyy duplicated from src/input/es_out.c
  */
-static char *DemuxGetLanguageCode( demux_t *p_demux, char *psz_var )
+static char *DemuxGetLanguageCode( demux_t *p_demux, const char *psz_var )
 {
     const iso639_lang_t *pl;
     char *psz_lang;
@@ -1120,9 +1127,12 @@ static void ESNew( demux_t *p_demux, int i_id )
     /* Add a new ES */
     if( tk->fmt.i_cat == VIDEO_ES )
     {
-        if( p_sys->i_aspect >= 0 )
+        switch( p_sys->i_aspect )
         {
-            tk->fmt.video.i_aspect = p_sys->i_aspect;
+            /* TODO Any docs somewhere ? */
+        default:
+            tk->fmt.video.i_aspect = 0;
+            break;
         }
         b_select = VLC_TRUE;
     }
@@ -1219,7 +1229,7 @@ static int EventThread( vlc_object_t *p_this )
     p_ev->b_still   = VLC_FALSE;
 
     /* catch all key event */
-    var_AddCallback( p_ev->p_vlc, "key-pressed", EventKey, p_ev );
+    var_AddCallback( p_ev->p_libvlc, "key-pressed", EventKey, p_ev );
 
     /* main loop */
     while( !p_ev->b_die )
@@ -1232,11 +1242,11 @@ static int EventThread( vlc_object_t *p_this )
             pci_t *pci = dvdnav_get_current_nav_pci( p_sys->dvdnav );
 
             vlc_value_t valk;
-            struct hotkey *p_hotkeys = p_ev->p_vlc->p_hotkeys;
+            struct hotkey *p_hotkeys = p_ev->p_libvlc->p_hotkeys;
             int i, i_action = -1;
 
             vlc_mutex_lock( &p_ev->lock );
-            var_Get( p_ev->p_vlc, "key-pressed", &valk );
+            var_Get( p_ev->p_libvlc, "key-pressed", &valk );
             for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
             {
                 if( p_hotkeys[i].i_key == valk.i_int )
@@ -1340,7 +1350,7 @@ static int EventThread( vlc_object_t *p_this )
         var_DelCallback( p_vout, "mouse-clicked", EventMouse, p_ev );
         vlc_object_release( p_vout );
     }
-    var_DelCallback( p_ev->p_vlc, "key-pressed", EventKey, p_ev );
+    var_DelCallback( p_ev->p_libvlc, "key-pressed", EventKey, p_ev );
 
     vlc_mutex_destroy( &p_ev->lock );