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
32 #include <vlc_common.h>
38 typedef enum vlc_ml_media_type_t
40 VLC_ML_MEDIA_TYPE_UNKNOWN
,
41 VLC_ML_MEDIA_TYPE_VIDEO
,
42 VLC_ML_MEDIA_TYPE_AUDIO
,
43 VLC_ML_MEDIA_TYPE_EXTERNAL
,
44 VLC_ML_MEDIA_TYPE_STREAM
,
45 } vlc_ml_media_type_t
;
47 typedef enum vlc_ml_media_subtype_t
49 VLC_ML_MEDIA_SUBTYPE_UNKNOWN
,
50 VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE
,
51 VLC_ML_MEDIA_SUBTYPE_MOVIE
,
52 VLC_ML_MEDIA_SUBTYPE_ALBUMTRACK
,
53 } vlc_ml_media_subtype_t
;
55 typedef enum vlc_ml_file_type_t
57 VLC_ML_FILE_TYPE_UNKNOWN
,
58 VLC_ML_FILE_TYPE_MAIN
,
59 VLC_ML_FILE_TYPE_PART
,
60 VLC_ML_FILE_TYPE_SOUNDTRACK
,
61 VLC_ML_FILE_TYPE_SUBTITLE
,
62 VLC_ML_FILE_TYPE_PLAYLIST
,
65 typedef enum vlc_ml_track_type_t
67 VLC_ML_TRACK_TYPE_UNKNOWN
,
68 VLC_ML_TRACK_TYPE_VIDEO
,
69 VLC_ML_TRACK_TYPE_AUDIO
,
70 } vlc_ml_track_type_t
;
72 typedef struct vlc_ml_movie_t
78 typedef struct vlc_ml_show_episode_t
82 uint32_t i_episode_nb
;
83 uint32_t i_season_number
;
84 } vlc_ml_show_episode_t
;
86 typedef struct vlc_ml_show_t
91 char* psz_artwork_mrl
;
93 unsigned int i_release_year
;
94 uint32_t i_nb_episodes
;
95 uint32_t i_nb_seasons
;
98 typedef struct vlc_ml_album_track_t
106 } vlc_ml_album_track_t
;
108 typedef struct vlc_ml_label_t
114 typedef struct vlc_ml_label_list_t
117 vlc_ml_label_t p_items
[];
118 } vlc_ml_label_list_t
;
120 typedef struct vlc_ml_file_t
123 vlc_ml_file_type_t i_type
;
127 typedef struct vlc_ml_file_list_t
130 vlc_ml_file_t p_items
[];
131 } vlc_ml_file_list_t
;
133 typedef struct vlc_ml_media_track_t
137 char* psz_description
;
138 vlc_ml_track_type_t i_type
;
145 uint32_t i_nbChannels
;
146 uint32_t i_sampleRate
;
159 } vlc_ml_media_track_t
;
161 typedef struct vlc_ml_media_track_list_t
164 vlc_ml_media_track_t p_items
[];
165 } vlc_ml_media_track_list_t
;
167 typedef struct vlc_ml_media_t
171 vlc_ml_media_type_t i_type
;
172 vlc_ml_media_subtype_t i_subtype
;
174 vlc_ml_file_list_t
* p_files
;
175 vlc_ml_media_track_list_t
* p_tracks
;
178 /* Duration in milliseconds */
180 uint32_t i_playcount
;
181 time_t i_last_played_date
;
184 char* psz_artwork_mrl
;
189 vlc_ml_show_episode_t show_episode
;
190 vlc_ml_movie_t movie
;
191 vlc_ml_album_track_t album_track
;
195 typedef struct vlc_ml_playlist_t
199 uint32_t i_creation_date
;
200 char* psz_artwork_mrl
;
203 typedef struct vlc_ml_artist_t
208 char* psz_artwork_mrl
;
211 unsigned int i_nb_album
;
212 unsigned int i_nb_tracks
;
215 typedef struct vlc_ml_artist_list_t
218 vlc_ml_artist_t p_items
[];
219 } vlc_ml_artist_list_t
;
221 typedef struct vlc_ml_album_t
{
225 char* psz_artwork_mrl
;
230 unsigned int i_duration
;
234 typedef struct vlc_ml_genre_t
241 typedef struct vlc_ml_media_list_t
244 vlc_ml_media_t p_items
[];
245 } vlc_ml_media_list_t
;
247 typedef struct vlc_ml_album_list_t
250 vlc_ml_album_t p_items
[];
251 } vlc_ml_album_list_t
;
253 typedef struct vlc_ml_show_list_t
256 vlc_ml_show_t p_items
[];
257 } vlc_ml_show_list_t
;
259 typedef struct vlc_ml_genre_list_t
262 vlc_ml_genre_t p_items
[];
263 } vlc_ml_genre_list_t
;
265 typedef struct vlc_ml_playlist_list_t
268 vlc_ml_playlist_t p_items
[];
269 } vlc_ml_playlist_list_t
;
271 typedef struct vlc_ml_entrypoint_t vlc_ml_entrypoint_t
;
272 struct vlc_ml_entrypoint_t
274 char* psz_mrl
; /**< This entrypoint's MRL. Will be NULL if b_present is false */
275 bool b_present
; /**< The presence state for this entrypoint. */
276 bool b_banned
; /**< Will be true if the user required this entrypoint to be excluded */
279 /* Opaque medialibrary pointer, to be used by any non-medialibrary module */
280 typedef struct vlc_medialibrary_t vlc_medialibrary_t
;
281 /* "Private" medialibrary pointer, to be used by the core & medialibrary modules */
282 typedef struct vlc_medialibrary_module_t vlc_medialibrary_module_t
;
283 /* Opaque event callback type */
284 typedef struct vlc_ml_event_callback_t vlc_ml_event_callback_t
;
286 typedef enum vlc_ml_sorting_criteria_t
289 * Default depends on the entity type:
290 * - By track number (and disc number) for album tracks
291 * - Alphabetical order for others
293 VLC_ML_SORTING_DEFAULT
,
294 VLC_ML_SORTING_ALPHA
,
295 VLC_ML_SORTING_DURATION
,
296 VLC_ML_SORTING_INSERTIONDATE
,
297 VLC_ML_SORTING_LASTMODIFICATIONDATE
,
298 VLC_ML_SORTING_RELEASEDATE
,
299 VLC_ML_SORTING_FILESIZE
,
300 VLC_ML_SORTING_ARTIST
,
301 VLC_ML_SORTING_PLAYCOUNT
,
302 VLC_ML_SORTING_ALBUM
,
303 VLC_ML_SORTING_FILENAME
,
304 VLC_ML_SORTING_TRACKNUMBER
,
305 } vlc_ml_sorting_criteria_t
;
307 typedef struct vlc_ml_query_params_t vlc_ml_query_params_t
;
308 struct vlc_ml_query_params_t
310 const char* psz_pattern
;
311 uint32_t i_nbResults
;
313 vlc_ml_sorting_criteria_t i_sort
;
317 enum vlc_ml_get_queries
319 VLC_ML_GET_MEDIA
, /**< arg1: Media ID; ret: vlc_ml_media_t* */
320 VLC_ML_GET_ALBUM
, /**< arg1: Album ID; ret: vlc_ml_album_t* */
321 VLC_ML_GET_ARTIST
, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
322 VLC_ML_GET_GENRE
, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
323 VLC_ML_GET_SHOW
, /**< arg1: Show ID; ret: vlc_ml_show_t* */
324 VLC_ML_GET_PLAYLIST
, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
327 enum vlc_ml_list_queries
329 /* General listing: */
331 VLC_ML_LIST_VIDEOS
, /**< arg1 (out): vlc_ml_media_list_t** */
332 VLC_ML_COUNT_VIDEOS
, /**< arg1 (out): size_t* */
333 VLC_ML_LIST_AUDIOS
, /**< arg1 (out): vlc_ml_media_list_t** */
334 VLC_ML_COUNT_AUDIOS
, /**< arg1 (out): size_t* */
335 VLC_ML_LIST_ALBUMS
, /**< arg1 (out): vlc_ml_album_list_t** */
336 VLC_ML_COUNT_ALBUMS
, /**< arg1 (out): size_t* */
337 VLC_ML_LIST_GENRES
, /**< arg1 (out): vlc_ml_genre_list_t** */
338 VLC_ML_COUNT_GENRES
, /**< arg1 (out): size_t* */
339 VLC_ML_LIST_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
340 VLC_ML_COUNT_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): size_t* */
341 VLC_ML_LIST_SHOWS
, /**< arg1 (out): vlc_ml_show_list_t** */
342 VLC_ML_COUNT_SHOWS
, /**< arg1 (out): size_t* */
343 VLC_ML_LIST_PLAYLISTS
, /**< arg1 (out): vlc_ml_playlist_list_t** */
344 VLC_ML_COUNT_PLAYLISTS
, /**< arg1 (out): size_t* */
345 VLC_ML_LIST_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
346 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
348 /* Album specific listings */
349 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
350 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
351 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
352 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
354 /* Artist specific listings */
355 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
356 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
357 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
358 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
360 /* Genre specific listings */
361 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
362 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
363 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
364 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
365 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
366 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
368 /* Show specific listings */
369 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
370 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
372 /* Media specific listings */
373 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
374 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
376 /* Playlist specific listings */
377 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
378 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
380 /* Children entities listing */
381 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t* */
382 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
383 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t* */
384 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
385 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t* */
386 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
389 enum vlc_ml_parent_type
391 VLC_ML_PARENT_ALBUM
= 1,
392 VLC_ML_PARENT_ARTIST
,
395 VLC_ML_PARENT_PLAYLIST
,
400 /* Adds a folder to discover through the medialibrary */
401 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
402 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
403 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
404 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
405 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entrypoint_t**); arg2: nb results(size_t*), res: can fail */
407 * Reload a specific folder, or all.
408 * arg1: mrl (const char*), NULL to reload all folders
411 VLC_ML_RELOAD_FOLDER
,
413 /* Pause/resume background operations, such as media discovery & media analysis */
414 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
415 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
417 /* Misc operations */
418 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
421 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
422 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
424 /* Media management */
425 VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, /**< arg1: media id; can fail */
426 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: char**; */
427 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: const char*; */
428 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; */
429 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
433 * User playback settings.
434 * All values/units are up to the caller and are not interpreted by the media
436 * All values are stored and returned as strings.
437 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_PREF,
438 * the value will be returned stored in the provided char**. If the preference was
439 * not set yet, NULL will be returned.
440 * When setting a preference, NULL can be provided as a value to unset it.
442 enum vlc_ml_playback_pref
444 VLC_ML_PLAYBACK_PREF_RATING
,
445 VLC_ML_PLAYBACK_PREF_PROGRESS
,
446 VLC_ML_PLAYBACK_PREF_SPEED
,
447 VLC_ML_PLAYBACK_PREF_TITLE
,
448 VLC_ML_PLAYBACK_PREF_CHAPTER
,
449 VLC_ML_PLAYBACK_PREF_PROGRAM
,
450 VLC_ML_PLAYBACK_PREF_SEEN
,
451 VLC_ML_PLAYBACK_PREF_VIDEO_TRACK
,
452 VLC_ML_PLAYBACK_PREF_ASPECT_RATIO
,
453 VLC_ML_PLAYBACK_PREF_ZOOM
,
454 VLC_ML_PLAYBACK_PREF_CROP
,
455 VLC_ML_PLAYBACK_PREF_DEINTERLACE
,
456 VLC_ML_PLAYBACK_PREF_VIDEO_FILTER
,
457 VLC_ML_PLAYBACK_PREF_AUDIO_TRACK
,
458 VLC_ML_PLAYBACK_PREF_GAIN
,
459 VLC_ML_PLAYBACK_PREF_AUDIO_DELAY
,
460 VLC_ML_PLAYBACK_PREF_SUBTITLE_TRACK
,
461 VLC_ML_PLAYBACK_PREF_SUBTITLE_DELAY
,
462 VLC_ML_PLAYBACK_PREF_APP_SPECIFIC
,
465 enum vlc_ml_event_type
468 * Entity modification callbacks. The affected entity will be passed:
469 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
470 * entity, in vlc_ml_event_t::modification::p_<type>
471 * for ADDED and UPDATED variants.
472 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
473 * When _DELETED callbacks get invoked, the entity will already have been
474 * deleted from the database, and cannot be retrieved anymore
476 VLC_ML_EVENT_MEDIA_ADDED
,
477 VLC_ML_EVENT_MEDIA_UPDATED
,
478 VLC_ML_EVENT_MEDIA_DELETED
,
479 VLC_ML_EVENT_ARTIST_ADDED
,
480 VLC_ML_EVENT_ARTIST_UPDATED
,
481 VLC_ML_EVENT_ARTIST_DELETED
,
482 VLC_ML_EVENT_ALBUM_ADDED
,
483 VLC_ML_EVENT_ALBUM_UPDATED
,
484 VLC_ML_EVENT_ALBUM_DELETED
,
485 VLC_ML_EVENT_PLAYLIST_ADDED
,
486 VLC_ML_EVENT_PLAYLIST_UPDATED
,
487 VLC_ML_EVENT_PLAYLIST_DELETED
,
488 VLC_ML_EVENT_GENRE_ADDED
,
489 VLC_ML_EVENT_GENRE_UPDATED
,
490 VLC_ML_EVENT_GENRE_DELETED
,
492 * A discovery started.
493 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
494 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
495 * VLC_ML_EVENT_DISCOVERY_COMPLETED events.
496 * The entry point being discovered is stored in
497 * vlc_ml_event_t::discovery_started::psz_entry_point.
499 VLC_ML_EVENT_DISCOVERY_STARTED
,
501 * Sent when a discovery or reload operation starts analyzing a new folder.
502 * The discovered entry point is stored in
503 * vlc_ml_event_t::discovery_progress::psz_entry_point.
505 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
507 * Sent when an entry point discovery is completed.
508 * The entry point that was being discovered is stored in
509 * vlc_ml_event_t::discovery_completed::psz_entry_point.
510 * The success or failure state is stored in
511 * vlc_ml_event_t::discovery_completed::b_success
513 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
515 * An entry point reload operation started.
516 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
517 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
518 * The entry point being reloaded is stored in
519 * vlc_ml_event_t::reload_started::psz_entry_point.
521 VLC_ML_EVENT_RELOAD_STARTED
,
523 * Sent when an entry point reload is completed.
524 * The entry point that was being reloaded is stored in
525 * vlc_ml_event_t::reload_completed::psz_entry_point.
526 * The success or failure state is stored in
527 * vlc_ml_event_t::reload_completed::b_success
529 VLC_ML_EVENT_RELOAD_COMPLETED
,
531 * Sent when an entry point removal request has been processed.
532 * The removed entry point is stored in
533 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
534 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
536 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
538 * Sent when an entry point ban request has been processed.
539 * The banned entry point is stored in
540 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
541 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
543 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
545 * Sent when an entry point unban request has been processed.
546 * The unbanned entry point is stored in
547 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
548 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
550 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
552 * Sent when a discoverer or parser threads changes its idle state.
553 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
554 * False means at least one background thread is in running, true means
555 * both discoverer & parser threads are paused.
557 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
559 * Sent when the parsing progress percentage gets updated.
560 * The percentage is stored as a [0;100] integer, in
561 * vlc_ml_event_t::parsing_progress::i_percent
562 * This value might decrease as more media get discovered, but it will only
563 * increase once all discovery operations are completed.
565 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
568 typedef struct vlc_ml_event_t
575 const char* psz_entry_point
;
579 const char* psz_entry_point
;
580 } discovery_progress
;
583 const char* psz_entry_point
;
585 } discovery_completed
;
588 const char* psz_entry_point
;
592 const char* psz_entry_point
;
597 const char* psz_entry_point
;
599 } entry_point_removed
;
602 const char* psz_entry_point
;
604 } entry_point_banned
;
607 const char* psz_entry_point
;
609 } entry_point_unbanned
;
616 const vlc_ml_media_t
* p_media
;
617 const vlc_ml_artist_t
* p_artist
;
618 const vlc_ml_album_t
* p_album
;
619 const vlc_ml_playlist_t
* p_playlist
;
620 const vlc_ml_genre_t
* p_genre
;
629 } background_idle_changed
;
633 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
635 typedef struct vlc_medialibrary_callbacks_t
637 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
638 } vlc_medialibrary_callbacks_t
;
640 struct vlc_medialibrary_module_t
642 struct vlc_common_members obj
;
648 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
650 * List some entities from the medialibrary.
652 * \param p_ml The medialibrary module instance.
653 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
654 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
655 * the default parameters (alphabetical ascending sort, no pagination)
657 * \return VLC_SUCCESS or an error code
659 * Refer to the individual list of vlc_ml_list requests for the additional
660 * per-query input/ouput parameters values & types
662 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
663 const vlc_ml_query_params_t
* p_params
, va_list args
);
666 * Get a specific entity by its id.
668 * \return The required entity, or a NULL pointer if couldn't be found.
670 * Refer to the list of queries for the specific return type
672 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, int64_t i_id
);
674 const vlc_medialibrary_callbacks_t
* cbs
;
677 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
678 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
680 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
681 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
683 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, int64_t i_id
) VLC_USED
;
684 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
685 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
686 const vlc_ml_query_params_t
* p_params
, ... );
689 * \brief Registers a medialibrary callback.
690 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
692 VLC_API vlc_ml_event_callback_t
*
693 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
696 * \brief Unregisters a medialibrary callback
697 * \param p_handle The handled returned by vlc_ml_register_callback
699 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
700 vlc_ml_event_callback_t
* p_callback
);
703 VLC_API
void vlc_ml_entrypoints_release( vlc_ml_entrypoint_t
* p_list
, size_t i_nb_items
);
705 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
706 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
707 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
708 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
709 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
710 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
712 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
713 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
714 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
715 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
716 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
717 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
718 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
719 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
721 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
723 return (vlc_ml_query_params_t
) {
727 .i_sort
= VLC_ML_SORTING_DEFAULT
,
732 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
734 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
737 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
739 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
742 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
744 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
747 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
749 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
752 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
753 vlc_ml_entrypoint_t
** pp_entrypoints
, size_t* p_nb_items
)
755 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
, p_nb_items
);
758 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
760 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
763 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
765 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
768 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
770 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
773 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
775 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
778 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
781 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
786 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
789 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
794 static inline int vlc_ml_media_increase_playcount( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
796 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, i_media_id
);
799 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
)
801 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, ppsz_result
);
804 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
)
806 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, psz_value
);
809 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, const char* psz_mrl
)
811 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
);
814 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
815 const char* psz_mrl
, int i_type
)
817 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
820 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
822 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
825 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
827 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
830 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
832 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
835 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
837 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
840 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
842 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
845 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
847 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
850 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
)
852 vlc_assert( p_ml
!= NULL
);
853 vlc_ml_media_list_t
* res
;
854 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
859 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
)
861 vlc_assert( p_ml
!= NULL
);
863 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
868 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
)
870 vlc_assert( p_ml
!= NULL
);
871 vlc_ml_artist_list_t
* res
;
872 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
877 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
)
879 vlc_assert( p_ml
!= NULL
);
881 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
886 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
)
888 vlc_assert( p_ml
!= NULL
);
889 vlc_ml_album_list_t
* res
;
890 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
895 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
)
897 vlc_assert( p_ml
!= NULL
);
899 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
904 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
)
906 vlc_assert( p_ml
!= NULL
);
907 vlc_ml_media_list_t
* res
;
908 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
913 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
)
915 vlc_assert( p_ml
!= NULL
);
917 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
922 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
)
924 vlc_assert( p_ml
!= NULL
);
925 vlc_ml_media_list_t
* res
;
926 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
931 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
)
933 vlc_assert( p_ml
!= NULL
);
935 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
940 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
)
942 vlc_assert( p_ml
!= NULL
);
943 vlc_ml_album_list_t
* res
;
944 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
949 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
)
951 vlc_assert( p_ml
!= NULL
);
953 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
958 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
)
960 vlc_assert( p_ml
!= NULL
);
961 vlc_ml_media_list_t
* res
;
962 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
967 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
)
969 vlc_assert( p_ml
!= NULL
);
971 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
976 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
978 vlc_assert( p_ml
!= NULL
);
979 vlc_ml_media_list_t
* res
;
980 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
985 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
987 vlc_assert( p_ml
!= NULL
);
989 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
994 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
996 vlc_assert( p_ml
!= NULL
);
997 vlc_ml_media_list_t
* res
;
998 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1003 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1005 vlc_assert( p_ml
!= NULL
);
1007 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1012 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1014 vlc_assert( p_ml
!= NULL
);
1015 vlc_ml_album_list_t
* res
;
1016 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1021 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1023 vlc_assert( p_ml
!= NULL
);
1025 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1030 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1032 vlc_assert( p_ml
!= NULL
);
1033 vlc_ml_genre_list_t
* res
;
1034 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1039 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1041 vlc_assert( p_ml
!= NULL
);
1043 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1049 * @brief vlc_ml_list_artists
1050 * @param params Query parameters, or NULL for the default
1051 * @param b_include_all True if you wish to fetch artists without at least one album.
1054 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
)
1056 vlc_assert( p_ml
!= NULL
);
1057 vlc_ml_artist_list_t
* res
;
1058 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1063 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1065 vlc_assert( p_ml
!= NULL
);
1067 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1072 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1074 vlc_assert( p_ml
!= NULL
);
1075 vlc_ml_show_list_t
* res
;
1076 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1081 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1083 vlc_assert( p_ml
!= NULL
);
1085 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1090 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
)
1092 vlc_assert( p_ml
!= NULL
);
1093 vlc_ml_media_list_t
* res
;
1094 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1099 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
)
1101 vlc_assert( p_ml
!= NULL
);
1103 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1108 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
)
1110 vlc_assert( p_ml
!= NULL
);
1111 vlc_ml_media_list_t
* res
;
1112 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1117 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
)
1119 vlc_assert( p_ml
!= NULL
);
1121 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1126 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
)
1128 vlc_assert( p_ml
!= NULL
);
1129 vlc_ml_album_list_t
* res
;
1130 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1135 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
)
1137 vlc_assert( p_ml
!= NULL
);
1139 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1144 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
)
1146 vlc_assert( p_ml
!= NULL
);
1147 vlc_ml_media_list_t
* res
;
1148 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1153 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
)
1155 vlc_assert( p_ml
!= NULL
);
1157 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1162 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
)
1164 vlc_assert( p_ml
!= NULL
);
1165 vlc_ml_label_list_t
* res
;
1166 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1171 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
)
1173 vlc_assert( p_ml
!= NULL
);
1175 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1180 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1182 vlc_assert( p_ml
!= NULL
);
1183 vlc_ml_media_list_t
* res
;
1184 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1189 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1191 vlc_assert( p_ml
!= NULL
);
1192 vlc_ml_media_list_t
* res
;
1193 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1198 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1200 vlc_assert( p_ml
!= NULL
);
1201 vlc_ml_playlist_list_t
* res
;
1202 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1207 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1209 vlc_assert( p_ml
!= NULL
);
1211 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1221 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1222 vlc_ml_show_t*: vlc_ml_show_release, \
1223 vlc_ml_artist_t*: vlc_ml_artist_release, \
1224 vlc_ml_album_t*: vlc_ml_album_release, \
1225 vlc_ml_genre_t*: vlc_ml_genre_release, \
1226 vlc_ml_media_t*: vlc_ml_media_release, \
1227 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1228 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1229 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1230 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1231 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1232 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1233 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1234 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1235 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release \
1238 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1239 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1240 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1241 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1242 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1243 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1244 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1245 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1246 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1247 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1248 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1249 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1250 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1251 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1254 #endif /* VLC_MEDIA_LIBRARY_H */