demux: ts: fix potential null deref (cid #1412981)
[vlc.git] / include / vlc_media_library.h
bloba35d9729ca3705ec792b7be9e1819919f6e601f6
1 /*****************************************************************************
2 * vlc_media_library.h: SQL-based media library
3 *****************************************************************************
4 * Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
5 * $Id$
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>
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.
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.
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 *****************************************************************************/
28 #ifndef VLC_MEDIA_LIBRARY_H
29 # define VLC_MEDIA_LIBRARY_H
31 # ifdef __cplusplus
32 extern "C" {
33 # endif
35 /*****************************************************************************
36 * ML Enums
37 *****************************************************************************/
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"
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:
51 typedef enum
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 */
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;
104 /** Media types (audio, video, etc...) */
105 typedef enum
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;
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* */
121 } ml_result_type_e;
123 #ifdef __cplusplus
125 #endif /* C++ */
127 #endif /* VLC_MEDIA_LIBRARY_H */