[vlc-devel] Re: [patch] unifying meta-information access, the 2nd
Derk-Jan Hartman
hartman at videolan.org
Wed Mar 1 15:17:32 CET 2006
What was the status of this patch?
DJ
On 15-feb-2006, at 18:30, Daniel Stränger wrote:
> hi!
>>> This patch unifies access to the meta-information by using the
>>> translated #definitions.
>> I think defining something for "Meta-information" might be good
>> to, or
>> even defining a new function vlc_input_item_GetMeta( input_item_t *,
>> char *) used like vlc_input_item_GetMeta( &p_item->input,
>> VLC_META_ARTIST ).
> I've decided the "defining" way, as it seems to me there are
> enough vlc_input_item_*Info(), vlc_meta_*() and InputControl()
> functions to access the meta-information.
>
> here is the completed patch.
>
> bye, daniel
> Index: src/input/es_out.c
> ===================================================================
> --- src/input/es_out.c (Revision 14326)
> +++ src/input/es_out.c (Arbeitskopie)
> @@ -462,8 +462,8 @@
> char *psz_cat = malloc( strlen(_("Program")) + 10 );
>
> sprintf( psz_cat, "%s %d", _("Program"), p_pgrm->i_id );
> - input_Control( p_input, INPUT_ADD_INFO, _("Meta-
> information"),
> - VLC_META_NOW_PLAYING, "%s", p_pgrm-
> >psz_now_playing );
> + input_Control( p_input, INPUT_ADD_INFO, _(VLC_META_INFO_CAT),
> + _(VLC_META_NOW_PLAYING), "%s", p_pgrm-
> >psz_now_playing );
> free( psz_cat );
> }
>
> @@ -631,8 +631,8 @@
>
> if( p_sys->p_pgrm == p_pgrm )
> {
> - input_Control( p_input, INPUT_ADD_INFO, _("Meta-
> information"),
> - VLC_META_NOW_PLAYING, "%s",
> psz_now_playing );
> + input_Control( p_input, INPUT_ADD_INFO, _
> (VLC_META_INFO_CAT),
> + _(VLC_META_NOW_PLAYING), "%s",
> psz_now_playing );
> }
> }
> free( psz_cat );
> Index: src/input/input.c
> ===================================================================
> --- src/input/input.c (Revision 14326)
> +++ src/input/input.c (Arbeitskopie)
> @@ -223,8 +223,8 @@
> }
>
> /* Remove 'Now playing' info as it is probably outdated */
> - input_Control( p_input, INPUT_DEL_INFO, _("Meta-information"),
> - VLC_META_NOW_PLAYING );
> + input_Control( p_input, INPUT_DEL_INFO, _(VLC_META_INFO_CAT),
> + VLC_META_NOW_PLAYING ); /* ? Don't
> translate as it might has been copied ? */
>
> return p_input;
> }
> @@ -1896,15 +1896,15 @@
> msg_Dbg( p_input, " - '%s' = '%s'",
> _(p_meta->name[i]), p_meta->value[i] );
>
> - if( !strcmp(p_meta->name[i], VLC_META_TITLE) && p_meta-
> >value[i] &&
> + if( !strcmp(p_meta->name[i], _(VLC_META_TITLE)) && p_meta-
> >value[i] &&
> !p_input->input.p_item->b_fixed_name )
> input_Control( p_input, INPUT_SET_NAME, p_meta->value
> [i] );
>
> - if( !strcmp( p_meta->name[i], VLC_META_AUTHOR ) )
> + if( !strcmp( p_meta->name[i], _(VLC_META_AUTHOR) ) )
> input_Control( p_input, INPUT_ADD_INFO, _("General"),
> - _("Author"), p_meta->value[i] );
> + _(VLC_META_AUTHOR), p_meta->value[i] );
>
> - input_Control( p_input, INPUT_ADD_INFO, _("Meta-
> information"),
> + input_Control( p_input, INPUT_ADD_INFO, _(VLC_META_INFO_CAT),
> _(p_meta->name[i]), "%s", p_meta->value[i] );
> }
>
> @@ -2362,7 +2362,7 @@
> #define GET_META( c, s ) \
> var_Get( p_input, (s), &val ); \
> if( *val.psz_string ) \
> - vlc_meta_Add( p_meta, c, val.psz_string ); \
> + vlc_meta_Add( p_meta, _(c), val.psz_string ); \
> free( val.psz_string )
>
> GET_META( VLC_META_TITLE, "meta-title" );
> Index: src/playlist/sort.c
> ===================================================================
> --- src/playlist/sort.c (Revision 14326)
> +++ src/playlist/sort.c (Arbeitskopie)
> @@ -187,10 +187,10 @@
> {
> char *psz_a = vlc_input_item_GetInfo(
> &pp_items[i]->input,
> - _( "Meta-information"), _
> ("Artist") );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_ARTIST) );
> char *psz_b = vlc_input_item_GetInfo(
> &pp_items[i_small]->input,
> - _( "Meta-information"), _
> ("Artist") );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_ARTIST) );
> if( pp_items[i]->i_children == -1 &&
> pp_items[i_small]->i_children >= 0 )
> {
> @@ -230,10 +230,10 @@
> {
> char *psz_a = vlc_input_item_GetInfo(
> &pp_items[i]->input,
> - _( "Meta-information"), _("Album/
> movie/show title") );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_COLLECTION) );
> char *psz_b = vlc_input_item_GetInfo(
> &pp_items[i_small]->input,
> - _( "Meta-information"), _("Album/
> movie/show title") );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_COLLECTION) );
> if( pp_items[i]->i_children == -1 &&
> pp_items[i_small]->i_children >= 0 )
> {
> @@ -325,17 +325,17 @@
> else if ( i_mode == SORT_AUTHOR )
> {
> psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
> - _("Meta-information"), _( "Artist" ) );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_ARTIST) );
> }
> else if ( i_mode == SORT_ALBUM )
> {
> psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
> - _("Meta-information"), _( "Album/movie/
> show title" ) );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_COLLECTION) );
> }
> else if ( i_mode == SORT_GENRE )
> {
> psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
> - _("Meta-information"), _( "Genre" ) );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_GENRE) );
> }
>
> if( psz_search && !strcmp( psz_search, "" ) )
> Index: modules/demux/playlist/m3u.c
> ===================================================================
> --- modules/demux/playlist/m3u.c (Revision 14326)
> +++ modules/demux/playlist/m3u.c (Arbeitskopie)
> @@ -206,8 +206,8 @@
> }
> p_item->input.i_duration = i_duration;
> if ( psz_artist && *psz_artist )
> - vlc_input_item_AddInfo( &p_item->input, _("Meta-
> information"),
> - _("Artist"), "%s",
> psz_artist );
> + vlc_input_item_AddInfo( &p_item->input, _
> (VLC_META_INFO_CAT),
> + _(VLC_META_ARTIST), "%s",
> psz_artist );
> playlist_NodeAddItem( p_playlist, p_item,
> p_current->pp_parents[0]->i_view,
> p_current, PLAYLIST_APPEND,
> Index: modules/demux/playlist/b4s.c
> ===================================================================
> --- modules/demux/playlist/b4s.c (Revision 14326)
> +++ modules/demux/playlist/b4s.c (Arbeitskopie)
> @@ -321,7 +321,7 @@
> if( psz_now )
> {
> vlc_input_item_AddInfo( &(p_item->input),
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _
> ( VLC_META_NOW_PLAYING ),
> "%s",
> psz_now );
> @@ -329,7 +329,7 @@
> if( psz_genre )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( VLC_META_GENRE ),
> "%s",
> psz_genre );
> @@ -337,7 +337,7 @@
> if( psz_listeners )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Listeners" ),
> "%s",
> psz_listeners );
> @@ -345,7 +345,7 @@
> if( psz_bitrate )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Bitrate" ),
> "%s",
> psz_bitrate );
> Index: modules/demux/playlist/podcast.c
> ===================================================================
> --- modules/demux/playlist/podcast.c (Revision 14326)
> +++ modules/demux/playlist/podcast.c (Arbeitskopie)
> @@ -286,7 +286,7 @@
> && !strcmp( psz_elname, "link" ) )
> {
> vlc_input_item_AddInfo( &(p_current->input),
> - _("Meta-information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Link" ),
> "%s",
> psz_text );
> @@ -295,7 +295,7 @@
> && !strcmp( psz_elname, "copyright" ) )
> {
> vlc_input_item_AddInfo( &(p_current->input),
> - _("Meta-information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Copyright" ),
> "%s",
> psz_text );
> @@ -304,7 +304,7 @@
> && !strcmp( psz_elname,
> "itunes:category" ) )
> {
> vlc_input_item_AddInfo( &(p_current->input),
> - _("Meta-information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Category" ),
> "%s",
> psz_text );
> @@ -313,7 +313,7 @@
> && !strcmp( psz_elname,
> "itunes:keywords" ) )
> {
> vlc_input_item_AddInfo( &(p_current->input),
> - _("Meta-information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Keywords" ),
> "%s",
> psz_text );
> @@ -322,7 +322,7 @@
> && !strcmp( psz_elname,
> "itunes:subtitle" ) )
> {
> vlc_input_item_AddInfo( &(p_current->input),
> - _("Meta-information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Subtitle" ),
> "%s",
> psz_text );
> @@ -332,7 +332,7 @@
> ||!strcmp( psz_elname,
> "description" ) ) )
> { /* <description> isn't standard iTunes podcast
> stuff */
> vlc_input_item_AddInfo( &(p_current->input),
> - _("Meta-information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Summary" ),
> "%s",
> psz_text );
> @@ -369,7 +369,7 @@
> if( psz_item_date )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast
> Publication Date" ),
> "%s",
> psz_item_date );
> @@ -377,7 +377,7 @@
> if( psz_item_author )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast
> Author" ),
> "%s",
> psz_item_author );
> @@ -385,7 +385,7 @@
> if( psz_item_category )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast
> Subcategory" ),
> "%s",
> psz_item_category );
> @@ -393,7 +393,7 @@
> if( psz_item_duration )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast
> Duration" ),
> "%s",
> psz_item_duration );
> @@ -401,7 +401,7 @@
> if( psz_item_keywords )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast
> Keywords" ),
> "%s",
> psz_item_keywords );
> @@ -409,7 +409,7 @@
> if( psz_item_subtitle )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast
> Subtitle" ),
> "%s",
> psz_item_subtitle );
> @@ -417,7 +417,7 @@
> if( psz_item_summary )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast
> Summary" ),
> "%s",
> psz_item_summary );
> @@ -425,7 +425,7 @@
> if( psz_item_size )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Size" ),
> "%s bytes",
> psz_item_size );
> @@ -433,7 +433,7 @@
> if( psz_item_type )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-
> information"),
> + _(VLC_META_INFO_CAT),
> _( "Podcast Type" ),
> "%s",
> psz_item_type );
> Index: modules/gui/wxwidgets/dialogs/playlist.cpp
> ===================================================================
> --- modules/gui/wxwidgets/dialogs/playlist.cpp (Revision 14326)
> +++ modules/gui/wxwidgets/dialogs/playlist.cpp (Arbeitskopie)
> @@ -62,9 +62,9 @@
> static int ItemChanged( vlc_object_t *, const char *,
> vlc_value_t, vlc_value_t, void * );
> static int ItemAppended( vlc_object_t *p_this, const char
> *psz_variable,
> - vlc_value_t oval, vlc_value_t nval, void
> *param );
> + vlc_value_t oval, vlc_value_t nval, void
> *param );
> static int ItemDeleted( vlc_object_t *p_this, const char
> *psz_variable,
> - vlc_value_t oval, vlc_value_t nval, void
> *param );
> + vlc_value_t oval, vlc_value_t nval, void
> *param );
>
> /
> **********************************************************************
> *******
> * Event Table.
> @@ -494,8 +494,7 @@
> wxString msg;
> wxString duration = wxU( "" );
> char *psz_author = vlc_input_item_GetInfo( &p_item->input,
> - _("Meta-
> information"),
> -
> VLC_META_ARTIST );
> + _
> (VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
> if( !psz_author )
> {
> UnlockPlaylist( p_intf->p_sys, p_playlist );
> @@ -519,7 +518,7 @@
> else
> {
> msg = wxString(wxU( psz_author )) + wxT(" - ") +
> - wxString(wxU(p_item->input.psz_name)) + duration;
> + wxString(wxU(p_item->input.psz_name)) + duration;
> }
> free( psz_author );
> treectrl->SetItemText( item , msg );
> Index: modules/gui/wxwidgets/input_manager.cpp
> ===================================================================
> --- modules/gui/wxwidgets/input_manager.cpp (Revision 14326)
> +++ modules/gui/wxwidgets/input_manager.cpp (Arbeitskopie)
> @@ -145,7 +145,7 @@
> void InputManager::UpdateNowPlaying()
> {
> char *psz_now_playing = vlc_input_item_GetInfo( p_input-
> >input.p_item,
> - _("Meta-information"), _(VLC_META_NOW_PLAYING) );
> + _(VLC_META_INFO_CAT), _(VLC_META_NOW_PLAYING) );
> if( psz_now_playing && *psz_now_playing )
> {
> p_main_intf->statusbar->SetStatusText(
> Index: modules/gui/wxwidgets/playlist_manager.cpp
> ===================================================================
> --- modules/gui/wxwidgets/playlist_manager.cpp (Revision 14326)
> +++ modules/gui/wxwidgets/playlist_manager.cpp (Arbeitskopie)
> @@ -42,6 +42,7 @@
>
> #include <wx/dynarray.h>
> #include <wx/imaglist.h>
> +#include "vlc_meta.h"
>
> namespace wxvlc {
> /* Callback prototype */
> @@ -291,7 +292,7 @@
> wxString duration = wxU( "" );
> char *psz_author =
> vlc_input_item_GetInfo( &p_item->input,
> - _("Meta-information"), _("Artist"));
> + _(VLC_META_INFO_CAT), _
> (VLC_META_ARTIST) );
> if( !psz_author )
> {
> UnlockPlaylist( p_intf->p_sys, p_playlist );
> Index: modules/misc/playlist/m3u.c
> ===================================================================
> --- modules/misc/playlist/m3u.c (Revision 14326)
> +++ modules/misc/playlist/m3u.c (Arbeitskopie)
> @@ -28,6 +28,7 @@
>
> #include <vlc/vlc.h>
> #include <vlc/intf.h>
> +#include <vlc_meta.h>
>
> #include
> <errno.h> /* ENOMEM */
>
> @@ -65,7 +66,7 @@
> {
> char *psz_artist =
> vlc_input_item_GetInfo( &p_playlist->pp_items[i]-
> >input,
> - _("Meta-information"), _
> ("Artist") );
> + _(VLC_META_INFO_CAT), _
> (VLC_META_ARTIST) );
> if( psz_artist && *psz_artist )
> {
> /* write EXTINF with artist */
> Index: modules/misc/msn.c
> ===================================================================
> --- modules/misc/msn.c (Revision 14326)
> +++ modules/misc/msn.c (Arbeitskopie)
> @@ -174,11 +174,11 @@
>
> /* Playing something ... */
> psz_artist = vlc_input_item_GetInfo( p_input->input.p_item,
> - _("Meta-information"),
> - VLC_META_ARTIST);
> + _(VLC_META_INFO_CAT),
> + _(VLC_META_ARTIST) );
> psz_album = vlc_input_item_GetInfo( p_input->input.p_item,
> - _("Meta-information"),
> - _("Album/movie/show
> title" ) );
> + _(VLC_META_INFO_CAT),
> + _(VLC_META_COLLECTION) );
> psz_title = strdup( p_input->input.p_item->psz_name );
> if( psz_title == NULL ) psz_title = strdup( N_("(no title)") );
> if( psz_artist == NULL ) psz_artist = strdup( N_("(no
> artist)") );
> Index: modules/access/cdda.c
> ===================================================================
> --- modules/access/cdda.c (Revision 14326)
> +++ modules/access/cdda.c (Arbeitskopie)
> @@ -508,7 +508,7 @@
> p_access->info.i_title+1 );
> pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
> *pp_meta = vlc_meta_New();
> - vlc_meta_Add( *pp_meta, VLC_META_TITLE, psz_title );
> + vlc_meta_Add( *pp_meta, _(VLC_META_TITLE), psz_title );
> free( psz_title );
> break;
>
> @@ -593,7 +593,7 @@
> }
> else
> {
> - char *psz_uri; int i_size, i_length;
> + char *psz_uri;
> int i_path_len = p_access->psz_path ? strlen( p_access-
> >psz_path )
> : 0;
> char *psz_opt;
> @@ -624,8 +624,8 @@
> if( cddb_track_get_title( t ) != NULL )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-information"),
> - VLC_META_TITLE,
> + _(VLC_META_INFO_CAT),
> + _(VLC_META_TITLE),
> cddb_track_get_title
> ( t ) );
> if( p_item->input.psz_name )
> free( p_item->input.psz_name );
> @@ -636,8 +636,8 @@
> if( psz_result )
> {
> vlc_input_item_AddInfo( &p_item->input,
> - _("Meta-information"),
> - VLC_META_ARTIST,
> psz_result );
> + _(VLC_META_INFO_CAT),
> + _(VLC_META_ARTIST),
> psz_result );
> }
> }
> }
> Index: modules/services_discovery/daap.c
> ===================================================================
> --- modules/services_discovery/daap.c (Revision 14326)
> +++ modules/services_discovery/daap.c (Arbeitskopie)
> @@ -604,10 +604,10 @@
> p_host->p_songs
> [i].id );
> p_item = playlist_ItemNew( p_sd, psz_buff,
> p_host->p_songs
> [i].itemname );
> - vlc_input_item_AddInfo( &p_item->input, _("Meta-
> information"),
> - _("Artist"), p_host->p_songs
> [i].songartist );
> - vlc_input_item_AddInfo( &p_item->input, _("Meta-
> information"),
> - _("Album"), p_host->p_songs
> [i].songalbum );
> + vlc_input_item_AddInfo( &p_item->input, _(VLC_META_INFO_CAT),
> + _(VLC_META_ARTIST), p_host->p_songs
> [i].songartist );
> + vlc_input_item_AddInfo( &p_item->input, _(VLC_META_INFO_CAT),
> + _(VLC_META_COLLECTION), p_host-
> >p_songs[i].songalbum );
>
> playlist_NodeAddItem( p_playlist, p_item, VIEW_CATEGORY,
> p_host->p_node, PLAYLIST_APPEND,
> PLAYLIST_END );
> Index: modules/codec/vorbis.c
> ===================================================================
> --- modules/codec/vorbis.c (Revision 14326)
> +++ modules/codec/vorbis.c (Arbeitskopie)
> @@ -617,11 +617,11 @@
> psz_value++;
> input_Control( p_input, INPUT_ADD_INFO, _("Vorbis
> comment"),
> psz_name, psz_value );
> - /* HACK, we should use meta */
> if( strcasestr( psz_name, "artist" ) )
> {
> - input_Control( p_input, INPUT_ADD_INFO, _("Meta-
> information"),
> - _("Artist"), psz_value );
> + vlc_input_item_AddInfo( p_input->input.p_item,
> + _(VLC_META_INFO_CAT), _
> (VLC_META_ARTIST),
> + "%s", psz_value );
> }
> else if( strcasestr( psz_name, "title" ) )
> {
> Index: include/vlc_meta.h
> ===================================================================
> --- include/vlc_meta.h (Revision 14326)
> +++ include/vlc_meta.h (Arbeitskopie)
> @@ -25,11 +25,14 @@
> #define _VLC_META_H 1
>
> /* VLC meta name */
> +#define VLC_META_INFO_CAT N_("Meta-information")
> #define VLC_META_TITLE N_("Title")
> #define VLC_META_AUTHOR N_("Author")
> #define VLC_META_ARTIST N_("Artist")
> #define VLC_META_GENRE N_("Genre")
> #define VLC_META_COPYRIGHT N_("Copyright")
> +#define VLC_META_COLLECTION N_("Album/movie/show title")
> +#define VLC_META_SEQ_NUM N_("Track number/position in
> set")
> #define VLC_META_DESCRIPTION N_("Description")
> #define VLC_META_RATING N_("Rating")
> #define VLC_META_DATE N_("Date")
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
More information about the vlc-devel
mailing list