Commit 03a8d035 authored by Rémi Duraffort's avatar Rémi Duraffort

Factorize code and remove unneed error message about memory allocation.

parent c426fd12
...@@ -633,10 +633,7 @@ static void ParseVorbisComments( decoder_t *p_dec ) ...@@ -633,10 +633,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
{ {
psz_comment = strdup( p_dec->p_sys->vc.user_comments[i] ); psz_comment = strdup( p_dec->p_sys->vc.user_comments[i] );
if( !psz_comment ) if( !psz_comment )
{
msg_Warn( p_dec, "out of memory" );
break; break;
}
psz_name = psz_comment; psz_name = psz_comment;
psz_value = strchr( psz_comment, '=' ); psz_value = strchr( psz_comment, '=' );
if( psz_value ) if( psz_value )
...@@ -645,52 +642,30 @@ static void ParseVorbisComments( decoder_t *p_dec ) ...@@ -645,52 +642,30 @@ static void ParseVorbisComments( decoder_t *p_dec )
psz_value++; psz_value++;
input_Control( p_input, INPUT_ADD_INFO, _("Vorbis comment"), input_Control( p_input, INPUT_ADD_INFO, _("Vorbis comment"),
psz_name, "%s", psz_value ); psz_name, "%s", psz_value );
/*TODO: dot he test at the beginning and save time !! */
#ifndef HAVE_TAGLIB #ifndef HAVE_TAGLIB
if( !strcasecmp( psz_name, "artist" ) ) if( psz_value && ( *psz_value != '\0' ) )
{ {
if( psz_value && ( *psz_value != '\0' ) ) if( !strcasecmp( psz_name, "artist" ) )
{
input_item_SetArtist( p_item, psz_value ); input_item_SetArtist( p_item, psz_value );
} else if( !strcasecmp( psz_name, "title" ) )
}
else if( !strcasecmp( psz_name, "title" ) )
{
if( psz_value && ( *psz_value != '\0' ) )
{ {
input_item_SetTitle( p_item, psz_value ); input_item_SetTitle( p_item, psz_value );
p_item->psz_name = strdup( psz_value ); p_item->psz_name = strdup( psz_value );
} }
} else if( !strcasecmp( psz_name, "album" ) )
else if( !strcasecmp( psz_name, "album" ) )
{
if( psz_value && ( *psz_value != '\0' ) )
{ {
input_item_SetAlbum( p_item, psz_value ); input_item_SetAlbum( p_item, psz_value );
} }
} else if( !strcasecmp( psz_name, "musicbrainz_trackid" ) )
else if( !strcasecmp( psz_name, "musicbrainz_trackid" ) )
{
if( psz_value && ( *psz_value != '\0' ) )
{
input_item_SetTrackID( p_item, psz_value ); input_item_SetTrackID( p_item, psz_value );
}
}
#if 0 //not used #if 0 //not used
else if( !strcasecmp( psz_name, "musicbrainz_artistid" ) ) else if( !strcasecmp( psz_name, "musicbrainz_artistid" ) )
{
if( psz_value && ( *psz_value != '\0' ) )
{
vlc_meta_SetArtistID( p_item, psz_value ); vlc_meta_SetArtistID( p_item, psz_value );
} else if( !strcasecmp( psz_name, "musicbrainz_albumid" ) )
}
else if( !strcasecmp( psz_name, "musicbrainz_albumid" ) )
{
if( psz_value && ( *psz_value != '\0' ) )
{
input_item_SetAlbumID( p_item, psz_value ); input_item_SetAlbumID( p_item, psz_value );
}
}
#endif #endif
}
#endif #endif
if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_GAIN" ) || if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_GAIN" ) ||
!strcasecmp( psz_name, "RG_RADIO" ) ) !strcasecmp( psz_name, "RG_RADIO" ) )
......
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