Commit 33eb0cd1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: merge stream_CommonDelete() and stream_Delete()

parent 96244c3d
...@@ -64,7 +64,15 @@ stream_t *stream_CommonNew(vlc_object_t *parent) ...@@ -64,7 +64,15 @@ stream_t *stream_CommonNew(vlc_object_t *parent)
stream_t *s = &priv->stream; stream_t *s = &priv->stream;
s->b_error = false;
s->p_module = NULL;
s->psz_url = NULL; s->psz_url = NULL;
s->p_source = NULL;
s->pf_read = NULL;
s->pf_readdir = NULL;
s->pf_control = NULL;
s->pf_destroy = NULL;
s->p_input = NULL;
priv->peek = NULL; priv->peek = NULL;
/* UTF16 and UTF32 text file conversion */ /* UTF16 and UTF32 text file conversion */
...@@ -76,20 +84,22 @@ stream_t *stream_CommonNew(vlc_object_t *parent) ...@@ -76,20 +84,22 @@ stream_t *stream_CommonNew(vlc_object_t *parent)
} }
/** /**
* Destroys a VLC stream object * Destroy a stream
*/ */
void stream_CommonDelete( stream_t *s ) void stream_Delete(stream_t *s)
{ {
stream_priv_t *priv = (stream_priv_t *)s; stream_priv_t *priv = (stream_priv_t *)s;
if (priv->text.conv != (vlc_iconv_t)(-1)) if (priv->text.conv != (vlc_iconv_t)(-1))
vlc_iconv_close(priv->text.conv); vlc_iconv_close(priv->text.conv);
if (priv->peek != NULL) if (priv->peek != NULL)
block_Release(priv->peek); block_Release(priv->peek);
if (s->pf_destroy != NULL)
s->pf_destroy(s);
free(s->psz_url); free(s->psz_url);
vlc_object_release( s ); vlc_object_release(s);
} }
#undef stream_UrlNew #undef stream_UrlNew
...@@ -513,14 +523,6 @@ int stream_vaControl(stream_t *s, int cmd, va_list args) ...@@ -513,14 +523,6 @@ int stream_vaControl(stream_t *s, int cmd, va_list args)
return s->pf_control(s, cmd, args); return s->pf_control(s, cmd, args);
} }
/**
* Destroy a stream
*/
void stream_Delete( stream_t *s )
{
s->pf_destroy( s );
}
int stream_Control( stream_t *s, int i_query, ... ) int stream_Control( stream_t *s, int i_query, ... )
{ {
va_list args; va_list args;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
/* */ /* */
stream_t *stream_CommonNew( vlc_object_t * ); stream_t *stream_CommonNew( vlc_object_t * );
void stream_CommonDelete( stream_t * );
/** /**
* This function creates a stream_t with an access_t back-end. * This function creates a stream_t with an access_t back-end.
......
...@@ -230,7 +230,6 @@ static void AStreamDestroy(stream_t *s) ...@@ -230,7 +230,6 @@ static void AStreamDestroy(stream_t *s)
{ {
stream_sys_t *sys = s->p_sys; stream_sys_t *sys = s->p_sys;
stream_CommonDelete(s);
if (sys->block != NULL) if (sys->block != NULL)
block_Release(sys->block); block_Release(sys->block);
vlc_access_Delete(sys->access); vlc_access_Delete(sys->access);
...@@ -269,6 +268,6 @@ stream_t *stream_AccessNew(vlc_object_t *parent, input_thread_t *input, ...@@ -269,6 +268,6 @@ stream_t *stream_AccessNew(vlc_object_t *parent, input_thread_t *input,
return s; return s;
error: error:
free(sys); free(sys);
stream_CommonDelete(s); stream_Delete(s);
return NULL; return NULL;
} }
...@@ -81,8 +81,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou ...@@ -81,8 +81,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
s->p_sys = p_sys = malloc( sizeof( *p_sys) ); s->p_sys = p_sys = malloc( sizeof( *p_sys) );
if( !s->p_sys ) if( !s->p_sys )
{ {
free( p_sys ); stream_Delete( s );
stream_CommonDelete( s );
return NULL; return NULL;
} }
...@@ -97,7 +96,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou ...@@ -97,7 +96,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
/* decoder fifo */ /* decoder fifo */
if( ( p_sys->p_fifo = block_FifoNew() ) == NULL ) if( ( p_sys->p_fifo = block_FifoNew() ) == NULL )
{ {
stream_CommonDelete( s ); stream_Delete( s );
free( p_sys->psz_name ); free( p_sys->psz_name );
free( p_sys ); free( p_sys );
return NULL; return NULL;
...@@ -110,7 +109,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou ...@@ -110,7 +109,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
{ {
vlc_mutex_destroy( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock );
block_FifoRelease( p_sys->p_fifo ); block_FifoRelease( p_sys->p_fifo );
stream_CommonDelete( s ); stream_Delete( s );
free( p_sys->psz_name ); free( p_sys->psz_name );
free( p_sys ); free( p_sys );
return NULL; return NULL;
...@@ -169,7 +168,6 @@ static void DStreamDelete( stream_t *s ) ...@@ -169,7 +168,6 @@ static void DStreamDelete( stream_t *s )
block_FifoRelease( p_sys->p_fifo ); block_FifoRelease( p_sys->p_fifo );
free( p_sys->psz_name ); free( p_sys->psz_name );
free( p_sys ); free( p_sys );
stream_CommonDelete( s );
} }
......
...@@ -53,7 +53,7 @@ stream_t *stream_FilterNew( stream_t *p_source, ...@@ -53,7 +53,7 @@ stream_t *stream_FilterNew( stream_t *p_source,
s->psz_url = strdup( p_source->psz_url ); s->psz_url = strdup( p_source->psz_url );
if( unlikely(s->psz_url == NULL) ) if( unlikely(s->psz_url == NULL) )
{ {
stream_CommonDelete( s ); stream_Delete( s );
return NULL; return NULL;
} }
} }
...@@ -64,7 +64,7 @@ stream_t *stream_FilterNew( stream_t *p_source, ...@@ -64,7 +64,7 @@ stream_t *stream_FilterNew( stream_t *p_source,
if( !s->p_module ) if( !s->p_module )
{ {
stream_CommonDelete( s ); stream_Delete( s );
return NULL; return NULL;
} }
...@@ -118,8 +118,6 @@ static void StreamDelete( stream_t *s ) ...@@ -118,8 +118,6 @@ static void StreamDelete( stream_t *s )
if( s->p_source ) if( s->p_source )
stream_Delete( s->p_source ); stream_Delete( s->p_source );
stream_CommonDelete( s );
} }
input_item_t *stream_FilterDefaultReadDir( stream_t *s ) input_item_t *stream_FilterDefaultReadDir( stream_t *s )
......
...@@ -62,8 +62,7 @@ stream_t *stream_MemoryNew( vlc_object_t *p_this, uint8_t *p_buffer, ...@@ -62,8 +62,7 @@ stream_t *stream_MemoryNew( vlc_object_t *p_this, uint8_t *p_buffer,
s->p_sys = p_sys = malloc( sizeof( stream_sys_t ) ); s->p_sys = p_sys = malloc( sizeof( stream_sys_t ) );
if( !s->p_sys ) if( !s->p_sys )
{ {
stream_CommonDelete( s ); stream_Delete( s );
free( p_sys );
return NULL; return NULL;
} }
p_sys->i_pos = 0; p_sys->i_pos = 0;
...@@ -83,7 +82,6 @@ static void Delete( stream_t *s ) ...@@ -83,7 +82,6 @@ static void Delete( stream_t *s )
{ {
if( !s->p_sys->i_preserve_memory ) free( s->p_sys->p_buffer ); if( !s->p_sys->i_preserve_memory ) free( s->p_sys->p_buffer );
free( s->p_sys ); free( s->p_sys );
stream_CommonDelete( s );
} }
/**************************************************************************** /****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment