[vlc-devel] commit: Removed useless stream_DemuxDelete. (Laurent Aimar )

git version control git at videolan.org
Tue Dec 9 21:40:24 CET 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Dec  8 22:04:11 2008 +0100| [02dc7efea86a69bfe03ba96a0bbba85a0a615e29] | committer: Laurent Aimar 

Removed useless stream_DemuxDelete.

Use stream_Delete instead.

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

 include/vlc_stream.h      |   16 ++++++++++++++--
 modules/access/rtp/rtp.c  |    2 +-
 modules/demux/avi/avi.c   |    2 +-
 modules/demux/decomp.c    |    4 ++--
 modules/demux/live555.cpp |   12 ++++++------
 src/input/demux.c         |   13 ++++++-------
 src/libvlccore.sym        |    1 -
 7 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index 06f28bf..4e4864c 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -156,14 +156,26 @@ static inline char *stream_ContentType( stream_t *s )
 
 /**
  * Create a special stream and a demuxer, this allows chaining demuxers
+ * You must delete it using stream_Delete.
  */
 #define stream_DemuxNew( a, b, c ) __stream_DemuxNew( VLC_OBJECT(a), b, c)
 VLC_EXPORT( stream_t *,__stream_DemuxNew, ( vlc_object_t *p_obj, const char *psz_demux, es_out_t *out ) );
+/**
+ * Send data to a stream_t handle created by stream_DemuxNew.
+ */
 VLC_EXPORT( void,      stream_DemuxSend,  ( stream_t *s, block_t *p_block ) );
-VLC_EXPORT( void,      stream_DemuxDelete,( stream_t *s ) );
 
+/**
+ * Create a stream_t reading from memory.
+ * You must delete it using stream_Delete.
+ */
 #define stream_MemoryNew( a, b, c, d ) __stream_MemoryNew( VLC_OBJECT(a), b, c, d )
-VLC_EXPORT( stream_t *,__stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, bool i_preserve_memory ) );
+VLC_EXPORT( stream_t *,__stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, bool b_preserve_memory ) );
+
+/**
+ * Create a stream_t reading from an URL.
+ * You must delete it using stream_Delete.
+ */
 #define stream_UrlNew( a, b ) __stream_UrlNew( VLC_OBJECT(a), b )
 VLC_EXPORT( stream_t *,__stream_UrlNew, (vlc_object_t *p_this, const char *psz_url ) );
 
diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index d639ab1..1ebf65f 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -418,7 +418,7 @@ static void *stream_init (demux_t *demux, const char *name)
 static void stream_destroy (demux_t *demux, void *data)
 {
     if (data)
-        stream_DemuxDelete ((stream_t *)data);
+        stream_Delete ((stream_t *)data);
     (void)demux;
 }
 
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 122400f..f285c30 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -770,7 +770,7 @@ static void Close ( vlc_object_t * p_this )
         if( p_sys->track[i] )
         {
             if( p_sys->track[i]->p_out_muxed )
-                stream_DemuxDelete( p_sys->track[i]->p_out_muxed );
+                stream_Delete( p_sys->track[i]->p_out_muxed );
             free( p_sys->track[i]->p_index );
             free( p_sys->track[i]->p_extra );
             free( p_sys->track[i] );
diff --git a/modules/demux/decomp.c b/modules/demux/decomp.c
index 1489db3..d0299a7 100644
--- a/modules/demux/decomp.c
+++ b/modules/demux/decomp.c
@@ -232,7 +232,7 @@ static int Open (demux_t *demux, const char *path)
                                        VLC_THREAD_PRIORITY_INPUT) == 0)
                             ret = VLC_SUCCESS;
                         else
-                            stream_DemuxDelete (p_sys->out);
+                            stream_Delete (p_sys->out);
                     }
                     else
                         msg_Err (demux, "Cannot create demux");
@@ -265,7 +265,7 @@ static void Close (vlc_object_t *obj)
     int status;
 
     vlc_cancel (p_sys->thread);
-    stream_DemuxDelete (p_sys->out);
+    stream_Delete (p_sys->out);
     close (p_sys->read_fd);
     vlc_join (p_sys->thread, NULL);
     close (p_sys->write_fd);
diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index 8e42941..b5f7930 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -398,14 +398,14 @@ error:
     {
         live_track_t *tk = p_sys->track[i];
 
-        if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+        if( tk->b_muxed ) stream_Delete( tk->p_out_muxed );
         es_format_Clean( &tk->fmt );
         free( tk->p_buffer );
         free( tk );
     }
 
     if( p_sys->i_track ) free( p_sys->track );
-    if( p_sys->p_out_asf ) stream_DemuxDelete( p_sys->p_out_asf );
+    if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
     if( p_sys->rtsp && p_sys->ms ) p_sys->rtsp->teardownMediaSession( *p_sys->ms );
     if( p_sys->p_timeout )
     {
@@ -439,14 +439,14 @@ static void Close( vlc_object_t *p_this )
     {
         live_track_t *tk = p_sys->track[i];
 
-        if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+        if( tk->b_muxed ) stream_Delete( tk->p_out_muxed );
         es_format_Clean( &tk->fmt );
         free( tk->p_buffer );
         free( tk );
     }
 
     if( p_sys->i_track ) free( p_sys->track );
-    if( p_sys->p_out_asf ) stream_DemuxDelete( p_sys->p_out_asf );
+    if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
     if( p_sys->rtsp && p_sys->ms ) p_sys->rtsp->teardownMediaSession( *p_sys->ms );
     if( p_sys->p_timeout )
     {
@@ -1457,14 +1457,14 @@ static int RollOverTcp( demux_t *p_demux )
     {
         live_track_t *tk = p_sys->track[i];
 
-        if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+        if( tk->b_muxed ) stream_Delete( tk->p_out_muxed );
         if( tk->p_es ) es_out_Del( p_demux->out, tk->p_es );
         es_format_Clean( &tk->fmt );
         free( tk->p_buffer );
         free( tk );
     }
     if( p_sys->i_track ) free( p_sys->track );
-    if( p_sys->p_out_asf ) stream_DemuxDelete( p_sys->p_out_asf );
+    if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
 
     p_sys->rtsp->teardownMediaSession( *p_sys->ms );
     Medium::close( p_sys->ms );
diff --git a/src/input/demux.c b/src/input/demux.c
index 8089669..ecdcf35 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -312,9 +312,10 @@ typedef struct
 
 } d_stream_sys_t;
 
-static int DStreamRead   ( stream_t *, void *p_read, unsigned int i_read );
-static int DStreamPeek   ( stream_t *, const uint8_t **pp_peek, unsigned int i_peek );
-static int DStreamControl( stream_t *, int i_query, va_list );
+static int  DStreamRead   ( stream_t *, void *p_read, unsigned int i_read );
+static int  DStreamPeek   ( stream_t *, const uint8_t **pp_peek, unsigned int i_peek );
+static int  DStreamControl( stream_t *, int i_query, va_list );
+static void DStreamDelete ( stream_t * );
 static void* DStreamThread ( vlc_object_t * );
 
 
@@ -331,6 +332,7 @@ stream_t *__stream_DemuxNew( vlc_object_t *p_obj, const char *psz_demux,
     s->pf_read   = DStreamRead;
     s->pf_peek   = DStreamPeek;
     s->pf_control= DStreamControl;
+    s->pf_destroy= DStreamDelete;
 
     s->p_sys = malloc( sizeof( d_stream_sys_t) );
     if( s->p_sys == NULL )
@@ -373,10 +375,7 @@ void stream_DemuxSend( stream_t *s, block_t *p_block )
     if( p_block ) block_FifoPut( p_sys->p_fifo, p_block );
 }
 
-/* FIXME why is it needed ?
- * We may be able to use pf_destroy
- */
-void stream_DemuxDelete( stream_t *s )
+static void DStreamDelete( stream_t *s )
 {
     d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
     block_t *p_empty;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index adf6311..8392089 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -365,7 +365,6 @@ __stats_Update
 stream_Block
 stream_Control
 stream_Delete
-stream_DemuxDelete
 __stream_DemuxNew
 stream_DemuxSend
 __stream_MemoryNew




More information about the vlc-devel mailing list