
On Thu, Jun 14, 2001 at 04:38:58AM +0200, Samuel Hocevar (sam@zoy.org) wrote:
> 
>    Yeah, either stef or I broke something (or maybe it was the
> combination of our two diabolic powers). I'll probably have a look at
> what's wrong tonight, but since it still works perfectly on my Debian
> box, any additional information/fixes can be useful.

Patch is attached :)

-- 
Jon Johansen
nanocrew.net


-- Attached file included as plaintext by Listar --

diff -urN vlc.010615/plugins/dvd/input_dvd.c vlc/plugins/dvd/input_dvd.c
--- vlc.010615/plugins/dvd/input_dvd.c	Fri Jun 15 03:19:36 2001
+++ vlc/plugins/dvd/input_dvd.c	Fri Jun 15 03:20:17 2001
@@ -157,7 +157,6 @@
     input_thread_t * p_input = (input_thread_t *)p_data;
 
     char * psz_name = p_input->p_source;
-    dvdcss_handle dvdhandle;
     int i_score = 5;
 
     if( TestMethod( INPUT_METHOD_VAR, "dvd" ) )
@@ -180,12 +179,6 @@
         psz_name += 4;
     }
 
-    dvdhandle = dvdcss_open( psz_name, DVDCSS_INIT_QUIET );
-    if( dvdhandle == NULL )
-    {
-        return( 0 );
-    }
-
     return( i_score );
 }
 
@@ -211,25 +204,7 @@
     p_input->p_plugin_data = (void *)p_dvd;
     p_input->p_method_data = NULL;
 
-    /* XXX: put this shit in an access plugin */
-    if( strlen( p_input->p_source ) > 4
-         && !strncasecmp( p_input->p_source, "dvd:", 4 ) )
-    {
-        p_dvd->dvdhandle = dvdcss_open( p_input->p_source + 4,
-                                        DVDCSS_INIT_QUIET );
-    }
-    else
-    {
-        p_dvd->dvdhandle = dvdcss_open( p_input->p_source,
-                                        DVDCSS_INIT_QUIET );
-    }
-
-    if( p_dvd->dvdhandle == NULL )
-    {
-        free( p_dvd );
-        p_input->b_error = 1;
-        return;
-    }
+    p_dvd->dvdhandle = (dvdcss_handle) p_input->i_handle;
 
     dvdcss_seek( p_dvd->dvdhandle, 0 );
 
@@ -336,6 +311,56 @@
 }
 
 /*****************************************************************************
+ * DVDOpen: open dvd
+ *****************************************************************************/
+static void DVDOpen( struct input_thread_s *p_input )
+{
+    dvdcss_handle dvdhandle;
+
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+
+    /* If we are here we can control the pace... */
+    p_input->stream.b_pace_control = 1;
+
+    p_input->stream.b_seekable = 1;
+    p_input->stream.p_selected_area->i_size = 0;
+
+    p_input->stream.p_selected_area->i_tell = 0;
+
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+    /* XXX: put this shit in an access plugin */
+    if( strlen( p_input->p_source ) > 4
+         && !strncasecmp( p_input->p_source, "dvd:", 4 ) )
+    {
+        dvdhandle = dvdcss_open( p_input->p_source + 4,
+                                        DVDCSS_INIT_QUIET );
+    }
+    else
+    {
+        dvdhandle = dvdcss_open( p_input->p_source,
+                                        DVDCSS_INIT_QUIET );
+    }
+
+    if( dvdhandle == NULL )
+    {
+        p_input->b_error = 1;
+        return;
+    }
+
+    p_input->i_handle = (int) dvdhandle;
+}
+
+/*****************************************************************************
+ * DVDClose: close dvd
+ *****************************************************************************/
+static void DVDClose( struct input_thread_s *p_input )
+{
+    /* Clean up libdvdcss */
+    dvdcss_close( (dvdcss_handle) p_input->i_handle );
+}
+
+/*****************************************************************************
  * DVDEnd: frees unused data
  *****************************************************************************/
 static void DVDEnd( input_thread_t * p_input )
@@ -348,9 +373,6 @@
 
     IfoDestroy( p_dvd->p_ifo );
 
-    /* Clean up libdvdcss */
-    dvdcss_close( p_dvd->dvdhandle );
-
     free( p_dvd );
 
     DVDNetlistEnd( p_netlist );
@@ -1058,16 +1080,6 @@
                      p_dvd->i_prg_cell, p_dvd->i_cell, p_dvd->i_chapter );
 */
 
-    return;
-}
-
-static void DVDOpen     ( struct input_thread_s *p_input )
-{
-    return;
-}
-
-static void DVDClose    ( struct input_thread_s *p_input )
-{
     return;
 }
 
diff -urN vlc.010615/src/input/input.c vlc/src/input/input.c
--- vlc.010615/src/input/input.c	Fri Jun 15 03:19:37 2001
+++ vlc/src/input/input.c	Fri Jun 15 03:20:37 2001
@@ -424,7 +424,6 @@
     if( p_input->b_error )
     {
         /* We barfed -- exit nicely */
-        p_input->pf_close( p_input );
         module_Unneed( p_input->p_input_module );
         return( -1 );
     }



