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
237 char* psz_artwork_mrl
;
239 uint32_t i_creation_date
;
244 typedef struct vlc_ml_artist_t
249 vlc_ml_thumbnail_t thumbnails
[VLC_ML_THUMBNAIL_SIZE_COUNT
];
252 unsigned int i_nb_album
;
253 unsigned int i_nb_tracks
;
256 typedef struct vlc_ml_artist_list_t
259 vlc_ml_artist_t p_items
[];
260 } vlc_ml_artist_list_t
;
262 typedef struct vlc_ml_album_t
{
266 vlc_ml_thumbnail_t thumbnails
[VLC_ML_THUMBNAIL_SIZE_COUNT
];
271 unsigned int i_duration
;
275 typedef struct vlc_ml_genre_t
282 typedef struct vlc_ml_media_list_t
285 vlc_ml_media_t p_items
[];
286 } vlc_ml_media_list_t
;
288 typedef struct vlc_ml_album_list_t
291 vlc_ml_album_t p_items
[];
292 } vlc_ml_album_list_t
;
294 typedef struct vlc_ml_show_list_t
297 vlc_ml_show_t p_items
[];
298 } vlc_ml_show_list_t
;
300 typedef struct vlc_ml_genre_list_t
303 vlc_ml_genre_t p_items
[];
304 } vlc_ml_genre_list_t
;
306 typedef struct vlc_ml_playlist_list_t
309 vlc_ml_playlist_t p_items
[];
310 } vlc_ml_playlist_list_t
;
312 typedef struct vlc_ml_entry_point_t
314 char* psz_mrl
; /**< This entrypoint's MRL. Will be NULL if b_present is false */
315 bool b_present
; /**< The presence state for this entrypoint. */
316 bool b_banned
; /**< Will be true if the user required this entrypoint to be excluded */
317 } vlc_ml_entry_point_t
;
319 typedef struct vlc_ml_entry_point_list_t
322 vlc_ml_entry_point_t p_items
[];
323 } vlc_ml_entry_point_list_t
;
325 typedef struct vlc_ml_bookmark_t
327 int64_t i_media_id
; /**< The associated media ID */
328 int64_t i_time
; /**< The bookmark time. The unit is arbitrary */
329 char* psz_name
; /**< The bookmark name */
330 char* psz_description
; /**< The bookmark description */
333 typedef struct vlc_ml_boomkmark_list_t
336 vlc_ml_bookmark_t p_items
[];
337 } vlc_ml_bookmark_list_t
;
339 /* Opaque medialibrary pointer, to be used by any non-medialibrary module */
340 typedef struct vlc_medialibrary_t vlc_medialibrary_t
;
341 /* "Private" medialibrary pointer, to be used by the core & medialibrary modules */
342 typedef struct vlc_medialibrary_module_t vlc_medialibrary_module_t
;
343 /* Opaque event callback type */
344 typedef struct vlc_ml_event_callback_t vlc_ml_event_callback_t
;
346 typedef enum vlc_ml_sorting_criteria_t
349 * Default depends on the entity type:
350 * - By track number (and disc number) for album tracks
351 * - Alphabetical order for others
353 VLC_ML_SORTING_DEFAULT
,
354 VLC_ML_SORTING_ALPHA
,
355 VLC_ML_SORTING_DURATION
,
356 VLC_ML_SORTING_INSERTIONDATE
,
357 VLC_ML_SORTING_LASTMODIFICATIONDATE
,
358 VLC_ML_SORTING_RELEASEDATE
,
359 VLC_ML_SORTING_FILESIZE
,
360 VLC_ML_SORTING_ARTIST
,
361 VLC_ML_SORTING_PLAYCOUNT
,
362 VLC_ML_SORTING_ALBUM
,
363 VLC_ML_SORTING_FILENAME
,
364 VLC_ML_SORTING_TRACKNUMBER
,
365 } vlc_ml_sorting_criteria_t
;
367 typedef struct vlc_ml_query_params_t vlc_ml_query_params_t
;
368 struct vlc_ml_query_params_t
370 const char* psz_pattern
;
371 uint32_t i_nbResults
;
373 vlc_ml_sorting_criteria_t i_sort
;
377 enum vlc_ml_get_queries
379 VLC_ML_GET_MEDIA
, /**< arg1: Media ID; ret: vlc_ml_media_t* */
380 VLC_ML_GET_MEDIA_BY_MRL
, /**< arg1: Media MRL; ret: vlc_ml_media_t* */
381 VLC_ML_GET_INPUT_ITEM
, /**< arg1: Media ID; ret: input_item_t* */
382 VLC_ML_GET_INPUT_ITEM_BY_MRL
,/**< arg1: Media MRL; ret: input_item_t* */
383 VLC_ML_GET_ALBUM
, /**< arg1: Album ID; ret: vlc_ml_album_t* */
384 VLC_ML_GET_ARTIST
, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
385 VLC_ML_GET_GENRE
, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
386 VLC_ML_GET_SHOW
, /**< arg1: Show ID; ret: vlc_ml_show_t* */
387 VLC_ML_GET_PLAYLIST
, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
390 enum vlc_ml_list_queries
392 /* General listing: */
394 VLC_ML_LIST_VIDEOS
, /**< arg1 (out): vlc_ml_media_list_t** */
395 VLC_ML_COUNT_VIDEOS
, /**< arg1 (out): size_t* */
396 VLC_ML_LIST_AUDIOS
, /**< arg1 (out): vlc_ml_media_list_t** */
397 VLC_ML_COUNT_AUDIOS
, /**< arg1 (out): size_t* */
398 VLC_ML_LIST_ALBUMS
, /**< arg1 (out): vlc_ml_album_list_t** */
399 VLC_ML_COUNT_ALBUMS
, /**< arg1 (out): size_t* */
400 VLC_ML_LIST_GENRES
, /**< arg1 (out): vlc_ml_genre_list_t** */
401 VLC_ML_COUNT_GENRES
, /**< arg1 (out): size_t* */
402 VLC_ML_LIST_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
403 VLC_ML_COUNT_ARTISTS
, /**< arg1 bool: includeAll; arg2 (out): size_t* */
404 VLC_ML_LIST_SHOWS
, /**< arg1 (out): vlc_ml_show_list_t** */
405 VLC_ML_COUNT_SHOWS
, /**< arg1 (out): size_t* */
406 VLC_ML_LIST_PLAYLISTS
, /**< arg1 (out): vlc_ml_playlist_list_t** */
407 VLC_ML_COUNT_PLAYLISTS
, /**< arg1 (out): size_t* */
408 VLC_ML_LIST_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
409 VLC_ML_COUNT_HISTORY
, /**< arg1 (out): size_t* */
410 VLC_ML_LIST_HISTORY_BY_TYPE
, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t** */
411 VLC_ML_COUNT_HISTORY_BY_TYPE
, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t***/
412 VLC_ML_LIST_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
413 VLC_ML_COUNT_STREAM_HISTORY
, /**< arg1 (out): size_t* */
415 /* Album specific listings */
416 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
417 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
418 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
419 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
421 /* Artist specific listings */
422 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
423 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
424 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
425 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
427 /* Genre specific listings */
428 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
429 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
430 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
431 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
432 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
433 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
435 /* Show specific listings */
436 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
437 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
439 /* Media specific listings */
440 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
441 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
442 VLC_ML_LIST_MEDIA_BOOKMARKS
, /**< arg1: media id; arg2 (out): vlc_ml_bookmark_list_t** */
444 /* Playlist specific listings */
445 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
446 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
448 /* Children entities listing */
449 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
450 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
451 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
452 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
453 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
454 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
457 enum vlc_ml_parent_type
459 VLC_ML_PARENT_UNKNOWN
,
461 VLC_ML_PARENT_ARTIST
,
464 VLC_ML_PARENT_PLAYLIST
,
469 /* Adds a folder to discover through the medialibrary */
470 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
471 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
472 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
473 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
474 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
475 VLC_ML_LIST_BANNED_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
476 VLC_ML_IS_INDEXED
, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
478 * Reload a specific folder, or all.
479 * arg1: mrl (const char*), NULL to reload all folders
482 VLC_ML_RELOAD_FOLDER
,
484 /* Pause/resume background operations, such as media discovery & media analysis */
485 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
486 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
488 /* Misc operations */
489 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
492 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
493 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
495 /* Media management */
496 VLC_ML_MEDIA_UPDATE_PROGRESS
, /**< arg1: media id; arg2: playback position; can fail */
497 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: char**; */
498 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: const char*; */
499 VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2(out): vlc_ml_playback_states_all* */
500 VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2: const vlc_ml_playback_states_all* */
501 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
502 VLC_ML_MEDIA_GENERATE_THUMBNAIL
, /**< arg1: media id; arg2: vlc_ml_thumbnail_size_t; arg3: width; arg4: height; arg5: position */
503 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
504 VLC_ML_MEDIA_SET_TYPE
, /**< arg1: media id; arg2: vlc_ml_media_type_t */
505 VLC_ML_MEDIA_ADD_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
506 VLC_ML_MEDIA_REMOVE_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
507 VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, /**< arg1: media id */
508 VLC_ML_MEDIA_UPDATE_BOOKMARK
, /**< arg1: media id; arg2: int64_t; arg3: const char*; arg4: const char* */
510 /* Playlist management */
511 VLC_ML_PLAYLIST_CREATE
, /**< arg1: const char*; arg2(out): vlc_ml_playlist_t**; can fail */
512 VLC_ML_PLAYLIST_DELETE
, /**< arg1: playlist id; can fail */
513 VLC_ML_PLAYLIST_APPEND
, /**< arg1: playlist id; arg2: media id; can fail */
514 VLC_ML_PLAYLIST_INSERT
, /**< arg1: playlist id; arg2: media id; arg3: position; can fail */
515 VLC_ML_PLAYLIST_MOVE
, /**< arg1: playlist id; arg2: from; arg3: to; can fail */
516 VLC_ML_PLAYLIST_REMOVE
/**< arg1: playlist id; arg2: position; can fail */
520 * User playback settings.
521 * All values/units are up to the caller and are not interpreted by the media
523 * All values are stored and returned as strings.
524 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_STATE,
525 * the value will be returned stored in the provided char**. If the state was
526 * not set yet, NULL will be returned.
527 * When setting a state, NULL can be provided as a value to unset it.
529 enum vlc_ml_playback_state
531 VLC_ML_PLAYBACK_STATE_RATING
,
532 VLC_ML_PLAYBACK_STATE_SPEED
,
533 VLC_ML_PLAYBACK_STATE_TITLE
,
534 VLC_ML_PLAYBACK_STATE_CHAPTER
,
535 VLC_ML_PLAYBACK_STATE_PROGRAM
,
536 VLC_ML_PLAYBACK_STATE_SEEN
,
537 VLC_ML_PLAYBACK_STATE_VIDEO_TRACK
,
538 VLC_ML_PLAYBACK_STATE_ASPECT_RATIO
,
539 VLC_ML_PLAYBACK_STATE_ZOOM
,
540 VLC_ML_PLAYBACK_STATE_CROP
,
541 VLC_ML_PLAYBACK_STATE_DEINTERLACE
,
542 VLC_ML_PLAYBACK_STATE_VIDEO_FILTER
,
543 VLC_ML_PLAYBACK_STATE_AUDIO_TRACK
,
544 VLC_ML_PLAYBACK_STATE_GAIN
,
545 VLC_ML_PLAYBACK_STATE_AUDIO_DELAY
,
546 VLC_ML_PLAYBACK_STATE_SUBTITLE_TRACK
,
547 VLC_ML_PLAYBACK_STATE_SUBTITLE_DELAY
,
548 VLC_ML_PLAYBACK_STATE_APP_SPECIFIC
,
551 typedef struct vlc_ml_playback_states_all
556 char* current_video_track
;
557 char* current_audio_track
;
558 char *current_subtitle_track
;
563 } vlc_ml_playback_states_all
;
565 enum vlc_ml_event_type
568 * Entity modification callbacks. The affected entity will be passed:
569 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
570 * entity, in vlc_ml_event_t::modification::p_<type>
571 * for ADDED and UPDATED variants.
572 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
573 * When _DELETED callbacks get invoked, the entity will already have been
574 * deleted from the database, and cannot be retrieved anymore
576 VLC_ML_EVENT_MEDIA_ADDED
,
577 VLC_ML_EVENT_MEDIA_UPDATED
,
578 VLC_ML_EVENT_MEDIA_DELETED
,
579 VLC_ML_EVENT_ARTIST_ADDED
,
580 VLC_ML_EVENT_ARTIST_UPDATED
,
581 VLC_ML_EVENT_ARTIST_DELETED
,
582 VLC_ML_EVENT_ALBUM_ADDED
,
583 VLC_ML_EVENT_ALBUM_UPDATED
,
584 VLC_ML_EVENT_ALBUM_DELETED
,
585 VLC_ML_EVENT_PLAYLIST_ADDED
,
586 VLC_ML_EVENT_PLAYLIST_UPDATED
,
587 VLC_ML_EVENT_PLAYLIST_DELETED
,
588 VLC_ML_EVENT_GENRE_ADDED
,
589 VLC_ML_EVENT_GENRE_UPDATED
,
590 VLC_ML_EVENT_GENRE_DELETED
,
591 VLC_ML_EVENT_BOOKMARKS_ADDED
,
592 VLC_ML_EVENT_BOOKMARKS_UPDATED
,
593 VLC_ML_EVENT_BOOKMARKS_DELETED
,
595 * A discovery started.
596 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
597 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
598 * VLC_ML_EVENT_DISCOVERY_PROGRESS events.
599 * The entry point being discovered is stored in
600 * vlc_ml_event_t::discovery_started::psz_entry_point.
602 VLC_ML_EVENT_DISCOVERY_STARTED
,
604 * Sent when a discovery or reload operation starts analyzing a new folder.
605 * The discovered entry point is stored in
606 * vlc_ml_event_t::discovery_progress::psz_entry_point.
608 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
610 * Sent when an entry point discovery is completed.
611 * The entry point that was being discovered is stored in
612 * vlc_ml_event_t::discovery_completed::psz_entry_point.
613 * The success or failure state is stored in
614 * vlc_ml_event_t::discovery_completed::b_success
616 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
618 * An entry point reload operation started.
619 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
620 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
621 * The entry point being reloaded is stored in
622 * vlc_ml_event_t::reload_started::psz_entry_point.
624 VLC_ML_EVENT_RELOAD_STARTED
,
626 * Sent when an entry point reload is completed.
627 * The entry point that was being reloaded is stored in
628 * vlc_ml_event_t::reload_completed::psz_entry_point.
629 * The success or failure state is stored in
630 * vlc_ml_event_t::reload_completed::b_success
632 VLC_ML_EVENT_RELOAD_COMPLETED
,
634 * Sent when a new entry point gets added to the database.
635 * The entry point that was added is stored in
636 * vlc::ml_event_t::entry_point_added::psz_entry_point, and the success or failure
637 * state is stored in vlc_ml_event_t::entry_point_added::b_success
638 * If successful, this event won't be emited again for this entry point.
639 * In case of failure, this event will be fired again if the same entry point
640 * is queued for discovery again.
642 VLC_ML_EVENT_ENTRY_POINT_ADDED
,
644 * Sent when an entry point removal request has been processed.
645 * The removed entry point is stored in
646 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
647 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
649 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
651 * Sent when an entry point ban request has been processed.
652 * The banned entry point is stored in
653 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
654 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
656 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
658 * Sent when an entry point unban request has been processed.
659 * The unbanned entry point is stored in
660 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
661 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
663 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
665 * Sent when a discoverer or parser threads changes its idle state.
666 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
667 * False means at least one background thread is in running, true means
668 * both discoverer & parser threads are paused.
670 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
672 * Sent when the parsing progress percentage gets updated.
673 * The percentage is stored as a [0;100] integer, in
674 * vlc_ml_event_t::parsing_progress::i_percent
675 * This value might decrease as more media get discovered, but it will only
676 * increase once all discovery operations are completed.
678 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
680 * Sent after a media thumbnail was generated, or if it's generation failed.
681 * The media is stored in vlc_ml_event_t::media_thumbnail_generated::p_media
682 * and the success state is stored in
683 * vlc_ml_event_t::media_thumbnail_generated::b_success
685 VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED
,
687 * Sent after the history gets changed. It can be either cleaned, or simply
688 * modified because a media was recently played/removed from the history.
689 * The history type (media/network) is stored in
690 * vlc_ml_event_t::history_changed::history_type
692 VLC_ML_EVENT_HISTORY_CHANGED
,
694 * Sent when an application requested rescan starts being processed.
696 VLC_ML_EVENT_RESCAN_STARTED
,
699 typedef struct vlc_ml_event_t
706 const char* psz_entry_point
;
710 const char* psz_entry_point
;
711 } discovery_progress
;
714 const char* psz_entry_point
;
716 } discovery_completed
;
719 const char* psz_entry_point
;
723 const char* psz_entry_point
;
728 const char* psz_entry_point
;
733 const char* psz_entry_point
;
735 } entry_point_removed
;
738 const char* psz_entry_point
;
740 } entry_point_banned
;
743 const char* psz_entry_point
;
745 } entry_point_unbanned
;
752 const vlc_ml_media_t
* p_media
;
753 const vlc_ml_artist_t
* p_artist
;
754 const vlc_ml_album_t
* p_album
;
755 const vlc_ml_playlist_t
* p_playlist
;
756 const vlc_ml_genre_t
* p_genre
;
757 const vlc_ml_bookmark_t
* p_bookmark
;
770 } background_idle_changed
;
773 const vlc_ml_media_t
* p_media
;
774 vlc_ml_thumbnail_size_t i_size
;
776 } media_thumbnail_generated
;
779 vlc_ml_history_type_t history_type
;
784 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
786 typedef struct vlc_medialibrary_callbacks_t
788 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
789 } vlc_medialibrary_callbacks_t
;
791 struct vlc_medialibrary_module_t
793 struct vlc_object_t obj
;
799 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
801 * List some entities from the medialibrary.
803 * \param p_ml The medialibrary module instance.
804 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
805 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
806 * the default parameters (alphabetical ascending sort, no pagination)
808 * \return VLC_SUCCESS or an error code
810 * Refer to the individual list of vlc_ml_list requests for the additional
811 * per-query input/ouput parameters values & types
813 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
814 const vlc_ml_query_params_t
* p_params
, va_list args
);
817 * Get a specific entity by its id or another unique value
819 * \return The required entity, or a NULL pointer if couldn't be found.
821 * Refer to the list of queries for the specific return type
823 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
825 const vlc_medialibrary_callbacks_t
* cbs
;
828 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
829 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
831 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
832 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
834 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
835 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
836 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
837 const vlc_ml_query_params_t
* p_params
, ... );
840 * \brief Registers a medialibrary callback.
841 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
843 VLC_API vlc_ml_event_callback_t
*
844 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
847 * \brief Unregisters a medialibrary callback
848 * \param p_handle The handled returned by vlc_ml_register_callback
850 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
851 vlc_ml_event_callback_t
* p_callback
);
853 * \brief Unregisters a medialibrary callback from the said callback.
854 * \param p_callback The handle returned by vlc_ml_register_callback
856 * This must only be called synchronously from the callback function provided to
857 * vlc_ml_event_register_callback
858 * The p_callback handle must be considered invalid when this function returns
860 VLC_API
void vlc_ml_event_unregister_from_callback( vlc_medialibrary_t
* p_ml
,
861 vlc_ml_event_callback_t
* p_callback
);
864 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
865 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
866 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
867 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
868 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
869 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
871 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
872 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
873 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
874 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
875 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
876 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
877 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
878 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
879 VLC_API
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t
* p_list
);
880 VLC_API
void vlc_ml_playback_states_all_release( vlc_ml_playback_states_all
* prefs
);
881 VLC_API
void vlc_ml_bookmark_release( vlc_ml_bookmark_t
* p_bookmark
);
882 VLC_API
void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t
* p_list
);
884 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
886 return (vlc_ml_query_params_t
) {
890 .i_sort
= VLC_ML_SORTING_DEFAULT
,
895 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
897 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
900 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
902 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
905 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
907 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
910 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
912 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
915 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
916 vlc_ml_entry_point_list_t
** pp_entrypoints
)
918 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
);
921 static inline int vlc_ml_list_banned_folder( vlc_medialibrary_t
* p_ml
,
922 vlc_ml_entry_point_list_t
** pp_entrypoints
)
924 return vlc_ml_control( p_ml
, VLC_ML_LIST_BANNED_FOLDERS
, pp_entrypoints
);
927 static inline int vlc_ml_is_indexed( vlc_medialibrary_t
* p_ml
,
928 const char* psz_mrl
, bool* p_res
)
930 return vlc_ml_control( p_ml
, VLC_ML_IS_INDEXED
, psz_mrl
, p_res
);
933 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
935 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
938 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
940 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
943 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
945 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
948 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
950 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
953 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
956 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
961 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
964 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
969 static inline int vlc_ml_media_update_progress( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
972 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_PROGRESS
, i_media_id
, progress
);
975 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
)
977 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, ppsz_result
);
980 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
)
982 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, psz_value
);
985 static inline int vlc_ml_media_get_all_playback_pref( vlc_medialibrary_t
* p_ml
,
987 vlc_ml_playback_states_all
* prefs
)
989 return vlc_ml_control( p_ml
,VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
992 static inline int vlc_ml_media_set_all_playback_states( vlc_medialibrary_t
* p_ml
,
994 const vlc_ml_playback_states_all
* prefs
)
996 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
999 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1000 const char* psz_mrl
, vlc_ml_thumbnail_size_t sizeType
)
1002 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
, sizeType
);
1005 static inline int vlc_ml_media_generate_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1006 vlc_ml_thumbnail_size_t size_type
,
1007 uint32_t i_desired_width
,
1008 uint32_t i_desired_height
,
1011 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GENERATE_THUMBNAIL
, i_media_id
,
1012 size_type
, i_desired_width
, i_desired_height
, position
);
1015 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1016 const char* psz_mrl
, int i_type
)
1018 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
1021 static inline int vlc_ml_media_set_type( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1022 vlc_ml_media_type_t i_type
)
1024 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_TYPE
, i_media_id
, (int)i_type
);
1027 static inline vlc_ml_bookmark_list_t
*
1028 vlc_ml_list_media_bookmarks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
,
1029 int64_t i_media_id
)
1031 assert( p_ml
!= NULL
);
1032 vlc_ml_bookmark_list_t
* res
;
1033 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_BOOKMARKS
, params
, i_media_id
,
1034 &res
) != VLC_SUCCESS
)
1040 vlc_ml_media_add_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1042 assert( p_ml
!= NULL
);
1043 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_BOOKMARK
, i_media_id
, i_time
);
1047 vlc_ml_media_remove_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1049 assert( p_ml
!= NULL
);
1050 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_BOOKMARK
, i_media_id
, i_time
);
1054 vlc_ml_media_update_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1055 int64_t i_time
, const char* psz_name
,
1056 const char* psz_desc
)
1058 assert( p_ml
!= NULL
);
1059 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_BOOKMARK
, i_media_id
,
1060 i_time
, psz_name
, psz_desc
);
1064 vlc_ml_media_remove_all_bookmarks( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1066 assert( p_ml
!= NULL
);
1067 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, i_media_id
);
1070 static inline vlc_ml_playlist_t
*
1071 vlc_ml_playlist_create( vlc_medialibrary_t
* p_ml
, const char * name
)
1073 assert( p_ml
!= NULL
);
1075 vlc_ml_playlist_t
* result
;
1077 if (vlc_ml_control( p_ml
, VLC_ML_PLAYLIST_CREATE
, name
, &result
) != VLC_SUCCESS
)
1084 vlc_ml_playlist_delete( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
1086 assert( p_ml
!= NULL
);
1088 return vlc_ml_control( p_ml
, VLC_ML_PLAYLIST_DELETE
, i_playlist_id
);
1092 vlc_ml_playlist_append( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
, int64_t i_media_id
)
1094 assert( p_ml
!= NULL
);
1096 return vlc_ml_control( p_ml
, VLC_ML_PLAYLIST_APPEND
, i_playlist_id
, i_media_id
);
1100 vlc_ml_playlist_insert( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
, int64_t i_media_id
,
1101 uint32_t i_position
)
1103 assert( p_ml
!= NULL
);
1105 return vlc_ml_control( p_ml
, VLC_ML_PLAYLIST_INSERT
, i_playlist_id
, i_media_id
, i_position
);
1109 vlc_ml_playlist_move( vlc_medialibrary_t
* p_ml
,
1110 int64_t i_playlist_id
, uint32_t i_from
, uint32_t i_to
)
1112 assert( p_ml
!= NULL
);
1114 return vlc_ml_control( p_ml
, VLC_ML_PLAYLIST_MOVE
, i_playlist_id
, i_from
, i_to
);
1118 vlc_ml_playlist_remove( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
, uint32_t i_position
)
1120 assert( p_ml
!= NULL
);
1122 return vlc_ml_control( p_ml
, VLC_ML_PLAYLIST_REMOVE
, i_playlist_id
, i_position
);
1125 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1127 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
1130 static inline vlc_ml_media_t
* vlc_ml_get_media_by_mrl( vlc_medialibrary_t
* p_ml
,
1131 const char* psz_mrl
)
1133 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA_BY_MRL
, psz_mrl
);
1136 static inline input_item_t
* vlc_ml_get_input_item( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1138 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM
, i_media_id
);
1141 static inline input_item_t
* vlc_ml_get_input_item_by_mrl( vlc_medialibrary_t
* p_ml
,
1142 const char* psz_mrl
)
1144 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM_BY_MRL
, psz_mrl
);
1147 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
1149 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
1152 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
1154 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
1157 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
1159 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
1162 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
1164 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
1167 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
1169 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
1172 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
)
1174 vlc_assert( p_ml
!= NULL
);
1175 vlc_ml_media_list_t
* res
;
1176 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1181 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
)
1183 vlc_assert( p_ml
!= NULL
);
1185 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1190 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
)
1192 vlc_assert( p_ml
!= NULL
);
1193 vlc_ml_artist_list_t
* res
;
1194 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1199 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
)
1201 vlc_assert( p_ml
!= NULL
);
1203 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1208 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
)
1210 vlc_assert( p_ml
!= NULL
);
1211 vlc_ml_album_list_t
* res
;
1212 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1217 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
)
1219 vlc_assert( p_ml
!= NULL
);
1221 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1226 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
)
1228 vlc_assert( p_ml
!= NULL
);
1229 vlc_ml_media_list_t
* res
;
1230 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1235 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
)
1237 vlc_assert( p_ml
!= NULL
);
1239 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1244 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
)
1246 vlc_assert( p_ml
!= NULL
);
1247 vlc_ml_media_list_t
* res
;
1248 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1253 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
)
1255 vlc_assert( p_ml
!= NULL
);
1257 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1262 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
)
1264 vlc_assert( p_ml
!= NULL
);
1265 vlc_ml_album_list_t
* res
;
1266 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1271 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
)
1273 vlc_assert( p_ml
!= NULL
);
1275 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1280 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
)
1282 vlc_assert( p_ml
!= NULL
);
1283 vlc_ml_media_list_t
* res
;
1284 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1289 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
)
1291 vlc_assert( p_ml
!= NULL
);
1293 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1298 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1300 vlc_assert( p_ml
!= NULL
);
1301 vlc_ml_media_list_t
* res
;
1302 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
1307 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1309 vlc_assert( p_ml
!= NULL
);
1311 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
1316 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1318 vlc_assert( p_ml
!= NULL
);
1319 vlc_ml_media_list_t
* res
;
1320 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1325 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1327 vlc_assert( p_ml
!= NULL
);
1329 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1334 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1336 vlc_assert( p_ml
!= NULL
);
1337 vlc_ml_album_list_t
* res
;
1338 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1343 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1345 vlc_assert( p_ml
!= NULL
);
1347 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1352 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1354 vlc_assert( p_ml
!= NULL
);
1355 vlc_ml_genre_list_t
* res
;
1356 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1361 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1363 vlc_assert( p_ml
!= NULL
);
1365 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1371 * @brief vlc_ml_list_artists
1372 * @param params Query parameters, or NULL for the default
1373 * @param b_include_all True if you wish to fetch artists without at least one album.
1376 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
)
1378 vlc_assert( p_ml
!= NULL
);
1379 vlc_ml_artist_list_t
* res
;
1380 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1385 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1387 vlc_assert( p_ml
!= NULL
);
1389 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1394 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1396 vlc_assert( p_ml
!= NULL
);
1397 vlc_ml_show_list_t
* res
;
1398 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1403 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1405 vlc_assert( p_ml
!= NULL
);
1407 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1412 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
)
1414 vlc_assert( p_ml
!= NULL
);
1415 vlc_ml_artist_list_t
* res
;
1416 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1421 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
)
1423 vlc_assert( p_ml
!= NULL
);
1425 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1430 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
)
1432 vlc_assert( p_ml
!= NULL
);
1433 vlc_ml_media_list_t
* res
;
1434 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1439 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
)
1441 vlc_assert( p_ml
!= NULL
);
1443 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1448 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
)
1450 vlc_assert( p_ml
!= NULL
);
1451 vlc_ml_album_list_t
* res
;
1452 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1457 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
)
1459 vlc_assert( p_ml
!= NULL
);
1461 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1466 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
)
1468 vlc_assert( p_ml
!= NULL
);
1469 vlc_ml_media_list_t
* res
;
1470 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1475 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
)
1477 vlc_assert( p_ml
!= NULL
);
1479 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1484 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
)
1486 vlc_assert( p_ml
!= NULL
);
1487 vlc_ml_label_list_t
* res
;
1488 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1493 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
)
1495 vlc_assert( p_ml
!= NULL
);
1497 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1502 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1504 vlc_assert( p_ml
!= NULL
);
1505 vlc_ml_media_list_t
* res
;
1506 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1511 static inline size_t vlc_ml_count_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1513 vlc_assert( p_ml
!= NULL
);
1515 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_HISTORY
, params
, &count
) != VLC_SUCCESS
)
1521 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
)
1523 vlc_assert( p_ml
!= NULL
);
1524 vlc_ml_media_list_t
* res
;
1525 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY_BY_TYPE
, params
, (int)type
, &res
) != VLC_SUCCESS
)
1530 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
)
1532 vlc_assert( p_ml
!= NULL
);
1534 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_HISTORY_BY_TYPE
, params
, (int)type
, &count
) != VLC_SUCCESS
)
1541 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1543 vlc_assert( p_ml
!= NULL
);
1544 vlc_ml_media_list_t
* res
;
1545 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1550 static inline size_t vlc_ml_count_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1552 vlc_assert( p_ml
!= NULL
);
1554 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_STREAM_HISTORY
, params
, &count
) != VLC_SUCCESS
)
1559 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1561 vlc_assert( p_ml
!= NULL
);
1562 vlc_ml_playlist_list_t
* res
;
1563 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1568 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1570 vlc_assert( p_ml
!= NULL
);
1572 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1577 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
)
1579 vlc_assert( p_ml
!= NULL
);
1580 vlc_ml_media_list_t
* res
;
1581 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLIST_MEDIA
, params
, i_playlist_id
, &res
) != VLC_SUCCESS
)
1586 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
)
1588 vlc_assert( p_ml
!= NULL
);
1590 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLIST_MEDIA
, params
, i_playlist_id
, &count
) != VLC_SUCCESS
)
1600 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1601 vlc_ml_show_t*: vlc_ml_show_release, \
1602 vlc_ml_artist_t*: vlc_ml_artist_release, \
1603 vlc_ml_album_t*: vlc_ml_album_release, \
1604 vlc_ml_genre_t*: vlc_ml_genre_release, \
1605 vlc_ml_media_t*: vlc_ml_media_release, \
1606 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1607 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1608 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1609 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1610 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1611 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1612 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1613 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1614 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
1615 vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release, \
1616 vlc_ml_playback_states_all*: vlc_ml_playback_states_all_release, \
1617 vlc_ml_bookmark_t*: vlc_ml_bookmark_release, \
1618 vlc_ml_bookmark_list_t*: vlc_ml_bookmark_list_release \
1621 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1622 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1623 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1624 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1625 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1626 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1627 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1628 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1629 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1630 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1631 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1632 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1633 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1634 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1635 static inline void vlc_ml_release( vlc_ml_entry_point_list_t
* list
) { vlc_ml_entry_point_list_release( list
); }
1636 static inline void vlc_ml_release( vlc_ml_playback_states_all
* prefs
) { vlc_ml_playback_states_all_release( prefs
); }
1637 static inline void vlc_ml_release( vlc_ml_bookmark_t
* bookmark
) { vlc_ml_bookmark_release( bookmark
); }
1638 static inline void vlc_ml_release( vlc_ml_bookmark_list_t
* list
) { vlc_ml_bookmark_list_release( list
); }
1641 #endif /* VLC_MEDIA_LIBRARY_H */