]> git.sesse.net Git - vlc/blobdiff - modules/access/dvdnav.c
Use vlc_b64_decode instead of local implementation
[vlc] / modules / access / dvdnav.c
index 4a7f333e4345315e27614400c6d20a4c52137130..c8d2b715e86dd9ceff8705ad3d073e4e6976c788 100644 (file)
 #include <stdlib.h>
 
 #include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_input.h>
+#include <vlc_access.h>
+#include <vlc_demux.h>
+
+#include <vlc_interface.h>
 
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
@@ -46,7 +50,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>
  *****************************************************************************/
 #define ANGLE_TEXT N_("DVD angle")
 #define ANGLE_LONGTEXT N_( \
-    "Allows you to select the default DVD angle." )
+     "Default DVD angle." )
 
 #define CACHING_TEXT N_("Caching value in ms")
 #define CACHING_LONGTEXT N_( \
-    "Allows you to modify the default caching value for DVDnav streams. This "\
-    "value should be set in millisecond units." )
+    "Caching value for DVDs. This "\
+    "value should be set in milliseconds." )
 #define MENU_TEXT N_("Start directly in menu")
 #define MENU_LONGTEXT N_( \
-    "Allows you to start the DVD directly in the main menu. This "\
-    "will try to skip all the useless warnings introductions." )
+    "Start the DVD directly in the main menu. This "\
+    "will try to skip all the useless warning introductions." )
 
 #define LANGUAGE_DEFAULT ("en")
 
@@ -206,10 +210,7 @@ static int Open( vlc_object_t *p_this )
     free( psz_name );
 
     /* Fill p_demux field */
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
-    memset( p_sys, 0, sizeof( demux_sys_t ) );
+    STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
     p_sys->dvdnav = p_dvdnav;
 
     ps_track_init( p_sys->tk );
@@ -251,7 +252,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)",
@@ -295,6 +296,9 @@ 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"), 
+                            _("VLC cannot set the DVD's title. It possibly "
+                              "cannot decrypt the entire disk.") );
             dvdnav_close( p_sys->dvdnav );
             free( p_sys );
             return VLC_EGENERIC;
@@ -543,10 +547,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             dvdnav_get_title_string(p_sys->dvdnav, &title_name);
             if( (NULL != title_name) && ('\0' != title_name[0]) )
             {
-                vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-                vlc_meta_t *meta;
-                *pp_meta = meta = vlc_meta_New();
-                vlc_meta_Add( meta, VLC_META_TITLE, title_name );
+                vlc_meta_t *p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
+                vlc_meta_SetTitle( p_meta, title_name );
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -1220,7 +1222,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 )
@@ -1233,11 +1235,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 )
@@ -1341,7 +1343,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 );