]> git.sesse.net Git - vlc/blobdiff - modules/demux/demux2.c
* modules/access/dshow: converted to access2/demux2. Let's hope I didn't break anythi...
[vlc] / modules / demux / demux2.c
index fc0f0ff9f9dd8c25b85b271bfadebc14c237a871..71dcecc84820b60b4b64be907d302005660f48cc 100644 (file)
@@ -2,7 +2,7 @@
  * demux2 adaptation layer.
  *****************************************************************************
  * Copyright (C) 2004 VideoLAN
- * $Id: demux2.c,v 1.1 2004/01/04 14:28:11 fenrir Exp $
+ * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -29,6 +29,8 @@
 #include <vlc/vlc.h>
 #include <vlc/input.h>
 
+#include "vlc_playlist.h"
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -36,10 +38,40 @@ static int  Demux2Open    ( vlc_object_t * );
 static void Demux2Close  ( vlc_object_t * );
 
 vlc_module_begin();
-    set_description( _("demux2 adaptation layer" ) );
-    set_capability( "demux", 0 );
+    set_description( _("Demux2 adaptation layer" ) );
+    set_capability( "demux", 10 );
     set_callbacks( Demux2Open, Demux2Close );
     add_shortcut( "demux2" );
+
+    /* Hack */
+    add_shortcut( "nsv" );
+    add_shortcut( "live" );
+    add_shortcut( "ts" );
+    add_shortcut( "ps2" );
+    add_shortcut( "dvdnav" );
+    add_shortcut( "dvdnavsimple" );
+    add_shortcut( "ffmpeg" );
+    add_shortcut( "mp3" );
+    add_shortcut( "mpga" );
+    add_shortcut( "aac" );
+    add_shortcut( "a52" );
+    add_shortcut( "dts" );
+    add_shortcut( "mod" );
+    add_shortcut( "flac" );
+    add_shortcut( "m3u" );
+    add_shortcut( "playlist" );
+    add_shortcut( "m4v" );
+    add_shortcut( "mp4v" );
+    add_shortcut( "mpgv" );
+    add_shortcut( "rawdv" );
+    add_shortcut( "ogg" );
+    add_shortcut( "h264" );
+    add_shortcut( "avi" );
+    add_shortcut( "mjpeg" );
+    add_shortcut( "directory" );
+    add_shortcut( "wav" );
+    add_shortcut( "v4l" );
+    add_shortcut( "dshow" );
 vlc_module_end();
 
 /*****************************************************************************
@@ -61,13 +93,17 @@ static int Demux2Open( vlc_object_t * p_this )
     input_thread_t *p_input = (input_thread_t *)p_this;
     demux2_sys_t   *p_sys   = malloc( sizeof( demux2_sys_t ) );
     demux_t        *p_demux;
+    playlist_t     *p_playlist;
 
     if( input_InitStream( p_input, 0 ) )
     {
         return VLC_EGENERIC;
     }
 
-    p_demux = demux2_New( p_input, p_input->psz_source, p_input->s, p_input->p_es_out );
+    p_demux = demux2_New( p_input,
+                          p_input->psz_access, p_input->psz_demux,
+                          p_input->psz_name,
+                          p_input->s, p_input->p_es_out );
 
     if( !p_demux )
     {
@@ -76,6 +112,19 @@ static int Demux2Open( vlc_object_t * p_this )
         return VLC_EGENERIC;
     }
 
+    /* Now retreive meta info from demuxer */
+    if( ( p_playlist = vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST,
+                                        FIND_ANYWHERE ) ) )
+    {
+        int64_t i_length;
+
+        if( !demux2_Control( p_demux, DEMUX_GET_LENGTH, &i_length ) )
+        {
+            playlist_SetDuration( p_playlist, -1, i_length );
+        }
+        vlc_object_release( p_playlist );
+    }
+
     p_input->pf_demux = Demux2Demux;
     p_input->pf_demux_control = Demux2Control;
     p_input->p_demux_data = (demux_sys_t*)p_sys;
@@ -93,8 +142,9 @@ static int Demux2Open( vlc_object_t * p_this )
  *****************************************************************************/
 static int Demux2Demux( input_thread_t * p_input )
 {
-    demux2_sys_t  *p_sys = (demux2_sys_t*)p_input->p_demux_data;
+    demux2_sys_t *p_sys = (demux2_sys_t*)p_input->p_demux_data;
 
+    p_sys->p_demux->b_die = p_input->b_die;
     return demux2_Demux( p_sys->p_demux );
 }
 
@@ -103,7 +153,7 @@ static int Demux2Demux( input_thread_t * p_input )
  *****************************************************************************/
 static int  Demux2Control( input_thread_t *p_input, int i_query, va_list args )
 {
-    demux2_sys_t  *p_sys = (demux2_sys_t*)p_input->p_demux_data;
+    demux2_sys_t *p_sys = (demux2_sys_t*)p_input->p_demux_data;
 
     return demux2_vaControl( p_sys->p_demux, i_query, args );
 }