+/*****************************************************************************
+ * 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 );
+}
+