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_t
;
44 typedef enum vlc_ml_media_subtype_t
46 VLC_ML_MEDIA_SUBTYPE_UNKNOWN
,
47 VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE
,
48 VLC_ML_MEDIA_SUBTYPE_MOVIE
,
49 VLC_ML_MEDIA_SUBTYPE_ALBUMTRACK
,
50 } vlc_ml_media_subtype_t
;
52 typedef enum vlc_ml_file_type_t
54 VLC_ML_FILE_TYPE_UNKNOWN
,
55 VLC_ML_FILE_TYPE_MAIN
,
56 VLC_ML_FILE_TYPE_PART
,
57 VLC_ML_FILE_TYPE_SOUNDTRACK
,
58 VLC_ML_FILE_TYPE_SUBTITLE
,
59 VLC_ML_FILE_TYPE_PLAYLIST
,
62 typedef enum vlc_ml_track_type_t
64 VLC_ML_TRACK_TYPE_UNKNOWN
,
65 VLC_ML_TRACK_TYPE_VIDEO
,
66 VLC_ML_TRACK_TYPE_AUDIO
,
67 } vlc_ml_track_type_t
;
69 typedef enum vlc_ml_thumbnail_size_t
71 VLC_ML_THUMBNAIL_SMALL
,
72 VLC_ML_THUMBNAIL_BANNER
,
74 VLC_ML_THUMBNAIL_SIZE_COUNT
75 } vlc_ml_thumbnail_size_t
;
77 typedef enum vlc_ml_thumbnail_status_t
79 VLC_ML_THUMBNAIL_STATUS_MISSING
,
80 VLC_ML_THUMBNAIL_STATUS_AVAILABLE
,
81 VLC_ML_THUMBNAIL_STATUS_FAILURE
,
82 VLC_ML_THUMBNAIL_STATUS_PERSISTENT_FAILURE
,
83 VLC_ML_THUMBNAIL_STATUS_CRASH
,
84 } vlc_ml_thumbnail_status_t
;
86 typedef enum vlc_ml_history_type_t
88 VLC_ML_HISTORY_TYPE_MEDIA
,
89 VLC_ML_HISTORY_TYPE_NETWORK
,
90 } vlc_ml_history_type_t
;
92 typedef struct vlc_ml_thumbnail_t
96 * True if a thumbnail is available, or if thumbnail generation was
97 * attempted but failed
99 vlc_ml_thumbnail_status_t i_status
;
100 } vlc_ml_thumbnail_t
;
102 typedef struct vlc_ml_movie_t
108 typedef struct vlc_ml_show_episode_t
112 uint32_t i_episode_nb
;
113 uint32_t i_season_number
;
114 } vlc_ml_show_episode_t
;
116 typedef struct vlc_ml_show_t
121 char* psz_artwork_mrl
;
123 unsigned int i_release_year
;
124 uint32_t i_nb_episodes
;
125 uint32_t i_nb_seasons
;
128 typedef struct vlc_ml_album_track_t
136 } vlc_ml_album_track_t
;
138 typedef struct vlc_ml_label_t
144 typedef struct vlc_ml_label_list_t
147 vlc_ml_label_t p_items
[];
148 } vlc_ml_label_list_t
;
150 typedef struct vlc_ml_file_t
153 vlc_ml_file_type_t i_type
;
159 typedef struct vlc_ml_file_list_t
162 vlc_ml_file_t p_items
[];
163 } vlc_ml_file_list_t
;
165 typedef struct vlc_ml_media_track_t
169 char* psz_description
;
170 vlc_ml_track_type_t i_type
;
177 uint32_t i_nbChannels
;
178 uint32_t i_sampleRate
;
191 } vlc_ml_media_track_t
;
193 typedef struct vlc_ml_media_track_list_t
196 vlc_ml_media_track_t p_items
[];
197 } vlc_ml_media_track_list_t
;
199 typedef struct vlc_ml_media_t
203 vlc_ml_media_type_t i_type
;
204 vlc_ml_media_subtype_t i_subtype
;
206 vlc_ml_file_list_t
* p_files
;
207 vlc_ml_media_track_list_t
* p_tracks
;
210 /* Duration in milliseconds */
212 uint32_t i_playcount
;
214 time_t i_last_played_date
;
217 vlc_ml_thumbnail_t thumbnails
[VLC_ML_THUMBNAIL_SIZE_COUNT
];
223 vlc_ml_show_episode_t show_episode
;
224 vlc_ml_movie_t movie
;
225 vlc_ml_album_track_t album_track
;
229 typedef struct vlc_ml_playlist_t
233 uint32_t i_creation_date
;
234 char* psz_artwork_mrl
;
237 typedef struct vlc_ml_artist_t
242 vlc_ml_thumbnail_t thumbnails
[VLC_ML_THUMBNAIL_SIZE_COUNT
];
245 unsigned int i_nb_album
;
246 unsigned int i_nb_tracks
;
249 typedef struct vlc_ml_artist_list_t
252 vlc_ml_artist_t p_items
[];
253 } vlc_ml_artist_list_t
;
255 typedef struct vlc_ml_album_t
{
259 vlc_ml_thumbnail_t thumbnails
[VLC_ML_THUMBNAIL_SIZE_COUNT
];
264 unsigned int i_duration
;
268 typedef struct vlc_ml_genre_t
275 typedef struct vlc_ml_media_list_t
278 vlc_ml_media_t p_items
[];
279 } vlc_ml_media_list_t
;
281 typedef struct vlc_ml_album_list_t
284 vlc_ml_album_t p_items
[];
285 } vlc_ml_album_list_t
;
287 typedef struct vlc_ml_show_list_t
290 vlc_ml_show_t p_items
[];
291 } vlc_ml_show_list_t
;
293 typedef struct vlc_ml_genre_list_t
296 vlc_ml_genre_t p_items
[];
297 } vlc_ml_genre_list_t
;
299 typedef struct vlc_ml_playlist_list_t
302 vlc_ml_playlist_t p_items
[];
303 } vlc_ml_playlist_list_t
;
305 typedef struct vlc_ml_entry_point_t
307 char* psz_mrl
; /**< This entrypoint's MRL. Will be NULL if b_present is false */
308 bool b_present
; /**< The presence state for this entrypoint. */
309 bool b_banned
; /**< Will be true if the user required this entrypoint to be excluded */
310 } vlc_ml_entry_point_t
;
312 typedef struct vlc_ml_entry_point_list_t
315 vlc_ml_entry_point_t p_items
[];
316 } vlc_ml_entry_point_list_t
;
318 typedef struct vlc_ml_bookmark_t
320 int64_t i_media_id
; /**< The associated media ID */
321 int64_t i_time
; /**< The bookmark time. The unit is arbitrary */
322 char* psz_name
; /**< The bookmark name */
323 char* psz_description
; /**< The bookmark description */
326 typedef struct vlc_ml_boomkmark_list_t
329 vlc_ml_bookmark_t p_items
[];
330 } vlc_ml_bookmark_list_t
;
332 /* Opaque medialibrary pointer, to be used by any non-medialibrary module */
333 typedef struct vlc_medialibrary_t vlc_medialibrary_t
;
334 /* "Private" medialibrary pointer, to be used by the core & medialibrary modules */
335 typedef struct vlc_medialibrary_module_t vlc_medialibrary_module_t
;
336 /* Opaque event callback type */
337 typedef struct vlc_ml_event_callback_t vlc_ml_event_callback_t
;
339 typedef enum vlc_ml_sorting_criteria_t
342 * Default depends on the entity type:
343 * - By track number (and disc number) for album tracks
344 * - Alphabetical order for others
346 VLC_ML_SORTING_DEFAULT
,
347 VLC_ML_SORTING_ALPHA
,
348 VLC_ML_SORTING_DURATION
,
349 VLC_ML_SORTING_INSERTIONDATE
,
350 VLC_ML_SORTING_LASTMODIFICATIONDATE
,
351 VLC_ML_SORTING_RELEASEDATE
,
352 VLC_ML_SORTING_FILESIZE
,
353 VLC_ML_SORTING_ARTIST
,
354 VLC_ML_SORTING_PLAYCOUNT
,
355 VLC_ML_SORTING_ALBUM
,
356 VLC_ML_SORTING_FILENAME
,
357 VLC_ML_SORTING_TRACKNUMBER
,
358 } vlc_ml_sorting_criteria_t
;
360 typedef struct vlc_ml_query_params_t vlc_ml_query_params_t
;
361 struct vlc_ml_query_params_t
363 const char* psz_pattern
;
364 uint32_t i_nbResults
;
366 vlc_ml_sorting_criteria_t i_sort
;
370 enum vlc_ml_get_queries
372 VLC_ML_GET_MEDIA
, /**< arg1: Media ID; ret: vlc_ml_media_t* */
373 VLC_ML_GET_MEDIA_BY_MRL
, /**< arg1: Media MRL; ret: vlc_ml_media_t* */
374 VLC_ML_GET_INPUT_ITEM
, /**< arg1: Media ID; ret: input_item_t* */
375 VLC_ML_GET_INPUT_ITEM_BY_MRL
,/**< arg1: Media MRL; ret: input_item_t* */
376 VLC_ML_GET_ALBUM
, /**< arg1: Album ID; ret: vlc_ml_album_t* */
377 VLC_ML_GET_ARTIST
, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
378 VLC_ML_GET_GENRE
, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
379 VLC_ML_GET_SHOW
, /**< arg1: Show ID; ret: vlc_ml_show_t* */
380 VLC_ML_GET_PLAYLIST
, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
383 enum vlc_ml_list_queries
385 /* General listing: */
387 VLC_ML_LIST_VIDEOS
, /**< arg1 (out): vlc_ml_media_list_t** */
388 VLC_ML_COUNT_VIDEOS
, /**< arg1 (out): size_t* */
389 VLC_ML_LIST_AUDIOS
, /**< arg1 (out): vlc_ml_media_list_t** */
390 VLC_ML_COUNT_AUDIOS
, /**< arg1 (out): size_t* */
391 VLC_ML_LIST_ALBUMS
, /**< arg1 (out): vlc_ml_album_list_t** */
392 VLC_ML_COUNT_ALBUMS
, /**< arg1 (out): size_t* */
393 VLC_ML_LIST_GENRES
, /**< arg1 (out): vlc_ml_genre_list_t** */
394 VLC_ML_COUNT_GENRES
, /**< arg1 (out): size_t* */
395 VLC_ML_LIST_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
396 VLC_ML_COUNT_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): size_t* */
397 VLC_ML_LIST_SHOWS
, /**< arg1 (out): vlc_ml_show_list_t** */
398 VLC_ML_COUNT_SHOWS
, /**< arg1 (out): size_t* */
399 VLC_ML_LIST_PLAYLISTS
, /**< arg1 (out): vlc_ml_playlist_list_t** */
400 VLC_ML_COUNT_PLAYLISTS
, /**< arg1 (out): size_t* */
401 VLC_ML_LIST_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
402 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
403 VLC_ML_COUNT_STREAM_HISTORY
, /**< arg1 (out): size_t* */
405 /* Album specific listings */
406 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
407 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
408 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
409 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
411 /* Artist specific listings */
412 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
413 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
414 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
415 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
417 /* Genre specific listings */
418 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
419 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
420 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
421 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
422 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
423 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
425 /* Show specific listings */
426 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
427 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
429 /* Media specific listings */
430 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
431 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
432 VLC_ML_LIST_MEDIA_BOOKMARKS
, /**< arg1: media id; arg2 (out): vlc_ml_bookmark_list_t** */
434 /* Playlist specific listings */
435 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
436 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
438 /* Children entities listing */
439 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
440 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
441 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
442 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
443 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
444 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
447 enum vlc_ml_parent_type
449 VLC_ML_PARENT_UNKNOWN
,
451 VLC_ML_PARENT_ARTIST
,
454 VLC_ML_PARENT_PLAYLIST
,
459 /* Adds a folder to discover through the medialibrary */
460 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
461 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
462 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
463 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
464 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
465 VLC_ML_IS_INDEXED
, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
467 * Reload a specific folder, or all.
468 * arg1: mrl (const char*), NULL to reload all folders
471 VLC_ML_RELOAD_FOLDER
,
473 /* Pause/resume background operations, such as media discovery & media analysis */
474 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
475 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
477 /* Misc operations */
478 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
481 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
482 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
484 /* Media management */
485 VLC_ML_MEDIA_UPDATE_PROGRESS
, /**< arg1: media id; arg2: playback position; can fail */
486 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: char**; */
487 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: const char*; */
488 VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2(out): vlc_ml_playback_states_all* */
489 VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2: const vlc_ml_playback_states_all* */
490 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
491 VLC_ML_MEDIA_GENERATE_THUMBNAIL
, /**< arg1: media id; arg2: vlc_ml_thumbnail_size_t; arg3: width; arg4: height; arg5: position */
492 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
493 VLC_ML_MEDIA_SET_TYPE
, /**< arg1: media id; arg2: vlc_ml_media_type_t */
494 VLC_ML_MEDIA_ADD_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
495 VLC_ML_MEDIA_REMOVE_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
496 VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, /**< arg1: media id */
497 VLC_ML_MEDIA_UPDATE_BOOKMARK
, /**< arg1: media id; arg2: int64_t; arg3: const char*; arg4: const char* */
501 * User playback settings.
502 * All values/units are up to the caller and are not interpreted by the media
504 * All values are stored and returned as strings.
505 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_STATE,
506 * the value will be returned stored in the provided char**. If the state was
507 * not set yet, NULL will be returned.
508 * When setting a state, NULL can be provided as a value to unset it.
510 enum vlc_ml_playback_state
512 VLC_ML_PLAYBACK_STATE_RATING
,
513 VLC_ML_PLAYBACK_STATE_SPEED
,
514 VLC_ML_PLAYBACK_STATE_TITLE
,
515 VLC_ML_PLAYBACK_STATE_CHAPTER
,
516 VLC_ML_PLAYBACK_STATE_PROGRAM
,
517 VLC_ML_PLAYBACK_STATE_SEEN
,
518 VLC_ML_PLAYBACK_STATE_VIDEO_TRACK
,
519 VLC_ML_PLAYBACK_STATE_ASPECT_RATIO
,
520 VLC_ML_PLAYBACK_STATE_ZOOM
,
521 VLC_ML_PLAYBACK_STATE_CROP
,
522 VLC_ML_PLAYBACK_STATE_DEINTERLACE
,
523 VLC_ML_PLAYBACK_STATE_VIDEO_FILTER
,
524 VLC_ML_PLAYBACK_STATE_AUDIO_TRACK
,
525 VLC_ML_PLAYBACK_STATE_GAIN
,
526 VLC_ML_PLAYBACK_STATE_AUDIO_DELAY
,
527 VLC_ML_PLAYBACK_STATE_SUBTITLE_TRACK
,
528 VLC_ML_PLAYBACK_STATE_SUBTITLE_DELAY
,
529 VLC_ML_PLAYBACK_STATE_APP_SPECIFIC
,
532 typedef struct vlc_ml_playback_states_all
537 char* current_video_track
;
538 char* current_audio_track
;
539 char *current_subtitle_track
;
544 } vlc_ml_playback_states_all
;
546 enum vlc_ml_event_type
549 * Entity modification callbacks. The affected entity will be passed:
550 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
551 * entity, in vlc_ml_event_t::modification::p_<type>
552 * for ADDED and UPDATED variants.
553 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
554 * When _DELETED callbacks get invoked, the entity will already have been
555 * deleted from the database, and cannot be retrieved anymore
557 VLC_ML_EVENT_MEDIA_ADDED
,
558 VLC_ML_EVENT_MEDIA_UPDATED
,
559 VLC_ML_EVENT_MEDIA_DELETED
,
560 VLC_ML_EVENT_ARTIST_ADDED
,
561 VLC_ML_EVENT_ARTIST_UPDATED
,
562 VLC_ML_EVENT_ARTIST_DELETED
,
563 VLC_ML_EVENT_ALBUM_ADDED
,
564 VLC_ML_EVENT_ALBUM_UPDATED
,
565 VLC_ML_EVENT_ALBUM_DELETED
,
566 VLC_ML_EVENT_PLAYLIST_ADDED
,
567 VLC_ML_EVENT_PLAYLIST_UPDATED
,
568 VLC_ML_EVENT_PLAYLIST_DELETED
,
569 VLC_ML_EVENT_GENRE_ADDED
,
570 VLC_ML_EVENT_GENRE_UPDATED
,
571 VLC_ML_EVENT_GENRE_DELETED
,
572 VLC_ML_EVENT_BOOKMARKS_ADDED
,
573 VLC_ML_EVENT_BOOKMARKS_UPDATED
,
574 VLC_ML_EVENT_BOOKMARKS_DELETED
,
576 * A discovery started.
577 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
578 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
579 * VLC_ML_EVENT_DISCOVERY_PROGRESS events.
580 * The entry point being discovered is stored in
581 * vlc_ml_event_t::discovery_started::psz_entry_point.
583 VLC_ML_EVENT_DISCOVERY_STARTED
,
585 * Sent when a discovery or reload operation starts analyzing a new folder.
586 * The discovered entry point is stored in
587 * vlc_ml_event_t::discovery_progress::psz_entry_point.
589 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
591 * Sent when an entry point discovery is completed.
592 * The entry point that was being discovered is stored in
593 * vlc_ml_event_t::discovery_completed::psz_entry_point.
594 * The success or failure state is stored in
595 * vlc_ml_event_t::discovery_completed::b_success
597 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
599 * An entry point reload operation started.
600 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
601 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
602 * The entry point being reloaded is stored in
603 * vlc_ml_event_t::reload_started::psz_entry_point.
605 VLC_ML_EVENT_RELOAD_STARTED
,
607 * Sent when an entry point reload is completed.
608 * The entry point that was being reloaded is stored in
609 * vlc_ml_event_t::reload_completed::psz_entry_point.
610 * The success or failure state is stored in
611 * vlc_ml_event_t::reload_completed::b_success
613 VLC_ML_EVENT_RELOAD_COMPLETED
,
615 * Sent when a new entry point gets added to the database.
616 * The entry point that was added is stored in
617 * vlc::ml_event_t::entry_point_added::psz_entry_point, and the success or failure
618 * state is stored in vlc_ml_event_t::entry_point_added::b_success
619 * If successful, this event won't be emited again for this entry point.
620 * In case of failure, this event will be fired again if the same entry point
621 * is queued for discovery again.
623 VLC_ML_EVENT_ENTRY_POINT_ADDED
,
625 * Sent when an entry point removal request has been processed.
626 * The removed entry point is stored in
627 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
628 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
630 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
632 * Sent when an entry point ban request has been processed.
633 * The banned entry point is stored in
634 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
635 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
637 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
639 * Sent when an entry point unban request has been processed.
640 * The unbanned entry point is stored in
641 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
642 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
644 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
646 * Sent when a discoverer or parser threads changes its idle state.
647 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
648 * False means at least one background thread is in running, true means
649 * both discoverer & parser threads are paused.
651 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
653 * Sent when the parsing progress percentage gets updated.
654 * The percentage is stored as a [0;100] integer, in
655 * vlc_ml_event_t::parsing_progress::i_percent
656 * This value might decrease as more media get discovered, but it will only
657 * increase once all discovery operations are completed.
659 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
661 * Sent after a media thumbnail was generated, or if it's generation failed.
662 * The media is stored in vlc_ml_event_t::media_thumbnail_generated::p_media
663 * and the success state is stored in
664 * vlc_ml_event_t::media_thumbnail_generated::b_success
666 VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED
,
668 * Sent after the history gets changed. It can be either cleaned, or simply
669 * modified because a media was recently played/removed from the history.
670 * The history type (media/network) is stored in
671 * vlc_ml_event_t::history_changed::history_type
673 VLC_ML_EVENT_HISTORY_CHANGED
,
675 * Sent when an application requested rescan starts being processed.
677 VLC_ML_EVENT_RESCAN_STARTED
,
680 typedef struct vlc_ml_event_t
687 const char* psz_entry_point
;
691 const char* psz_entry_point
;
692 } discovery_progress
;
695 const char* psz_entry_point
;
697 } discovery_completed
;
700 const char* psz_entry_point
;
704 const char* psz_entry_point
;
709 const char* psz_entry_point
;
714 const char* psz_entry_point
;
716 } entry_point_removed
;
719 const char* psz_entry_point
;
721 } entry_point_banned
;
724 const char* psz_entry_point
;
726 } entry_point_unbanned
;
733 const vlc_ml_media_t
* p_media
;
734 const vlc_ml_artist_t
* p_artist
;
735 const vlc_ml_album_t
* p_album
;
736 const vlc_ml_playlist_t
* p_playlist
;
737 const vlc_ml_genre_t
* p_genre
;
738 const vlc_ml_bookmark_t
* p_bookmark
;
751 } background_idle_changed
;
754 const vlc_ml_media_t
* p_media
;
755 vlc_ml_thumbnail_size_t i_size
;
757 } media_thumbnail_generated
;
760 vlc_ml_history_type_t history_type
;
765 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
767 typedef struct vlc_medialibrary_callbacks_t
769 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
770 } vlc_medialibrary_callbacks_t
;
772 struct vlc_medialibrary_module_t
774 struct vlc_object_t obj
;
780 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
782 * List some entities from the medialibrary.
784 * \param p_ml The medialibrary module instance.
785 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
786 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
787 * the default parameters (alphabetical ascending sort, no pagination)
789 * \return VLC_SUCCESS or an error code
791 * Refer to the individual list of vlc_ml_list requests for the additional
792 * per-query input/ouput parameters values & types
794 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
795 const vlc_ml_query_params_t
* p_params
, va_list args
);
798 * Get a specific entity by its id or another unique value
800 * \return The required entity, or a NULL pointer if couldn't be found.
802 * Refer to the list of queries for the specific return type
804 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
806 const vlc_medialibrary_callbacks_t
* cbs
;
809 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
810 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
812 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
813 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
815 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
816 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
817 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
818 const vlc_ml_query_params_t
* p_params
, ... );
821 * \brief Registers a medialibrary callback.
822 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
824 VLC_API vlc_ml_event_callback_t
*
825 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
828 * \brief Unregisters a medialibrary callback
829 * \param p_handle The handled returned by vlc_ml_register_callback
831 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
832 vlc_ml_event_callback_t
* p_callback
);
834 * \brief Unregisters a medialibrary callback from the said callback.
835 * \param p_callback The handle returned by vlc_ml_register_callback
837 * This must only be called synchronously from the callback function provided to
838 * vlc_ml_event_register_callback
839 * The p_callback handle must be considered invalid when this function returns
841 VLC_API
void vlc_ml_event_unregister_from_callback( vlc_medialibrary_t
* p_ml
,
842 vlc_ml_event_callback_t
* p_callback
);
845 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
846 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
847 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
848 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
849 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
850 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
852 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
853 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
854 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
855 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
856 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
857 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
858 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
859 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
860 VLC_API
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t
* p_list
);
861 VLC_API
void vlc_ml_playback_states_all_release( vlc_ml_playback_states_all
* prefs
);
862 VLC_API
void vlc_ml_bookmark_release( vlc_ml_bookmark_t
* p_bookmark
);
863 VLC_API
void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t
* p_list
);
865 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
867 return (vlc_ml_query_params_t
) {
871 .i_sort
= VLC_ML_SORTING_DEFAULT
,
876 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
878 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
881 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
883 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
886 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
888 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
891 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
893 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
896 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
897 vlc_ml_entry_point_list_t
** pp_entrypoints
)
899 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
);
902 static inline int vlc_ml_is_indexed( vlc_medialibrary_t
* p_ml
,
903 const char* psz_mrl
, bool* p_res
)
905 return vlc_ml_control( p_ml
, VLC_ML_IS_INDEXED
, psz_mrl
, p_res
);
908 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
910 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
913 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
915 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
918 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
920 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
923 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
925 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
928 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
931 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
936 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
939 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
944 static inline int vlc_ml_media_update_progress( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
947 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_PROGRESS
, i_media_id
, progress
);
950 static inline int vlc_ml_media_get_playback_state( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int i_state
, char** ppsz_result
)
952 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, ppsz_result
);
955 static inline int vlc_ml_media_set_playback_state( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int i_state
, const char* psz_value
)
957 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, psz_value
);
960 static inline int vlc_ml_media_get_all_playback_pref( vlc_medialibrary_t
* p_ml
,
962 vlc_ml_playback_states_all
* prefs
)
964 return vlc_ml_control( p_ml
,VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
967 static inline int vlc_ml_media_set_all_playback_states( vlc_medialibrary_t
* p_ml
,
969 const vlc_ml_playback_states_all
* prefs
)
971 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
974 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
975 const char* psz_mrl
, vlc_ml_thumbnail_size_t sizeType
)
977 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
, sizeType
);
980 static inline int vlc_ml_media_generate_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
981 vlc_ml_thumbnail_size_t size_type
,
982 uint32_t i_desired_width
,
983 uint32_t i_desired_height
,
986 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GENERATE_THUMBNAIL
, i_media_id
,
987 size_type
, i_desired_width
, i_desired_height
, position
);
990 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
991 const char* psz_mrl
, int i_type
)
993 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
996 static inline int vlc_ml_media_set_type( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
997 vlc_ml_media_type_t i_type
)
999 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_TYPE
, i_media_id
, (int)i_type
);
1002 static inline vlc_ml_bookmark_list_t
*
1003 vlc_ml_list_media_bookmarks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
,
1004 int64_t i_media_id
)
1006 assert( p_ml
!= NULL
);
1007 vlc_ml_bookmark_list_t
* res
;
1008 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_BOOKMARKS
, params
, i_media_id
,
1009 &res
) != VLC_SUCCESS
)
1015 vlc_ml_media_add_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1017 assert( p_ml
!= NULL
);
1018 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_BOOKMARK
, i_media_id
, i_time
);
1022 vlc_ml_media_remove_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1024 assert( p_ml
!= NULL
);
1025 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_BOOKMARK
, i_media_id
, i_time
);
1029 vlc_ml_media_update_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1030 int64_t i_time
, const char* psz_name
,
1031 const char* psz_desc
)
1033 assert( p_ml
!= NULL
);
1034 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_BOOKMARK
, i_media_id
,
1035 i_time
, psz_name
, psz_desc
);
1039 vlc_ml_media_remove_all_bookmarks( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1041 assert( p_ml
!= NULL
);
1042 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, i_media_id
);
1045 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1047 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
1050 static inline vlc_ml_media_t
* vlc_ml_get_media_by_mrl( vlc_medialibrary_t
* p_ml
,
1051 const char* psz_mrl
)
1053 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA_BY_MRL
, psz_mrl
);
1056 static inline input_item_t
* vlc_ml_get_input_item( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1058 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM
, i_media_id
);
1061 static inline input_item_t
* vlc_ml_get_input_item_by_mrl( vlc_medialibrary_t
* p_ml
,
1062 const char* psz_mrl
)
1064 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM_BY_MRL
, psz_mrl
);
1067 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
1069 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
1072 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
1074 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
1077 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
1079 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
1082 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
1084 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
1087 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
1089 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
1092 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
)
1094 vlc_assert( p_ml
!= NULL
);
1095 vlc_ml_media_list_t
* res
;
1096 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1101 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
)
1103 vlc_assert( p_ml
!= NULL
);
1105 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1110 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
)
1112 vlc_assert( p_ml
!= NULL
);
1113 vlc_ml_artist_list_t
* res
;
1114 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1119 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
)
1121 vlc_assert( p_ml
!= NULL
);
1123 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1128 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
)
1130 vlc_assert( p_ml
!= NULL
);
1131 vlc_ml_album_list_t
* res
;
1132 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1137 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
)
1139 vlc_assert( p_ml
!= NULL
);
1141 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1146 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
)
1148 vlc_assert( p_ml
!= NULL
);
1149 vlc_ml_media_list_t
* res
;
1150 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1155 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
)
1157 vlc_assert( p_ml
!= NULL
);
1159 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1164 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
)
1166 vlc_assert( p_ml
!= NULL
);
1167 vlc_ml_media_list_t
* res
;
1168 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1173 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
)
1175 vlc_assert( p_ml
!= NULL
);
1177 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1182 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
)
1184 vlc_assert( p_ml
!= NULL
);
1185 vlc_ml_album_list_t
* res
;
1186 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1191 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
)
1193 vlc_assert( p_ml
!= NULL
);
1195 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1200 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
)
1202 vlc_assert( p_ml
!= NULL
);
1203 vlc_ml_media_list_t
* res
;
1204 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1209 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
)
1211 vlc_assert( p_ml
!= NULL
);
1213 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1218 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1220 vlc_assert( p_ml
!= NULL
);
1221 vlc_ml_media_list_t
* res
;
1222 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
1227 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1229 vlc_assert( p_ml
!= NULL
);
1231 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
1236 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1238 vlc_assert( p_ml
!= NULL
);
1239 vlc_ml_media_list_t
* res
;
1240 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1245 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1247 vlc_assert( p_ml
!= NULL
);
1249 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1254 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1256 vlc_assert( p_ml
!= NULL
);
1257 vlc_ml_album_list_t
* res
;
1258 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1263 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1265 vlc_assert( p_ml
!= NULL
);
1267 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1272 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1274 vlc_assert( p_ml
!= NULL
);
1275 vlc_ml_genre_list_t
* res
;
1276 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1281 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1283 vlc_assert( p_ml
!= NULL
);
1285 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1291 * @brief vlc_ml_list_artists
1292 * @param params Query parameters, or NULL for the default
1293 * @param b_include_all True if you wish to fetch artists without at least one album.
1296 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
)
1298 vlc_assert( p_ml
!= NULL
);
1299 vlc_ml_artist_list_t
* res
;
1300 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1305 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1307 vlc_assert( p_ml
!= NULL
);
1309 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1314 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1316 vlc_assert( p_ml
!= NULL
);
1317 vlc_ml_show_list_t
* res
;
1318 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1323 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1325 vlc_assert( p_ml
!= NULL
);
1327 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1332 static inline vlc_ml_artist_list_t
* vlc_ml_list_genre_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, int64_t i_genre_id
)
1334 vlc_assert( p_ml
!= NULL
);
1335 vlc_ml_artist_list_t
* res
;
1336 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1341 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
)
1343 vlc_assert( p_ml
!= NULL
);
1345 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1350 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
)
1352 vlc_assert( p_ml
!= NULL
);
1353 vlc_ml_media_list_t
* res
;
1354 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1359 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
)
1361 vlc_assert( p_ml
!= NULL
);
1363 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1368 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
)
1370 vlc_assert( p_ml
!= NULL
);
1371 vlc_ml_album_list_t
* res
;
1372 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1377 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
)
1379 vlc_assert( p_ml
!= NULL
);
1381 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1386 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
)
1388 vlc_assert( p_ml
!= NULL
);
1389 vlc_ml_media_list_t
* res
;
1390 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1395 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
)
1397 vlc_assert( p_ml
!= NULL
);
1399 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1404 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
)
1406 vlc_assert( p_ml
!= NULL
);
1407 vlc_ml_label_list_t
* res
;
1408 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1413 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
)
1415 vlc_assert( p_ml
!= NULL
);
1417 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1422 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1424 vlc_assert( p_ml
!= NULL
);
1425 vlc_ml_media_list_t
* res
;
1426 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1431 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1433 vlc_assert( p_ml
!= NULL
);
1434 vlc_ml_media_list_t
* res
;
1435 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1440 static inline size_t vlc_ml_count_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1442 vlc_assert( p_ml
!= NULL
);
1444 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_STREAM_HISTORY
, params
, &count
) != VLC_SUCCESS
)
1449 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1451 vlc_assert( p_ml
!= NULL
);
1452 vlc_ml_playlist_list_t
* res
;
1453 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1458 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1460 vlc_assert( p_ml
!= NULL
);
1462 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1467 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
)
1469 vlc_assert( p_ml
!= NULL
);
1470 vlc_ml_media_list_t
* res
;
1471 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLIST_MEDIA
, params
, i_playlist_id
, &res
) != VLC_SUCCESS
)
1476 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
)
1478 vlc_assert( p_ml
!= NULL
);
1480 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLIST_MEDIA
, params
, i_playlist_id
, &count
) != VLC_SUCCESS
)
1490 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1491 vlc_ml_show_t*: vlc_ml_show_release, \
1492 vlc_ml_artist_t*: vlc_ml_artist_release, \
1493 vlc_ml_album_t*: vlc_ml_album_release, \
1494 vlc_ml_genre_t*: vlc_ml_genre_release, \
1495 vlc_ml_media_t*: vlc_ml_media_release, \
1496 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1497 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1498 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1499 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1500 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1501 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1502 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1503 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1504 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
1505 vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release, \
1506 vlc_ml_playback_states_all*: vlc_ml_playback_states_all_release, \
1507 vlc_ml_bookmark_t*: vlc_ml_bookmark_release, \
1508 vlc_ml_bookmark_list_t*: vlc_ml_bookmark_list_release \
1511 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1512 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1513 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1514 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1515 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1516 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1517 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1518 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1519 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1520 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1521 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1522 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1523 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1524 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1525 static inline void vlc_ml_release( vlc_ml_entry_point_list_t
* list
) { vlc_ml_entry_point_list_release( list
); }
1526 static inline void vlc_ml_release( vlc_ml_playback_states_all
* prefs
) { vlc_ml_playback_states_all_release( prefs
); }
1527 static inline void vlc_ml_release( vlc_ml_bookmark_t
* bookmark
) { vlc_ml_bookmark_release( bookmark
); }
1528 static inline void vlc_ml_release( vlc_ml_bookmark_list_t
* list
) { vlc_ml_bookmark_list_release( list
); }
1531 #endif /* VLC_MEDIA_LIBRARY_H */