VLC  3.0.15
vlc_media_library.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_media_library.h: SQL-based media library
3  *****************************************************************************
4  * Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
5  * $Id: a35d9729ca3705ec792b7be9e1819919f6e601f6 $
6  *
7  * Authors: Antoine Lejeune <phytos@videolan.org>
8  * Jean-Philippe André <jpeg@videolan.org>
9  * Rémi Duraffort <ivoire@videolan.org>
10  * Adrien Maglo <magsoft@videolan.org>
11  * Srikanth Raju <srikiraju at gmail dot com>
12  *
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation; either version 2.1 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  *****************************************************************************/
27 
28 #ifndef VLC_MEDIA_LIBRARY_H
29 # define VLC_MEDIA_LIBRARY_H
30 
31 # ifdef __cplusplus
32 extern "C" {
33 # endif
34 
35 /*****************************************************************************
36  * ML Enums
37  *****************************************************************************/
38 
39 #define ML_PERSON_ARTIST "Artist"
40 #define ML_PERSON_ALBUM_ARTIST "Album Artist"
41 #define ML_PERSON_ENCODER "Encoder"
42 #define ML_PERSON_PUBLISHER "Publisher"
43 
44 
45 /** List of Query select types.
46  * In a query array or variable argument list, each select type is followed
47  * by an argument (X) of variable type (char* or int, @see ml_element_t).
48  * These types can be used either in the query list or in the result array.
49  * Some types are reserved for the result array:
50  */
51 typedef enum
52 {
53  ML_ALBUM = 1, /**< Album Title */
54  ML_ALBUM_ID, /**< Album ID */
55  ML_ALBUM_COVER, /**< Album Cover art url */
56  /* FIXME: Remove ML_ARTIST */
57  ML_ARTIST, /**< Artist, interpreted as ML_PEOPLE
58  && ML_PEOPLE_ROLE = ML_PERSON_ARTIST */
59  ML_ARTIST_ID, /**< Artist ID, interpreted as ML_PEOPLE_ID
60  && ML_PEOPLE_ROLE = ML_PERSON_ARTIST */
61  ML_COMMENT, /**< Comment about media */
62  ML_COUNT_MEDIA, /**< Number of medias */
63  ML_COUNT_ALBUM, /**< Number of albums */
64  ML_COUNT_PEOPLE, /**< Number of people */
65  ML_COVER, /**< Cover art url */
66  ML_DURATION, /**< Duration in ms */
67  ML_DISC_NUMBER, /**< Disc number of the track */
68  ML_EXTRA, /**< Extra/comment (string) on the media */
69  ML_FIRST_PLAYED, /**< First time media was played */
70  ML_FILESIZE, /**< Size of the media file */
71  ML_GENRE, /**< Genre of the media (if any) */
72  ML_ID, /**< Media ID */
73  ML_IMPORT_TIME, /**< Date when media was imported */
74  ML_LANGUAGE, /**< Language */
75  ML_LAST_PLAYED, /**< Last play UNIX timestamp */
76  ML_LAST_SKIPPED, /**< Time when media was last skipped */
77  ML_ORIGINAL_TITLE, /**< Media original title (if any) */
78  ML_PEOPLE, /**< Any People associated with this media */
79  ML_PEOPLE_ID, /**< Id of a person */
80  ML_PEOPLE_ROLE, /**< Person role */
81  ML_PLAYED_COUNT, /**< Media play count */
82  ML_PREVIEW, /**< Url of the video preview */
83  ML_SKIPPED_COUNT, /**< Number of times skipped */
84  ML_SCORE, /**< Computed media score */
85  ML_TITLE, /**< Media title */
86  ML_TRACK_NUMBER, /**< Media track number (if any) */
87  ML_TYPE, /**< Media type. @see ml_type_e */
88  ML_URI, /**< Media full URI. */
89  ML_VOTE, /**< Media user vote value */
90  ML_YEAR, /**< Media publishing year */
91  ML_DIRECTORY, /**< Monitored directory */
92  ML_MEDIA, /**< Full media descriptor. @see ml_media_t */
93  ML_MEDIA_SPARSE, /**< Sparse media. @see ml_media_t */
94  ML_MEDIA_EXTRA, /**< Sparse + Extra = Full media */
95 
96  /* Some special elements */
97  ML_LIMIT = -1, /**< Limit a query to X results */
98  ML_SORT_DESC = -2, /**< Sort a query descending on argument X */
99  ML_SORT_ASC = -3, /**< Sort a query ascending on argument X */
100  ML_DISTINCT = -4, /**< Add DISTINCT to SELECT statements. */
101  ML_END = -42 /**< End of argument list */
102 } ml_select_e;
103 
104 /** Media types (audio, video, etc...) */
105 typedef enum
106 {
107  ML_UNKNOWN = 0, /**< Unknown media type */
108  ML_AUDIO = 1 << 0, /**< Audio only media */
109  ML_VIDEO = 1 << 1, /**< Video media. May contain audio channels */
110  ML_STREAM = 1 << 2, /**< Streamed media = not a local file */
111  ML_NODE = 1 << 3, /**< Nodes like simple nodes, directories, playlists, etc */
112  ML_REMOVABLE = 1 << 4, /**< Removable media: CD/DVD/Card/... */
113 } ml_type_e;
114 
115 /** Query result item/list type: integers, strings, medias, timestamps */
116 typedef enum {
117  ML_TYPE_INT, /**< Object is an int */
118  ML_TYPE_PSZ, /**< A string char* */
119  ML_TYPE_TIME, /**< A timestamp mtime_t */
120  ML_TYPE_MEDIA, /**< A pointer to a media ml_media_t* */
122 
123 #ifdef __cplusplus
124 }
125 #endif /* C++ */
126 
127 #endif /* VLC_MEDIA_LIBRARY_H */
ML_LANGUAGE
Language.
Definition: vlc_media_library.h:73
ML_IMPORT_TIME
Date when media was imported.
Definition: vlc_media_library.h:72
ML_VIDEO
Video media.
Definition: vlc_media_library.h:108
ml_select_e
ml_select_e
List of Query select types.
Definition: vlc_media_library.h:50
ML_MEDIA_SPARSE
Sparse media.
Definition: vlc_media_library.h:92
ML_PEOPLE_ROLE
Person role.
Definition: vlc_media_library.h:79
ML_ALBUM_COVER
Album Cover art url.
Definition: vlc_media_library.h:54
vlc_common.h
ML_URI
Media full URI.
Definition: vlc_media_library.h:87
ML_PEOPLE
Any People associated with this media.
Definition: vlc_media_library.h:77
ML_ALBUM_ID
Album ID.
Definition: vlc_media_library.h:53
ML_MEDIA_EXTRA
Sparse + Extra = Full media.
Definition: vlc_media_library.h:93
ML_COUNT_PEOPLE
Number of people.
Definition: vlc_media_library.h:63
ML_SORT_ASC
Sort a query ascending on argument X.
Definition: vlc_media_library.h:98
ML_TYPE_MEDIA
A pointer to a media ml_media_t*.
Definition: vlc_media_library.h:119
ML_FILESIZE
Size of the media file.
Definition: vlc_media_library.h:69
ML_TYPE_TIME
A timestamp mtime_t.
Definition: vlc_media_library.h:118
ML_PREVIEW
Url of the video preview.
Definition: vlc_media_library.h:81
ML_ORIGINAL_TITLE
Media original title (if any)
Definition: vlc_media_library.h:76
ML_TYPE_PSZ
A string char*.
Definition: vlc_media_library.h:117
ML_TRACK_NUMBER
Media track number (if any)
Definition: vlc_media_library.h:85
ML_UNKNOWN
Unknown media type.
Definition: vlc_media_library.h:106
ML_TITLE
Media title.
Definition: vlc_media_library.h:84
ML_MEDIA
Full media descriptor.
Definition: vlc_media_library.h:91
ML_VOTE
Media user vote value.
Definition: vlc_media_library.h:88
ML_EXTRA
Extra/comment (string) on the media.
Definition: vlc_media_library.h:67
ml_result_type_e
ml_result_type_e
Query result item/list type: integers, strings, medias, timestamps.
Definition: vlc_media_library.h:115
ML_TYPE_INT
Object is an int.
Definition: vlc_media_library.h:116
ML_AUDIO
Audio only media.
Definition: vlc_media_library.h:107
ML_SORT_DESC
Sort a query descending on argument X.
Definition: vlc_media_library.h:97
ML_SCORE
Computed media score.
Definition: vlc_media_library.h:83
ML_REMOVABLE
Removable media: CD/DVD/Card/...
Definition: vlc_media_library.h:111
ML_ARTIST
Artist, interpreted as ML_PEOPLE && ML_PEOPLE_ROLE = ML_PERSON_ARTIST.
Definition: vlc_media_library.h:56
ML_DISC_NUMBER
Disc number of the track.
Definition: vlc_media_library.h:66
ML_YEAR
Media publishing year.
Definition: vlc_media_library.h:89
ML_FIRST_PLAYED
First time media was played.
Definition: vlc_media_library.h:68
ML_ALBUM
Album Title.
Definition: vlc_media_library.h:52
ML_PEOPLE_ID
Id of a person.
Definition: vlc_media_library.h:78
ML_END
End of argument list.
Definition: vlc_media_library.h:100
ML_LAST_SKIPPED
Time when media was last skipped.
Definition: vlc_media_library.h:75
ML_ID
Media ID.
Definition: vlc_media_library.h:71
ML_NODE
Nodes like simple nodes, directories, playlists, etc.
Definition: vlc_media_library.h:110
ML_STREAM
Streamed media = not a local file.
Definition: vlc_media_library.h:109
ML_COMMENT
Comment about media.
Definition: vlc_media_library.h:60
ML_COUNT_MEDIA
Number of medias.
Definition: vlc_media_library.h:61
ML_GENRE
Genre of the media (if any)
Definition: vlc_media_library.h:70
ML_TYPE
Media type.
Definition: vlc_media_library.h:86
ML_LIMIT
Limit a query to X results.
Definition: vlc_media_library.h:96
ML_LAST_PLAYED
Last play UNIX timestamp.
Definition: vlc_media_library.h:74
ML_COUNT_ALBUM
Number of albums.
Definition: vlc_media_library.h:62
ML_SKIPPED_COUNT
Number of times skipped.
Definition: vlc_media_library.h:82
ML_PLAYED_COUNT
Media play count.
Definition: vlc_media_library.h:80
ML_DIRECTORY
Monitored directory.
Definition: vlc_media_library.h:90
ml_type_e
ml_type_e
Media types (audio, video, etc...)
Definition: vlc_media_library.h:104
ML_ARTIST_ID
Artist ID, interpreted as ML_PEOPLE_ID && ML_PEOPLE_ROLE = ML_PERSON_ARTIST.
Definition: vlc_media_library.h:58
ML_COVER
Cover art url.
Definition: vlc_media_library.h:64
ML_DISTINCT
Add DISTINCT to SELECT statements.
Definition: vlc_media_library.h:99
ML_DURATION
Duration in ms.
Definition: vlc_media_library.h:65