1 /*****************************************************************************
2 * vlc_meta.h: Stream meta-data
3 *****************************************************************************
4 * Copyright (C) 2004 the VideoLAN team
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
28 #define VLC_META_INFO_CAT N_("Meta-information")
29 #define VLC_META_TITLE N_("Title")
30 #define VLC_META_AUTHOR N_("Author")
31 #define VLC_META_ARTIST N_("Artist")
32 #define VLC_META_GENRE N_("Genre")
33 #define VLC_META_COPYRIGHT N_("Copyright")
34 #define VLC_META_COLLECTION N_("Album/movie/show title")
35 #define VLC_META_SEQ_NUM N_("Track number/position in set")
36 #define VLC_META_DESCRIPTION N_("Description")
37 #define VLC_META_RATING N_("Rating")
38 #define VLC_META_DATE N_("Date")
39 #define VLC_META_SETTING N_("Setting")
40 #define VLC_META_URL N_("URL")
41 #define VLC_META_LANGUAGE N_("Language")
42 #define VLC_META_NOW_PLAYING N_("Now Playing")
43 #define VLC_META_PUBLISHER N_("Publisher")
44 #define VLC_META_ENCODED_BY N_("Encoded by")
46 #define VLC_META_ART_URL N_("Art URL")
48 #define VLC_META_CODEC_NAME N_("Codec Name")
49 #define VLC_META_CODEC_DESCRIPTION N_("Codec Description")
51 #define ITEM_PREPARSED 0x01
52 #define ITEM_META_FETCHED 0x02
53 #define ITEM_ARTURL_FETCHED 0x04
54 #define ITEM_ART_FETCHED 0x08
65 char *psz_description;
78 /* track meta information */
84 #define vlc_meta_Set( meta,var,val ) { \
85 if( meta->psz_##var ) free( meta->psz_##var ); \
86 meta->psz_##var = strdup( val ); }
88 #define vlc_meta_SetTitle( meta, b ) vlc_meta_Set( meta, title, b );
89 #define vlc_meta_SetArtist( meta, b ) vlc_meta_Set( meta, artist, b );
90 #define vlc_meta_SetAuthor( meta, b ) vlc_meta_Set( meta, author, b );
91 #define vlc_meta_SetGenre( meta, b ) vlc_meta_Set( meta, genre, b );
92 #define vlc_meta_SetCopyright( meta, b ) vlc_meta_Set( meta, copyright, b );
93 #define vlc_meta_SetAlbum( meta, b ) vlc_meta_Set( meta, album, b );
94 #define vlc_meta_SetTracknum( meta, b ) vlc_meta_Set( meta, tracknum, b );
95 #define vlc_meta_SetDescription( meta, b ) vlc_meta_Set( meta, description, b );
96 #define vlc_meta_SetRating( meta, b ) vlc_meta_Set( meta, rating, b );
97 #define vlc_meta_SetDate( meta, b ) vlc_meta_Set( meta, date, b );
98 #define vlc_meta_SetSetting( meta, b ) vlc_meta_Set( meta, setting, b );
99 #define vlc_meta_SetURL( meta, b ) vlc_meta_Set( meta, url, b );
100 #define vlc_meta_SetLanguage( meta, b ) vlc_meta_Set( meta, language, b );
101 #define vlc_meta_SetNowPlaying( meta, b ) vlc_meta_Set( meta, nowplaying, b );
102 #define vlc_meta_SetPublisher( meta, b ) vlc_meta_Set( meta, publisher, b );
103 #define vlc_meta_SetEncodedBy( meta, b ) vlc_meta_Set( meta, encodedby, b );
104 #define vlc_meta_SetArtURL( meta, b ) vlc_meta_Set( meta, arturl, b );
106 static inline vlc_meta_t *vlc_meta_New( void )
108 vlc_meta_t *m = (vlc_meta_t*)malloc( sizeof( vlc_meta_t ) );
109 if( !m ) return NULL;
111 m->psz_author = NULL;
112 m->psz_artist = NULL;
114 m->psz_copyright = NULL;
116 m->psz_tracknum = NULL;
117 m->psz_description = NULL;
118 m->psz_rating = NULL;
120 m->psz_setting = NULL;
122 m->psz_language = NULL;
123 m->psz_nowplaying = NULL;
124 m->psz_publisher = NULL;
125 m->psz_encodedby = NULL;
126 m->psz_arturl = NULL;
131 static inline void vlc_meta_Delete( vlc_meta_t *m )
133 free( m->psz_title );
134 free( m->psz_author );
135 free( m->psz_artist );
136 free( m->psz_genre );
137 free( m->psz_copyright );
138 free( m->psz_album );
139 free( m->psz_tracknum );
140 free( m->psz_description );
141 free( m->psz_rating );
143 free( m->psz_setting );
145 free( m->psz_language );
146 free( m->psz_nowplaying );
147 free( m->psz_publisher );
148 free( m->psz_encodedby );
149 free( m->psz_arturl );
154 static inline void vlc_meta_Merge( vlc_meta_t *dst, vlc_meta_t *src )
156 if( !dst || !src ) return;
157 #define COPY_FIELD( a ) \
158 if( src->psz_ ## a ) { \
159 if( dst->psz_ ## a ) free( dst->psz_## a ); \
160 dst->psz_##a = strdup( src->psz_##a ); \
163 COPY_FIELD( author );
164 COPY_FIELD( artist );
166 COPY_FIELD( copyright );
168 COPY_FIELD( tracknum );
169 COPY_FIELD( description );
170 COPY_FIELD( rating );
172 COPY_FIELD( setting );
174 COPY_FIELD( language );
175 COPY_FIELD( nowplaying );
176 COPY_FIELD( publisher );
177 COPY_FIELD( encodedby );
178 COPY_FIELD( arturl );
180 /** \todo Track meta */
184 ALBUM_ART_WHEN_ASKED,
185 ALBUM_ART_WHEN_PLAYED,
190 input_item_t *p_item;
191 const char *psz_file;