Commit 3d6d7eae authored by Rémi Duraffort's avatar Rémi Duraffort

access_out_shoutcast: factorise.

parent 73b7ed7f
...@@ -264,9 +264,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -264,9 +264,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the shoutcast streaming format" ); msg_Err( p_access, "failed to set the shoutcast streaming format" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
/* Don't force bitrate to 0 but only use when specified. This will otherwise /* Don't force bitrate to 0 but only use when specified. This will otherwise
...@@ -279,9 +277,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -279,9 +277,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the information about the bitrate" ); msg_Err( p_access, "failed to set the information about the bitrate" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
} }
else else
...@@ -304,9 +300,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -304,9 +300,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the information about the samplerate" ); msg_Err( p_access, "failed to set the information about the samplerate" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
} }
...@@ -318,9 +312,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -318,9 +312,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the information about the number of channels" ); msg_Err( p_access, "failed to set the information about the number of channels" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
} }
...@@ -332,9 +324,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -332,9 +324,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the information about Ogg Vorbis quality" ); msg_Err( p_access, "failed to set the information about Ogg Vorbis quality" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
} }
...@@ -344,9 +334,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -344,9 +334,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the server status setting to public" ); msg_Err( p_access, "failed to set the server status setting to public" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
} }
...@@ -367,9 +355,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -367,9 +355,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the protocol to 'icy'" ); msg_Err( p_access, "failed to set the protocol to 'icy'" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
i_ret = shout_open( p_shout ); i_ret = shout_open( p_shout );
if( i_ret == SHOUTERR_SUCCESS ) if( i_ret == SHOUTERR_SUCCESS )
...@@ -393,9 +379,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -393,9 +379,7 @@ static int Open( vlc_object_t *p_this )
if( i_ret != SHOUTERR_SUCCESS ) if( i_ret != SHOUTERR_SUCCESS )
{ {
msg_Err( p_access, "failed to set the protocol to 'http'" ); msg_Err( p_access, "failed to set the protocol to 'http'" );
free( p_access->p_sys ); goto error;
free( psz_accessname );
return VLC_EGENERIC;
} }
i_ret = shout_open( p_shout ); i_ret = shout_open( p_shout );
if( i_ret == SHOUTERR_SUCCESS ) if( i_ret == SHOUTERR_SUCCESS )
...@@ -439,6 +423,11 @@ static int Open( vlc_object_t *p_this ) ...@@ -439,6 +423,11 @@ static int Open( vlc_object_t *p_this )
free( psz_accessname ); free( psz_accessname );
return VLC_SUCCESS; return VLC_SUCCESS;
error:
free( psz_accessname );
free( p_sys );
return VLC_EGENERIC;
} }
/***************************************************************************** /*****************************************************************************
......
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