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 
174 - (instancetype)initWithStream:(NSInputStream *)stream;
175 
181 - (instancetype)initAsNodeWithName:(NSString *)aName;
182 
186 typedef NS_ENUM(NSUInteger, VLCMediaOrientation) {
187  VLCMediaOrientationTopLeft,
188  VLCMediaOrientationTopRight,
189  VLCMediaOrientationBottomLeft,
190  VLCMediaOrientationBottomRight,
191  VLCMediaOrientationLeftTop,
192  VLCMediaOrientationLeftBottom,
193  VLCMediaOrientationRightTop,
194  VLCMediaOrientationRightBottom
195 };
196 
200 typedef NS_ENUM(NSUInteger, VLCMediaProjection) {
201  VLCMediaProjectionRectangular,
202  VLCMediaProjectionEquiRectangular,
203  VLCMediaProjectionCubemapLayoutStandard = 0x100
204 };
205 
209 typedef NS_ENUM(NSUInteger, VLCMediaType) {
210  VLCMediaTypeUnknown,
211  VLCMediaTypeFile,
212  VLCMediaTypeDirectory,
213  VLCMediaTypeDisc,
214  VLCMediaTypeStream,
215  VLCMediaTypePlaylist,
216 };
217 
222 @property (readonly) VLCMediaType mediaType;
223 
233 - (NSComparisonResult)compare:(VLCMedia *)media;
234 
235 /* Properties */
239 @property (nonatomic, weak) id<VLCMediaDelegate> delegate;
240 
246 @property (nonatomic, readwrite, strong) VLCTime * length;
247 
256 - (VLCTime *)lengthWaitUntilDate:(NSDate *)aDate;
257 
262 @property (nonatomic, readonly) BOOL isParsed __attribute__((deprecated));
263 
267 typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
268 {
269  VLCMediaParsedStatusInit = 0,
270  VLCMediaParsedStatusSkipped,
271  VLCMediaParsedStatusFailed,
272  VLCMediaParsedStatusTimeout,
273  VLCMediaParsedStatusDone
274 };
278 @property (nonatomic, readonly) VLCMediaParsedStatus parsedStatus;
279 
283 @property (nonatomic, readonly, strong) NSURL * url;
284 
288 @property (nonatomic, readonly, strong) VLCMediaList * subitems;
289 
296 - (NSString *)metadataForKey:(NSString *)key;
297 
304 - (void)setMetadata:(NSString *)data forKey:(NSString *)key;
305 
310 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL saveMetadata;
311 
315 @property (nonatomic, readonly, copy) NSDictionary * metaDictionary;
316 
320 @property (nonatomic, readonly) VLCMediaState state;
321 
325 @property (NS_NONATOMIC_IOSONLY, getter=isMediaSizeSuitableForDevice, readonly) BOOL mediaSizeSuitableForDevice;
326 
335 extern NSString *const VLCMediaTracksInformationCodec;
336 
341 extern NSString *const VLCMediaTracksInformationId;
350 extern NSString *const VLCMediaTracksInformationType;
351 
361 extern NSString *const VLCMediaTracksInformationCodecLevel;
362 
367 extern NSString *const VLCMediaTracksInformationBitrate;
372 extern NSString *const VLCMediaTracksInformationLanguage;
378 
388 extern NSString *const VLCMediaTracksInformationAudioRate;
389 
399 extern NSString *const VLCMediaTracksInformationVideoWidth;
400 
411 
422 
427 extern NSString *const VLCMediaTracksInformationFrameRate;
433 
439 
443 extern NSString *const VLCMediaTracksInformationTypeAudio;
447 extern NSString *const VLCMediaTracksInformationTypeVideo;
451 extern NSString *const VLCMediaTracksInformationTypeText;
456 
491 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *tracksInformation;
492 
503 - (void)parse __attribute__((deprecated));
504 
511 - (void)synchronousParse __attribute__((deprecated));
512 
513 enum {
519 };
525 
536 - (int)parseWithOptions:(VLCMediaParsingOptions)options;
537 
549 - (int)parseWithOptions:(VLCMediaParsingOptions)options timeout:(int)timeoutValue;
550 
559 - (void)addOptions:(NSDictionary*)options;
560 
576 - (int)storeCookie:(NSString * _Nonnull)cookie
577  forHost:(NSString * _Nonnull)host
578  path:(NSString * _Nonnull)path;
579 
587 - (void)clearStoredCookies;
588 
594 @property (NS_NONATOMIC_IOSONLY, readonly, copy, nullable) NSDictionary *stats;
595 
596 #pragma mark - individual stats
597 
602 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnInput;
607 @property (NS_NONATOMIC_IOSONLY, readonly) float inputBitrate;
608 
613 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnDemux;
618 @property (NS_NONATOMIC_IOSONLY, readonly) float demuxBitrate;
619 
624 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedVideoBlocks;
629 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedAudioBlocks;
630 
635 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDisplayedPictures;
640 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostPictures;
641 
646 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfPlayedAudioBuffers;
651 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostAudioBuffers;
652 
657 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentPackets;
662 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentBytes;
667 @property (NS_NONATOMIC_IOSONLY, readonly) float streamOutputBitrate;
673 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfCorruptedDataPackets;
679 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDiscontinuties;
680 
681 @end
682 
683 NS_ASSUME_NONNULL_END
typedef NS_ENUM(NSUInteger, VLCMediaOrientation)
Definition: VLCMedia.h:186
NSInteger numberOfReadBytesOnInput
Definition: VLCMedia.h:602
NSString *const VLCMediaTracksInformationType
Definition: VLCMedia.h:350
NSString *const VLCMediaTracksInformationDescription
Definition: VLCMedia.h:377
(deprecated __attribute__()
float streamOutputBitrate
Definition: VLCMedia.h:667
NSInteger numberOfPlayedAudioBuffers
Definition: VLCMedia.h:646
NSString *const VLCMediaTracksInformationTypeUnknown
Definition: VLCMedia.h:455
NSString *const VLCMediaTracksInformationLanguage
Definition: VLCMedia.h:372
NSString *const VLCMediaTracksInformationBitrate
Definition: VLCMedia.h:367
NSString *const VLCMediaTracksInformationCodecLevel
Definition: VLCMedia.h:361
NSString *const VLCMediaTracksInformationFrameRate
Definition: VLCMedia.h:427
NSString *const VLCMediaTracksInformationCodec
Definition: VLCMedia.h:335
NSDictionary * stats
Definition: VLCMedia.h:594
id< VLCMediaDelegate > delegate
Definition: VLCMedia.h:239
NSString *const VLCMediaTracksInformationId
Definition: VLCMedia.h:341
NSString *const VLCMediaTracksInformationTypeText
Definition: VLCMedia.h:451
Fetch meta and covert art using local resources.
Definition: VLCMedia.h:516
NSString *const VLCMediaTracksInformationVideoHeight
Definition: VLCMedia.h:394
float demuxBitrate
Definition: VLCMedia.h:618
BOOL saveMetadata
Definition: VLCMedia.h:310
NSString *const VLCMediaTracksInformationFrameRateDenominator
Definition: VLCMedia.h:432
BOOL mediaSizeSuitableForDevice
Definition: VLCMedia.h:325
NSInteger numberOfDisplayedPictures
Definition: VLCMedia.h:635
NSString *const VLCMediaTracksInformationCodecProfile
Definition: VLCMedia.h:356
NSArray * tracksInformation
Definition: VLCMedia.h:491
Interact with the user when preparsing this item (and not its sub items). Set this flag in order to r...
Definition: VLCMedia.h:518
typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
Definition: VLCMedia.h:267
VLCMediaList * subitems
Definition: VLCMedia.h:288
NSString *const VLCMediaTracksInformationSourceAspectRatio
Definition: VLCMedia.h:416
typedef NS_ENUM(NSUInteger, VLCMediaType)
Definition: VLCMedia.h:209
NSString *const VLCMediaTracksInformationTypeAudio
Definition: VLCMedia.h:443
NSInteger numberOfDecodedAudioBlocks
Definition: VLCMedia.h:629
VLCMediaState state
Definition: VLCMedia.h:320
NSInteger numberOfLostAudioBuffers
Definition: VLCMedia.h:651
Definition: VLCMediaList.h:67
NSString *const VLCMediaTracksInformationAudioChannelsNumber
Definition: VLCMedia.h:383
NSString *const VLCMediaTracksInformationVideoProjection
Definition: VLCMedia.h:410
NSInteger numberOfSentPackets
Definition: VLCMedia.h:657
NSInteger numberOfLostPictures
Definition: VLCMedia.h:640
VLCTime * length
Definition: VLCMedia.h:246
float inputBitrate
Definition: VLCMedia.h:607
typedef NS_ENUM(NSUInteger, VLCMediaProjection)
Definition: VLCMedia.h:200
NSInteger numberOfReadBytesOnDemux
Definition: VLCMedia.h:613
NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator
Definition: VLCMedia.h:421
void clearStoredCookies()
NSInteger numberOfCorruptedDataPackets
Definition: VLCMedia.h:673
Definition: VLCMedia.h:112
NSString *const VLCMediaTracksInformationTextEncoding
Definition: VLCMedia.h:438
NSString *const VLCMediaTracksInformationAudioRate
Definition: VLCMedia.h:388
Parse media even if it's a network file.
Definition: VLCMedia.h:515
int VLCMediaParsingOptions
Definition: VLCMedia.h:524
NSDictionary * metaDictionary
Definition: VLCMedia.h:315
VLCMediaParsedStatus parsedStatus
Definition: VLCMedia.h:274
NSString *const VLCMediaTracksInformationTypeVideo
Definition: VLCMedia.h:447
Fetch meta and covert art using network resources.
Definition: VLCMedia.h:517
NSInteger numberOfDecodedVideoBlocks
Definition: VLCMedia.h:624
NSString *const VLCMediaTracksInformationVideoWidth
Definition: VLCMedia.h:399
NSURL * url
Definition: VLCMedia.h:283
Parse media if it's a local file.
Definition: VLCMedia.h:514
Definition: VLCTime.h:30
Definition: VLCMedia.h:86
NSInteger numberOfDiscontinuties
Definition: VLCMedia.h:679
NSInteger numberOfSentBytes
Definition: VLCMedia.h:662
NSString *const VLCMediaTracksInformationVideoOrientation
Definition: VLCMedia.h:405
VLCMediaType mediaType
Definition: VLCMedia.h:216