VLCKit

VLCMedia.h
1 /*****************************************************************************
2 * VLCMedia.h: VLCKit.framework VLCMedia header
3 *****************************************************************************
4 * Copyright (C) 2007 Pierre d'Herbemont
5 * Copyright (C) 2013 Felix Paul Kühne
6 * Copyright (C) 2007-2013 VLC authors and VideoLAN
7 * $Id$
8 *
9 * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
10 * Felix Paul Kühne <fkuehne # videolan.org>
11 * Soomin Lee <TheHungryBu # gmail.com>
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU Lesser General Public License as published by
15 * the Free Software Foundation; either version 2.1 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
27
28 #import <Foundation/Foundation.h>
29 #import "VLCMediaList.h"
30 #import "VLCTime.h"
31
32 NS_ASSUME_NONNULL_BEGIN
33
34 /* Meta Dictionary Keys */
38 extern NSString *const VLCMetaInformationTitle; /* NSString */
39 extern NSString *const VLCMetaInformationArtist; /* NSString */
40 extern NSString *const VLCMetaInformationGenre; /* NSString */
41 extern NSString *const VLCMetaInformationCopyright; /* NSString */
42 extern NSString *const VLCMetaInformationAlbum; /* NSString */
43 extern NSString *const VLCMetaInformationTrackNumber; /* NSString */
44 extern NSString *const VLCMetaInformationDescription; /* NSString */
45 extern NSString *const VLCMetaInformationRating; /* NSString */
46 extern NSString *const VLCMetaInformationDate; /* NSString */
47 extern NSString *const VLCMetaInformationSetting; /* NSString */
48 extern NSString *const VLCMetaInformationURL; /* NSString */
49 extern NSString *const VLCMetaInformationLanguage; /* NSString */
50 extern NSString *const VLCMetaInformationNowPlaying; /* NSString */
51 extern NSString *const VLCMetaInformationPublisher; /* NSString */
52 extern NSString *const VLCMetaInformationEncodedBy; /* NSString */
53 extern NSString *const VLCMetaInformationArtworkURL; /* NSString */
54 extern NSString *const VLCMetaInformationArtwork; /* NSImage */
55 extern NSString *const VLCMetaInformationTrackID; /* NSString */
56 extern NSString *const VLCMetaInformationTrackTotal; /* NSString */
57 extern NSString *const VLCMetaInformationDirector; /* NSString */
58 extern NSString *const VLCMetaInformationSeason; /* NSString */
59 extern NSString *const VLCMetaInformationEpisode; /* NSString */
60 extern NSString *const VLCMetaInformationShowName; /* NSString */
61 extern NSString *const VLCMetaInformationActors; /* NSString */
62 extern NSString *const VLCMetaInformationAlbumArtist; /* NSString */
63 extern NSString *const VLCMetaInformationDiscNumber; /* NSString */
64
65 /* Notification Messages */
69 extern NSString *const VLCMediaMetaChanged;
70
71 // Forward declarations, supresses compiler error messages
72 @class VLCMediaList;
73 @class VLCMedia;
74
75 typedef NS_ENUM(NSInteger, VLCMediaState) {
76 VLCMediaStateNothingSpecial,
77 VLCMediaStateBuffering,
78 VLCMediaStatePlaying,
79 VLCMediaStateError,
80 };
81
86 @protocol VLCMediaDelegate <NSObject>
87
88 @optional
89
95 - (void)mediaMetaDataDidChange:(VLCMedia *)aMedia;
96
102 - (void)mediaDidFinishParsing:(VLCMedia *)aMedia;
103 @end
104
112 @interface VLCMedia : NSObject
113
114 /* Factories */
121 + (instancetype)mediaWithURL:(NSURL *)anURL;
122
129 + (instancetype)mediaWithPath:(NSString *)aPath;
130
137 + (NSString *)codecNameForFourCC:(uint32_t)fourcc trackType:(NSString *)trackType;
138
146 + (instancetype)mediaAsNodeWithName:(NSString *)aName;
147
148 /* Initializers */
154 - (instancetype)initWithURL:(NSURL *)anURL;
155
161 - (instancetype)initWithPath:(NSString *)aPath;
162
168 - (instancetype)initAsNodeWithName:(NSString *)aName;
169
173 typedef NS_ENUM(NSUInteger, VLCMediaOrientation) {
174 VLCMediaOrientationTopLeft,
175 VLCMediaOrientationTopRight,
176 VLCMediaOrientationBottomLeft,
177 VLCMediaOrientationBottomRight,
178 VLCMediaOrientationLeftTop,
179 VLCMediaOrientationLeftBottom,
180 VLCMediaOrientationRightTop,
181 VLCMediaOrientationRightBottom
182 };
183
187 typedef NS_ENUM(NSUInteger, VLCMediaProjection) {
188 VLCMediaProjectionRectangular,
189 VLCMediaProjectionEquiRectangular,
190 VLCMediaProjectionCubemapLayoutStandard = 0x100
191 };
192
196 typedef NS_ENUM(NSUInteger, VLCMediaType) {
197 VLCMediaTypeUnknown,
198 VLCMediaTypeFile,
199 VLCMediaTypeDirectory,
200 VLCMediaTypeDisc,
201 VLCMediaTypeStream,
202 VLCMediaTypePlaylist,
203 };
204
209 @property (readonly) VLCMediaType mediaType;
210
220 - (NSComparisonResult)compare:(VLCMedia *)media;
221
222 /* Properties */
226 @property (nonatomic, weak) id<VLCMediaDelegate> delegate;
227
233 @property (nonatomic, readwrite, strong) VLCTime * length;
234
243 - (VLCTime *)lengthWaitUntilDate:(NSDate *)aDate;
244
249 @property (nonatomic, readonly) BOOL isParsed __attribute__((deprecated));
250
254 typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
255 {
256 VLCMediaParsedStatusInit = 0,
257 VLCMediaParsedStatusSkipped,
258 VLCMediaParsedStatusFailed,
259 VLCMediaParsedStatusDone
260 };
264 @property (nonatomic, readonly) VLCMediaParsedStatus parsedStatus;
265
269 @property (nonatomic, readonly, strong) NSURL * url;
270
274 @property (nonatomic, readonly, strong) VLCMediaList * subitems;
275
282 - (NSString *)metadataForKey:(NSString *)key;
283
290 - (void)setMetadata:(NSString *)data forKey:(NSString *)key;
291
296 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL saveMetadata;
297
301 @property (nonatomic, readonly, copy) NSDictionary * metaDictionary;
302
306 @property (nonatomic, readonly) VLCMediaState state;
307
311 @property (NS_NONATOMIC_IOSONLY, getter=isMediaSizeSuitableForDevice, readonly) BOOL mediaSizeSuitableForDevice;
312
321 extern NSString *const VLCMediaTracksInformationCodec;
322
327 extern NSString *const VLCMediaTracksInformationId;
336 extern NSString *const VLCMediaTracksInformationType;
337
342 extern NSString *const VLCMediaTracksInformationCodecProfile;
347 extern NSString *const VLCMediaTracksInformationCodecLevel;
348
353 extern NSString *const VLCMediaTracksInformationBitrate;
358 extern NSString *const VLCMediaTracksInformationLanguage;
363 extern NSString *const VLCMediaTracksInformationDescription;
364
369 extern NSString *const VLCMediaTracksInformationAudioChannelsNumber;
374 extern NSString *const VLCMediaTracksInformationAudioRate;
375
380 extern NSString *const VLCMediaTracksInformationVideoHeight;
385 extern NSString *const VLCMediaTracksInformationVideoWidth;
386
391 extern NSString *const VLCMediaTracksInformationVideoOrientation;
396 extern NSString *const VLCMediaTracksInformationVideoProjection;
397
402 extern NSString *const VLCMediaTracksInformationSourceAspectRatio;
407 extern NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator;
408
413 extern NSString *const VLCMediaTracksInformationFrameRate;
418 extern NSString *const VLCMediaTracksInformationFrameRateDenominator;
419
424 extern NSString *const VLCMediaTracksInformationTextEncoding;
425
429 extern NSString *const VLCMediaTracksInformationTypeAudio;
433 extern NSString *const VLCMediaTracksInformationTypeVideo;
437 extern NSString *const VLCMediaTracksInformationTypeText;
441 extern NSString *const VLCMediaTracksInformationTypeUnknown;
442
477 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *tracksInformation;
478
489 - (void)parse __attribute__((deprecated));
490
497 - (void)synchronousParse __attribute__((deprecated));
498
499
500 enum {
501 VLCMediaParseLocal = 0x00,
502 VLCMediaParseNetwork = 0x01,
503 VLCMediaFetchLocal = 0x02,
504 VLCMediaFetchNetwork = 0x04,
505 };
510 typedef int VLCMediaParsingOptions;
511
522 - (int)parseWithOptions:(VLCMediaParsingOptions)options;
523
535 - (int)parseWithOptions:(VLCMediaParsingOptions)options timeout:(int)timeoutValue;
536
545 - (void)addOptions:(NSDictionary*)options;
546
562 - (int)storeCookie:(NSString * _Nonnull)cookie
563 forHost:(NSString * _Nonnull)host
564 path:(NSString * _Nonnull)path;
565
573 - (void)clearStoredCookies;
574
580 @property (NS_NONATOMIC_IOSONLY, readonly, copy, nullable) NSDictionary *stats;
581
582 #pragma mark - individual stats
583
588 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnInput;
593 @property (NS_NONATOMIC_IOSONLY, readonly) float inputBitrate;
594
599 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnDemux;
604 @property (NS_NONATOMIC_IOSONLY, readonly) float demuxBitrate;
605
610 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedVideoBlocks;
615 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedAudioBlocks;
616
621 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDisplayedPictures;
626 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostPictures;
627
632 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfPlayedAudioBuffers;
637 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostAudioBuffers;
638
643 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentPackets;
648 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentBytes;
653 @property (NS_NONATOMIC_IOSONLY, readonly) float streamOutputBitrate;
659 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfCorruptedDataPackets;
665 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDiscontinuties;
666
667 @end
668
669 NS_ASSUME_NONNULL_END
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaOrientation)
Definition: VLCMedia.h:173
VLCMedia::numberOfReadBytesOnInput
NSInteger numberOfReadBytesOnInput
Definition: VLCMedia.h:588
VLCMedia::VLCMediaTracksInformationType
NSString *const VLCMediaTracksInformationType
Definition: VLCMedia.h:336
VLCMedia::VLCMediaTracksInformationDescription
NSString *const VLCMediaTracksInformationDescription
Definition: VLCMedia.h:363
-[VLCMedia __attribute__]
(deprecated __attribute__()
VLCMedia::streamOutputBitrate
float streamOutputBitrate
Definition: VLCMedia.h:653
VLCMedia::numberOfPlayedAudioBuffers
NSInteger numberOfPlayedAudioBuffers
Definition: VLCMedia.h:632
VLCMedia::VLCMediaTracksInformationTypeUnknown
NSString *const VLCMediaTracksInformationTypeUnknown
Definition: VLCMedia.h:441
VLCMedia::VLCMediaTracksInformationLanguage
NSString *const VLCMediaTracksInformationLanguage
Definition: VLCMedia.h:358
VLCMedia::VLCMediaTracksInformationBitrate
NSString *const VLCMediaTracksInformationBitrate
Definition: VLCMedia.h:353
VLCMedia::VLCMediaTracksInformationCodecLevel
NSString *const VLCMediaTracksInformationCodecLevel
Definition: VLCMedia.h:347
VLCMedia::VLCMediaTracksInformationFrameRate
NSString *const VLCMediaTracksInformationFrameRate
Definition: VLCMedia.h:413
VLCMedia::VLCMediaTracksInformationCodec
NSString *const VLCMediaTracksInformationCodec
Definition: VLCMedia.h:321
VLCMedia::stats
NSDictionary * stats
Definition: VLCMedia.h:580
VLCMedia::delegate
id< VLCMediaDelegate > delegate
Definition: VLCMedia.h:226
VLCMedia::VLCMediaTracksInformationId
NSString *const VLCMediaTracksInformationId
Definition: VLCMedia.h:327
VLCMedia::VLCMediaTracksInformationTypeText
NSString *const VLCMediaTracksInformationTypeText
Definition: VLCMedia.h:437
VLCMedia::VLCMediaTracksInformationVideoHeight
NSString *const VLCMediaTracksInformationVideoHeight
Definition: VLCMedia.h:380
VLCMedia::demuxBitrate
float demuxBitrate
Definition: VLCMedia.h:604
VLCMedia::saveMetadata
BOOL saveMetadata
Definition: VLCMedia.h:296
VLCMedia::VLCMediaTracksInformationFrameRateDenominator
NSString *const VLCMediaTracksInformationFrameRateDenominator
Definition: VLCMedia.h:418
VLCMedia::mediaSizeSuitableForDevice
BOOL mediaSizeSuitableForDevice
Definition: VLCMedia.h:311
VLCMedia::numberOfDisplayedPictures
NSInteger numberOfDisplayedPictures
Definition: VLCMedia.h:621
VLCMedia::VLCMediaTracksInformationCodecProfile
NSString *const VLCMediaTracksInformationCodecProfile
Definition: VLCMedia.h:342
VLCMedia::tracksInformation
NSArray * tracksInformation
Definition: VLCMedia.h:477
-[VLCMedia NS_ENUM]
typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
Definition: VLCMedia.h:254
VLCMedia::subitems
VLCMediaList * subitems
Definition: VLCMedia.h:274
VLCMedia::VLCMediaTracksInformationSourceAspectRatio
NSString *const VLCMediaTracksInformationSourceAspectRatio
Definition: VLCMedia.h:402
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaType)
Definition: VLCMedia.h:196
VLCMedia::VLCMediaTracksInformationTypeAudio
NSString *const VLCMediaTracksInformationTypeAudio
Definition: VLCMedia.h:429
VLCMedia::numberOfDecodedAudioBlocks
NSInteger numberOfDecodedAudioBlocks
Definition: VLCMedia.h:615
VLCMedia::state
VLCMediaState state
Definition: VLCMedia.h:306
VLCMedia::numberOfLostAudioBuffers
NSInteger numberOfLostAudioBuffers
Definition: VLCMedia.h:637
VLCMediaList
Definition: VLCMediaList.h:67
VLCMedia::VLCMediaTracksInformationAudioChannelsNumber
NSString *const VLCMediaTracksInformationAudioChannelsNumber
Definition: VLCMedia.h:369
VLCMedia::VLCMediaTracksInformationVideoProjection
NSString *const VLCMediaTracksInformationVideoProjection
Definition: VLCMedia.h:396
VLCMedia::numberOfSentPackets
NSInteger numberOfSentPackets
Definition: VLCMedia.h:643
VLCMedia::numberOfLostPictures
NSInteger numberOfLostPictures
Definition: VLCMedia.h:626
VLCMedia::length
VLCTime * length
Definition: VLCMedia.h:233
VLCMedia::inputBitrate
float inputBitrate
Definition: VLCMedia.h:593
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaProjection)
Definition: VLCMedia.h:187
VLCMedia::numberOfReadBytesOnDemux
NSInteger numberOfReadBytesOnDemux
Definition: VLCMedia.h:599
VLCMedia::VLCMediaTracksInformationSourceAspectRatioDenominator
NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator
Definition: VLCMedia.h:407
-[VLCMedia clearStoredCookies]
void clearStoredCookies()
VLCMedia::numberOfCorruptedDataPackets
NSInteger numberOfCorruptedDataPackets
Definition: VLCMedia.h:659
VLCMedia
Definition: VLCMedia.h:112
VLCMedia::VLCMediaTracksInformationTextEncoding
NSString *const VLCMediaTracksInformationTextEncoding
Definition: VLCMedia.h:424
VLCMedia::VLCMediaTracksInformationAudioRate
NSString *const VLCMediaTracksInformationAudioRate
Definition: VLCMedia.h:374
VLCMedia::VLCMediaParsingOptions
int VLCMediaParsingOptions
Definition: VLCMedia.h:510
VLCMedia::metaDictionary
NSDictionary * metaDictionary
Definition: VLCMedia.h:301
VLCMedia::parsedStatus
VLCMediaParsedStatus parsedStatus
Definition: VLCMedia.h:260
VLCMedia::VLCMediaTracksInformationTypeVideo
NSString *const VLCMediaTracksInformationTypeVideo
Definition: VLCMedia.h:433
VLCMedia::numberOfDecodedVideoBlocks
NSInteger numberOfDecodedVideoBlocks
Definition: VLCMedia.h:610
VLCMedia::VLCMediaTracksInformationVideoWidth
NSString *const VLCMediaTracksInformationVideoWidth
Definition: VLCMedia.h:385
VLCMedia::url
NSURL * url
Definition: VLCMedia.h:269
VLCTime
Definition: VLCTime.h:30
VLCMedia::numberOfDiscontinuties
NSInteger numberOfDiscontinuties
Definition: VLCMedia.h:665
VLCMedia::numberOfSentBytes
NSInteger numberOfSentBytes
Definition: VLCMedia.h:648
VLCMedia::VLCMediaTracksInformationVideoOrientation
NSString *const VLCMediaTracksInformationVideoOrientation
Definition: VLCMedia.h:391
VLCMedia::mediaType
VLCMediaType mediaType
Definition: VLCMedia.h:203