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 
347 extern NSString *const VLCMediaTracksInformationCodecLevel;
348 
353 extern NSString *const VLCMediaTracksInformationBitrate;
358 extern NSString *const VLCMediaTracksInformationLanguage;
364 
374 extern NSString *const VLCMediaTracksInformationAudioRate;
375 
385 extern NSString *const VLCMediaTracksInformationVideoWidth;
386 
397 
408 
413 extern NSString *const VLCMediaTracksInformationFrameRate;
419 
425 
429 extern NSString *const VLCMediaTracksInformationTypeAudio;
433 extern NSString *const VLCMediaTracksInformationTypeVideo;
437 extern NSString *const VLCMediaTracksInformationTypeText;
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 };
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
typedef NS_ENUM(NSUInteger, VLCMediaOrientation)
Definition: VLCMedia.h:173
NSInteger numberOfReadBytesOnInput
Definition: VLCMedia.h:588
NSString *const VLCMediaTracksInformationType
Definition: VLCMedia.h:336
NSString *const VLCMediaTracksInformationDescription
Definition: VLCMedia.h:363
(deprecated __attribute__()
float streamOutputBitrate
Definition: VLCMedia.h:653
NSInteger numberOfPlayedAudioBuffers
Definition: VLCMedia.h:632
NSString *const VLCMediaTracksInformationTypeUnknown
Definition: VLCMedia.h:441
NSString *const VLCMediaTracksInformationLanguage
Definition: VLCMedia.h:358
NSString *const VLCMediaTracksInformationBitrate
Definition: VLCMedia.h:353
NSString *const VLCMediaTracksInformationCodecLevel
Definition: VLCMedia.h:347
NSString *const VLCMediaTracksInformationFrameRate
Definition: VLCMedia.h:413
NSString *const VLCMediaTracksInformationCodec
Definition: VLCMedia.h:321
NSDictionary * stats
Definition: VLCMedia.h:580
id< VLCMediaDelegate > delegate
Definition: VLCMedia.h:226
NSString *const VLCMediaTracksInformationId
Definition: VLCMedia.h:327
NSString *const VLCMediaTracksInformationTypeText
Definition: VLCMedia.h:437
NSString *const VLCMediaTracksInformationVideoHeight
Definition: VLCMedia.h:380
float demuxBitrate
Definition: VLCMedia.h:604
BOOL saveMetadata
Definition: VLCMedia.h:296
NSString *const VLCMediaTracksInformationFrameRateDenominator
Definition: VLCMedia.h:418
BOOL mediaSizeSuitableForDevice
Definition: VLCMedia.h:311
NSInteger numberOfDisplayedPictures
Definition: VLCMedia.h:621
NSString *const VLCMediaTracksInformationCodecProfile
Definition: VLCMedia.h:342
NSArray * tracksInformation
Definition: VLCMedia.h:477
typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
Definition: VLCMedia.h:254
VLCMediaList * subitems
Definition: VLCMedia.h:274
NSString *const VLCMediaTracksInformationSourceAspectRatio
Definition: VLCMedia.h:402
typedef NS_ENUM(NSUInteger, VLCMediaType)
Definition: VLCMedia.h:196
NSString *const VLCMediaTracksInformationTypeAudio
Definition: VLCMedia.h:429
NSInteger numberOfDecodedAudioBlocks
Definition: VLCMedia.h:615
VLCMediaState state
Definition: VLCMedia.h:306
NSInteger numberOfLostAudioBuffers
Definition: VLCMedia.h:637
Definition: VLCMediaList.h:67
NSString *const VLCMediaTracksInformationAudioChannelsNumber
Definition: VLCMedia.h:369
NSString *const VLCMediaTracksInformationVideoProjection
Definition: VLCMedia.h:396
NSInteger numberOfSentPackets
Definition: VLCMedia.h:643
NSInteger numberOfLostPictures
Definition: VLCMedia.h:626
VLCTime * length
Definition: VLCMedia.h:233
float inputBitrate
Definition: VLCMedia.h:593
typedef NS_ENUM(NSUInteger, VLCMediaProjection)
Definition: VLCMedia.h:187
NSInteger numberOfReadBytesOnDemux
Definition: VLCMedia.h:599
NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator
Definition: VLCMedia.h:407
void clearStoredCookies()
NSInteger numberOfCorruptedDataPackets
Definition: VLCMedia.h:659
Definition: VLCMedia.h:112
NSString *const VLCMediaTracksInformationTextEncoding
Definition: VLCMedia.h:424
NSString *const VLCMediaTracksInformationAudioRate
Definition: VLCMedia.h:374
int VLCMediaParsingOptions
Definition: VLCMedia.h:510
NSDictionary * metaDictionary
Definition: VLCMedia.h:301
VLCMediaParsedStatus parsedStatus
Definition: VLCMedia.h:260
NSString *const VLCMediaTracksInformationTypeVideo
Definition: VLCMedia.h:433
NSInteger numberOfDecodedVideoBlocks
Definition: VLCMedia.h:610
NSString *const VLCMediaTracksInformationVideoWidth
Definition: VLCMedia.h:385
NSURL * url
Definition: VLCMedia.h:269
Definition: VLCTime.h:30
NSInteger numberOfDiscontinuties
Definition: VLCMedia.h:665
NSInteger numberOfSentBytes
Definition: VLCMedia.h:648
NSString *const VLCMediaTracksInformationVideoOrientation
Definition: VLCMedia.h:391
VLCMediaType mediaType
Definition: VLCMedia.h:203