forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvlc_media_library.h
2066 lines (1791 loc) · 76.6 KB
/
vlc_media_library.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*****************************************************************************
* vlc_media_library.h: SQL-based media library
*****************************************************************************
* Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
*
* Authors: Antoine Lejeune <[email protected]>
* Jean-Philippe André <[email protected]>
* Rémi Duraffort <[email protected]>
* Adrien Maglo <[email protected]>
* Srikanth Raju <srikiraju at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_MEDIA_LIBRARY_H
# define VLC_MEDIA_LIBRARY_H
#include <assert.h>
#include <vlc_common.h>
#include <time.h>
# ifdef __cplusplus
extern "C" {
# endif
typedef enum vlc_ml_media_type_t
{
VLC_ML_MEDIA_TYPE_UNKNOWN,
VLC_ML_MEDIA_TYPE_VIDEO,
VLC_ML_MEDIA_TYPE_AUDIO,
} vlc_ml_media_type_t;
typedef enum vlc_ml_media_subtype_t
{
VLC_ML_MEDIA_SUBTYPE_UNKNOWN,
VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE,
VLC_ML_MEDIA_SUBTYPE_MOVIE,
VLC_ML_MEDIA_SUBTYPE_ALBUMTRACK,
} vlc_ml_media_subtype_t;
typedef enum vlc_ml_file_type_t
{
VLC_ML_FILE_TYPE_UNKNOWN,
VLC_ML_FILE_TYPE_MAIN,
VLC_ML_FILE_TYPE_PART,
VLC_ML_FILE_TYPE_SOUNDTRACK,
VLC_ML_FILE_TYPE_SUBTITLE,
VLC_ML_FILE_TYPE_PLAYLIST,
} vlc_ml_file_type_t;
typedef enum vlc_ml_track_type_t
{
VLC_ML_TRACK_TYPE_UNKNOWN,
VLC_ML_TRACK_TYPE_VIDEO,
VLC_ML_TRACK_TYPE_AUDIO,
VLC_ML_TRACK_TYPE_SUBTITLE,
} vlc_ml_track_type_t;
typedef enum vlc_ml_thumbnail_size_t
{
VLC_ML_THUMBNAIL_SMALL,
VLC_ML_THUMBNAIL_BANNER,
VLC_ML_THUMBNAIL_SIZE_COUNT
} vlc_ml_thumbnail_size_t;
typedef enum vlc_ml_thumbnail_status_t
{
VLC_ML_THUMBNAIL_STATUS_MISSING,
VLC_ML_THUMBNAIL_STATUS_AVAILABLE,
VLC_ML_THUMBNAIL_STATUS_FAILURE,
VLC_ML_THUMBNAIL_STATUS_PERSISTENT_FAILURE,
VLC_ML_THUMBNAIL_STATUS_CRASH,
} vlc_ml_thumbnail_status_t;
typedef enum vlc_ml_history_type_t
{
VLC_ML_HISTORY_TYPE_GLOBAL,
VLC_ML_HISTORY_TYPE_LOCAL,
VLC_ML_HISTORY_TYPE_NETWORK,
} vlc_ml_history_type_t;
typedef enum vlc_ml_playlist_type_t
{
VLC_ML_PLAYLIST_TYPE_ALL, /**< Playlist containing any kind of tracks */
VLC_ML_PLAYLIST_TYPE_AUDIO, /**< Playlist containing at least one audio track */
VLC_ML_PLAYLIST_TYPE_VIDEO, /**< Playlist containing at least one video track */
VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY, /**< Playlist containing audio tracks only */
VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY, /**< Playlist containing video tracks only */
} vlc_ml_playlist_type_t;
typedef struct vlc_ml_thumbnail_t
{
char* psz_mrl;
/**
* True if a thumbnail is available, or if thumbnail generation was
* attempted but failed
*/
vlc_ml_thumbnail_status_t i_status;
} vlc_ml_thumbnail_t;
typedef struct vlc_ml_movie_t
{
char* psz_summary;
char* psz_imdb_id;
} vlc_ml_movie_t;
typedef struct vlc_ml_show_episode_t
{
char* psz_summary;
char* psz_tvdb_id;
uint32_t i_episode_nb;
uint32_t i_season_number;
} vlc_ml_show_episode_t;
typedef struct vlc_ml_show_t
{
int64_t i_id;
char* psz_name;
char* psz_summary;
char* psz_artwork_mrl;
char* psz_tvdb_id;
unsigned int i_release_year;
uint32_t i_nb_episodes;
uint32_t i_nb_seasons;
} vlc_ml_show_t;
typedef struct vlc_ml_label_t
{
int64_t i_id;
char* psz_name;
} vlc_ml_label_t;
typedef struct vlc_ml_label_list_t
{
size_t i_nb_items;
vlc_ml_label_t p_items[];
} vlc_ml_label_list_t;
typedef struct vlc_ml_file_t
{
char* psz_mrl;
int64_t i_size;
time_t i_last_modification_date;
vlc_ml_file_type_t i_type;
bool b_external;
bool b_removable;
bool b_present;
} vlc_ml_file_t;
typedef struct vlc_ml_file_list_t
{
size_t i_nb_items;
vlc_ml_file_t p_items[];
} vlc_ml_file_list_t;
typedef struct vlc_ml_media_track_t
{
char* psz_codec;
char* psz_language;
char* psz_description;
vlc_ml_track_type_t i_type;
uint32_t i_bitrate;
union
{
struct
{
// Audio
uint32_t i_nbChannels;
uint32_t i_sampleRate;
} a;
struct
{
// Video
uint32_t i_height;
uint32_t i_width;
uint32_t i_sarNum;
uint32_t i_sarDen;
uint32_t i_fpsNum;
uint32_t i_fpsDen;
} v;
struct
{
// Subtitle
char* psz_encoding;
} s;
};
} vlc_ml_media_track_t;
typedef struct vlc_ml_media_track_list_t
{
size_t i_nb_items;
vlc_ml_media_track_t p_items[];
} vlc_ml_media_track_list_t;
typedef struct vlc_ml_media_t
{
int64_t i_id;
vlc_ml_media_type_t i_type;
vlc_ml_media_subtype_t i_subtype;
vlc_ml_file_list_t* p_files;
vlc_ml_media_track_list_t* p_tracks;
int32_t i_year;
/* Duration in milliseconds */
int64_t i_duration;
uint32_t i_playcount;
double f_progress;
time_t i_last_played_date;
char* psz_title;
char* psz_filename;
vlc_ml_thumbnail_t thumbnails[VLC_ML_THUMBNAIL_SIZE_COUNT];
bool b_is_favorite;
bool b_is_public;
union
{
vlc_ml_show_episode_t show_episode;
vlc_ml_movie_t movie;
struct
{
int64_t i_artist_id;
int64_t i_album_id;
int64_t i_genre_id;
int i_track_nb;
int i_disc_nb;
} album_track;
};
} vlc_ml_media_t;
typedef struct vlc_ml_group_t
{
int64_t i_id;
char* psz_name;
uint32_t i_nb_total_media;
uint32_t i_nb_video;
uint32_t i_nb_audio;
uint32_t i_nb_unknown;
uint32_t i_nb_present_media;
uint32_t i_nb_present_video;
uint32_t i_nb_present_audio;
uint32_t i_nb_present_unknown;
uint32_t i_nb_seen;
uint32_t i_nb_present_seen;
int64_t i_duration;
time_t i_creation_date;
time_t i_last_modification_date;
} vlc_ml_group_t;
typedef struct vlc_ml_playlist_t
{
int64_t i_id;
char* psz_name;
char* psz_mrl;
char* psz_artwork_mrl;
unsigned int i_nb_media;
uint32_t i_nb_video;
uint32_t i_nb_audio;
uint32_t i_nb_unknown;
unsigned int i_nb_present_media;
uint32_t i_nb_present_video;
uint32_t i_nb_present_audio;
uint32_t i_nb_present_unknown;
uint32_t i_creation_date;
int64_t i_duration; /* In ms */
uint32_t i_nb_duration_unknown;
bool b_is_read_only;
bool b_is_favorite;
} vlc_ml_playlist_t;
typedef struct vlc_ml_artist_t
{
int64_t i_id;
char* psz_name;
char* psz_shortbio;
vlc_ml_thumbnail_t thumbnails[VLC_ML_THUMBNAIL_SIZE_COUNT];
char* psz_mb_id;
unsigned int i_nb_album;
unsigned int i_nb_tracks;
uint32_t i_nb_present_tracks;
bool b_is_favorite;
} vlc_ml_artist_t;
typedef struct vlc_ml_artist_list_t
{
size_t i_nb_items;
vlc_ml_artist_t p_items[];
} vlc_ml_artist_list_t;
typedef struct vlc_ml_album_t {
int64_t i_id;
char* psz_title;
char* psz_summary;
vlc_ml_thumbnail_t thumbnails[VLC_ML_THUMBNAIL_SIZE_COUNT];
char* psz_artist;
int64_t i_artist_id;
uint32_t i_nb_tracks;
uint32_t i_nb_present_tracks;
uint32_t i_nb_discs;
int64_t i_duration; /* in ms */
unsigned int i_year;
bool b_is_favorite;
} vlc_ml_album_t;
typedef struct vlc_ml_genre_t
{
int64_t i_id;
char* psz_name;
size_t i_nb_tracks;
vlc_ml_thumbnail_t thumbnails[VLC_ML_THUMBNAIL_SIZE_COUNT];
bool b_is_favorite;
} vlc_ml_genre_t;
typedef struct vlc_ml_media_list_t
{
size_t i_nb_items;
vlc_ml_media_t p_items[];
} vlc_ml_media_list_t;
typedef struct vlc_ml_album_list_t
{
size_t i_nb_items;
vlc_ml_album_t p_items[];
} vlc_ml_album_list_t;
typedef struct vlc_ml_show_list_t
{
size_t i_nb_items;
vlc_ml_show_t p_items[];
} vlc_ml_show_list_t;
typedef struct vlc_ml_genre_list_t
{
size_t i_nb_items;
vlc_ml_genre_t p_items[];
} vlc_ml_genre_list_t;
typedef struct vlc_ml_group_list_t
{
size_t i_nb_items;
vlc_ml_group_t p_items[];
} vlc_ml_group_list_t;
typedef struct vlc_ml_playlist_list_t
{
size_t i_nb_items;
vlc_ml_playlist_t p_items[];
} vlc_ml_playlist_list_t;
typedef struct vlc_ml_folder_t
{
int64_t i_id; /**< The folder's MRL. Will be NULL if b_present is false */
char* psz_name; /**< The folder's name */
char* psz_mrl; /**< The folder's MRL. Will be NULL if b_present is false */
unsigned int i_nb_media; /**< The media count */
unsigned int i_nb_video; /**< The number of video for this folder */
unsigned int i_nb_audio; /**< The number of audio for this volder */
int64_t i_duration; /**< The sum of all the member durations of the folder in ms. */
bool b_is_favorite; /**< The folder's favorite state */
bool b_present; /**< The folder's presence state */
bool b_banned; /**< Will be true if the user required this folder to be excluded */
} vlc_ml_folder_t;
typedef struct vlc_ml_folder_list_t
{
size_t i_nb_items;
vlc_ml_folder_t p_items[];
} vlc_ml_folder_list_t;
typedef struct vlc_ml_bookmark_t
{
int64_t i_media_id; /**< The associated media ID */
int64_t i_time; /**< The bookmark time. The unit is arbitrary */
char* psz_name; /**< The bookmark name */
char* psz_description; /**< The bookmark description */
} vlc_ml_bookmark_t;
typedef struct vlc_ml_boomkmark_list_t
{
size_t i_nb_items;
vlc_ml_bookmark_t p_items[];
} vlc_ml_bookmark_list_t;
/* Opaque medialibrary pointer, to be used by any non-medialibrary module */
typedef struct vlc_medialibrary_t vlc_medialibrary_t;
/* "Private" medialibrary pointer, to be used by the core & medialibrary modules */
typedef struct vlc_medialibrary_module_t vlc_medialibrary_module_t;
/* Opaque event callback type */
typedef struct vlc_ml_event_callback_t vlc_ml_event_callback_t;
typedef enum vlc_ml_sorting_criteria_t
{
/*
* Default depends on the entity type:
* - By track number (and disc number) for album tracks
* - Alphabetical order for others
*/
VLC_ML_SORTING_DEFAULT,
VLC_ML_SORTING_ALPHA,
VLC_ML_SORTING_DURATION,
VLC_ML_SORTING_INSERTIONDATE,
VLC_ML_SORTING_LASTMODIFICATIONDATE,
VLC_ML_SORTING_RELEASEDATE,
VLC_ML_SORTING_FILESIZE,
VLC_ML_SORTING_ARTIST,
VLC_ML_SORTING_PLAYCOUNT,
VLC_ML_SORTING_ALBUM,
VLC_ML_SORTING_FILENAME,
VLC_ML_SORTING_TRACKNUMBER,
} vlc_ml_sorting_criteria_t;
/**
* Generic parameter set for medialibrary queries.
*
* \warning Should only be default instanciated with ::vlc_ml_query_params_create().
*/
typedef struct vlc_ml_query_params_t
{
const char* psz_pattern;
uint32_t i_nbResults;
uint32_t i_offset;
vlc_ml_sorting_criteria_t i_sort;
bool b_desc;
bool b_favorite_only;
bool b_public_only;
} vlc_ml_query_params_t;
enum vlc_ml_get_queries
{
VLC_ML_GET_MEDIA, /**< arg1: Media ID; ret: vlc_ml_media_t* */
VLC_ML_GET_MEDIA_BY_MRL, /**< arg1: Media MRL; ret: vlc_ml_media_t* */
VLC_ML_GET_INPUT_ITEM, /**< arg1: Media ID; ret: input_item_t* */
VLC_ML_GET_INPUT_ITEM_BY_MRL, /**< arg1: Media MRL; ret: input_item_t* */
VLC_ML_GET_ALBUM, /**< arg1: Album ID; ret: vlc_ml_album_t* */
VLC_ML_GET_ARTIST, /**< arg1: Artist ID; ret: vlc_ml_artist_t* */
VLC_ML_GET_GENRE, /**< arg1: Genre ID; ret: vlc_ml_genre_t* */
VLC_ML_GET_SHOW, /**< arg1: Show ID; ret: vlc_ml_show_t* */
VLC_ML_GET_PLAYLIST, /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
VLC_ML_GET_GROUP, /**< arg1: Group ID; ret: vlc_ml_group_t* */
VLC_ML_GET_FOLDER, /**< arg1: folder ID; ret: vlc_ml_folder_t* */
};
enum vlc_ml_list_queries
{
/* General listing: */
VLC_ML_LIST_MEDIA, /**< arg1 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_MEDIA, /**< arg1 (out): size_t* */
VLC_ML_LIST_VIDEOS, /**< arg1 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_VIDEOS, /**< arg1 (out): size_t* */
VLC_ML_LIST_AUDIOS, /**< arg1 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_AUDIOS, /**< arg1 (out): size_t* */
VLC_ML_LIST_ALBUMS, /**< arg1 (out): vlc_ml_album_list_t** */
VLC_ML_COUNT_ALBUMS, /**< arg1 (out): size_t* */
VLC_ML_LIST_GENRES, /**< arg1 (out): vlc_ml_genre_list_t** */
VLC_ML_COUNT_GENRES, /**< arg1 (out): size_t* */
VLC_ML_LIST_ARTISTS, /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t** */
VLC_ML_COUNT_ARTISTS, /**< arg1 bool: includeAll; arg2 (out): size_t* */
VLC_ML_LIST_SHOWS, /**< arg1 (out): vlc_ml_show_list_t** */
VLC_ML_COUNT_SHOWS, /**< arg1 (out): size_t* */
VLC_ML_LIST_GROUPS, /**< arg1 (out): vlc_ml_group_list_t** */
VLC_ML_COUNT_GROUPS, /**< arg1 (out): size_t* */
VLC_ML_LIST_PLAYLISTS, /**< arg1 (out): vlc_ml_playlist_list_t** */
VLC_ML_COUNT_PLAYLISTS, /**< arg1 (out): size_t* */
VLC_ML_LIST_HISTORY, /**< arg1 vlc_ml_history_type_t; arg2 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_HISTORY, /**< arg1 vlc_ml_history_type_t; arg2 (out): size_t* */
VLC_ML_LIST_VIDEO_HISTORY, /**< arg1 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_VIDEO_HISTORY, /**< arg1 (out): vlc_ml_media_list_t** */
VLC_ML_LIST_AUDIO_HISTORY, /**< arg1 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_AUDIO_HISTORY, /**< arg1 (out): vlc_ml_media_list_t** */
VLC_ML_LIST_ENTRY_POINTS, /**< arg1 bool: list_banned; arg2 (out): vlc_ml_folder_list_t** */
VLC_ML_COUNT_ENTRY_POINTS, /**< arg1 bool: list_banned; arg2 (out): size_t* */
VLC_ML_LIST_FOLDERS, /**< arg1 (out): vlc_ml_folder_list_t** */
VLC_ML_COUNT_FOLDERS, /**< arg1 (out): size_t* */
VLC_ML_LIST_FOLDERS_BY_TYPE, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_FOLDERS_BY_TYPE, /**< arg1 vlc_ml_media_type_t: the media type. arg2 (out): vlc_ml_media_list_t** */
/* Album specific listings */
VLC_ML_LIST_ALBUM_TRACKS, /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_ALBUM_TRACKS, /**< arg1: The album id. arg2 (out): size_t* */
VLC_ML_LIST_ALBUM_ARTISTS, /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t** */
VLC_ML_COUNT_ALBUM_ARTISTS, /**< arg1: The album id. arg2 (out): size_t* */
/* Artist specific listings */
VLC_ML_LIST_ARTIST_ALBUMS, /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t** */
VLC_ML_COUNT_ARTIST_ALBUMS, /**< arg1: The artist id. arg2(out): size_t* */
VLC_ML_LIST_ARTIST_TRACKS, /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t** */
VLC_ML_COUNT_ARTIST_TRACKS, /**< arg1: The artist id. arg2(out): size_t* */
/* Genre specific listings */
VLC_ML_LIST_GENRE_ARTISTS, /**< arg1: genre id; arg2 (out): vlc_ml_artist_list_t** */
VLC_ML_COUNT_GENRE_ARTISTS, /**< arg1: genre id; arg2 (out): size_t* */
VLC_ML_LIST_GENRE_TRACKS, /**< arg1: genre id; arg2 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_GENRE_TRACKS, /**< arg1: genre id; arg2 (out): size_t* */
VLC_ML_LIST_GENRE_ALBUMS, /**< arg1: genre id; arg2 (out): vlc_ml_album_list_t** */
VLC_ML_COUNT_GENRE_ALBUMS, /**< arg1: genre id; arg2 (out): size_t* */
/* Show specific listings */
VLC_ML_LIST_SHOW_EPISODES, /**< arg1: show id; arg2(out): vlc_ml_media_list_t** */
VLC_ML_COUNT_SHOW_EPISODES, /**< arg1: show id; arg2(out): size_t* */
/* Media specific listings */
VLC_ML_LIST_MEDIA_LABELS, /**< arg1: media id; arg2 (out): vlc_ml_label_list_t** */
VLC_ML_COUNT_MEDIA_LABELS, /**< arg1: media id; arg2 (out): size_t* */
VLC_ML_LIST_MEDIA_BOOKMARKS, /**< arg1: media id; arg2 (out): vlc_ml_bookmark_list_t** */
/* Groups specific listings */
VLC_ML_LIST_GROUP_MEDIA, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_GROUP_MEDIA, /**< arg1: playlist id; arg2 (out): size_t* */
/* Playlist specific listings */
VLC_ML_LIST_PLAYLIST_MEDIA, /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_PLAYLIST_MEDIA, /**< arg1: playlist id; arg2 (out): size_t* */
/* Folder specific listings */
VLC_ML_LIST_SUBFOLDERS, /**< arg1: parent id; arg2 (out): vlc_ml_folder_list_t** */
VLC_ML_COUNT_SUBFOLDERS, /**< arg1: parent id; arg2 (out): size_t* */
VLC_ML_LIST_FOLDER_MEDIA, /**< arg1: folder id; arg2 (out): vlc_ml_media_list_t** */
VLC_ML_COUNT_FOLDER_MEDIA, /**< arg1: folder id; arg2 (out): size_t* */
/* Children entities listing */
VLC_ML_LIST_MEDIA_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
VLC_ML_COUNT_MEDIA_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
VLC_ML_LIST_VIDEO_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
VLC_ML_COUNT_VIDEO_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
VLC_ML_LIST_AUDIO_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
VLC_ML_COUNT_AUDIO_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
VLC_ML_LIST_ARTISTS_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
VLC_ML_COUNT_ARTISTS_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
VLC_ML_LIST_ALBUMS_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
VLC_ML_COUNT_ALBUMS_OF, /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
};
enum vlc_ml_parent_type
{
VLC_ML_PARENT_UNKNOWN,
VLC_ML_PARENT_ALBUM,
VLC_ML_PARENT_ARTIST,
VLC_ML_PARENT_SHOW,
VLC_ML_PARENT_GENRE,
VLC_ML_PARENT_GROUP,
VLC_ML_PARENT_FOLDER,
VLC_ML_PARENT_PLAYLIST,
};
enum vlc_ml_control
{
/* Adds a folder to discover through the medialibrary */
VLC_ML_ADD_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
VLC_ML_REMOVE_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
VLC_ML_BAN_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
VLC_ML_UNBAN_FOLDER, /**< arg1: mrl (const char*) res: can't fail */
VLC_ML_IS_INDEXED, /**< arg1: mrl (const char*) arg2 (out): bool*; res: can fail */
/**
* Reload a specific folder, or all.
* arg1: mrl (const char*), NULL to reload all folders
* res: can't fail
*/
VLC_ML_RELOAD_FOLDER,
VLC_ML_SET_FOLDER_PUBLIC, /**< arg1: mrl (const char *); res: can't fail */
VLC_ML_SET_FOLDER_PRIVATE, /**< arg1: mrl (const char *); res: can't fail */
/* Pause/resume background operations, such as media discovery & media analysis */
VLC_ML_PAUSE_BACKGROUND, /**< no args; can't fail */
VLC_ML_RESUME_BACKGROUND, /**< no args; can't fail */
/* Misc operations */
VLC_ML_CLEAR_HISTORY, /**< arg1: vlc_ml_history_type_t; can't fail */
/* Create media */
VLC_ML_NEW_EXTERNAL_MEDIA, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
VLC_ML_NEW_STREAM, /**< arg1: const char*; arg2(out): vlc_ml_media_t** */
VLC_ML_REMOVE_STREAM,
/* Media management */
VLC_ML_MEDIA_UPDATE_PROGRESS, /**< arg1: media id; arg2: playback position; can fail */
VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: char**; */
VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE, /**< arg1: media id; arg2: vlc_ml_playback_state; arg3: const char*; */
VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES, /**< arg1: media id; arg2(out): vlc_ml_playback_states_all* */
VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES, /**< arg1: media id; arg2: const vlc_ml_playback_states_all* */
VLC_ML_MEDIA_SET_THUMBNAIL, /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
VLC_ML_MEDIA_SET_GENRE_THUMBNAIL, /**< arg1: media id; arg2: const char*; arg3: vlc_ml_thumbnail_size_t */
VLC_ML_MEDIA_GENERATE_THUMBNAIL, /**< arg1: media id; arg2: vlc_ml_thumbnail_size_t; arg3: width; arg4: height; arg5: position */
VLC_ML_MEDIA_ADD_EXTERNAL_MRL, /**< arg1: media id; arg2: const char*; arg3: type(vlc_ml_file_type_t) */
VLC_ML_MEDIA_SET_TYPE, /**< arg1: media id; arg2: vlc_ml_media_type_t */
VLC_ML_MEDIA_SET_PLAYED, /**< arg1: media id; arg2: bool */
VLC_ML_MEDIA_SET_FAVORITE, /**< arg1: media id; arg2: bool */
VLC_ML_MEDIA_ADD_BOOKMARK, /**< arg1: media id; arg2: int64_t */
VLC_ML_MEDIA_REMOVE_BOOKMARK, /**< arg1: media id; arg2: int64_t */
VLC_ML_MEDIA_REMOVE_ALL_BOOKMARKS, /**< arg1: media id */
VLC_ML_MEDIA_UPDATE_BOOKMARK, /**< arg1: media id; arg2: int64_t; arg3: const char*; arg4: const char* */
/* Playlist management */
VLC_ML_PLAYLIST_CREATE, /**< arg1: const char*; arg2(out): vlc_ml_playlist_t**; can fail */
VLC_ML_PLAYLIST_DELETE, /**< arg1: playlist id; can fail */
VLC_ML_PLAYLIST_APPEND, /**< arg1: playlist id; arg2: pointer on media ids; arg3: media ids count; can fail */
VLC_ML_PLAYLIST_INSERT, /**< arg1: playlist id; arg2: pointer on media ids; arg3: media ids count; arg4: position; can fail */
VLC_ML_PLAYLIST_MOVE, /**< arg1: playlist id; arg2: from; arg3: to; arg4: count; can fail */
VLC_ML_PLAYLIST_REMOVE, /**< arg1: playlist id; arg2: position; arg3: count; can fail */
VLC_ML_PLAYLIST_RENAME, /**< arg1: playlist id; arg2: const char*; can fail */
/* Set Favorites */
VLC_ML_FOLDER_SET_FAVORITE, /**< arg1: mrl (const char*); arg2: bool; res: can fail */
VLC_ML_ARTIST_SET_FAVORITE, /**< arg1: artist id; arg2: bool; can fail */
VLC_ML_ALBUM_SET_FAVORITE, /**< arg1: album id; arg2: bool; can fail */
VLC_ML_GENRE_SET_FAVORITE, /**< arg1: genre id; arg2: bool; can fail */
VLC_ML_PLAYLIST_SET_FAVORITE, /**< arg1: playlist id; arg2: bool; can fail */
};
/**
* User playback settings.
* All values/units are up to the caller and are not interpreted by the media
* library.
* All values are stored and returned as strings.
* When calling vlc_medialibrary_t::pf_control with vlc_ml_MEDIA_GET_MEDIA_PLAYBACK_STATE,
* the value will be returned stored in the provided char**. If the state was
* not set yet, NULL will be returned.
* When setting a state, NULL can be provided as a value to unset it.
*/
enum vlc_ml_playback_state
{
VLC_ML_PLAYBACK_STATE_RATING,
VLC_ML_PLAYBACK_STATE_SPEED,
VLC_ML_PLAYBACK_STATE_TITLE,
VLC_ML_PLAYBACK_STATE_CHAPTER,
VLC_ML_PLAYBACK_STATE_PROGRAM,
VLC_ML_PLAYBACK_STATE_VIDEO_TRACK,
VLC_ML_PLAYBACK_STATE_ASPECT_RATIO,
VLC_ML_PLAYBACK_STATE_ZOOM,
VLC_ML_PLAYBACK_STATE_CROP,
VLC_ML_PLAYBACK_STATE_DEINTERLACE,
VLC_ML_PLAYBACK_STATE_VIDEO_FILTER,
VLC_ML_PLAYBACK_STATE_AUDIO_TRACK,
VLC_ML_PLAYBACK_STATE_GAIN,
VLC_ML_PLAYBACK_STATE_AUDIO_DELAY,
VLC_ML_PLAYBACK_STATE_SUBTITLE_TRACK,
VLC_ML_PLAYBACK_STATE_SUBTITLE_DELAY,
VLC_ML_PLAYBACK_STATE_APP_SPECIFIC,
};
typedef struct vlc_ml_playback_states_all
{
float rate;
float zoom;
int current_title;
char* current_video_track;
char* current_audio_track;
char *current_subtitle_track;
char* aspect_ratio;
char* crop;
char* deinterlace;
char* video_filter;
} vlc_ml_playback_states_all;
enum vlc_ml_event_type
{
/**
* Entity modification callbacks. The affected entity will be passed:
* - As a `vlc_ml_<type>_t`, depending on the type of the modified/inserted
* entity, in `vlc_ml_event_t::modification::p_<type>`
* for ADDED and UPDATED variants.
* - as an id, in ::vlc_ml_event_t::deletion::i_entity_id
* When _DELETED callbacks get invoked, the entity will already have been
* deleted from the database, and cannot be retrieved anymore
*/
VLC_ML_EVENT_MEDIA_ADDED,
VLC_ML_EVENT_MEDIA_UPDATED,
VLC_ML_EVENT_MEDIA_DELETED,
VLC_ML_EVENT_ARTIST_ADDED,
VLC_ML_EVENT_ARTIST_UPDATED,
VLC_ML_EVENT_ARTIST_DELETED,
VLC_ML_EVENT_ALBUM_ADDED,
VLC_ML_EVENT_ALBUM_UPDATED,
VLC_ML_EVENT_ALBUM_DELETED,
VLC_ML_EVENT_GROUP_ADDED,
VLC_ML_EVENT_GROUP_UPDATED,
VLC_ML_EVENT_GROUP_DELETED,
VLC_ML_EVENT_PLAYLIST_ADDED,
VLC_ML_EVENT_PLAYLIST_UPDATED,
VLC_ML_EVENT_PLAYLIST_DELETED,
VLC_ML_EVENT_GENRE_ADDED,
VLC_ML_EVENT_GENRE_UPDATED,
VLC_ML_EVENT_GENRE_DELETED,
VLC_ML_EVENT_BOOKMARKS_ADDED,
VLC_ML_EVENT_BOOKMARKS_UPDATED,
VLC_ML_EVENT_BOOKMARKS_DELETED,
VLC_ML_EVENT_FOLDER_ADDED,
VLC_ML_EVENT_FOLDER_UPDATED,
VLC_ML_EVENT_FOLDER_DELETED,
/**
* A discovery started.
*
* This event will be emitted when the media library starts discovering a
* scheduled entry point.
* If more than a single entry point are queued, this event won't be fired
* again until all operations are completed and a new operation is scheduled.
* Once all currently queued operations are done
* VLC_ML_EVENT_DISCOVERY_COMPLETED will be emitted.
*/
VLC_ML_EVENT_DISCOVERY_STARTED,
/**
* Sent when a discovery or reload operation starts analyzing a new folder.
* The discovered entry point is stored in
* vlc_ml_event_t::discovery_progress::psz_entry_point.
*/
VLC_ML_EVENT_DISCOVERY_PROGRESS,
/**
* Sent when all queued discovery operations are done being processed.
*/
VLC_ML_EVENT_DISCOVERY_COMPLETED,
/**
* This event is sent when a discovery failed. The entry point that failed to
* be discovered is stored in
* vlc_ml_event_t::discovery_failed::psz_entry_point
*/
VLC_ML_EVENT_DISCOVERY_FAILED,
/**
* Sent when a new entry point gets added to the database.
* The entry point that was added is stored in
* vlc::ml_event_t::entry_point_added::psz_entry_point, and the success or failure
* state is stored in vlc_ml_event_t::entry_point_added::b_success
* If successful, this event won't be emitted again for this entry point.
* In case of failure, this event will be fired again if the same entry point
* is queued for discovery again.
*/
VLC_ML_EVENT_ENTRY_POINT_ADDED,
/**
* Sent when an entry point removal request has been processed.
* The removed entry point is stored in
* vlc_ml_event_t::entry_point_removed::psz_entry_point and the success or failure
* state is stored in vlc_ml_event_t::entry_point_removed::b_success
*/
VLC_ML_EVENT_ENTRY_POINT_REMOVED,
/**
* Sent when an entry point ban request has been processed.
* The banned entry point is stored in
* vlc_ml_event_t::entry_point_banned::psz_entry_point and the operation success
* state is stored in vlc_ml_event_t::entry_point_banned::b_success
*/
VLC_ML_EVENT_ENTRY_POINT_BANNED,
/**
* Sent when an entry point unban request has been processed.
* The unbanned entry point is stored in
* vlc_ml_event_t::entry_point_unbanned::psz_entry_point and the operation success
* state is stored in vlc_ml_event_t::entry_point_unbanned::b_success
*/
VLC_ML_EVENT_ENTRY_POINT_UNBANNED,
/**
* Sent when a discoverer or parser threads changes its idle state.
* The idle state is stored in vlc_ml_event_t::background_idle_changed.b_idle.
* False means at least one background thread is in running, true means
* both discoverer & parser threads are paused.
*/
VLC_ML_EVENT_BACKGROUND_IDLE_CHANGED,
/**
* Sent when the parsing progress percentage gets updated.
* The percentage is stored as a [0;100] integer, in
* vlc_ml_event_t::parsing_progress::i_percent
* This value might decrease as more media get discovered, but it will only
* increase once all discovery operations are completed.
*/
VLC_ML_EVENT_PARSING_PROGRESS_UPDATED,
/**
* Sent after a media thumbnail was generated, or if it's generation failed.
* The media is stored in vlc_ml_event_t::media_thumbnail_generated::p_media
* and the success state is stored in
* vlc_ml_event_t::media_thumbnail_generated::b_success
*/
VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED,
/**
* Sent after the history gets changed. It can be either cleaned, or simply
* modified because a media was recently played/removed from the history.
* The history type (global/local/network) is stored in
* vlc_ml_event_t::history_changed::history_type
*/
VLC_ML_EVENT_HISTORY_CHANGED,
/**
* Sent when an application requested rescan starts being processed.
*/
VLC_ML_EVENT_RESCAN_STARTED,
};
typedef struct vlc_ml_event_t
{
int i_type;
union
{
struct
{
const char* psz_entry_point;
} discovery_progress;
struct
{
const char* psz_entry_point;
} discovery_failed;
struct
{
const char* psz_entry_point;
bool b_success;
} entry_point_added;
struct
{
const char* psz_entry_point;
bool b_success;
} entry_point_removed;
struct
{
const char* psz_entry_point;
bool b_success;
} entry_point_banned;
struct
{
const char* psz_entry_point;
bool b_success;
} entry_point_unbanned;
struct
{
uint8_t i_percent;
} parsing_progress;
union
{
const vlc_ml_media_t* p_media;
const vlc_ml_artist_t* p_artist;
const vlc_ml_album_t* p_album;
const vlc_ml_group_t* p_group;
const vlc_ml_playlist_t* p_playlist;
const vlc_ml_genre_t* p_genre;
const vlc_ml_bookmark_t* p_bookmark;
const vlc_ml_folder_t* p_folder;
} creation;
struct
{
int64_t i_entity_id;
} modification;
struct
{
int64_t i_entity_id;
} deletion;
struct
{
bool b_idle;
} background_idle_changed;
struct
{
const vlc_ml_media_t* p_media;
vlc_ml_thumbnail_size_t i_size;
bool b_success;
} media_thumbnail_generated;
struct
{
vlc_ml_history_type_t history_type;
} history_changed;
};
} vlc_ml_event_t;
typedef void (*vlc_ml_callback_t)( void* p_data, const vlc_ml_event_t* p_event );
typedef struct vlc_medialibrary_callbacks_t
{
void (*pf_send_event)( vlc_medialibrary_module_t* p_ml, const vlc_ml_event_t* p_event );
} vlc_medialibrary_callbacks_t;
struct vlc_medialibrary_module_t
{
struct vlc_object_t obj;
module_t *p_module;
void* p_sys;
int (*pf_control)( struct vlc_medialibrary_module_t* p_ml, int i_query, va_list args );
/**
* List some entities from the medialibrary.
*
* \param p_ml The medialibrary module instance.
* \param i_query The type search to be performed. \see vlc_ml_list enumeration
* \param p_params A pointer to a vlc_ml_query_params_t structure, or NULL for
* the default parameters (alphabetical ascending sort, no pagination)
*
* \return VLC_SUCCESS or an error code
*
* Refer to the individual list of vlc_ml_list requests for the additional
* per-query input/output parameters values & types
*/
int (*pf_list)( struct vlc_medialibrary_module_t* p_ml, int i_query,
const vlc_ml_query_params_t* p_params, va_list args );
/**
* Get a specific entity by its id or another unique value
*
* \return The required entity, or a NULL pointer if couldn't be found.
*
* Refer to the list of queries for the specific return type
*/
void* (*pf_get)( struct vlc_medialibrary_module_t* p_ml, int i_query, va_list args );
const vlc_medialibrary_callbacks_t* cbs;
};
vlc_medialibrary_t* libvlc_MlCreate( libvlc_int_t* p_libvlc );
void libvlc_MlRelease( vlc_medialibrary_t* p_ml );
VLC_API vlc_medialibrary_t* vlc_ml_instance_get( vlc_object_t* p_obj ) VLC_USED;
#define vlc_ml_instance_get(x) vlc_ml_instance_get( VLC_OBJECT(x) )
VLC_API void* vlc_ml_get( vlc_medialibrary_t* p_ml, int i_query, ... ) VLC_USED;
VLC_API int vlc_ml_control( vlc_medialibrary_t* p_ml, int i_query, ... ) VLC_USED;
VLC_API int vlc_ml_list( vlc_medialibrary_t* p_ml, int i_query,
const vlc_ml_query_params_t* p_params, ... );
/**
* \brief Registers a medialibrary callback.
* \returns A handle to the callback, to be passed to vlc_ml_event_unregister_callback
*/
VLC_API vlc_ml_event_callback_t*
vlc_ml_event_register_callback( vlc_medialibrary_t* p_ml, vlc_ml_callback_t cb, void* p_data );
/**
* \brief Unregisters a medialibrary callback
* \param p_ml an initialized medialibrary instance
* \param p_callback The callback handle returned by vlc_ml_register_callback
*/
VLC_API void vlc_ml_event_unregister_callback( vlc_medialibrary_t* p_ml,
vlc_ml_event_callback_t* p_callback );
/**
* \brief Unregisters a medialibrary callback from the said callback.
* \param p_ml an initialized medialibrary instance
* \param p_callback The handle returned by vlc_ml_register_callback
*
* This must only be called synchronously from the callback function provided to
* vlc_ml_event_register_callback
* The p_callback handle must be considered invalid when this function returns
*/
VLC_API void vlc_ml_event_unregister_from_callback( vlc_medialibrary_t* p_ml,
vlc_ml_event_callback_t* p_callback );
VLC_API void vlc_ml_show_release( vlc_ml_show_t* p_show );
VLC_API void vlc_ml_artist_release( vlc_ml_artist_t* p_artist );
VLC_API void vlc_ml_genre_release( vlc_ml_genre_t* p_genre );
VLC_API void vlc_ml_media_release( vlc_ml_media_t* p_media );
VLC_API void vlc_ml_album_release( vlc_ml_album_t* p_album );
VLC_API void vlc_ml_group_release( vlc_ml_group_t* p_group );
VLC_API void vlc_ml_playlist_release( vlc_ml_playlist_t* p_playlist );
VLC_API void vlc_ml_folder_release( vlc_ml_folder_t* p_folder );
VLC_API void vlc_ml_label_list_release( vlc_ml_label_list_t* p_list );
VLC_API void vlc_ml_file_list_release( vlc_ml_file_list_t* p_list );
VLC_API void vlc_ml_artist_list_release( vlc_ml_artist_list_t* p_list );
VLC_API void vlc_ml_media_list_release( vlc_ml_media_list_t* p_list );
VLC_API void vlc_ml_album_list_release( vlc_ml_album_list_t* p_list );
VLC_API void vlc_ml_show_list_release( vlc_ml_show_list_t* p_list );
VLC_API void vlc_ml_genre_list_release( vlc_ml_genre_list_t* p_list );
VLC_API void vlc_ml_group_list_release( vlc_ml_group_list_t* p_list );
VLC_API void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t* p_list );
VLC_API void vlc_ml_folder_list_release( vlc_ml_folder_list_t* p_list );
VLC_API void vlc_ml_playback_states_all_release( vlc_ml_playback_states_all* prefs );
VLC_API void vlc_ml_bookmark_release( vlc_ml_bookmark_t* p_bookmark );
VLC_API void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t* p_list );
static inline vlc_ml_query_params_t vlc_ml_query_params_create(void)
{
#ifdef __cplusplus
vlc_ml_query_params_t ret = { };
ret.i_sort = VLC_ML_SORTING_DEFAULT;