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_entry_point_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 */
276 } vlc_ml_entry_point_t
;
278 typedef struct vlc_ml_entry_point_list_t
281 vlc_ml_entry_point_t p_items
[];
282 } vlc_ml_entry_point_list_t
;
284 /* Opaque medialibrary pointer, to be used by any non-medialibrary module */
285 typedef struct vlc_medialibrary_t vlc_medialibrary_t
;
286 /* "Private" medialibrary pointer, to be used by the core & medialibrary modules */
287 typedef struct vlc_medialibrary_module_t vlc_medialibrary_module_t
;
288 /* Opaque event callback type */
289 typedef struct vlc_ml_event_callback_t vlc_ml_event_callback_t
;
291 typedef enum vlc_ml_sorting_criteria_t
294 * Default depends on the entity type:
295 * - By track number (and disc number) for album tracks
296 * - Alphabetical order for others
298 VLC_ML_SORTING_DEFAULT
,
299 VLC_ML_SORTING_ALPHA
,
300 VLC_ML_SORTING_DURATION
,
301 VLC_ML_SORTING_INSERTIONDATE
,
302 VLC_ML_SORTING_LASTMODIFICATIONDATE
,
303 VLC_ML_SORTING_RELEASEDATE
,
304 VLC_ML_SORTING_FILESIZE
,
305 VLC_ML_SORTING_ARTIST
,
306 VLC_ML_SORTING_PLAYCOUNT
,
307 VLC_ML_SORTING_ALBUM
,
308 VLC_ML_SORTING_FILENAME
,
309 VLC_ML_SORTING_TRACKNUMBER
,
310 } vlc_ml_sorting_criteria_t
;
312 typedef struct vlc_ml_query_params_t vlc_ml_query_params_t
;
313 struct vlc_ml_query_params_t
315 const char* psz_pattern
;
316 uint32_t i_nbResults
;
318 vlc_ml_sorting_criteria_t i_sort
;
322 enum vlc_ml_get_queries
324 VLC_ML_GET_MEDIA
, /**< arg1: Media ID; ret: vlc_ml_media_t* */
325 VLC_ML_GET_ALBUM
, /**< arg1: Album ID; ret: vlc_ml_album_t* */
326 VLC_ML_GET_ARTIST
, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
327 VLC_ML_GET_GENRE
, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
328 VLC_ML_GET_SHOW
, /**< arg1: Show ID; ret: vlc_ml_show_t* */
329 VLC_ML_GET_PLAYLIST
, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
332 enum vlc_ml_list_queries
334 /* General listing: */
336 VLC_ML_LIST_VIDEOS
, /**< arg1 (out): vlc_ml_media_list_t** */
337 VLC_ML_COUNT_VIDEOS
, /**< arg1 (out): size_t* */
338 VLC_ML_LIST_AUDIOS
, /**< arg1 (out): vlc_ml_media_list_t** */
339 VLC_ML_COUNT_AUDIOS
, /**< arg1 (out): size_t* */
340 VLC_ML_LIST_ALBUMS
, /**< arg1 (out): vlc_ml_album_list_t** */
341 VLC_ML_COUNT_ALBUMS
, /**< arg1 (out): size_t* */
342 VLC_ML_LIST_GENRES
, /**< arg1 (out): vlc_ml_genre_list_t** */
343 VLC_ML_COUNT_GENRES
, /**< arg1 (out): size_t* */
344 VLC_ML_LIST_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
345 VLC_ML_COUNT_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): size_t* */
346 VLC_ML_LIST_SHOWS
, /**< arg1 (out): vlc_ml_show_list_t** */
347 VLC_ML_COUNT_SHOWS
, /**< arg1 (out): size_t* */
348 VLC_ML_LIST_PLAYLISTS
, /**< arg1 (out): vlc_ml_playlist_list_t** */
349 VLC_ML_COUNT_PLAYLISTS
, /**< arg1 (out): size_t* */
350 VLC_ML_LIST_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
351 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
353 /* Album specific listings */
354 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
355 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
356 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
357 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
359 /* Artist specific listings */
360 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
361 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
362 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
363 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
365 /* Genre specific listings */
366 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
367 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
368 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
369 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
370 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
371 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
373 /* Show specific listings */
374 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
375 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
377 /* Media specific listings */
378 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
379 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
381 /* Playlist specific listings */
382 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
383 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
385 /* Children entities listing */
386 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
387 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
388 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
389 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
390 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
391 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
394 enum vlc_ml_parent_type
396 VLC_ML_PARENT_ALBUM
= 1,
397 VLC_ML_PARENT_ARTIST
,
400 VLC_ML_PARENT_PLAYLIST
,
405 /* Adds a folder to discover through the medialibrary */
406 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
407 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
408 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
409 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
410 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
412 * Reload a specific folder, or all.
413 * arg1: mrl (const char*), NULL to reload all folders
416 VLC_ML_RELOAD_FOLDER
,
418 /* Pause/resume background operations, such as media discovery & media analysis */
419 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
420 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
422 /* Misc operations */
423 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
426 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
427 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
429 /* Media management */
430 VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, /**< arg1: media id; can fail */
431 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: char**; */
432 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: const char*; */
433 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; */
434 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
438 * User playback settings.
439 * All values/units are up to the caller and are not interpreted by the media
441 * All values are stored and returned as strings.
442 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_PREF,
443 * the value will be returned stored in the provided char**. If the preference was
444 * not set yet, NULL will be returned.
445 * When setting a preference, NULL can be provided as a value to unset it.
447 enum vlc_ml_playback_pref
449 VLC_ML_PLAYBACK_PREF_RATING
,
450 VLC_ML_PLAYBACK_PREF_PROGRESS
,
451 VLC_ML_PLAYBACK_PREF_SPEED
,
452 VLC_ML_PLAYBACK_PREF_TITLE
,
453 VLC_ML_PLAYBACK_PREF_CHAPTER
,
454 VLC_ML_PLAYBACK_PREF_PROGRAM
,
455 VLC_ML_PLAYBACK_PREF_SEEN
,
456 VLC_ML_PLAYBACK_PREF_VIDEO_TRACK
,
457 VLC_ML_PLAYBACK_PREF_ASPECT_RATIO
,
458 VLC_ML_PLAYBACK_PREF_ZOOM
,
459 VLC_ML_PLAYBACK_PREF_CROP
,
460 VLC_ML_PLAYBACK_PREF_DEINTERLACE
,
461 VLC_ML_PLAYBACK_PREF_VIDEO_FILTER
,
462 VLC_ML_PLAYBACK_PREF_AUDIO_TRACK
,
463 VLC_ML_PLAYBACK_PREF_GAIN
,
464 VLC_ML_PLAYBACK_PREF_AUDIO_DELAY
,
465 VLC_ML_PLAYBACK_PREF_SUBTITLE_TRACK
,
466 VLC_ML_PLAYBACK_PREF_SUBTITLE_DELAY
,
467 VLC_ML_PLAYBACK_PREF_APP_SPECIFIC
,
470 enum vlc_ml_event_type
473 * Entity modification callbacks. The affected entity will be passed:
474 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
475 * entity, in vlc_ml_event_t::modification::p_<type>
476 * for ADDED and UPDATED variants.
477 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
478 * When _DELETED callbacks get invoked, the entity will already have been
479 * deleted from the database, and cannot be retrieved anymore
481 VLC_ML_EVENT_MEDIA_ADDED
,
482 VLC_ML_EVENT_MEDIA_UPDATED
,
483 VLC_ML_EVENT_MEDIA_DELETED
,
484 VLC_ML_EVENT_ARTIST_ADDED
,
485 VLC_ML_EVENT_ARTIST_UPDATED
,
486 VLC_ML_EVENT_ARTIST_DELETED
,
487 VLC_ML_EVENT_ALBUM_ADDED
,
488 VLC_ML_EVENT_ALBUM_UPDATED
,
489 VLC_ML_EVENT_ALBUM_DELETED
,
490 VLC_ML_EVENT_PLAYLIST_ADDED
,
491 VLC_ML_EVENT_PLAYLIST_UPDATED
,
492 VLC_ML_EVENT_PLAYLIST_DELETED
,
493 VLC_ML_EVENT_GENRE_ADDED
,
494 VLC_ML_EVENT_GENRE_UPDATED
,
495 VLC_ML_EVENT_GENRE_DELETED
,
497 * A discovery started.
498 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
499 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
500 * VLC_ML_EVENT_DISCOVERY_COMPLETED events.
501 * The entry point being discovered is stored in
502 * vlc_ml_event_t::discovery_started::psz_entry_point.
504 VLC_ML_EVENT_DISCOVERY_STARTED
,
506 * Sent when a discovery or reload operation starts analyzing a new folder.
507 * The discovered entry point is stored in
508 * vlc_ml_event_t::discovery_progress::psz_entry_point.
510 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
512 * Sent when an entry point discovery is completed.
513 * The entry point that was being discovered is stored in
514 * vlc_ml_event_t::discovery_completed::psz_entry_point.
515 * The success or failure state is stored in
516 * vlc_ml_event_t::discovery_completed::b_success
518 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
520 * An entry point reload operation started.
521 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
522 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
523 * The entry point being reloaded is stored in
524 * vlc_ml_event_t::reload_started::psz_entry_point.
526 VLC_ML_EVENT_RELOAD_STARTED
,
528 * Sent when an entry point reload is completed.
529 * The entry point that was being reloaded is stored in
530 * vlc_ml_event_t::reload_completed::psz_entry_point.
531 * The success or failure state is stored in
532 * vlc_ml_event_t::reload_completed::b_success
534 VLC_ML_EVENT_RELOAD_COMPLETED
,
536 * Sent when an entry point removal request has been processed.
537 * The removed entry point is stored in
538 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
539 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
541 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
543 * Sent when an entry point ban request has been processed.
544 * The banned entry point is stored in
545 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
546 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
548 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
550 * Sent when an entry point unban request has been processed.
551 * The unbanned entry point is stored in
552 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
553 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
555 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
557 * Sent when a discoverer or parser threads changes its idle state.
558 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
559 * False means at least one background thread is in running, true means
560 * both discoverer & parser threads are paused.
562 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
564 * Sent when the parsing progress percentage gets updated.
565 * The percentage is stored as a [0;100] integer, in
566 * vlc_ml_event_t::parsing_progress::i_percent
567 * This value might decrease as more media get discovered, but it will only
568 * increase once all discovery operations are completed.
570 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
573 typedef struct vlc_ml_event_t
580 const char* psz_entry_point
;
584 const char* psz_entry_point
;
585 } discovery_progress
;
588 const char* psz_entry_point
;
590 } discovery_completed
;
593 const char* psz_entry_point
;
597 const char* psz_entry_point
;
602 const char* psz_entry_point
;
604 } entry_point_removed
;
607 const char* psz_entry_point
;
609 } entry_point_banned
;
612 const char* psz_entry_point
;
614 } entry_point_unbanned
;
621 const vlc_ml_media_t
* p_media
;
622 const vlc_ml_artist_t
* p_artist
;
623 const vlc_ml_album_t
* p_album
;
624 const vlc_ml_playlist_t
* p_playlist
;
625 const vlc_ml_genre_t
* p_genre
;
634 } background_idle_changed
;
638 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
640 typedef struct vlc_medialibrary_callbacks_t
642 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
643 } vlc_medialibrary_callbacks_t
;
645 struct vlc_medialibrary_module_t
647 struct vlc_common_members obj
;
653 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
655 * List some entities from the medialibrary.
657 * \param p_ml The medialibrary module instance.
658 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
659 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
660 * the default parameters (alphabetical ascending sort, no pagination)
662 * \return VLC_SUCCESS or an error code
664 * Refer to the individual list of vlc_ml_list requests for the additional
665 * per-query input/ouput parameters values & types
667 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
668 const vlc_ml_query_params_t
* p_params
, va_list args
);
671 * Get a specific entity by its id.
673 * \return The required entity, or a NULL pointer if couldn't be found.
675 * Refer to the list of queries for the specific return type
677 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, int64_t i_id
);
679 const vlc_medialibrary_callbacks_t
* cbs
;
682 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
683 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
685 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
686 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
688 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, int64_t i_id
) VLC_USED
;
689 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
690 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
691 const vlc_ml_query_params_t
* p_params
, ... );
694 * \brief Registers a medialibrary callback.
695 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
697 VLC_API vlc_ml_event_callback_t
*
698 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
701 * \brief Unregisters a medialibrary callback
702 * \param p_handle The handled returned by vlc_ml_register_callback
704 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
705 vlc_ml_event_callback_t
* p_callback
);
708 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
709 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
710 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
711 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
712 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
713 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
715 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
716 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
717 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
718 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
719 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
720 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
721 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
722 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
723 VLC_API
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t
* p_list
);
725 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
727 return (vlc_ml_query_params_t
) {
731 .i_sort
= VLC_ML_SORTING_DEFAULT
,
736 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
738 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
741 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
743 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
746 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
748 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
751 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
753 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
756 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
757 vlc_ml_entry_point_list_t
** pp_entrypoints
)
759 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
);
762 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
764 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
767 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
769 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
772 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
774 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
777 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
779 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
782 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
785 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
790 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
793 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
798 static inline int vlc_ml_media_increase_playcount( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
800 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, i_media_id
);
803 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
)
805 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, ppsz_result
);
808 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
)
810 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, psz_value
);
813 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, const char* psz_mrl
)
815 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
);
818 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
819 const char* psz_mrl
, int i_type
)
821 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
824 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
826 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
829 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
831 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
834 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
836 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
839 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
841 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
844 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
846 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
849 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
851 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
854 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
)
856 vlc_assert( p_ml
!= NULL
);
857 vlc_ml_media_list_t
* res
;
858 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
863 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
)
865 vlc_assert( p_ml
!= NULL
);
867 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
872 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
)
874 vlc_assert( p_ml
!= NULL
);
875 vlc_ml_artist_list_t
* res
;
876 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
881 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
)
883 vlc_assert( p_ml
!= NULL
);
885 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
890 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
)
892 vlc_assert( p_ml
!= NULL
);
893 vlc_ml_album_list_t
* res
;
894 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
899 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
)
901 vlc_assert( p_ml
!= NULL
);
903 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
908 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
)
910 vlc_assert( p_ml
!= NULL
);
911 vlc_ml_media_list_t
* res
;
912 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
917 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
)
919 vlc_assert( p_ml
!= NULL
);
921 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
926 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
)
928 vlc_assert( p_ml
!= NULL
);
929 vlc_ml_media_list_t
* res
;
930 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
935 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
)
937 vlc_assert( p_ml
!= NULL
);
939 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
944 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
)
946 vlc_assert( p_ml
!= NULL
);
947 vlc_ml_album_list_t
* res
;
948 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
953 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
)
955 vlc_assert( p_ml
!= NULL
);
957 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
962 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
)
964 vlc_assert( p_ml
!= NULL
);
965 vlc_ml_media_list_t
* res
;
966 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
971 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
)
973 vlc_assert( p_ml
!= NULL
);
975 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
980 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
982 vlc_assert( p_ml
!= NULL
);
983 vlc_ml_media_list_t
* res
;
984 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
989 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
991 vlc_assert( p_ml
!= NULL
);
993 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
998 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1000 vlc_assert( p_ml
!= NULL
);
1001 vlc_ml_media_list_t
* res
;
1002 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1007 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1009 vlc_assert( p_ml
!= NULL
);
1011 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1016 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1018 vlc_assert( p_ml
!= NULL
);
1019 vlc_ml_album_list_t
* res
;
1020 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1025 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1027 vlc_assert( p_ml
!= NULL
);
1029 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1034 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1036 vlc_assert( p_ml
!= NULL
);
1037 vlc_ml_genre_list_t
* res
;
1038 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1043 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1045 vlc_assert( p_ml
!= NULL
);
1047 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1053 * @brief vlc_ml_list_artists
1054 * @param params Query parameters, or NULL for the default
1055 * @param b_include_all True if you wish to fetch artists without at least one album.
1058 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
)
1060 vlc_assert( p_ml
!= NULL
);
1061 vlc_ml_artist_list_t
* res
;
1062 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1067 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1069 vlc_assert( p_ml
!= NULL
);
1071 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1076 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1078 vlc_assert( p_ml
!= NULL
);
1079 vlc_ml_show_list_t
* res
;
1080 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1085 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1087 vlc_assert( p_ml
!= NULL
);
1089 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1094 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
)
1096 vlc_assert( p_ml
!= NULL
);
1097 vlc_ml_media_list_t
* res
;
1098 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1103 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
)
1105 vlc_assert( p_ml
!= NULL
);
1107 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1112 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
)
1114 vlc_assert( p_ml
!= NULL
);
1115 vlc_ml_media_list_t
* res
;
1116 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1121 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
)
1123 vlc_assert( p_ml
!= NULL
);
1125 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1130 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
)
1132 vlc_assert( p_ml
!= NULL
);
1133 vlc_ml_album_list_t
* res
;
1134 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1139 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
)
1141 vlc_assert( p_ml
!= NULL
);
1143 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1148 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
)
1150 vlc_assert( p_ml
!= NULL
);
1151 vlc_ml_media_list_t
* res
;
1152 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1157 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
)
1159 vlc_assert( p_ml
!= NULL
);
1161 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1166 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
)
1168 vlc_assert( p_ml
!= NULL
);
1169 vlc_ml_label_list_t
* res
;
1170 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1175 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
)
1177 vlc_assert( p_ml
!= NULL
);
1179 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1184 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1186 vlc_assert( p_ml
!= NULL
);
1187 vlc_ml_media_list_t
* res
;
1188 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1193 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1195 vlc_assert( p_ml
!= NULL
);
1196 vlc_ml_media_list_t
* res
;
1197 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1202 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1204 vlc_assert( p_ml
!= NULL
);
1205 vlc_ml_playlist_list_t
* res
;
1206 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1211 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1213 vlc_assert( p_ml
!= NULL
);
1215 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1225 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1226 vlc_ml_show_t*: vlc_ml_show_release, \
1227 vlc_ml_artist_t*: vlc_ml_artist_release, \
1228 vlc_ml_album_t*: vlc_ml_album_release, \
1229 vlc_ml_genre_t*: vlc_ml_genre_release, \
1230 vlc_ml_media_t*: vlc_ml_media_release, \
1231 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1232 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1233 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1234 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1235 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1236 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1237 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1238 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1239 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
1240 vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release \
1243 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1244 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1245 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1246 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1247 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1248 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1249 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1250 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1251 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1252 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1253 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1254 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1255 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1256 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1257 static inline void vlc_ml_release( vlc_ml_entry_point_list_t
* list
) { vlc_ml_entry_point_list_release( list
); }
1260 #endif /* VLC_MEDIA_LIBRARY_H */