1 /*****************************************************************************
2 * vlc_media_library.h: SQL-based media library
3 *****************************************************************************
4 * Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
6 * Authors: Antoine Lejeune <phytos@videolan.org>
7 * Jean-Philippe André <jpeg@videolan.org>
8 * Rémi Duraffort <ivoire@videolan.org>
9 * Adrien Maglo <magsoft@videolan.org>
10 * Srikanth Raju <srikiraju at gmail dot com>
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation; either version 2.1 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this program; if not, write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
27 #ifndef VLC_MEDIA_LIBRARY_H
28 # define VLC_MEDIA_LIBRARY_H
31 #include <vlc_common.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
;
128 typedef struct vlc_ml_file_list_t
131 vlc_ml_file_t p_items
[];
132 } vlc_ml_file_list_t
;
134 typedef struct vlc_ml_media_track_t
138 char* psz_description
;
139 vlc_ml_track_type_t i_type
;
146 uint32_t i_nbChannels
;
147 uint32_t i_sampleRate
;
160 } vlc_ml_media_track_t
;
162 typedef struct vlc_ml_media_track_list_t
165 vlc_ml_media_track_t p_items
[];
166 } vlc_ml_media_track_list_t
;
168 typedef struct vlc_ml_media_t
172 vlc_ml_media_type_t i_type
;
173 vlc_ml_media_subtype_t i_subtype
;
175 vlc_ml_file_list_t
* p_files
;
176 vlc_ml_media_track_list_t
* p_tracks
;
179 /* Duration in milliseconds */
181 uint32_t i_playcount
;
182 time_t i_last_played_date
;
185 char* psz_artwork_mrl
;
186 /* True if a thumbnail is available, or if thumbnail generation was
187 * attempted but failed */
188 bool b_artwork_generated
;
193 vlc_ml_show_episode_t show_episode
;
194 vlc_ml_movie_t movie
;
195 vlc_ml_album_track_t album_track
;
199 typedef struct vlc_ml_playlist_t
203 uint32_t i_creation_date
;
204 char* psz_artwork_mrl
;
207 typedef struct vlc_ml_artist_t
212 char* psz_artwork_mrl
;
215 unsigned int i_nb_album
;
216 unsigned int i_nb_tracks
;
219 typedef struct vlc_ml_artist_list_t
222 vlc_ml_artist_t p_items
[];
223 } vlc_ml_artist_list_t
;
225 typedef struct vlc_ml_album_t
{
229 char* psz_artwork_mrl
;
234 unsigned int i_duration
;
238 typedef struct vlc_ml_genre_t
245 typedef struct vlc_ml_media_list_t
248 vlc_ml_media_t p_items
[];
249 } vlc_ml_media_list_t
;
251 typedef struct vlc_ml_album_list_t
254 vlc_ml_album_t p_items
[];
255 } vlc_ml_album_list_t
;
257 typedef struct vlc_ml_show_list_t
260 vlc_ml_show_t p_items
[];
261 } vlc_ml_show_list_t
;
263 typedef struct vlc_ml_genre_list_t
266 vlc_ml_genre_t p_items
[];
267 } vlc_ml_genre_list_t
;
269 typedef struct vlc_ml_playlist_list_t
272 vlc_ml_playlist_t p_items
[];
273 } vlc_ml_playlist_list_t
;
275 typedef struct vlc_ml_entry_point_t
277 char* psz_mrl
; /**< This entrypoint's MRL. Will be NULL if b_present is false */
278 bool b_present
; /**< The presence state for this entrypoint. */
279 bool b_banned
; /**< Will be true if the user required this entrypoint to be excluded */
280 } vlc_ml_entry_point_t
;
282 typedef struct vlc_ml_entry_point_list_t
285 vlc_ml_entry_point_t p_items
[];
286 } vlc_ml_entry_point_list_t
;
288 /* Opaque medialibrary pointer, to be used by any non-medialibrary module */
289 typedef struct vlc_medialibrary_t vlc_medialibrary_t
;
290 /* "Private" medialibrary pointer, to be used by the core & medialibrary modules */
291 typedef struct vlc_medialibrary_module_t vlc_medialibrary_module_t
;
292 /* Opaque event callback type */
293 typedef struct vlc_ml_event_callback_t vlc_ml_event_callback_t
;
295 typedef enum vlc_ml_sorting_criteria_t
298 * Default depends on the entity type:
299 * - By track number (and disc number) for album tracks
300 * - Alphabetical order for others
302 VLC_ML_SORTING_DEFAULT
,
303 VLC_ML_SORTING_ALPHA
,
304 VLC_ML_SORTING_DURATION
,
305 VLC_ML_SORTING_INSERTIONDATE
,
306 VLC_ML_SORTING_LASTMODIFICATIONDATE
,
307 VLC_ML_SORTING_RELEASEDATE
,
308 VLC_ML_SORTING_FILESIZE
,
309 VLC_ML_SORTING_ARTIST
,
310 VLC_ML_SORTING_PLAYCOUNT
,
311 VLC_ML_SORTING_ALBUM
,
312 VLC_ML_SORTING_FILENAME
,
313 VLC_ML_SORTING_TRACKNUMBER
,
314 } vlc_ml_sorting_criteria_t
;
316 typedef struct vlc_ml_query_params_t vlc_ml_query_params_t
;
317 struct vlc_ml_query_params_t
319 const char* psz_pattern
;
320 uint32_t i_nbResults
;
322 vlc_ml_sorting_criteria_t i_sort
;
326 enum vlc_ml_get_queries
328 VLC_ML_GET_MEDIA
, /**< arg1: Media ID; ret: vlc_ml_media_t* */
329 VLC_ML_GET_INPUT_ITEM
, /**< arg1: Media ID; ret: input_item_t* */
330 VLC_ML_GET_ALBUM
, /**< arg1: Album ID; ret: vlc_ml_album_t* */
331 VLC_ML_GET_ARTIST
, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
332 VLC_ML_GET_GENRE
, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
333 VLC_ML_GET_SHOW
, /**< arg1: Show ID; ret: vlc_ml_show_t* */
334 VLC_ML_GET_PLAYLIST
, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
337 enum vlc_ml_list_queries
339 /* General listing: */
341 VLC_ML_LIST_VIDEOS
, /**< arg1 (out): vlc_ml_media_list_t** */
342 VLC_ML_COUNT_VIDEOS
, /**< arg1 (out): size_t* */
343 VLC_ML_LIST_AUDIOS
, /**< arg1 (out): vlc_ml_media_list_t** */
344 VLC_ML_COUNT_AUDIOS
, /**< arg1 (out): size_t* */
345 VLC_ML_LIST_ALBUMS
, /**< arg1 (out): vlc_ml_album_list_t** */
346 VLC_ML_COUNT_ALBUMS
, /**< arg1 (out): size_t* */
347 VLC_ML_LIST_GENRES
, /**< arg1 (out): vlc_ml_genre_list_t** */
348 VLC_ML_COUNT_GENRES
, /**< arg1 (out): size_t* */
349 VLC_ML_LIST_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
350 VLC_ML_COUNT_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): size_t* */
351 VLC_ML_LIST_SHOWS
, /**< arg1 (out): vlc_ml_show_list_t** */
352 VLC_ML_COUNT_SHOWS
, /**< arg1 (out): size_t* */
353 VLC_ML_LIST_PLAYLISTS
, /**< arg1 (out): vlc_ml_playlist_list_t** */
354 VLC_ML_COUNT_PLAYLISTS
, /**< arg1 (out): size_t* */
355 VLC_ML_LIST_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
356 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
358 /* Album specific listings */
359 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
360 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
361 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
362 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
364 /* Artist specific listings */
365 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
366 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
367 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
368 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
370 /* Genre specific listings */
371 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
372 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
373 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
374 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
375 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
376 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
378 /* Show specific listings */
379 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
380 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
382 /* Media specific listings */
383 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
384 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
386 /* Playlist specific listings */
387 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
388 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
390 /* Children entities listing */
391 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
392 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
393 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
394 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
395 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
396 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
399 enum vlc_ml_parent_type
401 VLC_ML_PARENT_UNKNOWN
,
403 VLC_ML_PARENT_ARTIST
,
406 VLC_ML_PARENT_PLAYLIST
,
411 /* Adds a folder to discover through the medialibrary */
412 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
413 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
414 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
415 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
416 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
417 VLC_ML_IS_INDEXED
, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
419 * Reload a specific folder, or all.
420 * arg1: mrl (const char*), NULL to reload all folders
423 VLC_ML_RELOAD_FOLDER
,
425 /* Pause/resume background operations, such as media discovery & media analysis */
426 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
427 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
429 /* Misc operations */
430 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
433 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
434 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
436 /* Media management */
437 VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, /**< arg1: media id; can fail */
438 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: char**; */
439 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: const char*; */
440 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; */
441 VLC_ML_MEDIA_GENERATE_THUMBNAIL
, /**< arg1: media id; */
442 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
446 * User playback settings.
447 * All values/units are up to the caller and are not interpreted by the media
449 * All values are stored and returned as strings.
450 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_PREF,
451 * the value will be returned stored in the provided char**. If the preference was
452 * not set yet, NULL will be returned.
453 * When setting a preference, NULL can be provided as a value to unset it.
455 enum vlc_ml_playback_pref
457 VLC_ML_PLAYBACK_PREF_RATING
,
458 VLC_ML_PLAYBACK_PREF_PROGRESS
,
459 VLC_ML_PLAYBACK_PREF_SPEED
,
460 VLC_ML_PLAYBACK_PREF_TITLE
,
461 VLC_ML_PLAYBACK_PREF_CHAPTER
,
462 VLC_ML_PLAYBACK_PREF_PROGRAM
,
463 VLC_ML_PLAYBACK_PREF_SEEN
,
464 VLC_ML_PLAYBACK_PREF_VIDEO_TRACK
,
465 VLC_ML_PLAYBACK_PREF_ASPECT_RATIO
,
466 VLC_ML_PLAYBACK_PREF_ZOOM
,
467 VLC_ML_PLAYBACK_PREF_CROP
,
468 VLC_ML_PLAYBACK_PREF_DEINTERLACE
,
469 VLC_ML_PLAYBACK_PREF_VIDEO_FILTER
,
470 VLC_ML_PLAYBACK_PREF_AUDIO_TRACK
,
471 VLC_ML_PLAYBACK_PREF_GAIN
,
472 VLC_ML_PLAYBACK_PREF_AUDIO_DELAY
,
473 VLC_ML_PLAYBACK_PREF_SUBTITLE_TRACK
,
474 VLC_ML_PLAYBACK_PREF_SUBTITLE_DELAY
,
475 VLC_ML_PLAYBACK_PREF_APP_SPECIFIC
,
478 enum vlc_ml_event_type
481 * Entity modification callbacks. The affected entity will be passed:
482 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
483 * entity, in vlc_ml_event_t::modification::p_<type>
484 * for ADDED and UPDATED variants.
485 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
486 * When _DELETED callbacks get invoked, the entity will already have been
487 * deleted from the database, and cannot be retrieved anymore
489 VLC_ML_EVENT_MEDIA_ADDED
,
490 VLC_ML_EVENT_MEDIA_UPDATED
,
491 VLC_ML_EVENT_MEDIA_DELETED
,
492 VLC_ML_EVENT_ARTIST_ADDED
,
493 VLC_ML_EVENT_ARTIST_UPDATED
,
494 VLC_ML_EVENT_ARTIST_DELETED
,
495 VLC_ML_EVENT_ALBUM_ADDED
,
496 VLC_ML_EVENT_ALBUM_UPDATED
,
497 VLC_ML_EVENT_ALBUM_DELETED
,
498 VLC_ML_EVENT_PLAYLIST_ADDED
,
499 VLC_ML_EVENT_PLAYLIST_UPDATED
,
500 VLC_ML_EVENT_PLAYLIST_DELETED
,
501 VLC_ML_EVENT_GENRE_ADDED
,
502 VLC_ML_EVENT_GENRE_UPDATED
,
503 VLC_ML_EVENT_GENRE_DELETED
,
505 * A discovery started.
506 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
507 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
508 * VLC_ML_EVENT_DISCOVERY_COMPLETED events.
509 * The entry point being discovered is stored in
510 * vlc_ml_event_t::discovery_started::psz_entry_point.
512 VLC_ML_EVENT_DISCOVERY_STARTED
,
514 * Sent when a discovery or reload operation starts analyzing a new folder.
515 * The discovered entry point is stored in
516 * vlc_ml_event_t::discovery_progress::psz_entry_point.
518 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
520 * Sent when an entry point discovery is completed.
521 * The entry point that was being discovered is stored in
522 * vlc_ml_event_t::discovery_completed::psz_entry_point.
523 * The success or failure state is stored in
524 * vlc_ml_event_t::discovery_completed::b_success
526 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
528 * An entry point reload operation started.
529 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
530 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
531 * The entry point being reloaded is stored in
532 * vlc_ml_event_t::reload_started::psz_entry_point.
534 VLC_ML_EVENT_RELOAD_STARTED
,
536 * Sent when an entry point reload is completed.
537 * The entry point that was being reloaded is stored in
538 * vlc_ml_event_t::reload_completed::psz_entry_point.
539 * The success or failure state is stored in
540 * vlc_ml_event_t::reload_completed::b_success
542 VLC_ML_EVENT_RELOAD_COMPLETED
,
544 * Sent when an entry point removal request has been processed.
545 * The removed entry point is stored in
546 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
547 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
549 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
551 * Sent when an entry point ban request has been processed.
552 * The banned entry point is stored in
553 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
554 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
556 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
558 * Sent when an entry point unban request has been processed.
559 * The unbanned entry point is stored in
560 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
561 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
563 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
565 * Sent when a discoverer or parser threads changes its idle state.
566 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
567 * False means at least one background thread is in running, true means
568 * both discoverer & parser threads are paused.
570 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
572 * Sent when the parsing progress percentage gets updated.
573 * The percentage is stored as a [0;100] integer, in
574 * vlc_ml_event_t::parsing_progress::i_percent
575 * This value might decrease as more media get discovered, but it will only
576 * increase once all discovery operations are completed.
578 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
580 * Sent after a media thumbnail was generated, or if it's generation failed.
581 * The media is stored in vlc_ml_event_t::media_thumbnail_generated::p_media
582 * and the success state is stored in
583 * vlc_ml_event_t::media_thumbnail_generated::b_success
585 VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED
,
588 typedef struct vlc_ml_event_t
595 const char* psz_entry_point
;
599 const char* psz_entry_point
;
600 } discovery_progress
;
603 const char* psz_entry_point
;
605 } discovery_completed
;
608 const char* psz_entry_point
;
612 const char* psz_entry_point
;
617 const char* psz_entry_point
;
619 } entry_point_removed
;
622 const char* psz_entry_point
;
624 } entry_point_banned
;
627 const char* psz_entry_point
;
629 } entry_point_unbanned
;
636 const vlc_ml_media_t
* p_media
;
637 const vlc_ml_artist_t
* p_artist
;
638 const vlc_ml_album_t
* p_album
;
639 const vlc_ml_playlist_t
* p_playlist
;
640 const vlc_ml_genre_t
* p_genre
;
649 } background_idle_changed
;
652 const vlc_ml_media_t
* p_media
;
654 } media_thumbnail_generated
;
658 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
660 typedef struct vlc_medialibrary_callbacks_t
662 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
663 } vlc_medialibrary_callbacks_t
;
665 struct vlc_medialibrary_module_t
667 struct vlc_common_members obj
;
673 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
675 * List some entities from the medialibrary.
677 * \param p_ml The medialibrary module instance.
678 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
679 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
680 * the default parameters (alphabetical ascending sort, no pagination)
682 * \return VLC_SUCCESS or an error code
684 * Refer to the individual list of vlc_ml_list requests for the additional
685 * per-query input/ouput parameters values & types
687 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
688 const vlc_ml_query_params_t
* p_params
, va_list args
);
691 * Get a specific entity by its id.
693 * \return The required entity, or a NULL pointer if couldn't be found.
695 * Refer to the list of queries for the specific return type
697 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, int64_t i_id
);
699 const vlc_medialibrary_callbacks_t
* cbs
;
702 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
703 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
705 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
706 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
708 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, int64_t i_id
) VLC_USED
;
709 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
710 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
711 const vlc_ml_query_params_t
* p_params
, ... );
714 * \brief Registers a medialibrary callback.
715 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
717 VLC_API vlc_ml_event_callback_t
*
718 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
721 * \brief Unregisters a medialibrary callback
722 * \param p_handle The handled returned by vlc_ml_register_callback
724 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
725 vlc_ml_event_callback_t
* p_callback
);
727 * \brief Unregisters a medialibrary callback from the said callback.
728 * \param p_callback The handle returned by vlc_ml_register_callback
730 * This must only be called synchronously from the callback function provided to
731 * vlc_ml_event_register_callback
732 * The p_callback handle must be considered invalid when this function returns
734 VLC_API
void vlc_ml_event_unregister_from_callback( vlc_medialibrary_t
* p_ml
,
735 vlc_ml_event_callback_t
* p_callback
);
738 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
739 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
740 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
741 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
742 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
743 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
745 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
746 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
747 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
748 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
749 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
750 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
751 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
752 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
753 VLC_API
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t
* p_list
);
755 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
757 return (vlc_ml_query_params_t
) {
761 .i_sort
= VLC_ML_SORTING_DEFAULT
,
766 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
768 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
771 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
773 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
776 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
778 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
781 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
783 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
786 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
787 vlc_ml_entry_point_list_t
** pp_entrypoints
)
789 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
);
792 static inline int vlc_ml_is_indexed( vlc_medialibrary_t
* p_ml
,
793 const char* psz_mrl
, bool* p_res
)
795 return vlc_ml_control( p_ml
, VLC_ML_IS_INDEXED
, psz_mrl
, p_res
);
798 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
800 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
803 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
805 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
808 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
810 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
813 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
815 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
818 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
821 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
826 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
829 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
834 static inline int vlc_ml_media_increase_playcount( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
836 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, i_media_id
);
839 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
)
841 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, ppsz_result
);
844 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
)
846 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, psz_value
);
849 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, const char* psz_mrl
)
851 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
);
854 static inline int vlc_ml_media_generate_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
856 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GENERATE_THUMBNAIL
, i_media_id
);
859 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
860 const char* psz_mrl
, int i_type
)
862 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
865 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
867 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
870 static inline input_item_t
* vlc_ml_get_input_item( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
872 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM
, i_media_id
);
875 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
877 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
880 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
882 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
885 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
887 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
890 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
892 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
895 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
897 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
900 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
)
902 vlc_assert( p_ml
!= NULL
);
903 vlc_ml_media_list_t
* res
;
904 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
909 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
)
911 vlc_assert( p_ml
!= NULL
);
913 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
918 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
)
920 vlc_assert( p_ml
!= NULL
);
921 vlc_ml_artist_list_t
* res
;
922 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
927 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
)
929 vlc_assert( p_ml
!= NULL
);
931 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
936 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
)
938 vlc_assert( p_ml
!= NULL
);
939 vlc_ml_album_list_t
* res
;
940 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
945 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
)
947 vlc_assert( p_ml
!= NULL
);
949 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
954 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
)
956 vlc_assert( p_ml
!= NULL
);
957 vlc_ml_media_list_t
* res
;
958 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
963 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
)
965 vlc_assert( p_ml
!= NULL
);
967 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
972 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
)
974 vlc_assert( p_ml
!= NULL
);
975 vlc_ml_media_list_t
* res
;
976 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
981 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
)
983 vlc_assert( p_ml
!= NULL
);
985 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
990 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
)
992 vlc_assert( p_ml
!= NULL
);
993 vlc_ml_album_list_t
* res
;
994 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
999 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
)
1001 vlc_assert( p_ml
!= NULL
);
1003 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1008 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
)
1010 vlc_assert( p_ml
!= NULL
);
1011 vlc_ml_media_list_t
* res
;
1012 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1017 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
)
1019 vlc_assert( p_ml
!= NULL
);
1021 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1026 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1028 vlc_assert( p_ml
!= NULL
);
1029 vlc_ml_media_list_t
* res
;
1030 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
1035 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1037 vlc_assert( p_ml
!= NULL
);
1039 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
1044 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1046 vlc_assert( p_ml
!= NULL
);
1047 vlc_ml_media_list_t
* res
;
1048 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1053 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1055 vlc_assert( p_ml
!= NULL
);
1057 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1062 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1064 vlc_assert( p_ml
!= NULL
);
1065 vlc_ml_album_list_t
* res
;
1066 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1071 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1073 vlc_assert( p_ml
!= NULL
);
1075 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1080 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1082 vlc_assert( p_ml
!= NULL
);
1083 vlc_ml_genre_list_t
* res
;
1084 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1089 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1091 vlc_assert( p_ml
!= NULL
);
1093 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1099 * @brief vlc_ml_list_artists
1100 * @param params Query parameters, or NULL for the default
1101 * @param b_include_all True if you wish to fetch artists without at least one album.
1104 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
)
1106 vlc_assert( p_ml
!= NULL
);
1107 vlc_ml_artist_list_t
* res
;
1108 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1113 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1115 vlc_assert( p_ml
!= NULL
);
1117 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1122 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1124 vlc_assert( p_ml
!= NULL
);
1125 vlc_ml_show_list_t
* res
;
1126 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1131 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1133 vlc_assert( p_ml
!= NULL
);
1135 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1140 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
)
1142 vlc_assert( p_ml
!= NULL
);
1143 vlc_ml_media_list_t
* res
;
1144 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1149 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
)
1151 vlc_assert( p_ml
!= NULL
);
1153 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1158 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
)
1160 vlc_assert( p_ml
!= NULL
);
1161 vlc_ml_media_list_t
* res
;
1162 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1167 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
)
1169 vlc_assert( p_ml
!= NULL
);
1171 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1176 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
)
1178 vlc_assert( p_ml
!= NULL
);
1179 vlc_ml_album_list_t
* res
;
1180 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1185 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
)
1187 vlc_assert( p_ml
!= NULL
);
1189 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1194 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
)
1196 vlc_assert( p_ml
!= NULL
);
1197 vlc_ml_media_list_t
* res
;
1198 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1203 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
)
1205 vlc_assert( p_ml
!= NULL
);
1207 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1212 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
)
1214 vlc_assert( p_ml
!= NULL
);
1215 vlc_ml_label_list_t
* res
;
1216 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1221 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
)
1223 vlc_assert( p_ml
!= NULL
);
1225 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1230 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1232 vlc_assert( p_ml
!= NULL
);
1233 vlc_ml_media_list_t
* res
;
1234 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1239 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1241 vlc_assert( p_ml
!= NULL
);
1242 vlc_ml_media_list_t
* res
;
1243 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1248 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1250 vlc_assert( p_ml
!= NULL
);
1251 vlc_ml_playlist_list_t
* res
;
1252 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1257 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1259 vlc_assert( p_ml
!= NULL
);
1261 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1266 static inline vlc_ml_media_list_t
* vlc_ml_list_playlist_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_playlist_id
)
1268 vlc_assert( p_ml
!= NULL
);
1269 vlc_ml_media_list_t
* res
;
1270 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLIST_MEDIA
, params
, i_playlist_id
, &res
) != VLC_SUCCESS
)
1275 static inline size_t vlc_ml_count_playlist_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_playlist_id
)
1277 vlc_assert( p_ml
!= NULL
);
1279 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLIST_MEDIA
, params
, i_playlist_id
, &count
) != VLC_SUCCESS
)
1289 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1290 vlc_ml_show_t*: vlc_ml_show_release, \
1291 vlc_ml_artist_t*: vlc_ml_artist_release, \
1292 vlc_ml_album_t*: vlc_ml_album_release, \
1293 vlc_ml_genre_t*: vlc_ml_genre_release, \
1294 vlc_ml_media_t*: vlc_ml_media_release, \
1295 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1296 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1297 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1298 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1299 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1300 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1301 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1302 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1303 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
1304 vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release \
1307 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1308 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1309 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1310 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1311 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1312 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1313 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1314 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1315 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1316 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1317 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1318 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1319 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1320 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1321 static inline void vlc_ml_release( vlc_ml_entry_point_list_t
* list
) { vlc_ml_entry_point_list_release( list
); }
1324 #endif /* VLC_MEDIA_LIBRARY_H */