-
Notifications
You must be signed in to change notification settings - Fork 6k
/
MediaMetadata.java
1546 lines (1401 loc) · 55.2 KB
/
MediaMetadata.java
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
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.IntDef;
import androidx.annotation.IntRange;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.util.Util;
import com.google.common.base.Objects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Arrays;
import java.util.List;
/**
* Metadata of a {@link MediaItem}, playlist, or a combination of multiple sources of {@link
* Metadata}.
*
* @deprecated com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which
* contains the same ExoPlayer code). See <a
* href="https://developer.android.com/guide/topics/media/media3/getting-started/migration-guide">the
* migration guide</a> for more details, including a script to help with the migration.
*/
@Deprecated
public final class MediaMetadata implements Bundleable {
/** A builder for {@link MediaMetadata} instances. */
public static final class Builder {
@Nullable private CharSequence title;
@Nullable private CharSequence artist;
@Nullable private CharSequence albumTitle;
@Nullable private CharSequence albumArtist;
@Nullable private CharSequence displayTitle;
@Nullable private CharSequence subtitle;
@Nullable private CharSequence description;
@Nullable private Rating userRating;
@Nullable private Rating overallRating;
@Nullable private byte[] artworkData;
@Nullable private @PictureType Integer artworkDataType;
@Nullable private Uri artworkUri;
@Nullable private Integer trackNumber;
@Nullable private Integer totalTrackCount;
@SuppressWarnings("deprecation") // Builder for deprecated field.
@Nullable
private @FolderType Integer folderType;
@Nullable private Boolean isBrowsable;
@Nullable private Boolean isPlayable;
@Nullable private Integer recordingYear;
@Nullable private Integer recordingMonth;
@Nullable private Integer recordingDay;
@Nullable private Integer releaseYear;
@Nullable private Integer releaseMonth;
@Nullable private Integer releaseDay;
@Nullable private CharSequence writer;
@Nullable private CharSequence composer;
@Nullable private CharSequence conductor;
@Nullable private Integer discNumber;
@Nullable private Integer totalDiscCount;
@Nullable private CharSequence genre;
@Nullable private CharSequence compilation;
@Nullable private CharSequence station;
@Nullable private @MediaType Integer mediaType;
@Nullable private Bundle extras;
public Builder() {}
@SuppressWarnings("deprecation") // Assigning from deprecated fields.
private Builder(MediaMetadata mediaMetadata) {
this.title = mediaMetadata.title;
this.artist = mediaMetadata.artist;
this.albumTitle = mediaMetadata.albumTitle;
this.albumArtist = mediaMetadata.albumArtist;
this.displayTitle = mediaMetadata.displayTitle;
this.subtitle = mediaMetadata.subtitle;
this.description = mediaMetadata.description;
this.userRating = mediaMetadata.userRating;
this.overallRating = mediaMetadata.overallRating;
this.artworkData = mediaMetadata.artworkData;
this.artworkDataType = mediaMetadata.artworkDataType;
this.artworkUri = mediaMetadata.artworkUri;
this.trackNumber = mediaMetadata.trackNumber;
this.totalTrackCount = mediaMetadata.totalTrackCount;
this.folderType = mediaMetadata.folderType;
this.isBrowsable = mediaMetadata.isBrowsable;
this.isPlayable = mediaMetadata.isPlayable;
this.recordingYear = mediaMetadata.recordingYear;
this.recordingMonth = mediaMetadata.recordingMonth;
this.recordingDay = mediaMetadata.recordingDay;
this.releaseYear = mediaMetadata.releaseYear;
this.releaseMonth = mediaMetadata.releaseMonth;
this.releaseDay = mediaMetadata.releaseDay;
this.writer = mediaMetadata.writer;
this.composer = mediaMetadata.composer;
this.conductor = mediaMetadata.conductor;
this.discNumber = mediaMetadata.discNumber;
this.totalDiscCount = mediaMetadata.totalDiscCount;
this.genre = mediaMetadata.genre;
this.compilation = mediaMetadata.compilation;
this.station = mediaMetadata.station;
this.mediaType = mediaMetadata.mediaType;
this.extras = mediaMetadata.extras;
}
/** Sets the title. */
@CanIgnoreReturnValue
public Builder setTitle(@Nullable CharSequence title) {
this.title = title;
return this;
}
/** Sets the artist. */
@CanIgnoreReturnValue
public Builder setArtist(@Nullable CharSequence artist) {
this.artist = artist;
return this;
}
/** Sets the album title. */
@CanIgnoreReturnValue
public Builder setAlbumTitle(@Nullable CharSequence albumTitle) {
this.albumTitle = albumTitle;
return this;
}
/** Sets the album artist. */
@CanIgnoreReturnValue
public Builder setAlbumArtist(@Nullable CharSequence albumArtist) {
this.albumArtist = albumArtist;
return this;
}
/** Sets the display title. */
@CanIgnoreReturnValue
public Builder setDisplayTitle(@Nullable CharSequence displayTitle) {
this.displayTitle = displayTitle;
return this;
}
/**
* Sets the subtitle.
*
* <p>This is the secondary title of the media, unrelated to closed captions.
*/
@CanIgnoreReturnValue
public Builder setSubtitle(@Nullable CharSequence subtitle) {
this.subtitle = subtitle;
return this;
}
/** Sets the description. */
@CanIgnoreReturnValue
public Builder setDescription(@Nullable CharSequence description) {
this.description = description;
return this;
}
/** Sets the user {@link Rating}. */
@CanIgnoreReturnValue
public Builder setUserRating(@Nullable Rating userRating) {
this.userRating = userRating;
return this;
}
/** Sets the overall {@link Rating}. */
@CanIgnoreReturnValue
public Builder setOverallRating(@Nullable Rating overallRating) {
this.overallRating = overallRating;
return this;
}
/**
* @deprecated Use {@link #setArtworkData(byte[] data, Integer pictureType)} or {@link
* #maybeSetArtworkData(byte[] data, int pictureType)}, providing a {@link PictureType}.
*/
@CanIgnoreReturnValue
@Deprecated
public Builder setArtworkData(@Nullable byte[] artworkData) {
return setArtworkData(artworkData, /* artworkDataType= */ null);
}
/**
* Sets the artwork data as a compressed byte array with an associated {@link PictureType
* artworkDataType}.
*/
@CanIgnoreReturnValue
public Builder setArtworkData(
@Nullable byte[] artworkData, @Nullable @PictureType Integer artworkDataType) {
this.artworkData = artworkData == null ? null : artworkData.clone();
this.artworkDataType = artworkDataType;
return this;
}
/**
* Sets the artwork data as a compressed byte array in the event that the associated {@link
* PictureType} is {@link #PICTURE_TYPE_FRONT_COVER}, the existing {@link PictureType} is not
* {@link #PICTURE_TYPE_FRONT_COVER}, or the current artworkData is not set.
*
* <p>Use {@link #setArtworkData(byte[], Integer)} to set the artwork data without checking the
* {@link PictureType}.
*/
@CanIgnoreReturnValue
public Builder maybeSetArtworkData(byte[] artworkData, @PictureType int artworkDataType) {
if (this.artworkData == null
|| Util.areEqual(artworkDataType, PICTURE_TYPE_FRONT_COVER)
|| !Util.areEqual(this.artworkDataType, PICTURE_TYPE_FRONT_COVER)) {
this.artworkData = artworkData.clone();
this.artworkDataType = artworkDataType;
}
return this;
}
/** Sets the artwork {@link Uri}. */
@CanIgnoreReturnValue
public Builder setArtworkUri(@Nullable Uri artworkUri) {
this.artworkUri = artworkUri;
return this;
}
/** Sets the track number. */
@CanIgnoreReturnValue
public Builder setTrackNumber(@Nullable Integer trackNumber) {
this.trackNumber = trackNumber;
return this;
}
/** Sets the total number of tracks. */
@CanIgnoreReturnValue
public Builder setTotalTrackCount(@Nullable Integer totalTrackCount) {
this.totalTrackCount = totalTrackCount;
return this;
}
/**
* Sets the {@link FolderType}.
*
* @deprecated Use {@link #setIsBrowsable} to indicate if an item is a browsable folder and use
* {@link #setMediaType} to indicate the type of the folder.
*/
@SuppressWarnings("deprecation") // Using deprecated type.
@Deprecated
@CanIgnoreReturnValue
public Builder setFolderType(@Nullable @FolderType Integer folderType) {
this.folderType = folderType;
return this;
}
/** Sets whether the media is a browsable folder. */
@CanIgnoreReturnValue
public Builder setIsBrowsable(@Nullable Boolean isBrowsable) {
this.isBrowsable = isBrowsable;
return this;
}
/** Sets whether the media is playable. */
@CanIgnoreReturnValue
public Builder setIsPlayable(@Nullable Boolean isPlayable) {
this.isPlayable = isPlayable;
return this;
}
/**
* @deprecated Use {@link #setRecordingYear(Integer)} instead.
*/
@CanIgnoreReturnValue
@Deprecated
public Builder setYear(@Nullable Integer year) {
return setRecordingYear(year);
}
/** Sets the year of the recording date. */
@CanIgnoreReturnValue
public Builder setRecordingYear(@Nullable Integer recordingYear) {
this.recordingYear = recordingYear;
return this;
}
/**
* Sets the month of the recording date.
*
* <p>Value should be between 1 and 12.
*/
@CanIgnoreReturnValue
public Builder setRecordingMonth(
@Nullable @IntRange(from = 1, to = 12) Integer recordingMonth) {
this.recordingMonth = recordingMonth;
return this;
}
/**
* Sets the day of the recording date.
*
* <p>Value should be between 1 and 31.
*/
@CanIgnoreReturnValue
public Builder setRecordingDay(@Nullable @IntRange(from = 1, to = 31) Integer recordingDay) {
this.recordingDay = recordingDay;
return this;
}
/** Sets the year of the release date. */
@CanIgnoreReturnValue
public Builder setReleaseYear(@Nullable Integer releaseYear) {
this.releaseYear = releaseYear;
return this;
}
/**
* Sets the month of the release date.
*
* <p>Value should be between 1 and 12.
*/
@CanIgnoreReturnValue
public Builder setReleaseMonth(@Nullable @IntRange(from = 1, to = 12) Integer releaseMonth) {
this.releaseMonth = releaseMonth;
return this;
}
/**
* Sets the day of the release date.
*
* <p>Value should be between 1 and 31.
*/
@CanIgnoreReturnValue
public Builder setReleaseDay(@Nullable @IntRange(from = 1, to = 31) Integer releaseDay) {
this.releaseDay = releaseDay;
return this;
}
/** Sets the writer. */
@CanIgnoreReturnValue
public Builder setWriter(@Nullable CharSequence writer) {
this.writer = writer;
return this;
}
/** Sets the composer. */
@CanIgnoreReturnValue
public Builder setComposer(@Nullable CharSequence composer) {
this.composer = composer;
return this;
}
/** Sets the conductor. */
@CanIgnoreReturnValue
public Builder setConductor(@Nullable CharSequence conductor) {
this.conductor = conductor;
return this;
}
/** Sets the disc number. */
@CanIgnoreReturnValue
public Builder setDiscNumber(@Nullable Integer discNumber) {
this.discNumber = discNumber;
return this;
}
/** Sets the total number of discs. */
@CanIgnoreReturnValue
public Builder setTotalDiscCount(@Nullable Integer totalDiscCount) {
this.totalDiscCount = totalDiscCount;
return this;
}
/** Sets the genre. */
@CanIgnoreReturnValue
public Builder setGenre(@Nullable CharSequence genre) {
this.genre = genre;
return this;
}
/** Sets the compilation. */
@CanIgnoreReturnValue
public Builder setCompilation(@Nullable CharSequence compilation) {
this.compilation = compilation;
return this;
}
/** Sets the name of the station streaming the media. */
@CanIgnoreReturnValue
public Builder setStation(@Nullable CharSequence station) {
this.station = station;
return this;
}
/** Sets the {@link MediaType}. */
@CanIgnoreReturnValue
public Builder setMediaType(@Nullable @MediaType Integer mediaType) {
this.mediaType = mediaType;
return this;
}
/** Sets the extras {@link Bundle}. */
@CanIgnoreReturnValue
public Builder setExtras(@Nullable Bundle extras) {
this.extras = extras;
return this;
}
/**
* Sets all fields supported by the {@link Metadata.Entry entries} within the {@link Metadata}.
*
* <p>Fields are only set if the {@link Metadata.Entry} has an implementation for {@link
* Metadata.Entry#populateMediaMetadata(Builder)}.
*
* <p>In the event that multiple {@link Metadata.Entry} objects within the {@link Metadata}
* relate to the same {@link MediaMetadata} field, then the last one will be used.
*/
@CanIgnoreReturnValue
public Builder populateFromMetadata(Metadata metadata) {
for (int i = 0; i < metadata.length(); i++) {
Metadata.Entry entry = metadata.get(i);
entry.populateMediaMetadata(this);
}
return this;
}
/**
* Sets all fields supported by the {@link Metadata.Entry entries} within the list of {@link
* Metadata}.
*
* <p>Fields are only set if the {@link Metadata.Entry} has an implementation for {@link
* Metadata.Entry#populateMediaMetadata(Builder)}.
*
* <p>In the event that multiple {@link Metadata.Entry} objects within any of the {@link
* Metadata} relate to the same {@link MediaMetadata} field, then the last one will be used.
*/
@CanIgnoreReturnValue
public Builder populateFromMetadata(List<Metadata> metadataList) {
for (int i = 0; i < metadataList.size(); i++) {
Metadata metadata = metadataList.get(i);
for (int j = 0; j < metadata.length(); j++) {
Metadata.Entry entry = metadata.get(j);
entry.populateMediaMetadata(this);
}
}
return this;
}
/**
* Populates all the fields from {@code mediaMetadata}.
*
* <p>Fields are populated when they are non-null with an exception that both {@code artworkUri}
* and {@code artworkData} are populated, when at least one of them is non-null.
*/
@SuppressWarnings("deprecation") // Populating deprecated fields.
@CanIgnoreReturnValue
public Builder populate(@Nullable MediaMetadata mediaMetadata) {
if (mediaMetadata == null) {
return this;
}
if (mediaMetadata.title != null) {
setTitle(mediaMetadata.title);
}
if (mediaMetadata.artist != null) {
setArtist(mediaMetadata.artist);
}
if (mediaMetadata.albumTitle != null) {
setAlbumTitle(mediaMetadata.albumTitle);
}
if (mediaMetadata.albumArtist != null) {
setAlbumArtist(mediaMetadata.albumArtist);
}
if (mediaMetadata.displayTitle != null) {
setDisplayTitle(mediaMetadata.displayTitle);
}
if (mediaMetadata.subtitle != null) {
setSubtitle(mediaMetadata.subtitle);
}
if (mediaMetadata.description != null) {
setDescription(mediaMetadata.description);
}
if (mediaMetadata.userRating != null) {
setUserRating(mediaMetadata.userRating);
}
if (mediaMetadata.overallRating != null) {
setOverallRating(mediaMetadata.overallRating);
}
if (mediaMetadata.artworkUri != null || mediaMetadata.artworkData != null) {
setArtworkUri(mediaMetadata.artworkUri);
setArtworkData(mediaMetadata.artworkData, mediaMetadata.artworkDataType);
}
if (mediaMetadata.trackNumber != null) {
setTrackNumber(mediaMetadata.trackNumber);
}
if (mediaMetadata.totalTrackCount != null) {
setTotalTrackCount(mediaMetadata.totalTrackCount);
}
if (mediaMetadata.folderType != null) {
setFolderType(mediaMetadata.folderType);
}
if (mediaMetadata.isBrowsable != null) {
setIsBrowsable(mediaMetadata.isBrowsable);
}
if (mediaMetadata.isPlayable != null) {
setIsPlayable(mediaMetadata.isPlayable);
}
if (mediaMetadata.year != null) {
setRecordingYear(mediaMetadata.year);
}
if (mediaMetadata.recordingYear != null) {
setRecordingYear(mediaMetadata.recordingYear);
}
if (mediaMetadata.recordingMonth != null) {
setRecordingMonth(mediaMetadata.recordingMonth);
}
if (mediaMetadata.recordingDay != null) {
setRecordingDay(mediaMetadata.recordingDay);
}
if (mediaMetadata.releaseYear != null) {
setReleaseYear(mediaMetadata.releaseYear);
}
if (mediaMetadata.releaseMonth != null) {
setReleaseMonth(mediaMetadata.releaseMonth);
}
if (mediaMetadata.releaseDay != null) {
setReleaseDay(mediaMetadata.releaseDay);
}
if (mediaMetadata.writer != null) {
setWriter(mediaMetadata.writer);
}
if (mediaMetadata.composer != null) {
setComposer(mediaMetadata.composer);
}
if (mediaMetadata.conductor != null) {
setConductor(mediaMetadata.conductor);
}
if (mediaMetadata.discNumber != null) {
setDiscNumber(mediaMetadata.discNumber);
}
if (mediaMetadata.totalDiscCount != null) {
setTotalDiscCount(mediaMetadata.totalDiscCount);
}
if (mediaMetadata.genre != null) {
setGenre(mediaMetadata.genre);
}
if (mediaMetadata.compilation != null) {
setCompilation(mediaMetadata.compilation);
}
if (mediaMetadata.station != null) {
setStation(mediaMetadata.station);
}
if (mediaMetadata.mediaType != null) {
setMediaType(mediaMetadata.mediaType);
}
if (mediaMetadata.extras != null) {
setExtras(mediaMetadata.extras);
}
return this;
}
/** Returns a new {@link MediaMetadata} instance with the current builder values. */
public MediaMetadata build() {
return new MediaMetadata(/* builder= */ this);
}
}
/**
* The type of content described by the media item.
*
* <p>One of {@link #MEDIA_TYPE_MIXED}, {@link #MEDIA_TYPE_MUSIC}, {@link
* #MEDIA_TYPE_AUDIO_BOOK_CHAPTER}, {@link #MEDIA_TYPE_PODCAST_EPISODE}, {@link
* #MEDIA_TYPE_RADIO_STATION}, {@link #MEDIA_TYPE_NEWS}, {@link #MEDIA_TYPE_VIDEO}, {@link
* #MEDIA_TYPE_TRAILER}, {@link #MEDIA_TYPE_MOVIE}, {@link #MEDIA_TYPE_TV_SHOW}, {@link
* #MEDIA_TYPE_ALBUM}, {@link #MEDIA_TYPE_ARTIST}, {@link #MEDIA_TYPE_GENRE}, {@link
* #MEDIA_TYPE_PLAYLIST}, {@link #MEDIA_TYPE_YEAR}, {@link #MEDIA_TYPE_AUDIO_BOOK}, {@link
* #MEDIA_TYPE_PODCAST}, {@link #MEDIA_TYPE_TV_CHANNEL}, {@link #MEDIA_TYPE_TV_SERIES}, {@link
* #MEDIA_TYPE_TV_SEASON}, {@link #MEDIA_TYPE_FOLDER_MIXED}, {@link #MEDIA_TYPE_FOLDER_ALBUMS},
* {@link #MEDIA_TYPE_FOLDER_ARTISTS}, {@link #MEDIA_TYPE_FOLDER_GENRES}, {@link
* #MEDIA_TYPE_FOLDER_PLAYLISTS}, {@link #MEDIA_TYPE_FOLDER_YEARS}, {@link
* #MEDIA_TYPE_FOLDER_AUDIO_BOOKS}, {@link #MEDIA_TYPE_FOLDER_PODCASTS}, {@link
* #MEDIA_TYPE_FOLDER_TV_CHANNELS}, {@link #MEDIA_TYPE_FOLDER_TV_SERIES}, {@link
* #MEDIA_TYPE_FOLDER_TV_SHOWS}, {@link #MEDIA_TYPE_FOLDER_RADIO_STATIONS}, {@link
* #MEDIA_TYPE_FOLDER_NEWS}, {@link #MEDIA_TYPE_FOLDER_VIDEOS}, {@link
* #MEDIA_TYPE_FOLDER_TRAILERS} or {@link #MEDIA_TYPE_FOLDER_MOVIES}.
*/
@Documented
@Retention(RetentionPolicy.SOURCE)
@Target(TYPE_USE)
@IntDef({
MEDIA_TYPE_MIXED,
MEDIA_TYPE_MUSIC,
MEDIA_TYPE_AUDIO_BOOK_CHAPTER,
MEDIA_TYPE_PODCAST_EPISODE,
MEDIA_TYPE_RADIO_STATION,
MEDIA_TYPE_NEWS,
MEDIA_TYPE_VIDEO,
MEDIA_TYPE_TRAILER,
MEDIA_TYPE_MOVIE,
MEDIA_TYPE_TV_SHOW,
MEDIA_TYPE_ALBUM,
MEDIA_TYPE_ARTIST,
MEDIA_TYPE_GENRE,
MEDIA_TYPE_PLAYLIST,
MEDIA_TYPE_YEAR,
MEDIA_TYPE_AUDIO_BOOK,
MEDIA_TYPE_PODCAST,
MEDIA_TYPE_TV_CHANNEL,
MEDIA_TYPE_TV_SERIES,
MEDIA_TYPE_TV_SEASON,
MEDIA_TYPE_FOLDER_MIXED,
MEDIA_TYPE_FOLDER_ALBUMS,
MEDIA_TYPE_FOLDER_ARTISTS,
MEDIA_TYPE_FOLDER_GENRES,
MEDIA_TYPE_FOLDER_PLAYLISTS,
MEDIA_TYPE_FOLDER_YEARS,
MEDIA_TYPE_FOLDER_AUDIO_BOOKS,
MEDIA_TYPE_FOLDER_PODCASTS,
MEDIA_TYPE_FOLDER_TV_CHANNELS,
MEDIA_TYPE_FOLDER_TV_SERIES,
MEDIA_TYPE_FOLDER_TV_SHOWS,
MEDIA_TYPE_FOLDER_RADIO_STATIONS,
MEDIA_TYPE_FOLDER_NEWS,
MEDIA_TYPE_FOLDER_VIDEOS,
MEDIA_TYPE_FOLDER_TRAILERS,
MEDIA_TYPE_FOLDER_MOVIES,
})
public @interface MediaType {}
/** Media of undetermined type or a mix of multiple {@linkplain MediaType media types}. */
public static final int MEDIA_TYPE_MIXED = 0;
/** {@link MediaType} for music. */
public static final int MEDIA_TYPE_MUSIC = 1;
/** {@link MediaType} for an audio book chapter. */
public static final int MEDIA_TYPE_AUDIO_BOOK_CHAPTER = 2;
/** {@link MediaType} for a podcast episode. */
public static final int MEDIA_TYPE_PODCAST_EPISODE = 3;
/** {@link MediaType} for a radio station. */
public static final int MEDIA_TYPE_RADIO_STATION = 4;
/** {@link MediaType} for news. */
public static final int MEDIA_TYPE_NEWS = 5;
/** {@link MediaType} for a video. */
public static final int MEDIA_TYPE_VIDEO = 6;
/** {@link MediaType} for a movie trailer. */
public static final int MEDIA_TYPE_TRAILER = 7;
/** {@link MediaType} for a movie. */
public static final int MEDIA_TYPE_MOVIE = 8;
/** {@link MediaType} for a TV show. */
public static final int MEDIA_TYPE_TV_SHOW = 9;
/**
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) belonging to an
* album.
*/
public static final int MEDIA_TYPE_ALBUM = 10;
/**
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) from the same
* artist.
*/
public static final int MEDIA_TYPE_ARTIST = 11;
/**
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) of the same
* genre.
*/
public static final int MEDIA_TYPE_GENRE = 12;
/**
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) forming a
* playlist.
*/
public static final int MEDIA_TYPE_PLAYLIST = 13;
/**
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) from the same
* year.
*/
public static final int MEDIA_TYPE_YEAR = 14;
/**
* {@link MediaType} for a group of items forming an audio book. Items in this group are typically
* of type {@link #MEDIA_TYPE_AUDIO_BOOK_CHAPTER}.
*/
public static final int MEDIA_TYPE_AUDIO_BOOK = 15;
/**
* {@link MediaType} for a group of items belonging to a podcast. Items in this group are
* typically of type {@link #MEDIA_TYPE_PODCAST_EPISODE}.
*/
public static final int MEDIA_TYPE_PODCAST = 16;
/**
* {@link MediaType} for a group of items that are part of a TV channel. Items in this group are
* typically of type {@link #MEDIA_TYPE_TV_SHOW}, {@link #MEDIA_TYPE_TV_SERIES} or {@link
* #MEDIA_TYPE_MOVIE}.
*/
public static final int MEDIA_TYPE_TV_CHANNEL = 17;
/**
* {@link MediaType} for a group of items that are part of a TV series. Items in this group are
* typically of type {@link #MEDIA_TYPE_TV_SHOW} or {@link #MEDIA_TYPE_TV_SEASON}.
*/
public static final int MEDIA_TYPE_TV_SERIES = 18;
/**
* {@link MediaType} for a group of items that are part of a TV series. Items in this group are
* typically of type {@link #MEDIA_TYPE_TV_SHOW}.
*/
public static final int MEDIA_TYPE_TV_SEASON = 19;
/** {@link MediaType} for a folder with mixed or undetermined content. */
public static final int MEDIA_TYPE_FOLDER_MIXED = 20;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_ALBUM albums}. */
public static final int MEDIA_TYPE_FOLDER_ALBUMS = 21;
/** {@link MediaType} for a folder containing {@linkplain #FIELD_ARTIST artists}. */
public static final int MEDIA_TYPE_FOLDER_ARTISTS = 22;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_GENRE genres}. */
public static final int MEDIA_TYPE_FOLDER_GENRES = 23;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_PLAYLIST playlists}. */
public static final int MEDIA_TYPE_FOLDER_PLAYLISTS = 24;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_YEAR years}. */
public static final int MEDIA_TYPE_FOLDER_YEARS = 25;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_AUDIO_BOOK audio books}. */
public static final int MEDIA_TYPE_FOLDER_AUDIO_BOOKS = 26;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_PODCAST podcasts}. */
public static final int MEDIA_TYPE_FOLDER_PODCASTS = 27;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_CHANNEL TV channels}. */
public static final int MEDIA_TYPE_FOLDER_TV_CHANNELS = 28;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_SERIES TV series}. */
public static final int MEDIA_TYPE_FOLDER_TV_SERIES = 29;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_SHOW TV shows}. */
public static final int MEDIA_TYPE_FOLDER_TV_SHOWS = 30;
/**
* {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_RADIO_STATION radio
* stations}.
*/
public static final int MEDIA_TYPE_FOLDER_RADIO_STATIONS = 31;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_NEWS news}. */
public static final int MEDIA_TYPE_FOLDER_NEWS = 32;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_VIDEO videos}. */
public static final int MEDIA_TYPE_FOLDER_VIDEOS = 33;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TRAILER movie trailers}. */
public static final int MEDIA_TYPE_FOLDER_TRAILERS = 34;
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_MOVIE movies}. */
public static final int MEDIA_TYPE_FOLDER_MOVIES = 35;
/**
* The folder type of the media item.
*
* <p>This can be used as the type of a browsable bluetooth folder (see section 6.10.2.2 of the <a
* href="https://www.bluetooth.com/specifications/specs/a-v-remote-control-profile-1-6-2/">Bluetooth
* AVRCP 1.6.2</a>).
*
* <p>One of {@link #FOLDER_TYPE_NONE}, {@link #FOLDER_TYPE_MIXED}, {@link #FOLDER_TYPE_TITLES},
* {@link #FOLDER_TYPE_ALBUMS}, {@link #FOLDER_TYPE_ARTISTS}, {@link #FOLDER_TYPE_GENRES}, {@link
* #FOLDER_TYPE_PLAYLISTS} or {@link #FOLDER_TYPE_YEARS}.
*
* @deprecated Use {@link #isBrowsable} to indicate if an item is a browsable folder and use
* {@link #mediaType} to indicate the type of the folder.
*/
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented
@Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@Deprecated
@SuppressWarnings("deprecation") // Defining deprecated constants.
@IntDef({
FOLDER_TYPE_NONE,
FOLDER_TYPE_MIXED,
FOLDER_TYPE_TITLES,
FOLDER_TYPE_ALBUMS,
FOLDER_TYPE_ARTISTS,
FOLDER_TYPE_GENRES,
FOLDER_TYPE_PLAYLISTS,
FOLDER_TYPE_YEARS
})
public @interface FolderType {}
/**
* Type for an item that is not a folder.
*
* @deprecated Use {@link #isBrowsable} set to false instead.
*/
@Deprecated public static final int FOLDER_TYPE_NONE = -1;
/**
* Type for a folder containing media of mixed types.
*
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
* #MEDIA_TYPE_FOLDER_MIXED} instead.
*/
@Deprecated public static final int FOLDER_TYPE_MIXED = 0;
/**
* Type for a folder containing only playable media.
*
* @deprecated Use {@link #isBrowsable} set to true instead.
*/
@Deprecated public static final int FOLDER_TYPE_TITLES = 1;
/**
* Type for a folder containing media categorized by album.
*
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
* #MEDIA_TYPE_FOLDER_ALBUMS} instead.
*/
@Deprecated public static final int FOLDER_TYPE_ALBUMS = 2;
/**
* Type for a folder containing media categorized by artist.
*
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
* #MEDIA_TYPE_FOLDER_ARTISTS} instead.
*/
@Deprecated public static final int FOLDER_TYPE_ARTISTS = 3;
/**
* Type for a folder containing media categorized by genre.
*
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
* #MEDIA_TYPE_FOLDER_GENRES} instead.
*/
@Deprecated public static final int FOLDER_TYPE_GENRES = 4;
/**
* Type for a folder containing a playlist.
*
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
* #MEDIA_TYPE_FOLDER_PLAYLISTS} instead.
*/
@Deprecated public static final int FOLDER_TYPE_PLAYLISTS = 5;
/**
* Type for a folder containing media categorized by year.
*
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
* #MEDIA_TYPE_FOLDER_YEARS} instead.
*/
@Deprecated public static final int FOLDER_TYPE_YEARS = 6;
/**
* The picture type of the artwork.
*
* <p>Values sourced from the ID3 v2.4 specification (See section 4.14 of
* https://id3.org/id3v2.4.0-frames).
*
* <p>One of {@link #PICTURE_TYPE_OTHER}, {@link #PICTURE_TYPE_FILE_ICON}, {@link
* #PICTURE_TYPE_FILE_ICON_OTHER}, {@link #PICTURE_TYPE_FRONT_COVER}, {@link
* #PICTURE_TYPE_BACK_COVER}, {@link #PICTURE_TYPE_LEAFLET_PAGE}, {@link #PICTURE_TYPE_MEDIA},
* {@link #PICTURE_TYPE_LEAD_ARTIST_PERFORMER}, {@link #PICTURE_TYPE_ARTIST_PERFORMER}, {@link
* #PICTURE_TYPE_CONDUCTOR}, {@link #PICTURE_TYPE_BAND_ORCHESTRA}, {@link #PICTURE_TYPE_COMPOSER},
* {@link #PICTURE_TYPE_LYRICIST}, {@link #PICTURE_TYPE_RECORDING_LOCATION}, {@link
* #PICTURE_TYPE_DURING_RECORDING}, {@link #PICTURE_TYPE_DURING_PERFORMANCE}, {@link
* #PICTURE_TYPE_MOVIE_VIDEO_SCREEN_CAPTURE}, {@link #PICTURE_TYPE_A_BRIGHT_COLORED_FISH}, {@link
* #PICTURE_TYPE_ILLUSTRATION}, {@link #PICTURE_TYPE_BAND_ARTIST_LOGO} or {@link
* #PICTURE_TYPE_PUBLISHER_STUDIO_LOGO}.
*/
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented
@Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({
PICTURE_TYPE_OTHER,
PICTURE_TYPE_FILE_ICON,
PICTURE_TYPE_FILE_ICON_OTHER,
PICTURE_TYPE_FRONT_COVER,
PICTURE_TYPE_BACK_COVER,
PICTURE_TYPE_LEAFLET_PAGE,
PICTURE_TYPE_MEDIA,
PICTURE_TYPE_LEAD_ARTIST_PERFORMER,
PICTURE_TYPE_ARTIST_PERFORMER,
PICTURE_TYPE_CONDUCTOR,
PICTURE_TYPE_BAND_ORCHESTRA,
PICTURE_TYPE_COMPOSER,
PICTURE_TYPE_LYRICIST,
PICTURE_TYPE_RECORDING_LOCATION,
PICTURE_TYPE_DURING_RECORDING,
PICTURE_TYPE_DURING_PERFORMANCE,
PICTURE_TYPE_MOVIE_VIDEO_SCREEN_CAPTURE,
PICTURE_TYPE_A_BRIGHT_COLORED_FISH,
PICTURE_TYPE_ILLUSTRATION,
PICTURE_TYPE_BAND_ARTIST_LOGO,
PICTURE_TYPE_PUBLISHER_STUDIO_LOGO
})
public @interface PictureType {}
public static final int PICTURE_TYPE_OTHER = 0x00;
public static final int PICTURE_TYPE_FILE_ICON = 0x01;
public static final int PICTURE_TYPE_FILE_ICON_OTHER = 0x02;
public static final int PICTURE_TYPE_FRONT_COVER = 0x03;
public static final int PICTURE_TYPE_BACK_COVER = 0x04;
public static final int PICTURE_TYPE_LEAFLET_PAGE = 0x05;
public static final int PICTURE_TYPE_MEDIA = 0x06;
public static final int PICTURE_TYPE_LEAD_ARTIST_PERFORMER = 0x07;
public static final int PICTURE_TYPE_ARTIST_PERFORMER = 0x08;
public static final int PICTURE_TYPE_CONDUCTOR = 0x09;
public static final int PICTURE_TYPE_BAND_ORCHESTRA = 0x0A;
public static final int PICTURE_TYPE_COMPOSER = 0x0B;
public static final int PICTURE_TYPE_LYRICIST = 0x0C;
public static final int PICTURE_TYPE_RECORDING_LOCATION = 0x0D;
public static final int PICTURE_TYPE_DURING_RECORDING = 0x0E;
public static final int PICTURE_TYPE_DURING_PERFORMANCE = 0x0F;
public static final int PICTURE_TYPE_MOVIE_VIDEO_SCREEN_CAPTURE = 0x10;
public static final int PICTURE_TYPE_A_BRIGHT_COLORED_FISH = 0x11;
public static final int PICTURE_TYPE_ILLUSTRATION = 0x12;
public static final int PICTURE_TYPE_BAND_ARTIST_LOGO = 0x13;
public static final int PICTURE_TYPE_PUBLISHER_STUDIO_LOGO = 0x14;
/** Empty {@link MediaMetadata}. */
public static final MediaMetadata EMPTY = new MediaMetadata.Builder().build();
/** Optional title. */
@Nullable public final CharSequence title;
/** Optional artist. */
@Nullable public final CharSequence artist;
/** Optional album title. */
@Nullable public final CharSequence albumTitle;
/** Optional album artist. */
@Nullable public final CharSequence albumArtist;
/** Optional display title. */
@Nullable public final CharSequence displayTitle;
/**
* Optional subtitle.
*
* <p>This is the secondary title of the media, unrelated to closed captions.
*/
@Nullable public final CharSequence subtitle;
/** Optional description. */
@Nullable public final CharSequence description;
/** Optional user {@link Rating}. */
@Nullable public final Rating userRating;
/** Optional overall {@link Rating}. */
@Nullable public final Rating overallRating;
/** Optional artwork data as a compressed byte array. */
@Nullable public final byte[] artworkData;
/** Optional {@link PictureType} of the artwork data. */
@Nullable public final @PictureType Integer artworkDataType;
/** Optional artwork {@link Uri}. */
@Nullable public final Uri artworkUri;
/** Optional track number. */
@Nullable public final Integer trackNumber;
/** Optional total number of tracks. */