]> git.sesse.net Git - vlc/commitdiff
Added path information in stream_t.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 25 Jan 2009 16:09:21 +0000 (17:09 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 25 Jan 2009 16:46:10 +0000 (17:46 +0100)
include/vlc_stream.h
src/input/stream.c
src/input/stream_demux.c
src/input/stream_filter.c
src/input/stream_memory.c

index b7f989dbcca78e67ecf6e5c78253d44801b9be6c..e5cd0e0130b1702455042323b449b69204023763 100644 (file)
@@ -56,6 +56,9 @@ struct stream_t
     /* Module properties for stream filter */
     module_t    *p_module;
 
+    /* Real or virtual path (it can only be changed during stream_t opening) */
+    char        *psz_path;
+
     /* Stream source for stream filter */
     stream_t *p_source;
 
index 66cb58fdd4da53638d4ceaacef3738b7400d729f..25053e3181c3da0acb9c72ec7eb6d3aecae62484 100644 (file)
@@ -237,6 +237,7 @@ void stream_CommonDelete( stream_t *s )
             vlc_iconv_close( s->p_text->conv );
         free( s->p_text );
     }
+    free( s->psz_path );
     vlc_object_release( s );
 }
 
@@ -284,8 +285,9 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
     if( !s )
         return NULL;
 
+    s->psz_path = strdup( p_access->psz_path );
     s->p_sys = p_sys = malloc( sizeof( *p_sys ) );
-    if( !p_sys )
+    if( !s->psz_path || !s->p_sys )
     {
         stream_CommonDelete( s );
         return NULL;
index 3b25d3cb95010562ad066a96dcdab4218dff412f..b2b76043784a1dfd87d4ee3e01988f93c0828eba 100644 (file)
@@ -64,13 +64,14 @@ stream_t *__stream_DemuxNew( vlc_object_t *p_obj, const char *psz_demux,
     s = stream_CommonNew( p_obj );
     if( s == NULL )
         return NULL;
+    s->psz_path  = strdup(""); /* N/A */
     s->pf_read   = DStreamRead;
     s->pf_peek   = DStreamPeek;
     s->pf_control= DStreamControl;
     s->pf_destroy= DStreamDelete;
 
     s->p_sys = p_sys = malloc( sizeof( *p_sys) );
-    if( s->p_sys == NULL )
+    if( !s->psz_path || !s->p_sys )
     {
         stream_CommonDelete( s );
         return NULL;
index be1ba02cfde845ecb3e0b88271a3420d821875f0..99060f89c74e0480bfb737e54820b853e74e1b82 100644 (file)
@@ -43,6 +43,12 @@ stream_t *stream_FilterNew( stream_t *p_source,
         return NULL;
 
     /* */
+    s->psz_path = strdup( p_source->psz_path );
+    if( !s->psz_path )
+    {
+        stream_CommonDelete( s );
+        return NULL;
+    }
     s->p_source = p_source;
 
     /* */
index e3cd6c805af68866a1addc892d992155915969b3..8cd3c43725ff27bc2fdc1e7aff810e8f0038678e 100644 (file)
@@ -56,9 +56,16 @@ stream_t *__stream_MemoryNew( vlc_object_t *p_this, uint8_t *p_buffer,
     stream_t *s = stream_CommonNew( p_this );
     stream_sys_t *p_sys;
 
-    if( !s ) return NULL;
+    if( !s )
+        return NULL;
 
+    s->psz_path = strdup( "" ); /* N/A */
     s->p_sys = p_sys = malloc( sizeof( stream_sys_t ) );
+    if( !s->psz_path || !s->p_sys )
+    {
+        stream_CommonDelete( s );
+        return NULL;
+    }
     p_sys->i_pos = 0;
     p_sys->i_size = i_size;
     p_sys->p_buffer = p_buffer;