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_STREAM_HISTORY
, /**< arg1 (out): vlc_ml_media_list_t** */
404 VLC_ML_COUNT_STREAM_HISTORY
, /**< arg1 (out): size_t* */
406 /* Album specific listings */
407 VLC_ML_LIST_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
408 VLC_ML_COUNT_ALBUM_TRACKS
, /**< arg1: The album id. arg2 (out): size_t* */
409 VLC_ML_LIST_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
410 VLC_ML_COUNT_ALBUM_ARTISTS
, /**< arg1: The album id. arg2 (out): size_t* */
412 /* Artist specific listings */
413 VLC_ML_LIST_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
414 VLC_ML_COUNT_ARTIST_ALBUMS
, /**< arg1: The artist id. arg2(out): size_t* */
415 VLC_ML_LIST_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
416 VLC_ML_COUNT_ARTIST_TRACKS
, /**< arg1: The artist id. arg2(out): size_t* */
418 /* Genre specific listings */
419 VLC_ML_LIST_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
420 VLC_ML_COUNT_GENRE_ARTISTS
, /**< arg1: genre id; arg2 (out): size_t* */
421 VLC_ML_LIST_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
422 VLC_ML_COUNT_GENRE_TRACKS
, /**< arg1: genre id; arg2 (out): size_t* */
423 VLC_ML_LIST_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
424 VLC_ML_COUNT_GENRE_ALBUMS
, /**< arg1: genre id; arg2 (out): size_t* */
426 /* Show specific listings */
427 VLC_ML_LIST_SHOW_EPISODES
, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
428 VLC_ML_COUNT_SHOW_EPISODES
, /**< arg1: show id; arg2(out): size_t* */
430 /* Media specific listings */
431 VLC_ML_LIST_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
432 VLC_ML_COUNT_MEDIA_LABELS
, /**< arg1: media id; arg2 (out): size_t* */
433 VLC_ML_LIST_MEDIA_BOOKMARKS
, /**< arg1: media id; arg2 (out): vlc_ml_bookmark_list_t** */
435 /* Playlist specific listings */
436 VLC_ML_LIST_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
437 VLC_ML_COUNT_PLAYLIST_MEDIA
, /**< arg1: playlist id; arg2 (out): size_t* */
439 /* Children entities listing */
440 VLC_ML_LIST_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
441 VLC_ML_COUNT_MEDIA_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
442 VLC_ML_LIST_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
443 VLC_ML_COUNT_ARTISTS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
444 VLC_ML_LIST_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
445 VLC_ML_COUNT_ALBUMS_OF
, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
448 enum vlc_ml_parent_type
450 VLC_ML_PARENT_UNKNOWN
,
452 VLC_ML_PARENT_ARTIST
,
455 VLC_ML_PARENT_PLAYLIST
,
460 /* Adds a folder to discover through the medialibrary */
461 VLC_ML_ADD_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
462 VLC_ML_REMOVE_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
463 VLC_ML_BAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
464 VLC_ML_UNBAN_FOLDER
, /**< arg1: mrl (const char*) res: can't fail */
465 VLC_ML_LIST_FOLDERS
, /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
466 VLC_ML_IS_INDEXED
, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
468 * Reload a specific folder, or all.
469 * arg1: mrl (const char*), NULL to reload all folders
472 VLC_ML_RELOAD_FOLDER
,
474 /* Pause/resume background operations, such as media discovery & media analysis */
475 VLC_ML_PAUSE_BACKGROUND
, /**< no args; can't fail */
476 VLC_ML_RESUME_BACKGROUND
, /**< no args; can't fail */
478 /* Misc operations */
479 VLC_ML_CLEAR_HISTORY
, /**< no args; can't fail */
482 VLC_ML_NEW_EXTERNAL_MEDIA
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
483 VLC_ML_NEW_STREAM
, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
485 /* Media management */
486 VLC_ML_MEDIA_UPDATE_PROGRESS
, /**< arg1: media id; arg2: playback position; can fail */
487 VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: char**; */
488 VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: const char*; */
489 VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2(out): vlc_ml_playback_states_all* */
490 VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, /**< arg1: media id; arg2: const vlc_ml_playback_states_all* */
491 VLC_ML_MEDIA_SET_THUMBNAIL
, /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
492 VLC_ML_MEDIA_GENERATE_THUMBNAIL
, /**< arg1: media id; arg2: vlc_ml_thumbnail_size_t; arg3: width; arg4: height; arg5: position */
493 VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
494 VLC_ML_MEDIA_SET_TYPE
, /**< arg1: media id; arg2: vlc_ml_media_type_t */
495 VLC_ML_MEDIA_ADD_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
496 VLC_ML_MEDIA_REMOVE_BOOKMARK
, /**< arg1: media id; arg2: int64_t */
497 VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, /**< arg1: media id */
498 VLC_ML_MEDIA_UPDATE_BOOKMARK
, /**< arg1: media id; arg2: int64_t; arg3: const char*; arg4: const char* */
502 * User playback settings.
503 * All values/units are up to the caller and are not interpreted by the media
505 * All values are stored and returned as strings.
506 * When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_STATE,
507 * the value will be returned stored in the provided char**. If the state was
508 * not set yet, NULL will be returned.
509 * When setting a state, NULL can be provided as a value to unset it.
511 enum vlc_ml_playback_state
513 VLC_ML_PLAYBACK_STATE_RATING
,
514 VLC_ML_PLAYBACK_STATE_SPEED
,
515 VLC_ML_PLAYBACK_STATE_TITLE
,
516 VLC_ML_PLAYBACK_STATE_CHAPTER
,
517 VLC_ML_PLAYBACK_STATE_PROGRAM
,
518 VLC_ML_PLAYBACK_STATE_SEEN
,
519 VLC_ML_PLAYBACK_STATE_VIDEO_TRACK
,
520 VLC_ML_PLAYBACK_STATE_ASPECT_RATIO
,
521 VLC_ML_PLAYBACK_STATE_ZOOM
,
522 VLC_ML_PLAYBACK_STATE_CROP
,
523 VLC_ML_PLAYBACK_STATE_DEINTERLACE
,
524 VLC_ML_PLAYBACK_STATE_VIDEO_FILTER
,
525 VLC_ML_PLAYBACK_STATE_AUDIO_TRACK
,
526 VLC_ML_PLAYBACK_STATE_GAIN
,
527 VLC_ML_PLAYBACK_STATE_AUDIO_DELAY
,
528 VLC_ML_PLAYBACK_STATE_SUBTITLE_TRACK
,
529 VLC_ML_PLAYBACK_STATE_SUBTITLE_DELAY
,
530 VLC_ML_PLAYBACK_STATE_APP_SPECIFIC
,
533 typedef struct vlc_ml_playback_states_all
538 char* current_video_track
;
539 char* current_audio_track
;
540 char *current_subtitle_track
;
545 } vlc_ml_playback_states_all
;
547 enum vlc_ml_event_type
550 * Entity modification callbacks. The affected entity will be passed:
551 * - As a vlc_ml_<type>_t, depending on the type of the modified/inserted
552 * entity, in vlc_ml_event_t::modification::p_<type>
553 * for ADDED and UPDATED variants.
554 * - as an id, in vlc_ml_event_t::deletion::i_entity_id
555 * When _DELETED callbacks get invoked, the entity will already have been
556 * deleted from the database, and cannot be retrieved anymore
558 VLC_ML_EVENT_MEDIA_ADDED
,
559 VLC_ML_EVENT_MEDIA_UPDATED
,
560 VLC_ML_EVENT_MEDIA_DELETED
,
561 VLC_ML_EVENT_ARTIST_ADDED
,
562 VLC_ML_EVENT_ARTIST_UPDATED
,
563 VLC_ML_EVENT_ARTIST_DELETED
,
564 VLC_ML_EVENT_ALBUM_ADDED
,
565 VLC_ML_EVENT_ALBUM_UPDATED
,
566 VLC_ML_EVENT_ALBUM_DELETED
,
567 VLC_ML_EVENT_PLAYLIST_ADDED
,
568 VLC_ML_EVENT_PLAYLIST_UPDATED
,
569 VLC_ML_EVENT_PLAYLIST_DELETED
,
570 VLC_ML_EVENT_GENRE_ADDED
,
571 VLC_ML_EVENT_GENRE_UPDATED
,
572 VLC_ML_EVENT_GENRE_DELETED
,
573 VLC_ML_EVENT_BOOKMARKS_ADDED
,
574 VLC_ML_EVENT_BOOKMARKS_UPDATED
,
575 VLC_ML_EVENT_BOOKMARKS_DELETED
,
577 * A discovery started.
578 * For each VLC_ML_EVENT_DISCOVERY_STARTED event, there will be
579 * 1 VLC_ML_EVENT_DISCOVERY_COMPLETED event, and N
580 * VLC_ML_EVENT_DISCOVERY_PROGRESS events.
581 * The entry point being discovered is stored in
582 * vlc_ml_event_t::discovery_started::psz_entry_point.
584 VLC_ML_EVENT_DISCOVERY_STARTED
,
586 * Sent when a discovery or reload operation starts analyzing a new folder.
587 * The discovered entry point is stored in
588 * vlc_ml_event_t::discovery_progress::psz_entry_point.
590 VLC_ML_EVENT_DISCOVERY_PROGRESS
,
592 * Sent when an entry point discovery is completed.
593 * The entry point that was being discovered is stored in
594 * vlc_ml_event_t::discovery_completed::psz_entry_point.
595 * The success or failure state is stored in
596 * vlc_ml_event_t::discovery_completed::b_success
598 VLC_ML_EVENT_DISCOVERY_COMPLETED
,
600 * An entry point reload operation started.
601 * For all the entry points being reloaded, N VLC_EVENT_DISCOVERY_PROGRESS
602 * and 1 VLC_EVENT_RELOAD_COMPLETED event will be sent.
603 * The entry point being reloaded is stored in
604 * vlc_ml_event_t::reload_started::psz_entry_point.
606 VLC_ML_EVENT_RELOAD_STARTED
,
608 * Sent when an entry point reload is completed.
609 * The entry point that was being reloaded is stored in
610 * vlc_ml_event_t::reload_completed::psz_entry_point.
611 * The success or failure state is stored in
612 * vlc_ml_event_t::reload_completed::b_success
614 VLC_ML_EVENT_RELOAD_COMPLETED
,
616 * Sent when a new entry point gets added to the database.
617 * The entry point that was added is stored in
618 * vlc::ml_event_t::entry_point_added::psz_entry_point, and the success or failure
619 * state is stored in vlc_ml_event_t::entry_point_added::b_success
620 * If successful, this event won't be emited again for this entry point.
621 * In case of failure, this event will be fired again if the same entry point
622 * is queued for discovery again.
624 VLC_ML_EVENT_ENTRY_POINT_ADDED
,
626 * Sent when an entry point removal request has been processed.
627 * The removed entry point is stored in
628 * vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
629 * state is stored in vlc_ml_event_t::entry_point_removed::b_success
631 VLC_ML_EVENT_ENTRY_POINT_REMOVED
,
633 * Sent when an entry point ban request has been processed.
634 * The banned entry point is stored in
635 * vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
636 * state is stored in vlc_ml_event_t::entry_point_banned::b_success
638 VLC_ML_EVENT_ENTRY_POINT_BANNED
,
640 * Sent when an entry point unban request has been processed.
641 * The unbanned entry point is stored in
642 * vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
643 * state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
645 VLC_ML_EVENT_ENTRY_POINT_UNBANNED
,
647 * Sent when a discoverer or parser threads changes its idle state.
648 * The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
649 * False means at least one background thread is in running, true means
650 * both discoverer & parser threads are paused.
652 VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED
,
654 * Sent when the parsing progress percentage gets updated.
655 * The percentage is stored as a [0;100] integer, in
656 * vlc_ml_event_t::parsing_progress::i_percent
657 * This value might decrease as more media get discovered, but it will only
658 * increase once all discovery operations are completed.
660 VLC_ML_EVENT_PARSING_PROGRESS_UPDATED
,
662 * Sent after a media thumbnail was generated, or if it's generation failed.
663 * The media is stored in vlc_ml_event_t::media_thumbnail_generated::p_media
664 * and the success state is stored in
665 * vlc_ml_event_t::media_thumbnail_generated::b_success
667 VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED
,
669 * Sent after the history gets changed. It can be either cleaned, or simply
670 * modified because a media was recently played/removed from the history.
671 * The history type (media/network) is stored in
672 * vlc_ml_event_t::history_changed::history_type
674 VLC_ML_EVENT_HISTORY_CHANGED
,
676 * Sent when an application requested rescan starts being processed.
678 VLC_ML_EVENT_RESCAN_STARTED
,
681 typedef struct vlc_ml_event_t
688 const char* psz_entry_point
;
692 const char* psz_entry_point
;
693 } discovery_progress
;
696 const char* psz_entry_point
;
698 } discovery_completed
;
701 const char* psz_entry_point
;
705 const char* psz_entry_point
;
710 const char* psz_entry_point
;
715 const char* psz_entry_point
;
717 } entry_point_removed
;
720 const char* psz_entry_point
;
722 } entry_point_banned
;
725 const char* psz_entry_point
;
727 } entry_point_unbanned
;
734 const vlc_ml_media_t
* p_media
;
735 const vlc_ml_artist_t
* p_artist
;
736 const vlc_ml_album_t
* p_album
;
737 const vlc_ml_playlist_t
* p_playlist
;
738 const vlc_ml_genre_t
* p_genre
;
739 const vlc_ml_bookmark_t
* p_bookmark
;
752 } background_idle_changed
;
755 const vlc_ml_media_t
* p_media
;
756 vlc_ml_thumbnail_size_t i_size
;
758 } media_thumbnail_generated
;
761 vlc_ml_history_type_t history_type
;
766 typedef void (*vlc_ml_callback_t
)( void* p_data
, const vlc_ml_event_t
* p_event
);
768 typedef struct vlc_medialibrary_callbacks_t
770 void (*pf_send_event
)( vlc_medialibrary_module_t
* p_ml
, const vlc_ml_event_t
* p_event
);
771 } vlc_medialibrary_callbacks_t
;
773 struct vlc_medialibrary_module_t
775 struct vlc_object_t obj
;
781 int (*pf_control
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
783 * List some entities from the medialibrary.
785 * \param p_ml The medialibrary module instance.
786 * \param i_query The type search to be performed. \see vlc_ml_list enumeration
787 * \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
788 * the default parameters (alphabetical ascending sort, no pagination)
790 * \return VLC_SUCCESS or an error code
792 * Refer to the individual list of vlc_ml_list requests for the additional
793 * per-query input/ouput parameters values & types
795 int (*pf_list
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
,
796 const vlc_ml_query_params_t
* p_params
, va_list args
);
799 * Get a specific entity by its id or another unique value
801 * \return The required entity, or a NULL pointer if couldn't be found.
803 * Refer to the list of queries for the specific return type
805 void* (*pf_get
)( struct vlc_medialibrary_module_t
* p_ml
, int i_query
, va_list args
);
807 const vlc_medialibrary_callbacks_t
* cbs
;
810 vlc_medialibrary_t
* libvlc_MlCreate( libvlc_int_t
* p_libvlc
);
811 void libvlc_MlRelease( vlc_medialibrary_t
* p_ml
);
813 VLC_API vlc_medialibrary_t
* vlc_ml_instance_get( vlc_object_t
* p_obj
) VLC_USED
;
814 #define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
816 VLC_API
void* vlc_ml_get( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
817 VLC_API
int vlc_ml_control( vlc_medialibrary_t
* p_ml
, int i_query
, ... ) VLC_USED
;
818 VLC_API
int vlc_ml_list( vlc_medialibrary_t
* p_ml
, int i_query
,
819 const vlc_ml_query_params_t
* p_params
, ... );
822 * \brief Registers a medialibrary callback.
823 * \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
825 VLC_API vlc_ml_event_callback_t
*
826 vlc_ml_event_register_callback( vlc_medialibrary_t
* p_ml
, vlc_ml_callback_t cb
, void* p_data
);
829 * \brief Unregisters a medialibrary callback
830 * \param p_handle The handled returned by vlc_ml_register_callback
832 VLC_API
void vlc_ml_event_unregister_callback( vlc_medialibrary_t
* p_ml
,
833 vlc_ml_event_callback_t
* p_callback
);
835 * \brief Unregisters a medialibrary callback from the said callback.
836 * \param p_callback The handle returned by vlc_ml_register_callback
838 * This must only be called synchronously from the callback function provided to
839 * vlc_ml_event_register_callback
840 * The p_callback handle must be considered invalid when this function returns
842 VLC_API
void vlc_ml_event_unregister_from_callback( vlc_medialibrary_t
* p_ml
,
843 vlc_ml_event_callback_t
* p_callback
);
846 VLC_API
void vlc_ml_show_release( vlc_ml_show_t
* p_show
);
847 VLC_API
void vlc_ml_artist_release( vlc_ml_artist_t
* p_artist
);
848 VLC_API
void vlc_ml_genre_release( vlc_ml_genre_t
* p_genre
);
849 VLC_API
void vlc_ml_media_release( vlc_ml_media_t
* p_media
);
850 VLC_API
void vlc_ml_album_release( vlc_ml_album_t
* p_album
);
851 VLC_API
void vlc_ml_playlist_release( vlc_ml_playlist_t
* p_playlist
);
853 VLC_API
void vlc_ml_label_list_release( vlc_ml_label_list_t
* p_list
);
854 VLC_API
void vlc_ml_file_list_release( vlc_ml_file_list_t
* p_list
);
855 VLC_API
void vlc_ml_artist_list_release( vlc_ml_artist_list_t
* p_list
);
856 VLC_API
void vlc_ml_media_list_release( vlc_ml_media_list_t
* p_list
);
857 VLC_API
void vlc_ml_album_list_release( vlc_ml_album_list_t
* p_list
);
858 VLC_API
void vlc_ml_show_list_release( vlc_ml_show_list_t
* p_list
);
859 VLC_API
void vlc_ml_genre_list_release( vlc_ml_genre_list_t
* p_list
);
860 VLC_API
void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t
* p_list
);
861 VLC_API
void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t
* p_list
);
862 VLC_API
void vlc_ml_playback_states_all_release( vlc_ml_playback_states_all
* prefs
);
863 VLC_API
void vlc_ml_bookmark_release( vlc_ml_bookmark_t
* p_bookmark
);
864 VLC_API
void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t
* p_list
);
866 static inline vlc_ml_query_params_t
vlc_ml_query_params_create()
868 return (vlc_ml_query_params_t
) {
872 .i_sort
= VLC_ML_SORTING_DEFAULT
,
877 static inline int vlc_ml_add_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
879 return vlc_ml_control( p_ml
, VLC_ML_ADD_FOLDER
, psz_folder
);
882 static inline int vlc_ml_remove_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
884 return vlc_ml_control( p_ml
, VLC_ML_REMOVE_FOLDER
, psz_folder
);
887 static inline int vlc_ml_ban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
889 return vlc_ml_control( p_ml
, VLC_ML_BAN_FOLDER
, psz_folder
);
892 static inline int vlc_ml_unban_folder( vlc_medialibrary_t
* p_ml
, const char* psz_folder
)
894 return vlc_ml_control( p_ml
, VLC_ML_UNBAN_FOLDER
, psz_folder
);
897 static inline int vlc_ml_list_folder( vlc_medialibrary_t
* p_ml
,
898 vlc_ml_entry_point_list_t
** pp_entrypoints
)
900 return vlc_ml_control( p_ml
, VLC_ML_LIST_FOLDERS
, pp_entrypoints
);
903 static inline int vlc_ml_is_indexed( vlc_medialibrary_t
* p_ml
,
904 const char* psz_mrl
, bool* p_res
)
906 return vlc_ml_control( p_ml
, VLC_ML_IS_INDEXED
, psz_mrl
, p_res
);
909 static inline int vlc_ml_reload_folder( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
911 return vlc_ml_control( p_ml
, VLC_ML_RELOAD_FOLDER
, psz_mrl
);
914 static inline int vlc_ml_pause_background( vlc_medialibrary_t
* p_ml
)
916 return vlc_ml_control( p_ml
, VLC_ML_PAUSE_BACKGROUND
);
919 static inline int vlc_ml_resume_background( vlc_medialibrary_t
* p_ml
)
921 return vlc_ml_control( p_ml
, VLC_ML_RESUME_BACKGROUND
);
924 static inline int vlc_ml_clear_history( vlc_medialibrary_t
* p_ml
)
926 return vlc_ml_control( p_ml
, VLC_ML_CLEAR_HISTORY
);
929 static inline vlc_ml_media_t
* vlc_ml_new_external_media( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
932 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_EXTERNAL_MEDIA
, psz_mrl
, &res
) != VLC_SUCCESS
)
937 static inline vlc_ml_media_t
* vlc_ml_new_stream( vlc_medialibrary_t
* p_ml
, const char* psz_mrl
)
940 if ( vlc_ml_control( p_ml
, VLC_ML_NEW_STREAM
, psz_mrl
, &res
) != VLC_SUCCESS
)
945 static inline int vlc_ml_media_update_progress( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
948 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_PROGRESS
, i_media_id
, progress
);
951 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
)
953 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, ppsz_result
);
956 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
)
958 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE
, i_media_id
, i_state
, psz_value
);
961 static inline int vlc_ml_media_get_all_playback_pref( vlc_medialibrary_t
* p_ml
,
963 vlc_ml_playback_states_all
* prefs
)
965 return vlc_ml_control( p_ml
,VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
968 static inline int vlc_ml_media_set_all_playback_states( vlc_medialibrary_t
* p_ml
,
970 const vlc_ml_playback_states_all
* prefs
)
972 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES
, i_media_id
, prefs
);
975 static inline int vlc_ml_media_set_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
976 const char* psz_mrl
, vlc_ml_thumbnail_size_t sizeType
)
978 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_THUMBNAIL
, i_media_id
, psz_mrl
, sizeType
);
981 static inline int vlc_ml_media_generate_thumbnail( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
982 vlc_ml_thumbnail_size_t size_type
,
983 uint32_t i_desired_width
,
984 uint32_t i_desired_height
,
987 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_GENERATE_THUMBNAIL
, i_media_id
,
988 size_type
, i_desired_width
, i_desired_height
, position
);
991 static inline int vlc_ml_media_add_external_mrl( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
992 const char* psz_mrl
, int i_type
)
994 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_EXTERNAL_MRL
, i_media_id
, psz_mrl
, i_type
);
997 static inline int vlc_ml_media_set_type( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
998 vlc_ml_media_type_t i_type
)
1000 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_SET_TYPE
, i_media_id
, (int)i_type
);
1003 static inline vlc_ml_bookmark_list_t
*
1004 vlc_ml_list_media_bookmarks( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
,
1005 int64_t i_media_id
)
1007 assert( p_ml
!= NULL
);
1008 vlc_ml_bookmark_list_t
* res
;
1009 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_BOOKMARKS
, params
, i_media_id
,
1010 &res
) != VLC_SUCCESS
)
1016 vlc_ml_media_add_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1018 assert( p_ml
!= NULL
);
1019 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_ADD_BOOKMARK
, i_media_id
, i_time
);
1023 vlc_ml_media_remove_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
, int64_t i_time
)
1025 assert( p_ml
!= NULL
);
1026 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_BOOKMARK
, i_media_id
, i_time
);
1030 vlc_ml_media_update_bookmark( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
,
1031 int64_t i_time
, const char* psz_name
,
1032 const char* psz_desc
)
1034 assert( p_ml
!= NULL
);
1035 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_UPDATE_BOOKMARK
, i_media_id
,
1036 i_time
, psz_name
, psz_desc
);
1040 vlc_ml_media_remove_all_bookmarks( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1042 assert( p_ml
!= NULL
);
1043 return vlc_ml_control( p_ml
, VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS
, i_media_id
);
1046 static inline vlc_ml_media_t
* vlc_ml_get_media( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1048 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA
, i_media_id
);
1051 static inline vlc_ml_media_t
* vlc_ml_get_media_by_mrl( vlc_medialibrary_t
* p_ml
,
1052 const char* psz_mrl
)
1054 return (vlc_ml_media_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_MEDIA_BY_MRL
, psz_mrl
);
1057 static inline input_item_t
* vlc_ml_get_input_item( vlc_medialibrary_t
* p_ml
, int64_t i_media_id
)
1059 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM
, i_media_id
);
1062 static inline input_item_t
* vlc_ml_get_input_item_by_mrl( vlc_medialibrary_t
* p_ml
,
1063 const char* psz_mrl
)
1065 return (input_item_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_INPUT_ITEM_BY_MRL
, psz_mrl
);
1068 static inline vlc_ml_album_t
* vlc_ml_get_album( vlc_medialibrary_t
* p_ml
, int64_t i_album_id
)
1070 return (vlc_ml_album_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ALBUM
, i_album_id
);
1073 static inline vlc_ml_artist_t
* vlc_ml_get_artist( vlc_medialibrary_t
* p_ml
, int64_t i_artist_id
)
1075 return (vlc_ml_artist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_ARTIST
, i_artist_id
);
1078 static inline vlc_ml_genre_t
* vlc_ml_get_genre( vlc_medialibrary_t
* p_ml
, int64_t i_genre_id
)
1080 return (vlc_ml_genre_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_GENRE
, i_genre_id
);
1083 static inline vlc_ml_show_t
* vlc_ml_get_show( vlc_medialibrary_t
* p_ml
, int64_t i_show_id
)
1085 return (vlc_ml_show_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_SHOW
, i_show_id
);
1088 static inline vlc_ml_playlist_t
* vlc_ml_get_playlist( vlc_medialibrary_t
* p_ml
, int64_t i_playlist_id
)
1090 return (vlc_ml_playlist_t
*)vlc_ml_get( p_ml
, VLC_ML_GET_PLAYLIST
, i_playlist_id
);
1093 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
)
1095 vlc_assert( p_ml
!= NULL
);
1096 vlc_ml_media_list_t
* res
;
1097 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1102 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
)
1104 vlc_assert( p_ml
!= NULL
);
1106 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_MEDIA_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1111 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
)
1113 vlc_assert( p_ml
!= NULL
);
1114 vlc_ml_artist_list_t
* res
;
1115 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1120 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
)
1122 vlc_assert( p_ml
!= NULL
);
1124 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1129 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
)
1131 vlc_assert( p_ml
!= NULL
);
1132 vlc_ml_album_list_t
* res
;
1133 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1138 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
)
1140 vlc_assert( p_ml
!= NULL
);
1142 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS_OF
, params
, i_parent_type
, i_parent_id
, &res
) != VLC_SUCCESS
)
1147 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
)
1149 vlc_assert( p_ml
!= NULL
);
1150 vlc_ml_media_list_t
* res
;
1151 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_TRACKS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1156 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
)
1158 vlc_assert( p_ml
!= NULL
);
1160 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_TRACKS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1165 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
)
1167 vlc_assert( p_ml
!= NULL
);
1168 vlc_ml_media_list_t
* res
;
1169 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUM_ARTISTS
, params
, i_album_id
, &res
) != VLC_SUCCESS
)
1174 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
)
1176 vlc_assert( p_ml
!= NULL
);
1178 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUM_ARTISTS
, params
, i_album_id
, &count
) != VLC_SUCCESS
)
1183 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
)
1185 vlc_assert( p_ml
!= NULL
);
1186 vlc_ml_album_list_t
* res
;
1187 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_ALBUMS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1192 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
)
1194 vlc_assert( p_ml
!= NULL
);
1196 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_ALBUMS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1201 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
)
1203 vlc_assert( p_ml
!= NULL
);
1204 vlc_ml_media_list_t
* res
;
1205 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTIST_TRACKS
, params
, i_artist_id
, &res
) != VLC_SUCCESS
)
1210 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
)
1212 vlc_assert( p_ml
!= NULL
);
1214 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTIST_TRACKS
, params
, i_artist_id
, &count
) != VLC_SUCCESS
)
1219 static inline vlc_ml_media_list_t
* vlc_ml_list_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1221 vlc_assert( p_ml
!= NULL
);
1222 vlc_ml_media_list_t
* res
;
1223 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_VIDEOS
, params
, &res
) != VLC_SUCCESS
)
1228 static inline size_t vlc_ml_count_video_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1230 vlc_assert( p_ml
!= NULL
);
1232 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_VIDEOS
, params
, &count
) != VLC_SUCCESS
)
1237 static inline vlc_ml_media_list_t
* vlc_ml_list_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1239 vlc_assert( p_ml
!= NULL
);
1240 vlc_ml_media_list_t
* res
;
1241 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_AUDIOS
, params
, &res
) != VLC_SUCCESS
)
1246 static inline size_t vlc_ml_count_audio_media( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1248 vlc_assert( p_ml
!= NULL
);
1250 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_AUDIOS
, params
, &count
) != VLC_SUCCESS
)
1255 static inline vlc_ml_album_list_t
* vlc_ml_list_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1257 vlc_assert( p_ml
!= NULL
);
1258 vlc_ml_album_list_t
* res
;
1259 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ALBUMS
, params
, &res
) != VLC_SUCCESS
)
1264 static inline size_t vlc_ml_count_albums( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1266 vlc_assert( p_ml
!= NULL
);
1268 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ALBUMS
, params
, &count
) != VLC_SUCCESS
)
1273 static inline vlc_ml_genre_list_t
* vlc_ml_list_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1275 vlc_assert( p_ml
!= NULL
);
1276 vlc_ml_genre_list_t
* res
;
1277 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRES
, params
, &res
) != VLC_SUCCESS
)
1282 static inline size_t vlc_ml_count_genres( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1284 vlc_assert( p_ml
!= NULL
);
1286 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRES
, params
, &count
) != VLC_SUCCESS
)
1292 * @brief vlc_ml_list_artists
1293 * @param params Query parameters, or NULL for the default
1294 * @param b_include_all True if you wish to fetch artists without at least one album.
1297 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
)
1299 vlc_assert( p_ml
!= NULL
);
1300 vlc_ml_artist_list_t
* res
;
1301 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_ARTISTS
, params
, (int)b_include_all
, &res
) != VLC_SUCCESS
)
1306 static inline size_t vlc_ml_count_artists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
, bool includeAll
)
1308 vlc_assert( p_ml
!= NULL
);
1310 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_ARTISTS
, params
, includeAll
, &count
) != VLC_SUCCESS
)
1315 static inline vlc_ml_show_list_t
* vlc_ml_list_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1317 vlc_assert( p_ml
!= NULL
);
1318 vlc_ml_show_list_t
* res
;
1319 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOWS
, params
, &res
) != VLC_SUCCESS
)
1324 static inline size_t vlc_ml_count_shows( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1326 vlc_assert( p_ml
!= NULL
);
1328 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_SHOWS
, params
, &count
) != VLC_SUCCESS
)
1333 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
)
1335 vlc_assert( p_ml
!= NULL
);
1336 vlc_ml_artist_list_t
* res
;
1337 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ARTISTS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1342 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
)
1344 vlc_assert( p_ml
!= NULL
);
1346 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ARTISTS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1351 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
)
1353 vlc_assert( p_ml
!= NULL
);
1354 vlc_ml_media_list_t
* res
;
1355 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_TRACKS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1360 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
)
1362 vlc_assert( p_ml
!= NULL
);
1364 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_TRACKS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1369 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
)
1371 vlc_assert( p_ml
!= NULL
);
1372 vlc_ml_album_list_t
* res
;
1373 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_GENRE_ALBUMS
, params
, i_genre_id
, &res
) != VLC_SUCCESS
)
1378 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
)
1380 vlc_assert( p_ml
!= NULL
);
1382 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_genre_id
, &count
) != VLC_SUCCESS
)
1387 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
)
1389 vlc_assert( p_ml
!= NULL
);
1390 vlc_ml_media_list_t
* res
;
1391 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_SHOW_EPISODES
, params
, i_show_id
, &res
) != VLC_SUCCESS
)
1396 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
)
1398 vlc_assert( p_ml
!= NULL
);
1400 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_GENRE_ALBUMS
, params
, i_show_id
, &count
) != VLC_SUCCESS
)
1405 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
)
1407 vlc_assert( p_ml
!= NULL
);
1408 vlc_ml_label_list_t
* res
;
1409 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &res
) != VLC_SUCCESS
)
1414 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
)
1416 vlc_assert( p_ml
!= NULL
);
1418 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_MEDIA_LABELS
, params
, i_media_id
, &count
) != VLC_SUCCESS
)
1423 static inline vlc_ml_media_list_t
* vlc_ml_list_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1425 vlc_assert( p_ml
!= NULL
);
1426 vlc_ml_media_list_t
* res
;
1427 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1432 static inline size_t vlc_ml_count_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1434 vlc_assert( p_ml
!= NULL
);
1436 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_HISTORY
, params
, &count
) != VLC_SUCCESS
)
1442 static inline vlc_ml_media_list_t
* vlc_ml_list_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1444 vlc_assert( p_ml
!= NULL
);
1445 vlc_ml_media_list_t
* res
;
1446 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_STREAM_HISTORY
, params
, &res
) != VLC_SUCCESS
)
1451 static inline size_t vlc_ml_count_stream_history( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1453 vlc_assert( p_ml
!= NULL
);
1455 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_STREAM_HISTORY
, params
, &count
) != VLC_SUCCESS
)
1460 static inline vlc_ml_playlist_list_t
* vlc_ml_list_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1462 vlc_assert( p_ml
!= NULL
);
1463 vlc_ml_playlist_list_t
* res
;
1464 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLISTS
, params
, &res
) != VLC_SUCCESS
)
1469 static inline size_t vlc_ml_count_playlists( vlc_medialibrary_t
* p_ml
, const vlc_ml_query_params_t
* params
)
1471 vlc_assert( p_ml
!= NULL
);
1473 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLISTS
, params
, &count
) != VLC_SUCCESS
)
1478 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
)
1480 vlc_assert( p_ml
!= NULL
);
1481 vlc_ml_media_list_t
* res
;
1482 if ( vlc_ml_list( p_ml
, VLC_ML_LIST_PLAYLIST_MEDIA
, params
, i_playlist_id
, &res
) != VLC_SUCCESS
)
1487 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
)
1489 vlc_assert( p_ml
!= NULL
);
1491 if ( vlc_ml_list( p_ml
, VLC_ML_COUNT_PLAYLIST_MEDIA
, params
, i_playlist_id
, &count
) != VLC_SUCCESS
)
1501 # define vlc_ml_release( OBJ ) _Generic( ( OBJ ), \
1502 vlc_ml_show_t*: vlc_ml_show_release, \
1503 vlc_ml_artist_t*: vlc_ml_artist_release, \
1504 vlc_ml_album_t*: vlc_ml_album_release, \
1505 vlc_ml_genre_t*: vlc_ml_genre_release, \
1506 vlc_ml_media_t*: vlc_ml_media_release, \
1507 vlc_ml_playlist_t*: vlc_ml_playlist_release, \
1508 vlc_ml_label_list_t*: vlc_ml_label_list_release, \
1509 vlc_ml_file_list_t*: vlc_ml_file_list_release, \
1510 vlc_ml_artist_list_t*: vlc_ml_artist_list_release, \
1511 vlc_ml_media_list_t*: vlc_ml_media_list_release, \
1512 vlc_ml_album_list_t*: vlc_ml_album_list_release, \
1513 vlc_ml_show_list_t*: vlc_ml_show_list_release, \
1514 vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
1515 vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
1516 vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release, \
1517 vlc_ml_playback_states_all*: vlc_ml_playback_states_all_release, \
1518 vlc_ml_bookmark_t*: vlc_ml_bookmark_release, \
1519 vlc_ml_bookmark_list_t*: vlc_ml_bookmark_list_release \
1522 static inline void vlc_ml_release( vlc_ml_show_t
* show
) { vlc_ml_show_release( show
); }
1523 static inline void vlc_ml_release( vlc_ml_artist_t
* artist
) { vlc_ml_artist_release( artist
); }
1524 static inline void vlc_ml_release( vlc_ml_album_t
* album
) { vlc_ml_album_release( album
); }
1525 static inline void vlc_ml_release( vlc_ml_genre_t
* genre
) { vlc_ml_genre_release( genre
); }
1526 static inline void vlc_ml_release( vlc_ml_media_t
* media
) { vlc_ml_media_release( media
); }
1527 static inline void vlc_ml_release( vlc_ml_playlist_t
* playlist
) { vlc_ml_playlist_release( playlist
); }
1528 static inline void vlc_ml_release( vlc_ml_label_list_t
* list
) { vlc_ml_label_list_release( list
); }
1529 static inline void vlc_ml_release( vlc_ml_file_list_t
* list
) { vlc_ml_file_list_release( list
); }
1530 static inline void vlc_ml_release( vlc_ml_artist_list_t
* list
) { vlc_ml_artist_list_release( list
); }
1531 static inline void vlc_ml_release( vlc_ml_media_list_t
* list
) { vlc_ml_media_list_release( list
); }
1532 static inline void vlc_ml_release( vlc_ml_album_list_t
* list
) { vlc_ml_album_list_release( list
); }
1533 static inline void vlc_ml_release( vlc_ml_show_list_t
* list
) { vlc_ml_show_list_release( list
); }
1534 static inline void vlc_ml_release( vlc_ml_genre_list_t
* list
) { vlc_ml_genre_list_release( list
); }
1535 static inline void vlc_ml_release( vlc_ml_playlist_list_t
* list
) { vlc_ml_playlist_list_release( list
); }
1536 static inline void vlc_ml_release( vlc_ml_entry_point_list_t
* list
) { vlc_ml_entry_point_list_release( list
); }
1537 static inline void vlc_ml_release( vlc_ml_playback_states_all
* prefs
) { vlc_ml_playback_states_all_release( prefs
); }
1538 static inline void vlc_ml_release( vlc_ml_bookmark_t
* bookmark
) { vlc_ml_bookmark_release( bookmark
); }
1539 static inline void vlc_ml_release( vlc_ml_bookmark_list_t
* list
) { vlc_ml_bookmark_list_release( list
); }
1542 #endif /* VLC_MEDIA_LIBRARY_H */