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
;
185 /* True if a thumbnail is available, or if thumbnail generation was
186 * attempted but failed */
187 bool b_artwork_generated
;
192 vlc_ml_show_episode_t show_episode
;
193 vlc_ml_movie_t movie
;
194 vlc_ml_album_track_t album_track
;
198 typedef struct vlc_ml_playlist_t
202 uint32_t i_creation_date
;
203 char* psz_artwork_mrl
;
206 typedef struct vlc_ml_artist_t
211 char* psz_artwork_mrl
;
214 unsigned int i_nb_album
;
215 unsigned int i_nb_tracks
;
218 typedef struct vlc_ml_artist_list_t
221 vlc_ml_artist_t p_items
[];
222 } vlc_ml_artist_list_t
;
224 typedef struct vlc_ml_album_t
{
228 char* psz_artwork_mrl
;
233 unsigned int i_duration
;
237 typedef struct vlc_ml_genre_t
244 typedef struct vlc_ml_media_list_t
247 vlc_ml_media_t p_items
[];
248 } vlc_ml_media_list_t
;
250 typedef struct vlc_ml_album_list_t
253 vlc_ml_album_t p_items
[];
254 } vlc_ml_album_list_t
;
256 typedef struct vlc_ml_show_list_t
259 vlc_ml_show_t p_items
[];
260 } vlc_ml_show_list_t
;
262 typedef struct vlc_ml_genre_list_t
265 vlc_ml_genre_t p_items
[];
266 } vlc_ml_genre_list_t
;
268 typedef struct vlc_ml_playlist_list_t
271 vlc_ml_playlist_t p_items
[];
272 } vlc_ml_playlist_list_t
;
274 typedef struct vlc_ml_entry_point_t
276 char* psz_mrl
; /**< This entrypoint's MRL. Will be NULL if b_present is false */
277 bool b_present
; /**< The presence state for this entrypoint. */
278 bool b_banned
; /**< Will be true if the user required this entrypoint to be excluded */
279 } vlc_ml_entry_point_t
;
281 typedef struct vlc_ml_entry_point_list_t
284 vlc_ml_entry_point_t p_items
[];
285 } vlc_ml_entry_point_list_t
;
287 /* Opaque medialibrary pointer, to be used by any non-medialibrary module */
288 typedef struct vlc_medialibrary_t vlc_medialibrary_t
;
289 /* "Private" medialibrary pointer, to be used by the core & medialibrary modules */
290 typedef struct vlc_medialibrary_module_t vlc_medialibrary_module_t
;
291 /* Opaque event callback type */
292 typedef struct vlc_ml_event_callback_t vlc_ml_event_callback_t
;
294 typedef enum vlc_ml_sorting_criteria_t
297 * Default depends on the entity type:
298 * - By track number (and disc number) for album tracks
299 * - Alphabetical order for others
301 VLC_ML_SORTING_DEFAULT
,
302 VLC_ML_SORTING_ALPHA
,
303 VLC_ML_SORTING_DURATION
,
304 VLC_ML_SORTING_INSERTIONDATE
,
305 VLC_ML_SORTING_LASTMODIFICATIONDATE
,
306 VLC_ML_SORTING_RELEASEDATE
,
307 VLC_ML_SORTING_FILESIZE
,
308 VLC_ML_SORTING_ARTIST
,
309 VLC_ML_SORTING_PLAYCOUNT
,
310 VLC_ML_SORTING_ALBUM
,
311 VLC_ML_SORTING_FILENAME
,
312 VLC_ML_SORTING_TRACKNUMBER
,
313 } vlc_ml_sorting_criteria_t
;
315 typedef struct vlc_ml_query_params_t vlc_ml_query_params_t
;
316 struct vlc_ml_query_params_t
318 const char* psz_pattern
;
319 uint32_t i_nbResults
;
321 vlc_ml_sorting_criteria_t i_sort
;
325 enum vlc_ml_get_queries
327 VLC_ML_GET_MEDIA
, /**< arg1: Media ID; ret: vlc_ml_media_t* */
328 VLC_ML_GET_ALBUM
, /**< arg1: Album ID; ret: vlc_ml_album_t* */
329 VLC_ML_GET_ARTIST
, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
330 VLC_ML_GET_GENRE
, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
331 VLC_ML_GET_SHOW
, /**< arg1: Show ID; ret: vlc_ml_show_t* */
332 VLC_ML_GET_PLAYLIST
, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
335 enum vlc_ml_list_queries
337 /* General listing: */
339 VLC_ML_LIST_VIDEOS
, /**< arg1 (out): vlc_ml_media_list_t** */
340 VLC_ML_COUNT_VIDEOS
, /**< arg1 (out): size_t* */
341 VLC_ML_LIST_AUDIOS
, /**< arg1 (out): vlc_ml_media_list_t** */
342 VLC_ML_COUNT_AUDIOS
, /**< arg1 (out): size_t* */
343 VLC_ML_LIST_ALBUMS
, /**< arg1 (out): vlc_ml_album_list_t** */
344 VLC_ML_COUNT_ALBUMS
, /**< arg1 (out): size_t* */
345 VLC_ML_LIST_GENRES
, /**< arg1 (out): vlc_ml_genre_list_t** */
346 VLC_ML_COUNT_GENRES
, /**< arg1 (out): size_t* */
347 VLC_ML_LIST_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
348 VLC_ML_COUNT_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): size_t* */
349 VLC_ML_LIST_SHOWS
, /**< arg1 (out): vlc_ml_show_list_t** */
350 VLC_ML_COUNT_SHOWS
, /**< arg1 (out): size_t* */
351 VLC_ML_LIST_PLAYLISTS
, /**< arg1 (out): vlc_ml_playlist_list_t** */
352 VLC_ML_COUNT_PLAYLISTS
, /**< arg1 (out): size_t* */
353 VLC_ML_LIST_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
354 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
356 /* Album specific listings */
357 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
358 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
359 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
360 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
362 /* Artist specific listings */
363 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
364 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
365 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
366 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
368 /* Genre specific listings */
369 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
370 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
371 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
372 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
373 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
374 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
376 /* Show specific listings */
377 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
378 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
380 /* Media specific listings */
381 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
382 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
384 /* Playlist specific listings */
385 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
386 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
388 /* Children entities listing */
389 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
390 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
391 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
392 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
393 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
394 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
397 enum vlc_ml_parent_type
399 VLC_ML_PARENT_ALBUM
= 1,
400 VLC_ML_PARENT_ARTIST
,
403 VLC_ML_PARENT_PLAYLIST
,
408 /* Adds a folder to discover through the medialibrary */
409 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
410 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
411 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
412 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
413 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
415 * Reload a specific folder, or all.
416 * arg1: mrl (const char*), NULL to reload all folders
419 VLC_ML_RELOAD_FOLDER
,
421 /* Pause/resume background operations, such as media discovery & media analysis */
422 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
423 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
425 /* Misc operations */
426 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
429 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
430 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
432 /* Media management */
433 VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, /**< arg1: media id; can fail */
434 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: char**; */
435 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, /**< arg1: media id; arg2: vlc_ml_playback_pref; arg3: const char*; */
436 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; */
437 VLC_ML_MEDIA_GENERATE_THUMBNAIL
, /**< arg1: media id; */
438 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
442 * User playback settings.
443 * All values/units are up to the caller and are not interpreted by the media
445 * All values are stored and returned as strings.
446 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_PREF,
447 * the value will be returned stored in the provided char**. If the preference was
448 * not set yet, NULL will be returned.
449 * When setting a preference, NULL can be provided as a value to unset it.
451 enum vlc_ml_playback_pref
453 VLC_ML_PLAYBACK_PREF_RATING
,
454 VLC_ML_PLAYBACK_PREF_PROGRESS
,
455 VLC_ML_PLAYBACK_PREF_SPEED
,
456 VLC_ML_PLAYBACK_PREF_TITLE
,
457 VLC_ML_PLAYBACK_PREF_CHAPTER
,
458 VLC_ML_PLAYBACK_PREF_PROGRAM
,
459 VLC_ML_PLAYBACK_PREF_SEEN
,
460 VLC_ML_PLAYBACK_PREF_VIDEO_TRACK
,
461 VLC_ML_PLAYBACK_PREF_ASPECT_RATIO
,
462 VLC_ML_PLAYBACK_PREF_ZOOM
,
463 VLC_ML_PLAYBACK_PREF_CROP
,
464 VLC_ML_PLAYBACK_PREF_DEINTERLACE
,
465 VLC_ML_PLAYBACK_PREF_VIDEO_FILTER
,
466 VLC_ML_PLAYBACK_PREF_AUDIO_TRACK
,
467 VLC_ML_PLAYBACK_PREF_GAIN
,
468 VLC_ML_PLAYBACK_PREF_AUDIO_DELAY
,
469 VLC_ML_PLAYBACK_PREF_SUBTITLE_TRACK
,
470 VLC_ML_PLAYBACK_PREF_SUBTITLE_DELAY
,
471 VLC_ML_PLAYBACK_PREF_APP_SPECIFIC
,
474 enum vlc_ml_event_type
477 * Entity modification callbacks. The affected entity will be passed:
478 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
479 * entity, in vlc_ml_event_t::modification::p_<type>
480 * for ADDED and UPDATED variants.
481 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
482 * When _DELETED callbacks get invoked, the entity will already have been
483 * deleted from the database, and cannot be retrieved anymore
485 VLC_ML_EVENT_MEDIA_ADDED
,
486 VLC_ML_EVENT_MEDIA_UPDATED
,
487 VLC_ML_EVENT_MEDIA_DELETED
,
488 VLC_ML_EVENT_ARTIST_ADDED
,
489 VLC_ML_EVENT_ARTIST_UPDATED
,
490 VLC_ML_EVENT_ARTIST_DELETED
,
491 VLC_ML_EVENT_ALBUM_ADDED
,
492 VLC_ML_EVENT_ALBUM_UPDATED
,
493 VLC_ML_EVENT_ALBUM_DELETED
,
494 VLC_ML_EVENT_PLAYLIST_ADDED
,
495 VLC_ML_EVENT_PLAYLIST_UPDATED
,
496 VLC_ML_EVENT_PLAYLIST_DELETED
,
497 VLC_ML_EVENT_GENRE_ADDED
,
498 VLC_ML_EVENT_GENRE_UPDATED
,
499 VLC_ML_EVENT_GENRE_DELETED
,
501 * A discovery started.
502 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
503 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
504 * VLC_ML_EVENT_DISCOVERY_COMPLETED events.
505 * The entry point being discovered is stored in
506 * vlc_ml_event_t::discovery_started::psz_entry_point.
508 VLC_ML_EVENT_DISCOVERY_STARTED
,
510 * Sent when a discovery or reload operation starts analyzing a new folder.
511 * The discovered entry point is stored in
512 * vlc_ml_event_t::discovery_progress::psz_entry_point.
514 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
516 * Sent when an entry point discovery is completed.
517 * The entry point that was being discovered is stored in
518 * vlc_ml_event_t::discovery_completed::psz_entry_point.
519 * The success or failure state is stored in
520 * vlc_ml_event_t::discovery_completed::b_success
522 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
524 * An entry point reload operation started.
525 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
526 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
527 * The entry point being reloaded is stored in
528 * vlc_ml_event_t::reload_started::psz_entry_point.
530 VLC_ML_EVENT_RELOAD_STARTED
,
532 * Sent when an entry point reload is completed.
533 * The entry point that was being reloaded is stored in
534 * vlc_ml_event_t::reload_completed::psz_entry_point.
535 * The success or failure state is stored in
536 * vlc_ml_event_t::reload_completed::b_success
538 VLC_ML_EVENT_RELOAD_COMPLETED
,
540 * Sent when an entry point removal request has been processed.
541 * The removed entry point is stored in
542 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
543 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
545 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
547 * Sent when an entry point ban request has been processed.
548 * The banned entry point is stored in
549 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
550 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
552 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
554 * Sent when an entry point unban request has been processed.
555 * The unbanned entry point is stored in
556 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
557 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
559 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
561 * Sent when a discoverer or parser threads changes its idle state.
562 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
563 * False means at least one background thread is in running, true means
564 * both discoverer & parser threads are paused.
566 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
568 * Sent when the parsing progress percentage gets updated.
569 * The percentage is stored as a [0;100] integer, in
570 * vlc_ml_event_t::parsing_progress::i_percent
571 * This value might decrease as more media get discovered, but it will only
572 * increase once all discovery operations are completed.
574 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
576 * Sent after a media thumbnail was generated, or if it's generation failed.
577 * The media is stored in vlc_ml_event_t::media_thumbnail_generated::p_media
578 * and the success state is stored in
579 * vlc_ml_event_t::media_thumbnail_generated::b_success
581 VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED
,
584 typedef struct vlc_ml_event_t
591 const char* psz_entry_point
;
595 const char* psz_entry_point
;
596 } discovery_progress
;
599 const char* psz_entry_point
;
601 } discovery_completed
;
604 const char* psz_entry_point
;
608 const char* psz_entry_point
;
613 const char* psz_entry_point
;
615 } entry_point_removed
;
618 const char* psz_entry_point
;
620 } entry_point_banned
;
623 const char* psz_entry_point
;
625 } entry_point_unbanned
;
632 const vlc_ml_media_t
* p_media
;
633 const vlc_ml_artist_t
* p_artist
;
634 const vlc_ml_album_t
* p_album
;
635 const vlc_ml_playlist_t
* p_playlist
;
636 const vlc_ml_genre_t
* p_genre
;
645 } background_idle_changed
;
648 const vlc_ml_media_t
* p_media
;
650 } media_thumbnail_generated
;
654 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
656 typedef struct vlc_medialibrary_callbacks_t
658 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
659 } vlc_medialibrary_callbacks_t
;
661 struct vlc_medialibrary_module_t
663 struct vlc_common_members obj
;
669 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
671 * List some entities from the medialibrary.
673 * \param p_ml The medialibrary module instance.
674 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
675 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
676 * the default parameters (alphabetical ascending sort, no pagination)
678 * \return VLC_SUCCESS or an error code
680 * Refer to the individual list of vlc_ml_list requests for the additional
681 * per-query input/ouput parameters values & types
683 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
684 const vlc_ml_query_params_t
* p_params
, va_list args
);
687 * Get a specific entity by its id.
689 * \return The required entity, or a NULL pointer if couldn't be found.
691 * Refer to the list of queries for the specific return type
693 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, int64_t i_id
);
695 const vlc_medialibrary_callbacks_t
* cbs
;
698 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
699 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
701 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
702 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
704 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, int64_t i_id
) VLC_USED
;
705 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
706 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
707 const vlc_ml_query_params_t
* p_params
, ... );
710 * \brief Registers a medialibrary callback.
711 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
713 VLC_API vlc_ml_event_callback_t
*
714 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
717 * \brief Unregisters a medialibrary callback
718 * \param p_handle The handled returned by vlc_ml_register_callback
720 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
721 vlc_ml_event_callback_t
* p_callback
);
723 * \brief Unregisters a medialibrary callback from the said callback.
724 * \param p_callback The handle returned by vlc_ml_register_callback
726 * This must only be called synchronously from the callback function provided to
727 * vlc_ml_event_register_callback
728 * The p_callback handle must be considered invalid when this function returns
730 VLC_API
void vlc_ml_event_unregister_from_callback( vlc_medialibrary_t
* p_ml
,
731 vlc_ml_event_callback_t
* p_callback
);
734 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
735 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
736 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
737 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
738 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
739 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
741 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
742 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
743 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
744 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
745 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
746 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
747 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
748 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
749 VLC_API
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t
* p_list
);
751 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
753 return (vlc_ml_query_params_t
) {
757 .i_sort
= VLC_ML_SORTING_DEFAULT
,
762 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
764 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
767 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
769 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
772 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
774 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
777 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
779 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
782 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
783 vlc_ml_entry_point_list_t
** pp_entrypoints
)
785 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
);
788 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
790 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
793 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
795 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
798 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
800 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
803 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
805 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
808 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
811 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
816 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
819 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
824 static inline int vlc_ml_media_increase_playcount( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
826 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_INCREASE_PLAY_COUNT
, i_media_id
);
829 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
)
831 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, ppsz_result
);
834 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
)
836 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_PREF
, i_media_id
, i_pref
, psz_value
);
839 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, const char* psz_mrl
)
841 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
);
844 static inline int vlc_ml_media_generate_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
846 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GENERATE_THUMBNAIL
, i_media_id
);
849 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
850 const char* psz_mrl
, int i_type
)
852 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
855 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
857 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
860 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
862 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
865 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
867 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
870 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
872 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
875 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
877 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
880 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
882 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
885 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
)
887 vlc_assert( p_ml
!= NULL
);
888 vlc_ml_media_list_t
* res
;
889 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
894 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
)
896 vlc_assert( p_ml
!= NULL
);
898 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
903 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
)
905 vlc_assert( p_ml
!= NULL
);
906 vlc_ml_artist_list_t
* res
;
907 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
912 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
)
914 vlc_assert( p_ml
!= NULL
);
916 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
921 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
)
923 vlc_assert( p_ml
!= NULL
);
924 vlc_ml_album_list_t
* res
;
925 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
930 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
)
932 vlc_assert( p_ml
!= NULL
);
934 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
939 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
)
941 vlc_assert( p_ml
!= NULL
);
942 vlc_ml_media_list_t
* res
;
943 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
948 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
)
950 vlc_assert( p_ml
!= NULL
);
952 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
957 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
)
959 vlc_assert( p_ml
!= NULL
);
960 vlc_ml_media_list_t
* res
;
961 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
966 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
)
968 vlc_assert( p_ml
!= NULL
);
970 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
975 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
)
977 vlc_assert( p_ml
!= NULL
);
978 vlc_ml_album_list_t
* res
;
979 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
984 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
)
986 vlc_assert( p_ml
!= NULL
);
988 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
993 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
)
995 vlc_assert( p_ml
!= NULL
);
996 vlc_ml_media_list_t
* res
;
997 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1002 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
)
1004 vlc_assert( p_ml
!= NULL
);
1006 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1011 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1013 vlc_assert( p_ml
!= NULL
);
1014 vlc_ml_media_list_t
* res
;
1015 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
1020 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1022 vlc_assert( p_ml
!= NULL
);
1024 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
1029 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1031 vlc_assert( p_ml
!= NULL
);
1032 vlc_ml_media_list_t
* res
;
1033 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1038 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1040 vlc_assert( p_ml
!= NULL
);
1042 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1047 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1049 vlc_assert( p_ml
!= NULL
);
1050 vlc_ml_album_list_t
* res
;
1051 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1056 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1058 vlc_assert( p_ml
!= NULL
);
1060 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1065 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1067 vlc_assert( p_ml
!= NULL
);
1068 vlc_ml_genre_list_t
* res
;
1069 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1074 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1076 vlc_assert( p_ml
!= NULL
);
1078 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1084 * @brief vlc_ml_list_artists
1085 * @param params Query parameters, or NULL for the default
1086 * @param b_include_all True if you wish to fetch artists without at least one album.
1089 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
)
1091 vlc_assert( p_ml
!= NULL
);
1092 vlc_ml_artist_list_t
* res
;
1093 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1098 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1100 vlc_assert( p_ml
!= NULL
);
1102 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1107 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1109 vlc_assert( p_ml
!= NULL
);
1110 vlc_ml_show_list_t
* res
;
1111 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1116 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1118 vlc_assert( p_ml
!= NULL
);
1120 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1125 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
)
1127 vlc_assert( p_ml
!= NULL
);
1128 vlc_ml_media_list_t
* res
;
1129 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1134 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
)
1136 vlc_assert( p_ml
!= NULL
);
1138 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1143 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
)
1145 vlc_assert( p_ml
!= NULL
);
1146 vlc_ml_media_list_t
* res
;
1147 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1152 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
)
1154 vlc_assert( p_ml
!= NULL
);
1156 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1161 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
)
1163 vlc_assert( p_ml
!= NULL
);
1164 vlc_ml_album_list_t
* res
;
1165 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1170 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
)
1172 vlc_assert( p_ml
!= NULL
);
1174 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1179 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
)
1181 vlc_assert( p_ml
!= NULL
);
1182 vlc_ml_media_list_t
* res
;
1183 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1188 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
)
1190 vlc_assert( p_ml
!= NULL
);
1192 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1197 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
)
1199 vlc_assert( p_ml
!= NULL
);
1200 vlc_ml_label_list_t
* res
;
1201 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1206 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
)
1208 vlc_assert( p_ml
!= NULL
);
1210 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1215 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1217 vlc_assert( p_ml
!= NULL
);
1218 vlc_ml_media_list_t
* res
;
1219 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1224 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1226 vlc_assert( p_ml
!= NULL
);
1227 vlc_ml_media_list_t
* res
;
1228 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1233 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1235 vlc_assert( p_ml
!= NULL
);
1236 vlc_ml_playlist_list_t
* res
;
1237 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1242 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1244 vlc_assert( p_ml
!= NULL
);
1246 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1251 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
)
1253 vlc_assert( p_ml
!= NULL
);
1254 vlc_ml_media_list_t
* res
;
1255 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLIST_MEDIA
, params
, i_playlist_id
, &res
) != VLC_SUCCESS
)
1260 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
)
1262 vlc_assert( p_ml
!= NULL
);
1264 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLIST_MEDIA
, params
, i_playlist_id
, &count
) != VLC_SUCCESS
)
1274 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1275 vlc_ml_show_t*: vlc_ml_show_release, \
1276 vlc_ml_artist_t*: vlc_ml_artist_release, \
1277 vlc_ml_album_t*: vlc_ml_album_release, \
1278 vlc_ml_genre_t*: vlc_ml_genre_release, \
1279 vlc_ml_media_t*: vlc_ml_media_release, \
1280 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1281 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1282 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1283 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1284 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1285 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1286 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1287 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1288 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
1289 vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release \
1292 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1293 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1294 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1295 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1296 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1297 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1298 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1299 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1300 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1301 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1302 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1303 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1304 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1305 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1306 static inline void vlc_ml_release( vlc_ml_entry_point_list_t
* list
) { vlc_ml_entry_point_list_release( list
); }
1309 #endif /* VLC_MEDIA_LIBRARY_H */