VLC  4.0.0-dev
vlc_meta.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_meta.h: Stream meta-data
3  *****************************************************************************
4  * Copyright (C) 2004 VLC authors and VideoLAN
5  *
6  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21  *****************************************************************************/
22 
23 #ifndef VLC_META_H
24 #define VLC_META_H 1
25 
26 /**
27  * \file
28  * This file defines functions and structures for stream meta-data in vlc
29  *
30  */
31 
32 typedef enum vlc_meta_type_t
33 {
62 
63 #define VLC_META_TYPE_COUNT 27
64 
65 #define ITEM_PREPARSED 1
66 #define ITEM_ART_FETCHED 2
67 #define ITEM_ART_NOTFOUND 4
68 
69 /**
70  * Basic function to deal with meta
71  */
72 struct vlc_meta_t;
73 
76 VLC_API void vlc_meta_Set( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val );
77 VLC_API const char * vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t meta_type );
78 
79 VLC_API void vlc_meta_AddExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value );
80 VLC_API const char * vlc_meta_GetExtra( const vlc_meta_t *m, const char *psz_name );
81 VLC_API unsigned vlc_meta_GetExtraCount( const vlc_meta_t *m );
82 
83 /**
84  * Allocate a copy of all extra meta names and a table with it.
85  * Be sure to free both the returned pointers and its name.
86  */
88 
89 VLC_API void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src );
90 
92 VLC_API void vlc_meta_SetStatus( vlc_meta_t *m, int status );
93 
94 /**
95  * Returns a localizes string describing the meta
96  */
98 
99 typedef struct meta_export_t
100 {
101  struct vlc_object_t obj;
103  const char *psz_file;
105 
107 
108 /* Setters for meta.
109  * Warning: Make sure to use the input_item meta setters (defined in vlc_input_item.h)
110  * instead of those one. */
111 #define vlc_meta_SetTitle( meta, b ) vlc_meta_Set( meta, vlc_meta_Title, b )
112 #define vlc_meta_SetArtist( meta, b ) vlc_meta_Set( meta, vlc_meta_Artist, b )
113 #define vlc_meta_SetGenre( meta, b ) vlc_meta_Set( meta, vlc_meta_Genre, b )
114 #define vlc_meta_SetCopyright( meta, b ) vlc_meta_Set( meta, vlc_meta_Copyright, b )
115 #define vlc_meta_SetAlbum( meta, b ) vlc_meta_Set( meta, vlc_meta_Album, b )
116 #define vlc_meta_SetTrackNum( meta, b ) vlc_meta_Set( meta, vlc_meta_TrackNumber, b )
117 #define vlc_meta_SetDescription( meta, b ) vlc_meta_Set( meta, vlc_meta_Description, b )
118 #define vlc_meta_SetRating( meta, b ) vlc_meta_Set( meta, vlc_meta_Rating, b )
119 #define vlc_meta_SetDate( meta, b ) vlc_meta_Set( meta, vlc_meta_Date, b )
120 #define vlc_meta_SetSetting( meta, b ) vlc_meta_Set( meta, vlc_meta_Setting, b )
121 #define vlc_meta_SetURL( meta, b ) vlc_meta_Set( meta, vlc_meta_URL, b )
122 #define vlc_meta_SetLanguage( meta, b ) vlc_meta_Set( meta, vlc_meta_Language, b )
123 #define vlc_meta_SetNowPlaying( meta, b ) vlc_meta_Set( meta, vlc_meta_NowPlaying, b )
124 #define vlc_meta_SetPublisher( meta, b ) vlc_meta_Set( meta, vlc_meta_Publisher, b )
125 #define vlc_meta_SetEncodedBy( meta, b ) vlc_meta_Set( meta, vlc_meta_EncodedBy, b )
126 #define vlc_meta_SetArtURL( meta, b ) vlc_meta_Set( meta, vlc_meta_ArtworkURL, b )
127 #define vlc_meta_SetTrackID( meta, b ) vlc_meta_Set( meta, vlc_meta_TrackID, b )
128 #define vlc_meta_SetTrackTotal( meta, b ) vlc_meta_Set( meta, vlc_meta_TrackTotal, b )
129 #define vlc_meta_SetDirector( meta, b ) vlc_meta_Set( meta, vlc_meta_Director, b )
130 #define vlc_meta_SetSeason( meta, b ) vlc_meta_Set( meta, vlc_meta_Season, b )
131 #define vlc_meta_SetEpisode( meta, b ) vlc_meta_Set( meta, vlc_meta_Episode, b )
132 #define vlc_meta_SetShowName( meta, b ) vlc_meta_Set( meta, vlc_meta_ShowName, b )
133 #define vlc_meta_SetActors( meta, b ) vlc_meta_Set( meta, vlc_meta_Actors, b )
134 #define vlc_meta_SetAlbumArtist( meta, b ) vlc_meta_Set( meta, vlc_meta_AlbumArtist, b )
135 #define vlc_meta_SetDiscNumber( meta, b ) vlc_meta_Set( meta, vlc_meta_DiscNumber, b )
136 
137 #define VLC_META_TITLE vlc_meta_TypeToLocalizedString( vlc_meta_Title )
138 #define VLC_META_ARTIST vlc_meta_TypeToLocalizedString( vlc_meta_Artist )
139 #define VLC_META_GENRE vlc_meta_TypeToLocalizedString( vlc_meta_Genre )
140 #define VLC_META_COPYRIGHT vlc_meta_TypeToLocalizedString( vlc_meta_Copyright )
141 #define VLC_META_ALBUM vlc_meta_TypeToLocalizedString( vlc_meta_Album )
142 #define VLC_META_TRACK_NUMBER vlc_meta_TypeToLocalizedString( vlc_meta_TrackNumber )
143 #define VLC_META_DESCRIPTION vlc_meta_TypeToLocalizedString( vlc_meta_Description )
144 #define VLC_META_RATING vlc_meta_TypeToLocalizedString( vlc_meta_Rating )
145 #define VLC_META_DATE vlc_meta_TypeToLocalizedString( vlc_meta_Date )
146 #define VLC_META_SETTING vlc_meta_TypeToLocalizedString( vlc_meta_Setting )
147 #define VLC_META_URL vlc_meta_TypeToLocalizedString( vlc_meta_URL )
148 #define VLC_META_LANGUAGE vlc_meta_TypeToLocalizedString( vlc_meta_Language )
149 #define VLC_META_NOW_PLAYING vlc_meta_TypeToLocalizedString( vlc_meta_NowPlaying )
150 #define VLC_META_PUBLISHER vlc_meta_TypeToLocalizedString( vlc_meta_Publisher )
151 #define VLC_META_ENCODED_BY vlc_meta_TypeToLocalizedString( vlc_meta_EncodedBy )
152 #define VLC_META_ART_URL vlc_meta_TypeToLocalizedString( vlc_meta_ArtworkURL )
153 #define VLC_META_TRACKID vlc_meta_TypeToLocalizedString( vlc_meta_TrackID )
154 #define VLC_META_DIRECTOR vlc_meta_TypeToLocalizedString( vlc_meta_Director )
155 #define VLC_META_SEASON vlc_meta_TypeToLocalizedString( vlc_meta_Season )
156 #define VLC_META_EPISODE vlc_meta_TypeToLocalizedString( vlc_meta_Episode )
157 #define VLC_META_SHOW_NAME vlc_meta_TypeToLocalizedString( vlc_meta_ShowName )
158 #define VLC_META_ACTORS vlc_meta_TypeToLocalizedString( vlc_meta_Actors )
159 #define VLC_META_ALBUMARTIST vlc_meta_TypeToLocalizedString( vlc_meta_AlbumArtist )
160 #define VLC_META_DISCNUMBER vlc_meta_TypeToLocalizedString( vlc_meta_DiscNumber )
161 
162 #define VLC_META_EXTRA_MB_ALBUMID "MB_ALBUMID"
163 
164 #endif
VLC_API
#define VLC_API
Definition: fourcc_gen.c:31
vlc_meta_Actors
@ vlc_meta_Actors
Definition: vlc_meta.h:58
vlc_meta_AddExtra
VLC_EXPORT void vlc_meta_AddExtra(vlc_meta_t *m, const char *psz_name, const char *psz_value)
Definition: meta.c:134
psz_name
const char * psz_name
Definition: text_style.c:53
vlc_meta_Merge
VLC_EXPORT void vlc_meta_Merge(vlc_meta_t *dst, const vlc_meta_t *src)
Merging meta.
Definition: meta.c:175
vlc_meta_Album
@ vlc_meta_Album
Definition: vlc_meta.h:39
vlc_meta_Language
@ vlc_meta_Language
Definition: vlc_meta.h:46
vlc_common.h
vlc_meta_DiscNumber
@ vlc_meta_DiscNumber
Definition: vlc_meta.h:60
vlc_meta_URL
@ vlc_meta_URL
Definition: vlc_meta.h:45
input_item_t
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:77
vlc_meta_Episode
@ vlc_meta_Episode
Definition: vlc_meta.h:56
vlc_meta_GetExtra
const VLC_EXPORT char * vlc_meta_GetExtra(const vlc_meta_t *m, const char *psz_name)
Definition: meta.c:143
vlc_meta_DiscTotal
@ vlc_meta_DiscTotal
Definition: vlc_meta.h:61
vlc_meta_Delete
VLC_EXPORT void vlc_meta_Delete(vlc_meta_t *m)
Definition: meta.c:108
vlc_meta_TypeToLocalizedString
const VLC_EXPORT char * vlc_meta_TypeToLocalizedString(vlc_meta_type_t meta_type)
Returns a localizes string describing the meta.
Definition: meta.c:49
vlc_meta_SetStatus
VLC_EXPORT void vlc_meta_SetStatus(vlc_meta_t *m, int status)
Definition: meta.c:166
meta_export_t::p_item
input_item_t * p_item
Definition: vlc_meta.h:103
vlc_meta_NowPlaying
@ vlc_meta_NowPlaying
Definition: vlc_meta.h:47
meta_export_t
struct meta_export_t meta_export_t
meta_export_t::obj
struct vlc_object_t obj
Definition: vlc_meta.h:102
vlc_meta_t
Definition: meta.c:39
meta_export_t
Definition: vlc_meta.h:100
vlc_meta_Title
@ vlc_meta_Title
Definition: vlc_meta.h:35
meta_export_t::psz_file
const char * psz_file
Definition: vlc_meta.h:104
vlc_meta_EncodedBy
@ vlc_meta_EncodedBy
Definition: vlc_meta.h:50
vlc_meta_Artist
@ vlc_meta_Artist
Definition: vlc_meta.h:36
vlc_meta_ArtworkURL
@ vlc_meta_ArtworkURL
Definition: vlc_meta.h:51
vlc_meta_Date
@ vlc_meta_Date
Definition: vlc_meta.h:43
vlc_meta_TrackTotal
@ vlc_meta_TrackTotal
Definition: vlc_meta.h:53
vlc_meta_New
VLC_EXPORT vlc_meta_t * vlc_meta_New(void)
vlc_meta contructor.
Definition: meta.c:90
vlc_meta_Genre
@ vlc_meta_Genre
Definition: vlc_meta.h:37
vlc_meta_CopyExtraNames
VLC_EXPORT char ** vlc_meta_CopyExtraNames(const vlc_meta_t *m)
Allocate a copy of all extra meta names and a table with it.
Definition: meta.c:153
input_item_WriteMeta
VLC_EXPORT int input_item_WriteMeta(vlc_object_t *, input_item_t *)
Definition: meta.c:240
vlc_object_t
VLC object common members.
Definition: vlc_objects.h:43
vlc_meta_AlbumArtist
@ vlc_meta_AlbumArtist
Definition: vlc_meta.h:59
vlc_meta_Copyright
@ vlc_meta_Copyright
Definition: vlc_meta.h:38
VLC_USED
#define VLC_USED
Definition: fourcc_gen.c:32
psz_value
char psz_value[8]
Definition: vout_intf.c:99
vlc_meta_Publisher
@ vlc_meta_Publisher
Definition: vlc_meta.h:49
vlc_meta_Season
@ vlc_meta_Season
Definition: vlc_meta.h:55
vlc_meta_Rating
@ vlc_meta_Rating
Definition: vlc_meta.h:42
vlc_meta_GetStatus
VLC_EXPORT int vlc_meta_GetStatus(vlc_meta_t *m)
vlc_meta status (see vlc_meta_status_e)
Definition: meta.c:161
vlc_meta_TrackNumber
@ vlc_meta_TrackNumber
Definition: vlc_meta.h:40
vlc_meta_TrackID
@ vlc_meta_TrackID
Definition: vlc_meta.h:52
vlc_meta_Setting
@ vlc_meta_Setting
Definition: vlc_meta.h:44
vlc_meta_GetExtraCount
VLC_EXPORT unsigned vlc_meta_GetExtraCount(const vlc_meta_t *m)
Definition: meta.c:148
vlc_meta_ESNowPlaying
@ vlc_meta_ESNowPlaying
Definition: vlc_meta.h:48
vlc_meta_type_t
vlc_meta_type_t
Definition: vlc_meta.h:33
vlc_meta_Description
@ vlc_meta_Description
Definition: vlc_meta.h:41
vlc_meta_Set
VLC_EXPORT void vlc_meta_Set(vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val)
vlc_meta has two kinds of meta, the one in a table, and the one in a dictionary.
Definition: meta.c:122
vlc_meta_Director
@ vlc_meta_Director
Definition: vlc_meta.h:54
vlc_meta_Get
const VLC_EXPORT char * vlc_meta_Get(const vlc_meta_t *p_meta, vlc_meta_type_t meta_type)
Definition: meta.c:129
vlc_meta_ShowName
@ vlc_meta_ShowName
Definition: vlc_meta.h:57