[vlc-commits] stream: destroy the access object underneath the stream_Access object

Rémi Denis-Courmont git at videolan.org
Sat Apr 13 18:02:06 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 13 19:01:03 2013 +0300| [33c8b74cdf230d045f6e9a8c69e7d60c3b9a4dc4] | committer: Rémi Denis-Courmont

stream: destroy the access object underneath the stream_Access object

This simplifies and factors code for stream_Url and input.
Also refs #8414.

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

 src/input/input.c  |    6 ------
 src/input/stream.c |   23 ++++-------------------
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index d1462e8..d8ed8d6 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2681,9 +2681,6 @@ error:
     if( in->p_stream )
         stream_Delete( in->p_stream );
 
-    if( in->p_access )
-        access_Delete( in->p_access );
-
     free( psz_var_demux );
     free( psz_dup );
 
@@ -2703,9 +2700,6 @@ static void InputSourceClean( input_source_t *in )
     if( in->p_stream )
         stream_Delete( in->p_stream );
 
-    if( in->p_access )
-        access_Delete( in->p_access );
-
     if( in->i_title > 0 )
     {
         for( i = 0; i < in->i_title; i++ )
diff --git a/src/input/stream.c b/src/input/stream.c
index e75618f..5124621 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -200,7 +200,6 @@ static int  AReadStream( stream_t *s, void *p_read, unsigned int i_read );
 /* Common */
 static int AStreamControl( stream_t *s, int i_query, va_list );
 static void AStreamDestroy( stream_t *s );
-static void UStreamDestroy( stream_t *s );
 static int  ASeek( stream_t *s, uint64_t i_pos );
 
 /****************************************************************************
@@ -249,7 +248,6 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
 {
     const char *psz_access, *psz_demux, *psz_path, *psz_anchor;
     access_t *p_access;
-    stream_t *p_res;
 
     if( !psz_url )
         return NULL;
@@ -266,14 +264,7 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
         return NULL;
     }
 
-    if( !( p_res = stream_AccessNew( p_access, NULL ) ) )
-    {
-        access_Delete( p_access );
-        return NULL;
-    }
-
-    p_res->pf_destroy = UStreamDestroy;
-    return p_res;
+    return stream_AccessNew( p_access, NULL );
 }
 
 stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
@@ -450,6 +441,7 @@ error:
     free( p_sys->list );
     free( s->p_sys );
     stream_CommonDelete( s );
+    access_Delete( p_access );
     return NULL;
 }
 
@@ -475,18 +467,11 @@ static void AStreamDestroy( stream_t *s )
         free( p_sys->list[p_sys->i_list]->psz_path );
         free( p_sys->list[p_sys->i_list] );
     }
-
     free( p_sys->list );
-    free( p_sys );
 
     stream_CommonDelete( s );
-}
-
-static void UStreamDestroy( stream_t *s )
-{
-    access_t *p_access = (access_t *)s->p_parent;
-    AStreamDestroy( s );
-    access_Delete( p_access );
+    access_Delete( p_sys->p_access );
+    free( p_sys );
 }
 
 /****************************************************************************



More information about the vlc-commits mailing list