Commit 1f958e20 authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCMedia: expose convienience method to ask VLC for the human-readable codec name of a given FourCC

parent a75c3426
......@@ -149,6 +149,14 @@ typedef NS_ENUM(NSInteger, VLCMediaState) {
*/
+ (instancetype)mediaWithPath:(NSString *)aPath;
/**
* convienience method to return a user-readable codec name for the given FourCC
* \param uint32_t the FourCC to process
* \param NSString a VLC track type if known to speed-up the name search
* \return a NSString containing the codec name if recognized, else an empty string
*/
+ (NSString *)codecNameForFourCC:(uint32_t)fourcc trackType:(NSString *)trackType;
/**
* TODO
* \param aName TODO
......
......@@ -10,6 +10,7 @@ New APIs:
VLCMetaInformationSeason, VLCMetaInformationEpisode,
VLCMetaInformationShowName, VLCMetaInformationActors,
VLCMetaInformationAlbumArtist, VLCMetaInformationDiscNumber
- new selector: codecNameForFourCC:trackType:
Deprecated APIs:
- VLCMediaPlayer
......
......@@ -176,6 +176,24 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
*/
@implementation VLCMedia
+ (NSString *)codecNameForFourCC:(uint32_t)fourcc trackType:(NSString *)trackType
{
libvlc_track_type_t track_type = libvlc_track_unknown;
if ([trackType isEqualToString:VLCMediaTracksInformationTypeAudio])
track_type = libvlc_track_audio;
else if ([trackType isEqualToString:VLCMediaTracksInformationTypeVideo])
track_type = libvlc_track_video;
else if ([trackType isEqualToString:VLCMediaTracksInformationTypeText])
track_type = libvlc_track_text;
const char *ret = libvlc_media_get_codec_description(track_type, fourcc);
if (ret)
return [NSString stringWithUTF8String:ret];
return @"";
}
+ (instancetype)mediaWithURL:(NSURL *)anURL;
{
return [[VLCMedia alloc] initWithURL:anURL];
......
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