[vlc-commits] macosx/library: add helpers to expose human readable types
Felix Paul Kühne
git at videolan.org
Sat Jan 25 13:43:18 CET 2020
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Jan 25 13:40:32 2020 +0100| [ac96cb4f29544b1b45af4c94d384e41ad6d6d7a8] | committer: Felix Paul Kühne
macosx/library: add helpers to expose human readable types
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac96cb4f29544b1b45af4c94d384e41ad6d6d7a8
---
modules/gui/macosx/library/VLCLibraryDataTypes.h | 4 ++
modules/gui/macosx/library/VLCLibraryDataTypes.m | 82 ++++++++++++++++++++++++
2 files changed, 86 insertions(+)
diff --git a/modules/gui/macosx/library/VLCLibraryDataTypes.h b/modules/gui/macosx/library/VLCLibraryDataTypes.h
index d208f20ff6..3d64261f70 100644
--- a/modules/gui/macosx/library/VLCLibraryDataTypes.h
+++ b/modules/gui/macosx/library/VLCLibraryDataTypes.h
@@ -43,6 +43,7 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@property (readonly) NSString *MRL;
@property (readonly) NSURL *fileURL;
@property (readonly) vlc_ml_file_type_t fileType;
+ at property (readonly) NSString *readableFileType;
@property (readonly) BOOL external;
@property (readonly) BOOL removable;
@property (readonly) BOOL present;
@@ -57,6 +58,7 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@property (readonly) NSString *language;
@property (readonly) NSString *trackDescription;
@property (readonly) vlc_ml_track_type_t trackType;
+ at property (readonly) NSString *readableTrackType;
@property (readonly) uint32_t bitrate;
@property (readonly) uint32_t numberOfAudioChannels;
@@ -156,7 +158,9 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@property (readonly) int64_t libraryID;
@property (readonly) vlc_ml_media_type_t mediaType;
+ at property (readonly) NSString *readableMediaType;
@property (readonly) vlc_ml_media_subtype_t mediaSubType;
+ at property (readonly) NSString *readableMediaSubType;
@property (readonly) VLCInputItem *inputItem;
@property (readonly) NSArray <VLCMediaLibraryFile *> *files;
diff --git a/modules/gui/macosx/library/VLCLibraryDataTypes.m b/modules/gui/macosx/library/VLCLibraryDataTypes.m
index 82fef465e0..7aa8373ac6 100644
--- a/modules/gui/macosx/library/VLCLibraryDataTypes.m
+++ b/modules/gui/macosx/library/VLCLibraryDataTypes.m
@@ -63,6 +63,34 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
return [NSURL URLWithString:_MRL];
}
+- (NSString *)readableFileType
+{
+ switch (_fileType) {
+ case VLC_ML_FILE_TYPE_MAIN:
+ return _NS("Main");
+ break;
+
+ case VLC_ML_FILE_TYPE_PART:
+ return _NS("Part");
+ break;
+
+ case VLC_ML_FILE_TYPE_PLAYLIST:
+ return _NS("Playlist");
+ break;
+
+ case VLC_ML_FILE_TYPE_SUBTITLE:
+ return _NS("Subtitle");
+ break;
+
+ case VLC_ML_FILE_TYPE_SOUNDTRACK:
+ return _NS("Soundtrack");
+
+ default:
+ return _NS("Unknown");
+ break;
+ }
+}
+
@end
@implementation VLCMediaLibraryTrack
@@ -95,6 +123,22 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
return [NSString stringWithFormat:@"%@ — type: %i, codec %@", NSStringFromClass([self class]), _trackType, _codec];
}
+- (NSString *)readableTrackType
+{
+ switch (_trackType) {
+ case VLC_ML_TRACK_TYPE_AUDIO:
+ return _NS("Audio");
+ break;
+
+ case VLC_ML_TRACK_TYPE_VIDEO:
+ return _NS("Video");
+
+ default:
+ return _NS("Unknown");
+ break;
+ }
+}
+
@end
@implementation VLCMediaLibraryMovie
@@ -373,6 +417,44 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
NSStringFromClass([self class]), _title, _libraryID, _mediaType, _smallArtworkMRL];
}
+- (NSString *)readableMediaType
+{
+ switch (_mediaType) {
+ case VLC_ML_MEDIA_TYPE_AUDIO:
+ return _NS("Audio");
+ break;
+
+ case VLC_ML_MEDIA_TYPE_VIDEO:
+ return _NS("Video");
+ break;
+
+ default:
+ return _NS("Unknown");
+ break;
+ }
+}
+
+- (NSString *)readableMediaSubType
+{
+ switch (_mediaSubType) {
+ case VLC_ML_MEDIA_SUBTYPE_MOVIE:
+ return _NS("Movie");
+ break;
+
+ case VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE:
+ return _NS("Show Episode");
+ break;
+
+ case VLC_ML_MEDIA_SUBTYPE_ALBUMTRACK:
+ return _NS("Album Track");
+ break;
+
+ default:
+ return _NS("Unknown");
+ break;
+ }
+}
+
- (VLCInputItem *)inputItem
{
input_item_t *p_inputItem = vlc_ml_get_input_item(_p_mediaLibrary, _libraryID);
More information about the vlc-commits
mailing list