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_ARTIST N_("Artist")
31 #define VLC_META_GENRE N_("Genre")
32 #define VLC_META_COPYRIGHT N_("Copyright")
33 #define VLC_META_COLLECTION N_("Album/movie/show title")
34 #define VLC_META_SEQ_NUM N_("Track number/position in set")
35 #define VLC_META_DESCRIPTION N_("Description")
36 #define VLC_META_RATING N_("Rating")
37 #define VLC_META_DATE N_("Date")
38 #define VLC_META_SETTING N_("Setting")
39 #define VLC_META_URL N_("URL")
40 #define VLC_META_LANGUAGE N_("Language")
41 #define VLC_META_NOW_PLAYING N_("Now Playing")
42 #define VLC_META_PUBLISHER N_("Publisher")
43 #define VLC_META_ENCODED_BY N_("Encoded by")
45 #define VLC_META_ART_URL N_("Art URL")
47 #define VLC_META_CODEC_NAME N_("Codec Name")
48 #define VLC_META_CODEC_DESCRIPTION N_("Codec Description")
50 #define ITEM_PREPARSED 0x01
51 #define ITEM_META_FETCHED 0x02
52 #define ITEM_ARTURL_FETCHED 0x04
53 #define ITEM_ART_FETCHED 0x08
54 #define ITEM_ART_NOTFOUND 0x10
64 char *psz_description;
80 /* track meta information */
86 #define vlc_meta_Set( meta,var,val ) { \
87 if( meta->psz_##var ) free( meta->psz_##var ); \
88 meta->psz_##var = strdup( val ); }
90 #define vlc_meta_SetTitle( meta, b ) vlc_meta_Set( meta, title, b );
91 #define vlc_meta_SetArtist( meta, b ) vlc_meta_Set( meta, artist, b );
92 #define vlc_meta_SetGenre( meta, b ) vlc_meta_Set( meta, genre, b );
93 #define vlc_meta_SetCopyright( meta, b ) vlc_meta_Set( meta, copyright, b );
94 #define vlc_meta_SetAlbum( meta, b ) vlc_meta_Set( meta, album, b );
95 #define vlc_meta_SetTracknum( meta, b ) vlc_meta_Set( meta, tracknum, b );
96 #define vlc_meta_SetDescription( meta, b ) vlc_meta_Set( meta, description, b );
97 #define vlc_meta_SetRating( meta, b ) vlc_meta_Set( meta, rating, b );
98 #define vlc_meta_SetDate( meta, b ) vlc_meta_Set( meta, date, b );
99 #define vlc_meta_SetSetting( meta, b ) vlc_meta_Set( meta, setting, b );
100 #define vlc_meta_SetURL( meta, b ) vlc_meta_Set( meta, url, b );
101 #define vlc_meta_SetLanguage( meta, b ) vlc_meta_Set( meta, language, b );
102 #define vlc_meta_SetNowPlaying( meta, b ) vlc_meta_Set( meta, nowplaying, b );
103 #define vlc_meta_SetPublisher( meta, b ) vlc_meta_Set( meta, publisher, b );
104 #define vlc_meta_SetEncodedBy( meta, b ) vlc_meta_Set( meta, encodedby, b );
105 #define vlc_meta_SetArtURL( meta, b ) vlc_meta_Set( meta, arturl, b );
106 #define vlc_meta_SetTrackID( meta, b ) vlc_meta_Set( meta, trackid, b );
107 #define vlc_meta_SetArtistID( meta, b ) vlc_meta_Set( meta, artistid, b );
108 #define vlc_meta_SetAlbumID( meta, b ) vlc_meta_Set( meta, albumid, b );
111 static inline vlc_meta_t *vlc_meta_New( void )
113 vlc_meta_t *m = (vlc_meta_t*)malloc( sizeof( vlc_meta_t ) );
114 if( !m ) return NULL;
116 m->psz_artist = NULL;
118 m->psz_copyright = NULL;
120 m->psz_tracknum = NULL;
121 m->psz_description = NULL;
122 m->psz_rating = NULL;
124 m->psz_setting = NULL;
126 m->psz_language = NULL;
127 m->psz_nowplaying = NULL;
128 m->psz_publisher = NULL;
129 m->psz_encodedby = NULL;
130 m->psz_arturl = NULL;
131 m->psz_trackid = NULL;
132 m->psz_artistid = NULL;
133 m->psz_albumid = NULL;
138 static inline void vlc_meta_Delete( vlc_meta_t *m )
140 free( m->psz_title );
141 free( m->psz_artist );
142 free( m->psz_genre );
143 free( m->psz_copyright );
144 free( m->psz_album );
145 free( m->psz_tracknum );
146 free( m->psz_description );
147 free( m->psz_rating );
149 free( m->psz_setting );
151 free( m->psz_language );
152 free( m->psz_nowplaying );
153 free( m->psz_publisher );
154 free( m->psz_encodedby );
155 free( m->psz_trackid );
156 free( m->psz_artistid );
157 free( m->psz_albumid );
158 free( m->psz_arturl );
163 static inline void vlc_meta_Merge( vlc_meta_t *dst, vlc_meta_t *src )
165 if( !dst || !src ) return;
166 #define COPY_FIELD( a ) \
167 if( src->psz_ ## a ) { \
168 if( dst->psz_ ## a ) free( dst->psz_## a ); \
169 dst->psz_##a = strdup( src->psz_##a ); \
172 COPY_FIELD( artist );
174 COPY_FIELD( copyright );
176 COPY_FIELD( tracknum );
177 COPY_FIELD( description );
178 COPY_FIELD( rating );
180 COPY_FIELD( setting );
182 COPY_FIELD( language );
183 COPY_FIELD( nowplaying );
184 COPY_FIELD( publisher );
185 COPY_FIELD( encodedby );
186 COPY_FIELD( trackid );
187 COPY_FIELD( artistid );
188 COPY_FIELD( albumid );
189 COPY_FIELD( arturl );
191 /** \todo Track meta */
195 ALBUM_ART_WHEN_ASKED,
196 ALBUM_ART_WHEN_PLAYED,
202 input_item_t *p_item;
203 const char *psz_file;
206 #define VLC_META_ENGINE_TITLE 0x00000001
207 #define VLC_META_ENGINE_ARTIST 0x00000004
208 #define VLC_META_ENGINE_GENRE 0x00000008
209 #define VLC_META_ENGINE_COPYRIGHT 0x00000010
210 #define VLC_META_ENGINE_COLLECTION 0x00000020
211 #define VLC_META_ENGINE_SEQ_NUM 0x00000040
212 #define VLC_META_ENGINE_DESCRIPTION 0x00000080
213 #define VLC_META_ENGINE_RATING 0x00000100
214 #define VLC_META_ENGINE_DATE 0x00000200
215 #define VLC_META_ENGINE_URL 0x00000400
216 #define VLC_META_ENGINE_LANGUAGE 0x00000800
218 #define VLC_META_ENGINE_ART_URL 0x00001000
220 #define VLC_META_ENGINE_MB_ARTIST_ID 0x00002000
221 #define VLC_META_ENGINE_MB_RELEASE_ID 0x00004000
222 #define VLC_META_ENGINE_MB_TRACK_ID 0x00008000
223 #define VLC_META_ENGINE_MB_TRM_ID 0x00010000
225 typedef struct meta_engine_sys_t meta_engine_sys_t;
233 uint32_t i_mandatory; /**< Stuff which we really need to get */
234 uint32_t i_optional; /**< Stuff which we'd like to have */
236 input_item_t *p_item;
239 VLC_EXPORT(uint32_t, input_CurrentMetaFlags,( vlc_meta_t *p_meta ) );