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_COUNT_HISTORY
, /**< arg1 (out): size_t* */
403 VLC_ML_LIST_HISTORY_BY_TYPE
, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t** */
404 VLC_ML_COUNT_HISTORY_BY_TYPE
, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t***/
405 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
406 VLC_ML_COUNT_STREAM_HISTORY
, /**< arg1 (out): size_t* */
408 /* Album specific listings */
409 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
410 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
411 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
412 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
414 /* Artist specific listings */
415 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
416 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
417 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
418 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
420 /* Genre specific listings */
421 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
422 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
423 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
424 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
425 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
426 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
428 /* Show specific listings */
429 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
430 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
432 /* Media specific listings */
433 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
434 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
435 VLC_ML_LIST_MEDIA_BOOKMARKS
, /**< arg1: media id; arg2 (out): vlc_ml_bookmark_list_t** */
437 /* Playlist specific listings */
438 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
439 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
441 /* Children entities listing */
442 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
443 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
444 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
445 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
446 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
447 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
450 enum vlc_ml_parent_type
452 VLC_ML_PARENT_UNKNOWN
,
454 VLC_ML_PARENT_ARTIST
,
457 VLC_ML_PARENT_PLAYLIST
,
462 /* Adds a folder to discover through the medialibrary */
463 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
464 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
465 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
466 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
467 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
468 VLC_ML_IS_INDEXED
, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
470 * Reload a specific folder, or all.
471 * arg1: mrl (const char*), NULL to reload all folders
474 VLC_ML_RELOAD_FOLDER
,
476 /* Pause/resume background operations, such as media discovery & media analysis */
477 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
478 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
480 /* Misc operations */
481 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
484 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
485 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
487 /* Media management */
488 VLC_ML_MEDIA_UPDATE_PROGRESS
, /**< arg1: media id; arg2: playback position; can fail */
489 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: char**; */
490 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: const char*; */
491 VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2(out): vlc_ml_playback_states_all* */
492 VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2: const vlc_ml_playback_states_all* */
493 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
494 VLC_ML_MEDIA_GENERATE_THUMBNAIL
, /**< arg1: media id; arg2: vlc_ml_thumbnail_size_t; arg3: width; arg4: height; arg5: position */
495 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
496 VLC_ML_MEDIA_SET_TYPE
, /**< arg1: media id; arg2: vlc_ml_media_type_t */
497 VLC_ML_MEDIA_ADD_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
498 VLC_ML_MEDIA_REMOVE_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
499 VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, /**< arg1: media id */
500 VLC_ML_MEDIA_UPDATE_BOOKMARK
, /**< arg1: media id; arg2: int64_t; arg3: const char*; arg4: const char* */
504 * User playback settings.
505 * All values/units are up to the caller and are not interpreted by the media
507 * All values are stored and returned as strings.
508 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_STATE,
509 * the value will be returned stored in the provided char**. If the state was
510 * not set yet, NULL will be returned.
511 * When setting a state, NULL can be provided as a value to unset it.
513 enum vlc_ml_playback_state
515 VLC_ML_PLAYBACK_STATE_RATING
,
516 VLC_ML_PLAYBACK_STATE_SPEED
,
517 VLC_ML_PLAYBACK_STATE_TITLE
,
518 VLC_ML_PLAYBACK_STATE_CHAPTER
,
519 VLC_ML_PLAYBACK_STATE_PROGRAM
,
520 VLC_ML_PLAYBACK_STATE_SEEN
,
521 VLC_ML_PLAYBACK_STATE_VIDEO_TRACK
,
522 VLC_ML_PLAYBACK_STATE_ASPECT_RATIO
,
523 VLC_ML_PLAYBACK_STATE_ZOOM
,
524 VLC_ML_PLAYBACK_STATE_CROP
,
525 VLC_ML_PLAYBACK_STATE_DEINTERLACE
,
526 VLC_ML_PLAYBACK_STATE_VIDEO_FILTER
,
527 VLC_ML_PLAYBACK_STATE_AUDIO_TRACK
,
528 VLC_ML_PLAYBACK_STATE_GAIN
,
529 VLC_ML_PLAYBACK_STATE_AUDIO_DELAY
,
530 VLC_ML_PLAYBACK_STATE_SUBTITLE_TRACK
,
531 VLC_ML_PLAYBACK_STATE_SUBTITLE_DELAY
,
532 VLC_ML_PLAYBACK_STATE_APP_SPECIFIC
,
535 typedef struct vlc_ml_playback_states_all
540 char* current_video_track
;
541 char* current_audio_track
;
542 char *current_subtitle_track
;
547 } vlc_ml_playback_states_all
;
549 enum vlc_ml_event_type
552 * Entity modification callbacks. The affected entity will be passed:
553 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
554 * entity, in vlc_ml_event_t::modification::p_<type>
555 * for ADDED and UPDATED variants.
556 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
557 * When _DELETED callbacks get invoked, the entity will already have been
558 * deleted from the database, and cannot be retrieved anymore
560 VLC_ML_EVENT_MEDIA_ADDED
,
561 VLC_ML_EVENT_MEDIA_UPDATED
,
562 VLC_ML_EVENT_MEDIA_DELETED
,
563 VLC_ML_EVENT_ARTIST_ADDED
,
564 VLC_ML_EVENT_ARTIST_UPDATED
,
565 VLC_ML_EVENT_ARTIST_DELETED
,
566 VLC_ML_EVENT_ALBUM_ADDED
,
567 VLC_ML_EVENT_ALBUM_UPDATED
,
568 VLC_ML_EVENT_ALBUM_DELETED
,
569 VLC_ML_EVENT_PLAYLIST_ADDED
,
570 VLC_ML_EVENT_PLAYLIST_UPDATED
,
571 VLC_ML_EVENT_PLAYLIST_DELETED
,
572 VLC_ML_EVENT_GENRE_ADDED
,
573 VLC_ML_EVENT_GENRE_UPDATED
,
574 VLC_ML_EVENT_GENRE_DELETED
,
575 VLC_ML_EVENT_BOOKMARKS_ADDED
,
576 VLC_ML_EVENT_BOOKMARKS_UPDATED
,
577 VLC_ML_EVENT_BOOKMARKS_DELETED
,
579 * A discovery started.
580 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
581 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
582 * VLC_ML_EVENT_DISCOVERY_PROGRESS events.
583 * The entry point being discovered is stored in
584 * vlc_ml_event_t::discovery_started::psz_entry_point.
586 VLC_ML_EVENT_DISCOVERY_STARTED
,
588 * Sent when a discovery or reload operation starts analyzing a new folder.
589 * The discovered entry point is stored in
590 * vlc_ml_event_t::discovery_progress::psz_entry_point.
592 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
594 * Sent when an entry point discovery is completed.
595 * The entry point that was being discovered is stored in
596 * vlc_ml_event_t::discovery_completed::psz_entry_point.
597 * The success or failure state is stored in
598 * vlc_ml_event_t::discovery_completed::b_success
600 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
602 * An entry point reload operation started.
603 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
604 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
605 * The entry point being reloaded is stored in
606 * vlc_ml_event_t::reload_started::psz_entry_point.
608 VLC_ML_EVENT_RELOAD_STARTED
,
610 * Sent when an entry point reload is completed.
611 * The entry point that was being reloaded is stored in
612 * vlc_ml_event_t::reload_completed::psz_entry_point.
613 * The success or failure state is stored in
614 * vlc_ml_event_t::reload_completed::b_success
616 VLC_ML_EVENT_RELOAD_COMPLETED
,
618 * Sent when a new entry point gets added to the database.
619 * The entry point that was added is stored in
620 * vlc::ml_event_t::entry_point_added::psz_entry_point, and the success or failure
621 * state is stored in vlc_ml_event_t::entry_point_added::b_success
622 * If successful, this event won't be emited again for this entry point.
623 * In case of failure, this event will be fired again if the same entry point
624 * is queued for discovery again.
626 VLC_ML_EVENT_ENTRY_POINT_ADDED
,
628 * Sent when an entry point removal request has been processed.
629 * The removed entry point is stored in
630 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
631 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
633 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
635 * Sent when an entry point ban request has been processed.
636 * The banned entry point is stored in
637 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
638 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
640 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
642 * Sent when an entry point unban request has been processed.
643 * The unbanned entry point is stored in
644 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
645 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
647 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
649 * Sent when a discoverer or parser threads changes its idle state.
650 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
651 * False means at least one background thread is in running, true means
652 * both discoverer & parser threads are paused.
654 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
656 * Sent when the parsing progress percentage gets updated.
657 * The percentage is stored as a [0;100] integer, in
658 * vlc_ml_event_t::parsing_progress::i_percent
659 * This value might decrease as more media get discovered, but it will only
660 * increase once all discovery operations are completed.
662 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
664 * Sent after a media thumbnail was generated, or if it's generation failed.
665 * The media is stored in vlc_ml_event_t::media_thumbnail_generated::p_media
666 * and the success state is stored in
667 * vlc_ml_event_t::media_thumbnail_generated::b_success
669 VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED
,
671 * Sent after the history gets changed. It can be either cleaned, or simply
672 * modified because a media was recently played/removed from the history.
673 * The history type (media/network) is stored in
674 * vlc_ml_event_t::history_changed::history_type
676 VLC_ML_EVENT_HISTORY_CHANGED
,
678 * Sent when an application requested rescan starts being processed.
680 VLC_ML_EVENT_RESCAN_STARTED
,
683 typedef struct vlc_ml_event_t
690 const char* psz_entry_point
;
694 const char* psz_entry_point
;
695 } discovery_progress
;
698 const char* psz_entry_point
;
700 } discovery_completed
;
703 const char* psz_entry_point
;
707 const char* psz_entry_point
;
712 const char* psz_entry_point
;
717 const char* psz_entry_point
;
719 } entry_point_removed
;
722 const char* psz_entry_point
;
724 } entry_point_banned
;
727 const char* psz_entry_point
;
729 } entry_point_unbanned
;
736 const vlc_ml_media_t
* p_media
;
737 const vlc_ml_artist_t
* p_artist
;
738 const vlc_ml_album_t
* p_album
;
739 const vlc_ml_playlist_t
* p_playlist
;
740 const vlc_ml_genre_t
* p_genre
;
741 const vlc_ml_bookmark_t
* p_bookmark
;
754 } background_idle_changed
;
757 const vlc_ml_media_t
* p_media
;
758 vlc_ml_thumbnail_size_t i_size
;
760 } media_thumbnail_generated
;
763 vlc_ml_history_type_t history_type
;
768 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
770 typedef struct vlc_medialibrary_callbacks_t
772 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
773 } vlc_medialibrary_callbacks_t
;
775 struct vlc_medialibrary_module_t
777 struct vlc_object_t obj
;
783 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
785 * List some entities from the medialibrary.
787 * \param p_ml The medialibrary module instance.
788 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
789 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
790 * the default parameters (alphabetical ascending sort, no pagination)
792 * \return VLC_SUCCESS or an error code
794 * Refer to the individual list of vlc_ml_list requests for the additional
795 * per-query input/ouput parameters values & types
797 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
798 const vlc_ml_query_params_t
* p_params
, va_list args
);
801 * Get a specific entity by its id or another unique value
803 * \return The required entity, or a NULL pointer if couldn't be found.
805 * Refer to the list of queries for the specific return type
807 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
809 const vlc_medialibrary_callbacks_t
* cbs
;
812 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
813 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
815 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
816 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
818 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
819 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
820 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
821 const vlc_ml_query_params_t
* p_params
, ... );
824 * \brief Registers a medialibrary callback.
825 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
827 VLC_API vlc_ml_event_callback_t
*
828 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
831 * \brief Unregisters a medialibrary callback
832 * \param p_handle The handled returned by vlc_ml_register_callback
834 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
835 vlc_ml_event_callback_t
* p_callback
);
837 * \brief Unregisters a medialibrary callback from the said callback.
838 * \param p_callback The handle returned by vlc_ml_register_callback
840 * This must only be called synchronously from the callback function provided to
841 * vlc_ml_event_register_callback
842 * The p_callback handle must be considered invalid when this function returns
844 VLC_API
void vlc_ml_event_unregister_from_callback( vlc_medialibrary_t
* p_ml
,
845 vlc_ml_event_callback_t
* p_callback
);
848 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
849 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
850 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
851 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
852 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
853 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
855 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
856 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
857 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
858 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
859 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
860 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
861 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
862 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
863 VLC_API
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t
* p_list
);
864 VLC_API
void vlc_ml_playback_states_all_release( vlc_ml_playback_states_all
* prefs
);
865 VLC_API
void vlc_ml_bookmark_release( vlc_ml_bookmark_t
* p_bookmark
);
866 VLC_API
void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t
* p_list
);
868 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
870 return (vlc_ml_query_params_t
) {
874 .i_sort
= VLC_ML_SORTING_DEFAULT
,
879 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
881 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
884 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
886 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
889 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
891 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
894 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
896 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
899 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
900 vlc_ml_entry_point_list_t
** pp_entrypoints
)
902 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
);
905 static inline int vlc_ml_is_indexed( vlc_medialibrary_t
* p_ml
,
906 const char* psz_mrl
, bool* p_res
)
908 return vlc_ml_control( p_ml
, VLC_ML_IS_INDEXED
, psz_mrl
, p_res
);
911 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
913 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
916 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
918 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
921 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
923 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
926 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
928 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
931 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
934 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
939 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
942 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
947 static inline int vlc_ml_media_update_progress( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
950 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_PROGRESS
, i_media_id
, progress
);
953 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
)
955 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, ppsz_result
);
958 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
)
960 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, psz_value
);
963 static inline int vlc_ml_media_get_all_playback_pref( vlc_medialibrary_t
* p_ml
,
965 vlc_ml_playback_states_all
* prefs
)
967 return vlc_ml_control( p_ml
,VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
970 static inline int vlc_ml_media_set_all_playback_states( vlc_medialibrary_t
* p_ml
,
972 const vlc_ml_playback_states_all
* prefs
)
974 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
977 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
978 const char* psz_mrl
, vlc_ml_thumbnail_size_t sizeType
)
980 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
, sizeType
);
983 static inline int vlc_ml_media_generate_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
984 vlc_ml_thumbnail_size_t size_type
,
985 uint32_t i_desired_width
,
986 uint32_t i_desired_height
,
989 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GENERATE_THUMBNAIL
, i_media_id
,
990 size_type
, i_desired_width
, i_desired_height
, position
);
993 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
994 const char* psz_mrl
, int i_type
)
996 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
999 static inline int vlc_ml_media_set_type( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1000 vlc_ml_media_type_t i_type
)
1002 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_TYPE
, i_media_id
, (int)i_type
);
1005 static inline vlc_ml_bookmark_list_t
*
1006 vlc_ml_list_media_bookmarks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
,
1007 int64_t i_media_id
)
1009 assert( p_ml
!= NULL
);
1010 vlc_ml_bookmark_list_t
* res
;
1011 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_BOOKMARKS
, params
, i_media_id
,
1012 &res
) != VLC_SUCCESS
)
1018 vlc_ml_media_add_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1020 assert( p_ml
!= NULL
);
1021 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_BOOKMARK
, i_media_id
, i_time
);
1025 vlc_ml_media_remove_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1027 assert( p_ml
!= NULL
);
1028 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_BOOKMARK
, i_media_id
, i_time
);
1032 vlc_ml_media_update_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1033 int64_t i_time
, const char* psz_name
,
1034 const char* psz_desc
)
1036 assert( p_ml
!= NULL
);
1037 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_BOOKMARK
, i_media_id
,
1038 i_time
, psz_name
, psz_desc
);
1042 vlc_ml_media_remove_all_bookmarks( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1044 assert( p_ml
!= NULL
);
1045 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, i_media_id
);
1048 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1050 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
1053 static inline vlc_ml_media_t
* vlc_ml_get_media_by_mrl( vlc_medialibrary_t
* p_ml
,
1054 const char* psz_mrl
)
1056 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA_BY_MRL
, psz_mrl
);
1059 static inline input_item_t
* vlc_ml_get_input_item( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1061 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM
, i_media_id
);
1064 static inline input_item_t
* vlc_ml_get_input_item_by_mrl( vlc_medialibrary_t
* p_ml
,
1065 const char* psz_mrl
)
1067 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM_BY_MRL
, psz_mrl
);
1070 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
1072 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
1075 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
1077 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
1080 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
1082 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
1085 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
1087 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
1090 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
1092 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
1095 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
)
1097 vlc_assert( p_ml
!= NULL
);
1098 vlc_ml_media_list_t
* res
;
1099 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1104 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
)
1106 vlc_assert( p_ml
!= NULL
);
1108 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1113 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
)
1115 vlc_assert( p_ml
!= NULL
);
1116 vlc_ml_artist_list_t
* res
;
1117 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1122 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
)
1124 vlc_assert( p_ml
!= NULL
);
1126 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1131 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
)
1133 vlc_assert( p_ml
!= NULL
);
1134 vlc_ml_album_list_t
* res
;
1135 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1140 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
)
1142 vlc_assert( p_ml
!= NULL
);
1144 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1149 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
)
1151 vlc_assert( p_ml
!= NULL
);
1152 vlc_ml_media_list_t
* res
;
1153 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1158 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
)
1160 vlc_assert( p_ml
!= NULL
);
1162 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1167 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
)
1169 vlc_assert( p_ml
!= NULL
);
1170 vlc_ml_media_list_t
* res
;
1171 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1176 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
)
1178 vlc_assert( p_ml
!= NULL
);
1180 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1185 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
)
1187 vlc_assert( p_ml
!= NULL
);
1188 vlc_ml_album_list_t
* res
;
1189 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1194 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
)
1196 vlc_assert( p_ml
!= NULL
);
1198 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1203 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
)
1205 vlc_assert( p_ml
!= NULL
);
1206 vlc_ml_media_list_t
* res
;
1207 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1212 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
)
1214 vlc_assert( p_ml
!= NULL
);
1216 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1221 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1223 vlc_assert( p_ml
!= NULL
);
1224 vlc_ml_media_list_t
* res
;
1225 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
1230 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1232 vlc_assert( p_ml
!= NULL
);
1234 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
1239 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( 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_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1248 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1250 vlc_assert( p_ml
!= NULL
);
1252 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1257 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1259 vlc_assert( p_ml
!= NULL
);
1260 vlc_ml_album_list_t
* res
;
1261 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1266 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1268 vlc_assert( p_ml
!= NULL
);
1270 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1275 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1277 vlc_assert( p_ml
!= NULL
);
1278 vlc_ml_genre_list_t
* res
;
1279 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1284 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1286 vlc_assert( p_ml
!= NULL
);
1288 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1294 * @brief vlc_ml_list_artists
1295 * @param params Query parameters, or NULL for the default
1296 * @param b_include_all True if you wish to fetch artists without at least one album.
1299 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
)
1301 vlc_assert( p_ml
!= NULL
);
1302 vlc_ml_artist_list_t
* res
;
1303 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1308 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1310 vlc_assert( p_ml
!= NULL
);
1312 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1317 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1319 vlc_assert( p_ml
!= NULL
);
1320 vlc_ml_show_list_t
* res
;
1321 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1326 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1328 vlc_assert( p_ml
!= NULL
);
1330 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1335 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
)
1337 vlc_assert( p_ml
!= NULL
);
1338 vlc_ml_artist_list_t
* res
;
1339 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1344 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
)
1346 vlc_assert( p_ml
!= NULL
);
1348 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1353 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
)
1355 vlc_assert( p_ml
!= NULL
);
1356 vlc_ml_media_list_t
* res
;
1357 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1362 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
)
1364 vlc_assert( p_ml
!= NULL
);
1366 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1371 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
)
1373 vlc_assert( p_ml
!= NULL
);
1374 vlc_ml_album_list_t
* res
;
1375 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1380 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
)
1382 vlc_assert( p_ml
!= NULL
);
1384 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1389 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
)
1391 vlc_assert( p_ml
!= NULL
);
1392 vlc_ml_media_list_t
* res
;
1393 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1398 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
)
1400 vlc_assert( p_ml
!= NULL
);
1402 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1407 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
)
1409 vlc_assert( p_ml
!= NULL
);
1410 vlc_ml_label_list_t
* res
;
1411 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1416 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
)
1418 vlc_assert( p_ml
!= NULL
);
1420 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1425 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1427 vlc_assert( p_ml
!= NULL
);
1428 vlc_ml_media_list_t
* res
;
1429 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1434 static inline size_t vlc_ml_count_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1436 vlc_assert( p_ml
!= NULL
);
1438 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_HISTORY
, params
, &count
) != VLC_SUCCESS
)
1444 static inline vlc_ml_media_list_t
* vlc_ml_list_history_by_type( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, vlc_ml_media_type_t type
)
1446 vlc_assert( p_ml
!= NULL
);
1447 vlc_ml_media_list_t
* res
;
1448 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY_BY_TYPE
, params
, (int)type
, &res
) != VLC_SUCCESS
)
1453 static inline size_t vlc_ml_count_history_by_type( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, vlc_ml_media_type_t type
)
1455 vlc_assert( p_ml
!= NULL
);
1457 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_HISTORY_BY_TYPE
, params
, (int)type
, &count
) != VLC_SUCCESS
)
1464 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1466 vlc_assert( p_ml
!= NULL
);
1467 vlc_ml_media_list_t
* res
;
1468 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1473 static inline size_t vlc_ml_count_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1475 vlc_assert( p_ml
!= NULL
);
1477 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_STREAM_HISTORY
, params
, &count
) != VLC_SUCCESS
)
1482 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1484 vlc_assert( p_ml
!= NULL
);
1485 vlc_ml_playlist_list_t
* res
;
1486 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1491 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1493 vlc_assert( p_ml
!= NULL
);
1495 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1500 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
)
1502 vlc_assert( p_ml
!= NULL
);
1503 vlc_ml_media_list_t
* res
;
1504 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLIST_MEDIA
, params
, i_playlist_id
, &res
) != VLC_SUCCESS
)
1509 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
)
1511 vlc_assert( p_ml
!= NULL
);
1513 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLIST_MEDIA
, params
, i_playlist_id
, &count
) != VLC_SUCCESS
)
1523 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1524 vlc_ml_show_t*: vlc_ml_show_release, \
1525 vlc_ml_artist_t*: vlc_ml_artist_release, \
1526 vlc_ml_album_t*: vlc_ml_album_release, \
1527 vlc_ml_genre_t*: vlc_ml_genre_release, \
1528 vlc_ml_media_t*: vlc_ml_media_release, \
1529 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1530 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1531 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1532 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1533 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1534 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1535 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1536 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1537 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
1538 vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release, \
1539 vlc_ml_playback_states_all*: vlc_ml_playback_states_all_release, \
1540 vlc_ml_bookmark_t*: vlc_ml_bookmark_release, \
1541 vlc_ml_bookmark_list_t*: vlc_ml_bookmark_list_release \
1544 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1545 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1546 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1547 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1548 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1549 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1550 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1551 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1552 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1553 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1554 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1555 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1556 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1557 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1558 static inline void vlc_ml_release( vlc_ml_entry_point_list_t
* list
) { vlc_ml_entry_point_list_release( list
); }
1559 static inline void vlc_ml_release( vlc_ml_playback_states_all
* prefs
) { vlc_ml_playback_states_all_release( prefs
); }
1560 static inline void vlc_ml_release( vlc_ml_bookmark_t
* bookmark
) { vlc_ml_bookmark_release( bookmark
); }
1561 static inline void vlc_ml_release( vlc_ml_bookmark_list_t
* list
) { vlc_ml_bookmark_list_release( list
); }
1564 #endif /* VLC_MEDIA_LIBRARY_H */