1 /*****************************************************************************
2 * vlc_media_library.h: SQL-based media library
3 *****************************************************************************
4 * Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
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
37 typedef enum vlc_ml_media_type_t
39 VLC_ML_MEDIA_TYPE_UNKNOWN
,
40 VLC_ML_MEDIA_TYPE_VIDEO
,
41 VLC_ML_MEDIA_TYPE_AUDIO
,
42 VLC_ML_MEDIA_TYPE_EXTERNAL
,
43 VLC_ML_MEDIA_TYPE_STREAM
,
44 } vlc_ml_media_type_t
;
46 typedef enum vlc_ml_media_subtype_t
48 VLC_ML_MEDIA_SUBTYPE_UNKNOWN
,
49 VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE
,
50 VLC_ML_MEDIA_SUBTYPE_MOVIE
,
51 VLC_ML_MEDIA_SUBTYPE_ALBUMTRACK
,
52 } vlc_ml_media_subtype_t
;
54 typedef enum vlc_ml_file_type_t
56 VLC_ML_FILE_TYPE_UNKNOWN
,
57 VLC_ML_FILE_TYPE_MAIN
,
58 VLC_ML_FILE_TYPE_PART
,
59 VLC_ML_FILE_TYPE_SOUNDTRACK
,
60 VLC_ML_FILE_TYPE_SUBTITLE
,
61 VLC_ML_FILE_TYPE_PLAYLIST
,
64 typedef enum vlc_ml_track_type_t
66 VLC_ML_TRACK_TYPE_UNKNOWN
,
67 VLC_ML_TRACK_TYPE_VIDEO
,
68 VLC_ML_TRACK_TYPE_AUDIO
,
69 } vlc_ml_track_type_t
;
71 typedef struct vlc_ml_movie_t
77 typedef struct vlc_ml_show_episode_t
81 uint32_t i_episode_nb
;
82 uint32_t i_season_number
;
83 } vlc_ml_show_episode_t
;
85 typedef struct vlc_ml_show_t
90 char* psz_artwork_mrl
;
92 unsigned int i_release_year
;
93 uint32_t i_nb_episodes
;
94 uint32_t i_nb_seasons
;
97 typedef struct vlc_ml_album_track_t
105 } vlc_ml_album_track_t
;
107 typedef struct vlc_ml_label_t
113 typedef struct vlc_ml_label_list_t
116 vlc_ml_label_t p_items
[];
117 } vlc_ml_label_list_t
;
119 typedef struct vlc_ml_file_t
122 vlc_ml_file_type_t i_type
;
126 typedef struct vlc_ml_file_list_t
129 vlc_ml_file_t p_items
[];
130 } vlc_ml_file_list_t
;
132 typedef struct vlc_ml_media_track_t
136 char* psz_description
;
137 vlc_ml_track_type_t i_type
;
144 uint32_t i_nbChannels
;
145 uint32_t i_sampleRate
;
158 } vlc_ml_media_track_t
;
160 typedef struct vlc_ml_media_track_list_t
163 vlc_ml_media_track_t p_items
[];
164 } vlc_ml_media_track_list_t
;
166 typedef struct vlc_ml_media_t
170 vlc_ml_media_type_t i_type
;
171 vlc_ml_media_subtype_t i_subtype
;
173 vlc_ml_file_list_t
* p_files
;
174 vlc_ml_media_track_list_t
* p_tracks
;
177 /* Duration in milliseconds */
179 uint32_t i_playcount
;
180 time_t i_last_played_date
;
183 char* psz_artwork_mrl
;
188 vlc_ml_show_episode_t show_episode
;
189 vlc_ml_movie_t movie
;
190 vlc_ml_album_track_t album_track
;
194 typedef struct vlc_ml_playlist_t
198 uint32_t i_creation_date
;
199 char* psz_artwork_mrl
;
202 typedef struct vlc_ml_artist_t
207 char* psz_artwork_mrl
;
210 unsigned int i_nb_album
;
211 unsigned int i_nb_tracks
;
214 typedef struct vlc_ml_artist_list_t
217 vlc_ml_artist_t p_items
[];
218 } vlc_ml_artist_list_t
;
220 typedef struct vlc_ml_album_t
{
224 char* psz_artwork_mrl
;
229 unsigned int i_duration
;
233 typedef struct vlc_ml_genre_t
240 typedef struct vlc_ml_media_list_t
243 vlc_ml_media_t p_items
[];
244 } vlc_ml_media_list_t
;
246 typedef struct vlc_ml_album_list_t
249 vlc_ml_album_t p_items
[];
250 } vlc_ml_album_list_t
;
252 typedef struct vlc_ml_show_list_t
255 vlc_ml_show_t p_items
[];
256 } vlc_ml_show_list_t
;
258 typedef struct vlc_ml_genre_list_t
261 vlc_ml_genre_t p_items
[];
262 } vlc_ml_genre_list_t
;
264 typedef struct vlc_ml_playlist_list_t
267 vlc_ml_playlist_t p_items
[];
268 } vlc_ml_playlist_list_t
;
270 typedef struct vlc_ml_entrypoint_t vlc_ml_entrypoint_t
;
271 struct vlc_ml_entrypoint_t
273 char* psz_mrl
; /**< This entrypoint's MRL. Will be NULL if b_present is false */
274 bool b_present
; /**< The presence state for this entrypoint. */
275 bool b_banned
; /**< Will be true if the user required this entrypoint to be excluded */
278 typedef struct vlc_medialibrary_t vlc_medialibrary_t
;
280 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
281 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
283 VLC_API vlc_medialibrary_t
* vlc_ml_get( vlc_object_t
* p_obj
) VLC_USED
;
284 #define vlc_ml_get(x) vlc_ml_get( VLC_OBJECT(x) )
286 VLC_API
void vlc_ml_entrypoints_release( vlc_ml_entrypoint_t
* p_list
, size_t i_nb_items
);
288 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
289 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
290 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
291 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
292 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
293 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
295 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
296 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
297 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
298 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
299 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
300 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
301 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
302 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
304 typedef enum vlc_ml_sorting_criteria_t
307 * Default depends on the entity type:
308 * - By track number (and disc number) for album tracks
309 * - Alphabetical order for others
311 VLC_ML_SORTING_DEFAULT
,
312 VLC_ML_SORTING_ALPHA
,
313 VLC_ML_SORTING_DURATION
,
314 VLC_ML_SORTING_INSERTIONDATE
,
315 VLC_ML_SORTING_LASTMODIFICATIONDATE
,
316 VLC_ML_SORTING_RELEASEDATE
,
317 VLC_ML_SORTING_FILESIZE
,
318 VLC_ML_SORTING_ARTIST
,
319 VLC_ML_SORTING_PLAYCOUNT
,
320 VLC_ML_SORTING_ALBUM
,
321 VLC_ML_SORTING_FILENAME
,
322 VLC_ML_SORTING_TRACKNUMBER
,
323 } vlc_ml_sorting_criteria_t
;
325 typedef struct vlc_ml_query_params_t vlc_ml_query_params_t
;
326 struct vlc_ml_query_params_t
328 const char* psz_pattern
;
329 uint32_t i_nbResults
;
331 vlc_ml_sorting_criteria_t i_sort
;
335 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
337 return (vlc_ml_query_params_t
) {
341 .i_sort
= VLC_ML_SORTING_DEFAULT
,
346 struct vlc_medialibrary_t
348 struct vlc_common_members obj
;
354 int (*pf_control
)( vlc_medialibrary_t
* p_ml
, int i_query
, ... );
356 * List some entities from the medialibrary.
358 * \param p_ml The medialibrary module instance.
359 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
360 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
361 * the default parameters (alphabetical ascending sort, no pagination)
363 * \return VLC_SUCCESS or an error code
365 * Refer to the individual list of vlc_ml_list requests for the additional
366 * per-query input/ouput parameters values & types
368 int (*pf_list
)( vlc_medialibrary_t
* p_ml
, int i_query
,
369 const vlc_ml_query_params_t
* p_params
, ... );
372 * Get a specific entity by its id.
374 * \return The required entity, or a NULL pointer if couldn't be found.
376 * Refer to the list of queries for the specific return type
378 void* (*pf_get
)( vlc_medialibrary_t
* p_ml
, int i_query
, int64_t i_id
);
383 /* Adds a folder to discover through the medialibrary */
384 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
385 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
386 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
387 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
388 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entrypoint_t**); arg2: nb results(size_t*), res: can fail */
390 /* Pause/resume background operations, such as media discovery & media analysis */
391 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
392 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
394 /* Misc operations */
395 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
398 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
399 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
401 /* Media management */
402 VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, /**< arg1: media id; can fail */
403 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: char**; */
404 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: const char*; */
405 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; */
406 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
410 * User playback settings.
411 * All values/units are up to the caller and are not interpreted by the media
413 * All values are stored and returned as strings.
414 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_PREF,
415 * the value will be returned stored in the provided char**. If the preference was
416 * not set yet, NULL will be returned.
417 * When setting a preference, NULL can be provided as a value to unset it.
419 enum vlc_ml_playback_pref
421 VLC_ML_PLAYBACK_PREF_RATING
,
422 VLC_ML_PLAYBACK_PREF_PROGRESS
,
423 VLC_ML_PLAYBACK_PREF_SPEED
,
424 VLC_ML_PLAYBACK_PREF_TITLE
,
425 VLC_ML_PLAYBACK_PREF_CHAPTER
,
426 VLC_ML_PLAYBACK_PREF_PROGRAM
,
427 VLC_ML_PLAYBACK_PREF_SEEN
,
428 VLC_ML_PLAYBACK_PREF_VIDEO_TRACK
,
429 VLC_ML_PLAYBACK_PREF_ASPECT_RATIO
,
430 VLC_ML_PLAYBACK_PREF_ZOOM
,
431 VLC_ML_PLAYBACK_PREF_CROP
,
432 VLC_ML_PLAYBACK_PREF_DEINTERLACE
,
433 VLC_ML_PLAYBACK_PREF_VIDEO_FILTER
,
434 VLC_ML_PLAYBACK_PREF_AUDIO_TRACK
,
435 VLC_ML_PLAYBACK_PREF_GAIN
,
436 VLC_ML_PLAYBACK_PREF_AUDIO_DELAY
,
437 VLC_ML_PLAYBACK_PREF_SUBTITLE_TRACK
,
438 VLC_ML_PLAYBACK_PREF_SUBTITLE_DELAY
,
439 VLC_ML_PLAYBACK_PREF_APP_SPECIFIC
,
442 static inline void vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
444 p_ml
->pf_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
447 static inline void vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
449 p_ml
->pf_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
452 static inline void vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
454 p_ml
->pf_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
457 static inline void vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
459 p_ml
->pf_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
462 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
463 vlc_ml_entrypoint_t
** pp_entrypoints
, size_t* p_nb_items
)
465 return p_ml
->pf_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
, p_nb_items
);
468 static inline void vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
470 p_ml
->pf_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
473 static inline void vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
475 p_ml
->pf_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
478 static inline void vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
480 p_ml
->pf_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
483 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
486 if ( p_ml
->pf_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
491 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
494 if ( p_ml
->pf_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
499 static inline int vlc_ml_media_increase_playcount( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
501 return p_ml
->pf_control( p_ml
, VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, i_media_id
);
504 static inline int vlc_ml_media_get_playback_pref( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int i_pref
, char** ppsz_result
)
506 return p_ml
->pf_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, ppsz_result
);
509 static inline int vlc_ml_media_set_playback_pref( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int i_pref
, const char* psz_value
)
511 return p_ml
->pf_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, psz_value
);
514 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, const char* psz_mrl
)
516 return p_ml
->pf_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
);
519 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
520 const char* psz_mrl
, int i_type
)
522 return p_ml
->pf_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
525 enum vlc_ml_get_queries
527 VLC_ML_GET_MEDIA
, /**< arg1: Media ID; ret: vlc_ml_media_t* */
528 VLC_ML_GET_ALBUM
, /**< arg1: Album ID; ret: vlc_ml_album_t* */
529 VLC_ML_GET_ARTIST
, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
530 VLC_ML_GET_GENRE
, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
531 VLC_ML_GET_SHOW
, /**< arg1: Show ID; ret: vlc_ml_show_t* */
532 VLC_ML_GET_PLAYLIST
, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
535 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
537 return (vlc_ml_media_t
*)p_ml
->pf_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
540 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
542 return (vlc_ml_album_t
*)p_ml
->pf_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
545 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
547 return (vlc_ml_artist_t
*)p_ml
->pf_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
550 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
552 return (vlc_ml_genre_t
*)p_ml
->pf_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
555 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
557 return (vlc_ml_show_t
*)p_ml
->pf_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
560 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
562 return (vlc_ml_playlist_t
*)p_ml
->pf_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
565 enum vlc_ml_list_queries
567 /* General listing: */
569 VLC_ML_LIST_VIDEOS
, /**< arg1 (out): vlc_ml_media_list_t** */
570 VLC_ML_COUNT_VIDEOS
, /**< arg1 (out): size_t* */
571 VLC_ML_LIST_AUDIOS
, /**< arg1 (out): vlc_ml_media_list_t** */
572 VLC_ML_COUNT_AUDIOS
, /**< arg1 (out): size_t* */
573 VLC_ML_LIST_ALBUMS
, /**< arg1 (out): vlc_ml_album_list_t** */
574 VLC_ML_COUNT_ALBUMS
, /**< arg1 (out): size_t* */
575 VLC_ML_LIST_GENRES
, /**< arg1 (out): vlc_ml_genre_list_t** */
576 VLC_ML_COUNT_GENRES
, /**< arg1 (out): size_t* */
577 VLC_ML_LIST_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
578 VLC_ML_COUNT_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): size_t* */
579 VLC_ML_LIST_SHOWS
, /**< arg1 (out): vlc_ml_show_list_t** */
580 VLC_ML_COUNT_SHOWS
, /**< arg1 (out): size_t* */
581 VLC_ML_LIST_PLAYLISTS
, /**< arg1 (out): vlc_ml_playlist_list_t** */
582 VLC_ML_COUNT_PLAYLISTS
, /**< arg1 (out): size_t* */
583 VLC_ML_LIST_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
584 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
586 /* Album specific listings */
587 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
588 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
589 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
590 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
592 /* Artist specific listings */
593 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
594 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
595 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
596 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
598 /* Genre specific listings */
599 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
600 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
601 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
602 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
603 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
604 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
606 /* Show specific listings */
607 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
608 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
610 /* Media specific listings */
611 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
612 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
614 /* Playlist specific listings */
615 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
616 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
618 /* Children entities listing */
619 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t* */
620 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
621 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t* */
622 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
623 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t* */
624 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
627 enum vlc_ml_parent_type
630 VLC_ML_PARENT_ARTIST
,
633 VLC_ML_PARENT_PLAYLIST
,
636 static inline vlc_ml_media_list_t
* vlc_ml_list_media_of( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int i_parent_type
, int64_t i_parent_id
)
638 vlc_assert( p_ml
!= NULL
);
639 vlc_ml_media_list_t
* res
;
640 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
645 static inline size_t vlc_ml_count_media_of( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int i_parent_type
, int64_t i_parent_id
)
647 vlc_assert( p_ml
!= NULL
);
649 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) )
654 static inline vlc_ml_artist_list_t
* vlc_ml_list_artist_of( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int i_parent_type
, int64_t i_parent_id
)
656 vlc_assert( p_ml
!= NULL
);
657 vlc_ml_artist_list_t
* res
;
658 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
663 static inline size_t vlc_ml_count_artists_of( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int i_parent_type
, int64_t i_parent_id
)
665 vlc_assert( p_ml
!= NULL
);
667 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) )
672 static inline vlc_ml_album_list_t
* vlc_ml_list_albums_of( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int i_parent_type
, int64_t i_parent_id
)
674 vlc_assert( p_ml
!= NULL
);
675 vlc_ml_album_list_t
* res
;
676 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
681 static inline size_t vlc_ml_count_albums_of( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int i_parent_type
, int64_t i_parent_id
)
683 vlc_assert( p_ml
!= NULL
);
685 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) )
690 static inline vlc_ml_media_list_t
* vlc_ml_list_album_tracks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_album_id
)
692 vlc_assert( p_ml
!= NULL
);
693 vlc_ml_media_list_t
* res
;
694 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
699 static inline size_t vlc_ml_count_album_tracks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_album_id
)
701 vlc_assert( p_ml
!= NULL
);
703 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
708 static inline vlc_ml_media_list_t
* vlc_ml_list_album_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_album_id
)
710 vlc_assert( p_ml
!= NULL
);
711 vlc_ml_media_list_t
* res
;
712 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
717 static inline size_t vlc_ml_count_album_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_album_id
)
719 vlc_assert( p_ml
!= NULL
);
721 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
726 static inline vlc_ml_album_list_t
* vlc_ml_list_artist_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_artist_id
)
728 vlc_assert( p_ml
!= NULL
);
729 vlc_ml_album_list_t
* res
;
730 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
735 static inline size_t vlc_ml_count_artist_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_artist_id
)
737 vlc_assert( p_ml
!= NULL
);
739 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
744 static inline vlc_ml_media_list_t
* vlc_ml_list_artist_tracks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_artist_id
)
746 vlc_assert( p_ml
!= NULL
);
747 vlc_ml_media_list_t
* res
;
748 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
753 static inline size_t vlc_ml_count_artist_tracks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_artist_id
)
755 vlc_assert( p_ml
!= NULL
);
757 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
762 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
764 vlc_assert( p_ml
!= NULL
);
765 vlc_ml_media_list_t
* res
;
766 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
771 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
773 vlc_assert( p_ml
!= NULL
);
775 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
780 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
782 vlc_assert( p_ml
!= NULL
);
783 vlc_ml_media_list_t
* res
;
784 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
789 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
791 vlc_assert( p_ml
!= NULL
);
793 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
798 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
800 vlc_assert( p_ml
!= NULL
);
801 vlc_ml_album_list_t
* res
;
802 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
807 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
809 vlc_assert( p_ml
!= NULL
);
811 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
816 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
818 vlc_assert( p_ml
!= NULL
);
819 vlc_ml_genre_list_t
* res
;
820 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
825 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
827 vlc_assert( p_ml
!= NULL
);
829 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
835 * @brief vlc_ml_list_artists
836 * @param params Query parameters, or NULL for the default
837 * @param b_include_all True if you wish to fetch artists without at least one album.
840 static inline vlc_ml_artist_list_t
* vlc_ml_list_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool b_include_all
)
842 vlc_assert( p_ml
!= NULL
);
843 vlc_ml_artist_list_t
* res
;
844 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
849 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
851 vlc_assert( p_ml
!= NULL
);
853 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
858 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
860 vlc_assert( p_ml
!= NULL
);
861 vlc_ml_show_list_t
* res
;
862 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
867 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
869 vlc_assert( p_ml
!= NULL
);
871 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
876 static inline vlc_ml_media_list_t
* vlc_ml_list_genre_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_genre_id
)
878 vlc_assert( p_ml
!= NULL
);
879 vlc_ml_media_list_t
* res
;
880 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
885 static inline size_t vlc_ml_count_genre_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_genre_id
)
887 vlc_assert( p_ml
!= NULL
);
889 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
894 static inline vlc_ml_media_list_t
* vlc_ml_list_genre_tracks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_genre_id
)
896 vlc_assert( p_ml
!= NULL
);
897 vlc_ml_media_list_t
* res
;
898 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
903 static inline size_t vlc_ml_count_genre_tracks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_genre_id
)
905 vlc_assert( p_ml
!= NULL
);
907 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
912 static inline vlc_ml_album_list_t
* vlc_ml_list_genre_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_genre_id
)
914 vlc_assert( p_ml
!= NULL
);
915 vlc_ml_album_list_t
* res
;
916 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
921 static inline size_t vlc_ml_count_genre_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_genre_id
)
923 vlc_assert( p_ml
!= NULL
);
925 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
930 static inline vlc_ml_media_list_t
* vlc_ml_list_show_episodes( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_show_id
)
932 vlc_assert( p_ml
!= NULL
);
933 vlc_ml_media_list_t
* res
;
934 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
939 static inline size_t vlc_ml_count_show_episodes( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_show_id
)
941 vlc_assert( p_ml
!= NULL
);
943 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
948 static inline vlc_ml_label_list_t
* vlc_ml_list_media_labels( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_media_id
)
950 vlc_assert( p_ml
!= NULL
);
951 vlc_ml_label_list_t
* res
;
952 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
957 static inline size_t vlc_ml_count_media_labels( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_media_id
)
959 vlc_assert( p_ml
!= NULL
);
961 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
966 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
968 vlc_assert( p_ml
!= NULL
);
969 vlc_ml_media_list_t
* res
;
970 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
975 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
977 vlc_assert( p_ml
!= NULL
);
978 vlc_ml_media_list_t
* res
;
979 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
984 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
986 vlc_assert( p_ml
!= NULL
);
987 vlc_ml_playlist_list_t
* res
;
988 if ( p_ml
->pf_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
993 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
995 vlc_assert( p_ml
!= NULL
);
997 if ( p_ml
->pf_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1007 # define vlc_ml_release_obj( OBJ ) _Generic( ( OBJ ), \
1008 vlc_ml_show_t*: vlc_ml_show_release, \
1009 vlc_ml_artist_t*: vlc_ml_artist_release, \
1010 vlc_ml_album_t*: vlc_ml_album_release, \
1011 vlc_ml_genre_t*: vlc_ml_genre_release, \
1012 vlc_ml_media_t*: vlc_ml_media_release, \
1013 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1014 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1015 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1016 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1017 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1018 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1019 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1020 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1021 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release \
1024 static inline void vlc_ml_release_obj( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1025 static inline void vlc_ml_release_obj( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1026 static inline void vlc_ml_release_obj( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1027 static inline void vlc_ml_release_obj( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1028 static inline void vlc_ml_release_obj( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1029 static inline void vlc_ml_release_obj( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1030 static inline void vlc_ml_release_obj( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1031 static inline void vlc_ml_release_obj( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1032 static inline void vlc_ml_release_obj( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1033 static inline void vlc_ml_release_obj( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1034 static inline void vlc_ml_release_obj( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1035 static inline void vlc_ml_release_obj( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1036 static inline void vlc_ml_release_obj( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1037 static inline void vlc_ml_release_obj( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1040 #endif /* VLC_MEDIA_LIBRARY_H */