Commit fad0ed47 authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCMedia: expand API to fetch and set individual meta properties and to save potential changes

parent f8d9fcc4
......@@ -226,6 +226,28 @@ typedef NSInteger VLCMediaState;
*/
@property (retain, readonly) VLCMediaList * subitems;
/**
* get meta property for key
* \note for performance reasons, fetching the metaDictionary will be faster!
* \see metaDictionary
* \see dictionary keys above
*/
- (NSString *)metadataForKey:(NSString *)key;
/**
* set meta property for key
* \param metadata to set as NSString
* \param metadata key
* \see dictionary keys above
*/
- (void)setMetadata:(NSString *)data forKey:(NSString *)key;
/**
* Save the previously changed metadata
* \return true if saving was successful
*/
- (BOOL)saveMetadata;
/**
* The receiver's meta data as a NSDictionary object.
*/
......@@ -335,7 +357,6 @@ extern NSString *VLCMediaTracksInformationTypeVideo;
extern NSString *VLCMediaTracksInformationTypeText;
extern NSString *VLCMediaTracksInformationTypeUnknown;
/**
* Returns the tracks information.
*
......
......@@ -666,6 +666,43 @@ NSString *VLCMediaTracksInformationTextEncoding = @"encoding"; // NSString
@synthesize url;
@synthesize subitems;
- (NSString *)metadataForKey:(NSString *)key
{
if (!p_md)
return NULL;
if (![self isParsed])
[self synchronousParse];
char *returnValue = libvlc_media_get_meta(p_md, [VLCMedia stringToMetaType:key]);
if (!returnValue)
return NULL;
NSString *actualReturnValue = [NSString stringWithUTF8String:returnValue];
free(returnValue);
return actualReturnValue;
}
- (void)setMetadata:(NSString *)data forKey:(NSString *)key
{
if (!p_md)
return;
libvlc_media_set_meta(p_md, [VLCMedia stringToMetaType:key], [data UTF8String]);
}
- (BOOL)saveMetadata
{
if (p_md)
return libvlc_media_save_meta(p_md);
return NO;
}
@synthesize metaDictionary;
@synthesize state;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment