[vlc-devel] commit: Added path information in stream_t. (Laurent Aimar )

git version control git at videolan.org
Sun Jan 25 18:01:19 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Jan 25 17:09:21 2009 +0100| [9f052b2bd26acc0d580e443dedb8681c287808ea] | committer: Laurent Aimar 

Added path information in stream_t.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f052b2bd26acc0d580e443dedb8681c287808ea
---

 include/vlc_stream.h      |    3 +++
 src/input/stream.c        |    4 +++-
 src/input/stream_demux.c  |    3 ++-
 src/input/stream_filter.c |    6 ++++++
 src/input/stream_memory.c |    9 ++++++++-
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index b7f989d..e5cd0e0 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -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;
 
diff --git a/src/input/stream.c b/src/input/stream.c
index 66cb58f..25053e3 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -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;
diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index 3b25d3c..b2b7604 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -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;
diff --git a/src/input/stream_filter.c b/src/input/stream_filter.c
index be1ba02..99060f8 100644
--- a/src/input/stream_filter.c
+++ b/src/input/stream_filter.c
@@ -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;
 
     /* */
diff --git a/src/input/stream_memory.c b/src/input/stream_memory.c
index e3cd6c8..8cd3c43 100644
--- a/src/input/stream_memory.c
+++ b/src/input/stream_memory.c
@@ -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;




More information about the vlc-devel mailing list