[vlc-commits] library/media types: support NSCoding

Felix Paul Kühne git at videolan.org
Fri Jul 5 15:45:53 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Fri Jul  5 15:25:46 2019 +0200| [fd2546f3c9728dbc1c95905b51309590f70419da] | committer: Felix Paul Kühne

library/media types: support NSCoding

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fd2546f3c9728dbc1c95905b51309590f70419da
---

 modules/gui/macosx/library/VLCLibraryDataTypes.m | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/gui/macosx/library/VLCLibraryDataTypes.m b/modules/gui/macosx/library/VLCLibraryDataTypes.m
index a347ac9606..ffced77f9e 100644
--- a/modules/gui/macosx/library/VLCLibraryDataTypes.m
+++ b/modules/gui/macosx/library/VLCLibraryDataTypes.m
@@ -34,6 +34,8 @@ const CGFloat VLCMediaLibrary720pWidth = 1280.;
 const CGFloat VLCMediaLibrary720pHeight = 720.;
 const long long int VLCMediaLibraryMediaItemDurationDenominator = 1000;
 
+NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryID";
+
 @implementation VLCMediaLibraryFile
 
 - (instancetype)initWithFile:(struct vlc_ml_file_t *)p_file
@@ -298,6 +300,18 @@ const long long int VLCMediaLibraryMediaItemDurationDenominator = 1000;
     return self;
 }
 
+- (instancetype)initWithCoder:(NSCoder *)aDecoder
+{
+    int64_t libraryID = [aDecoder decodeInt64ForKey:VLCMediaLibraryMediaItemLibraryID];
+    self = [VLCMediaLibraryMediaItem mediaItemForLibraryID:libraryID];
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)aCoder
+{
+    [aCoder encodeInt64:_libraryID forKey:VLCMediaLibraryMediaItemLibraryID];
+}
+
 - (NSString *)description
 {
     return [NSString stringWithFormat:@"%@ — title: %@, ID: %lli, type: %i, artwork: %@",



More information about the vlc-commits mailing list