diff --git a/Headers/Public/VLCMedia.h b/Headers/Public/VLCMedia.h index d76ccf87691ae4c66ecf7e2abddd83d60a23f858..5808270493d5199eea4450be43c699b0865b96b4 100644 --- a/Headers/Public/VLCMedia.h +++ b/Headers/Public/VLCMedia.h @@ -270,6 +270,34 @@ typedef NS_ENUM(unsigned, VLCMediaParsedStatus) */ @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray<VLCMediaTracksInformation *> *tracksInformation; +/** + * list of possible libvlc_media_filestat type. + */ +typedef NS_ENUM(unsigned, VLCMediaFileStatType) { + VLCMediaFileStatTypeMtime = 0, + VLCMediaFileStatTypeSize = 1 +} NS_SWIFT_NAME(VLCMedia.FileStatType); + +/** + * list of possible libvlc_media_filestat return type. + */ +typedef NS_ENUM(int, VLCMediaFileStatReturnType) { + VLCMediaFileStatReturnTypeError = -1, + VLCMediaFileStatReturnTypeNotFound = 0, + VLCMediaFileStatReturnTypeSuccess = 1 +} NS_SWIFT_NAME(VLCMedia.FileStatReturnType); + +/** + * Get a 'filestat' value + * + * 'stat' values are currently only parsed by directory accesses. This mean that only sub medias of a directory media, + * parsed with libvlc_media_parse_with_options() can have valid 'stat' properties. + * \param type VLCMediaFileStatType + * \param value field in which the value will be stored + * \return VLCMediaFileStatReturnType + */ +- (VLCMediaFileStatReturnType)fileStatValueForType:(const VLCMediaFileStatType)type value:(uint64_t *)value; + /** * enum of available options for use with parseWithOptions * \note you may pipe multiple values for the single parameter diff --git a/Sources/VLCMedia.m b/Sources/VLCMedia.m index 7faa1324b92d863b8b6059b76b924d79f47a9ce2..63151b3e455f9de76008e9a8ffc4302dffbc9c71 100644 --- a/Sources/VLCMedia.m +++ b/Sources/VLCMedia.m @@ -405,6 +405,14 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self) #endif } +- (VLCMediaFileStatReturnType)fileStatValueForType:(const VLCMediaFileStatType)type value:(uint64_t *)value +{ + if (!p_md || !value) + return VLCMediaFileStatReturnTypeError; + + return libvlc_media_get_filestat(p_md, type, value); +} + - (nullable NSDictionary *)stats { if (!p_md)