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 
31 
32 NS_ASSUME_NONNULL_BEGIN
33 
34 /* Meta Dictionary Keys */
38 extern NSString *const VLCMetaInformationTitle __attribute__((deprecated)); /* NSString */
39 extern NSString *const VLCMetaInformationArtist __attribute__((deprecated)); /* NSString */
40 extern NSString *const VLCMetaInformationGenre __attribute__((deprecated)); /* NSString */
41 extern NSString *const VLCMetaInformationCopyright __attribute__((deprecated)); /* NSString */
42 extern NSString *const VLCMetaInformationAlbum __attribute__((deprecated)); /* NSString */
43 extern NSString *const VLCMetaInformationTrackNumber __attribute__((deprecated)); /* NSString */
44 extern NSString *const VLCMetaInformationDescription __attribute__((deprecated)); /* NSString */
45 extern NSString *const VLCMetaInformationRating __attribute__((deprecated)); /* NSString */
46 extern NSString *const VLCMetaInformationDate __attribute__((deprecated)); /* NSString */
47 extern NSString *const VLCMetaInformationSetting __attribute__((deprecated)); /* NSString */
48 extern NSString *const VLCMetaInformationURL __attribute__((deprecated)); /* NSString */
49 extern NSString *const VLCMetaInformationLanguage __attribute__((deprecated)); /* NSString */
50 extern NSString *const VLCMetaInformationNowPlaying __attribute__((deprecated)); /* NSString */
51 extern NSString *const VLCMetaInformationPublisher __attribute__((deprecated)); /* NSString */
52 extern NSString *const VLCMetaInformationEncodedBy __attribute__((deprecated)); /* NSString */
53 extern NSString *const VLCMetaInformationArtworkURL __attribute__((deprecated)); /* NSString */
54 extern NSString *const VLCMetaInformationArtwork __attribute__((deprecated)); /* NSImage */
55 extern NSString *const VLCMetaInformationTrackID __attribute__((deprecated)); /* NSString */
56 extern NSString *const VLCMetaInformationTrackTotal __attribute__((deprecated)); /* NSString */
57 extern NSString *const VLCMetaInformationDirector __attribute__((deprecated)); /* NSString */
58 extern NSString *const VLCMetaInformationSeason __attribute__((deprecated)); /* NSString */
59 extern NSString *const VLCMetaInformationEpisode __attribute__((deprecated)); /* NSString */
60 extern NSString *const VLCMetaInformationShowName __attribute__((deprecated)); /* NSString */
61 extern NSString *const VLCMetaInformationActors __attribute__((deprecated)); /* NSString */
62 extern NSString *const VLCMetaInformationAlbumArtist __attribute__((deprecated)); /* NSString */
63 extern NSString *const VLCMetaInformationDiscNumber __attribute__((deprecated)); /* 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:(nullable VLCMedia *)media;
234 
235 /* Properties */
239 @property (nonatomic, weak, nullable) 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, nullable) NSURL * url;
284 
288 @property (nonatomic, readonly, strong, nullable) VLCMediaList * subitems;
289 
297 - (nullable NSString *)metadataForKey:(NSString *)key __attribute__((deprecated));
298 
306 - (void)setMetadata:(NSString *)data forKey:(NSString *)key __attribute__((deprecated));
307 
313 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL saveMetadata __attribute__((deprecated));
314 
319 @property (nonatomic, readonly, copy) NSDictionary * metaDictionary __attribute__((deprecated));
320 
324 @property (nonatomic, readonly) VLCMediaMetaData *metaData;
325 
329 @property (nonatomic, readonly) VLCMediaState state;
330 
334 @property (NS_NONATOMIC_IOSONLY, getter=isMediaSizeSuitableForDevice, readonly) BOOL mediaSizeSuitableForDevice;
335 
344 extern NSString *const VLCMediaTracksInformationCodec;
345 
350 extern NSString *const VLCMediaTracksInformationId;
359 extern NSString *const VLCMediaTracksInformationType;
360 
370 extern NSString *const VLCMediaTracksInformationCodecLevel;
371 
376 extern NSString *const VLCMediaTracksInformationBitrate;
381 extern NSString *const VLCMediaTracksInformationLanguage;
387 
397 extern NSString *const VLCMediaTracksInformationAudioRate;
398 
408 extern NSString *const VLCMediaTracksInformationVideoWidth;
409 
420 
431 
436 extern NSString *const VLCMediaTracksInformationFrameRate;
442 
448 
452 extern NSString *const VLCMediaTracksInformationTypeAudio;
456 extern NSString *const VLCMediaTracksInformationTypeVideo;
460 extern NSString *const VLCMediaTracksInformationTypeText;
465 
500 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *tracksInformation;
501 
505 @property (nonatomic, nullable) id userData;
506 
517 - (void)parse __attribute__((deprecated));
518 
525 - (void)synchronousParse __attribute__((deprecated));
526 
531 typedef NS_OPTIONS(int, VLCMediaParsingOptions) {
532  VLCMediaParseLocal = 0x00,
533  VLCMediaParseNetwork = 0x01,
534  VLCMediaFetchLocal = 0x02,
535  VLCMediaFetchNetwork = 0x04,
536  VLCMediaDoInteract = 0x08,
537 };
538 
549 - (int)parseWithOptions:(VLCMediaParsingOptions)options;
550 
562 - (int)parseWithOptions:(VLCMediaParsingOptions)options timeout:(int)timeoutValue;
563 
570 - (void)parseStop;
571 
580 - (void)addOption:(NSString *)option;
581 - (void)addOptions:(NSDictionary*)options;
582 
598 - (int)storeCookie:(NSString *)cookie
599  forHost:(NSString *)host
600  path:(NSString *)path;
601 
609 - (void)clearStoredCookies;
610 
615 {
616  /* Input */
617  const int readBytes;
618  const float inputBitrate;
619  /* Demux */
620  const int demuxReadBytes;
621  const float demuxBitrate;
622  const int demuxCorrupted;
623  const int demuxDiscontinuity;
624  /* Decoders */
625  const int decodedVideo;
626  const int decodedAudio;
627  /* Video Output */
628  const int displayedPictures;
629  const int lostPictures;
630  /* Audio output */
631  const int playedAudioBuffers;
632  const int lostAudioBuffers;
633  /* Stream output */
634  const int sentPackets;
635  const int sentBytes;
636  const float sendBitrate;
637 } NS_SWIFT_NAME(VLCMedia.Stats);
638 typedef struct VLCMediaStats VLCMediaStats;
639 
660 @property (nonatomic, readonly) VLCMediaStats statistics;
661 
662 @end
663 
664 #pragma mark - VLCMedia+Deprecated
665 
667 
673 @property (NS_NONATOMIC_IOSONLY, readonly, copy, nullable) NSDictionary *stats DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
674 
679 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnInput DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
684 @property (NS_NONATOMIC_IOSONLY, readonly) float inputBitrate DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
685 
690 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnDemux DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
695 @property (NS_NONATOMIC_IOSONLY, readonly) float demuxBitrate DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
696 
701 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedVideoBlocks DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
706 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedAudioBlocks DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
707 
712 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDisplayedPictures DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
717 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostPictures DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
718 
723 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfPlayedAudioBuffers DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
728 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostAudioBuffers DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
729 
734 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentPackets DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
739 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentBytes DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
744 @property (NS_NONATOMIC_IOSONLY, readonly) float streamOutputBitrate DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
750 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfCorruptedDataPackets DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
756 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDiscontinuties DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMedia statistics] instead");
757 
758 @end
759 
760 NS_ASSUME_NONNULL_END
-[VLCMedia NS_OPTIONS]
typedef NS_OPTIONS(int, VLCMediaParsingOptions)
Definition: VLCMedia.h:531
VLCMedia::VLCMediaTracksInformationCodec
NSString *const VLCMediaTracksInformationCodec
Definition: VLCMedia.h:344
VLCMedia::VLCMediaTracksInformationLanguage
NSString *const VLCMediaTracksInformationLanguage
Definition: VLCMedia.h:381
VLCMedia::delegate
id< VLCMediaDelegate > delegate
Definition: VLCMedia.h:239
VLCMedia::VLCMediaTracksInformationVideoOrientation
NSString *const VLCMediaTracksInformationVideoOrientation
Definition: VLCMedia.h:414
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaOrientation)
Definition: VLCMedia.h:186
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaType)
Definition: VLCMedia.h:209
VLCMediaList
Definition: VLCMediaList.h:68
VLCMedia::VLCMediaTracksInformationTypeAudio
NSString *const VLCMediaTracksInformationTypeAudio
Definition: VLCMedia.h:452
VLCMedia::VLCMediaTracksInformationDescription
NSString *const VLCMediaTracksInformationDescription
Definition: VLCMedia.h:386
VLCMedia::mediaSizeSuitableForDevice
BOOL mediaSizeSuitableForDevice
Definition: VLCMedia.h:334
VLCMedia::tracksInformation
NSArray * tracksInformation
Definition: VLCMedia.h:500
VLCMedia
Definition: VLCMedia.h:112
VLCMedia::state
VLCMediaState state
Definition: VLCMedia.h:329
VLCMedia::VLCMediaTracksInformationFrameRateDenominator
NSString *const VLCMediaTracksInformationFrameRateDenominator
Definition: VLCMedia.h:441
-[VLCMedia NS_ENUM]
typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
Definition: VLCMedia.h:267
VLCMedia::subitems
VLCMediaList * subitems
Definition: VLCMedia.h:288
VLCMedia::userData
id userData
Definition: VLCMedia.h:505
VLCMedia::VLCMediaTracksInformationCodecProfile
NSString *const VLCMediaTracksInformationCodecProfile
Definition: VLCMedia.h:365
VLCMedia::VLCMediaTracksInformationTypeUnknown
NSString *const VLCMediaTracksInformationTypeUnknown
Definition: VLCMedia.h:464
VLCMedia::VLCMediaTracksInformationAudioChannelsNumber
NSString *const VLCMediaTracksInformationAudioChannelsNumber
Definition: VLCMedia.h:392
VLCMedia::VLCMediaStats
Definition: VLCMedia.h:614
VLCMedia::VLCMediaTracksInformationVideoProjection
NSString *const VLCMediaTracksInformationVideoProjection
Definition: VLCMedia.h:419
VLCMedia::VLCMediaTracksInformationVideoHeight
NSString *const VLCMediaTracksInformationVideoHeight
Definition: VLCMedia.h:403
VLCMedia::VLCMediaTracksInformationSourceAspectRatio
NSString *const VLCMediaTracksInformationSourceAspectRatio
Definition: VLCMedia.h:425
-[VLCMedia parseStop]
void parseStop()
VLCMedia::metaData
VLCMediaMetaData * metaData
Definition: VLCMedia.h:324
VLCMedia::VLCMediaTracksInformationSourceAspectRatioDenominator
NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator
Definition: VLCMedia.h:430
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaProjection)
Definition: VLCMedia.h:200
VLCMediaDelegate-p
Definition: VLCMedia.h:86
VLCMedia(Deprecated)
Definition: VLCMedia.h:666
VLCMedia::VLCMediaTracksInformationVideoWidth
NSString *const VLCMediaTracksInformationVideoWidth
Definition: VLCMedia.h:408
-[VLCMedia clearStoredCookies]
void clearStoredCookies()
VLCMedia::url
NSURL * url
Definition: VLCMedia.h:283
VLCMedia::length
VLCTime * length
Definition: VLCMedia.h:246
VLCMedia::parsedStatus
VLCMediaParsedStatus parsedStatus
Definition: VLCMedia.h:274
VLCMedia::VLCMediaTracksInformationTextEncoding
NSString *const VLCMediaTracksInformationTextEncoding
Definition: VLCMedia.h:447
-[VLCMedia __attribute__]
(deprecated __attribute__()
VLCMediaMetaData
Definition: VLCMediaMetaData.h:43
VLCMedia::VLCMediaTracksInformationCodecLevel
NSString *const VLCMediaTracksInformationCodecLevel
Definition: VLCMedia.h:370
VLCMedia::VLCMediaTracksInformationTypeVideo
NSString *const VLCMediaTracksInformationTypeVideo
Definition: VLCMedia.h:456
VLCMedia::VLCMediaTracksInformationTypeText
NSString *const VLCMediaTracksInformationTypeText
Definition: VLCMedia.h:460
VLCMedia::VLCMediaTracksInformationBitrate
NSString *const VLCMediaTracksInformationBitrate
Definition: VLCMedia.h:376
VLCMedia::VLCMediaTracksInformationFrameRate
NSString *const VLCMediaTracksInformationFrameRate
Definition: VLCMedia.h:436
VLCMedia::VLCMediaTracksInformationType
NSString *const VLCMediaTracksInformationType
Definition: VLCMedia.h:359
VLCMedia::mediaType
VLCMediaType mediaType
Definition: VLCMedia.h:216
VLCMedia::VLCMediaTracksInformationAudioRate
NSString *const VLCMediaTracksInformationAudioRate
Definition: VLCMedia.h:397
VLCMedia::VLCMediaTracksInformationId
NSString *const VLCMediaTracksInformationId
Definition: VLCMedia.h:350
VLCTime
Definition: VLCTime.h:32