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
356 extern NSString *const VLCMediaTracksInformationCodecProfile;
361 extern NSString *const VLCMediaTracksInformationCodecLevel;
362
367 extern NSString *const VLCMediaTracksInformationBitrate;
372 extern NSString *const VLCMediaTracksInformationLanguage;
377 extern NSString *const VLCMediaTracksInformationDescription;
378
383 extern NSString *const VLCMediaTracksInformationAudioChannelsNumber;
388 extern NSString *const VLCMediaTracksInformationAudioRate;
389
394 extern NSString *const VLCMediaTracksInformationVideoHeight;
399 extern NSString *const VLCMediaTracksInformationVideoWidth;
400
405 extern NSString *const VLCMediaTracksInformationVideoOrientation;
410 extern NSString *const VLCMediaTracksInformationVideoProjection;
411
416 extern NSString *const VLCMediaTracksInformationSourceAspectRatio;
421 extern NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator;
422
427 extern NSString *const VLCMediaTracksInformationFrameRate;
432 extern NSString *const VLCMediaTracksInformationFrameRateDenominator;
433
438 extern NSString *const VLCMediaTracksInformationTextEncoding;
439
443 extern NSString *const VLCMediaTracksInformationTypeAudio;
447 extern NSString *const VLCMediaTracksInformationTypeVideo;
451 extern NSString *const VLCMediaTracksInformationTypeText;
455 extern NSString *const VLCMediaTracksInformationTypeUnknown;
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 {
514 VLCMediaParseLocal = 0x00,
515 VLCMediaParseNetwork = 0x01,
516 VLCMediaFetchLocal = 0x02,
517 VLCMediaFetchNetwork = 0x04,
518 VLCMediaDoInteract = 0x08,
519 };
524 typedef int VLCMediaParsingOptions;
525
536 - (int)parseWithOptions:(VLCMediaParsingOptions)options;
537
549 - (int)parseWithOptions:(VLCMediaParsingOptions)options timeout:(int)timeoutValue;
550
557 - (void)parseStop;
558
567 - (void)addOption:(NSString *)option;
568 - (void)addOptions:(NSDictionary*)options;
569
585 - (int)storeCookie:(NSString * _Nonnull)cookie
586 forHost:(NSString * _Nonnull)host
587 path:(NSString * _Nonnull)path;
588
596 - (void)clearStoredCookies;
597
603 @property (NS_NONATOMIC_IOSONLY, readonly, copy, nullable) NSDictionary *stats;
604
605 #pragma mark - individual stats
606
611 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnInput;
616 @property (NS_NONATOMIC_IOSONLY, readonly) float inputBitrate;
617
622 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnDemux;
627 @property (NS_NONATOMIC_IOSONLY, readonly) float demuxBitrate;
628
633 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedVideoBlocks;
638 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedAudioBlocks;
639
644 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDisplayedPictures;
649 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostPictures;
650
655 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfPlayedAudioBuffers;
660 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostAudioBuffers;
661
666 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentPackets;
671 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentBytes;
676 @property (NS_NONATOMIC_IOSONLY, readonly) float streamOutputBitrate;
682 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfCorruptedDataPackets;
688 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDiscontinuties;
689
690 @end
691
692 NS_ASSUME_NONNULL_END
VLCMedia::numberOfSentBytes
NSInteger numberOfSentBytes
Definition: VLCMedia.h:671
VLCMedia::streamOutputBitrate
float streamOutputBitrate
Definition: VLCMedia.h:676
VLCMedia::VLCMediaTracksInformationCodec
NSString *const VLCMediaTracksInformationCodec
Definition: VLCMedia.h:335
VLCMedia::VLCMediaTracksInformationLanguage
NSString *const VLCMediaTracksInformationLanguage
Definition: VLCMedia.h:372
VLCMedia::delegate
id< VLCMediaDelegate > delegate
Definition: VLCMedia.h:239
VLCMedia::numberOfDisplayedPictures
NSInteger numberOfDisplayedPictures
Definition: VLCMedia.h:644
VLCMedia::numberOfDecodedAudioBlocks
NSInteger numberOfDecodedAudioBlocks
Definition: VLCMedia.h:638
VLCMedia::VLCMediaParseNetwork
@ VLCMediaParseNetwork
Parse media even if it's a network file.
Definition: VLCMedia.h:515
VLCMedia::VLCMediaTracksInformationVideoOrientation
NSString *const VLCMediaTracksInformationVideoOrientation
Definition: VLCMedia.h:405
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaOrientation)
Definition: VLCMedia.h:186
VLCMedia::numberOfPlayedAudioBuffers
NSInteger numberOfPlayedAudioBuffers
Definition: VLCMedia.h:655
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaType)
Definition: VLCMedia.h:209
VLCMedia::numberOfReadBytesOnInput
NSInteger numberOfReadBytesOnInput
Definition: VLCMedia.h:611
VLCMedia::demuxBitrate
float demuxBitrate
Definition: VLCMedia.h:627
VLCMediaList
Definition: VLCMediaList.h:68
VLCMedia::VLCMediaTracksInformationTypeAudio
NSString *const VLCMediaTracksInformationTypeAudio
Definition: VLCMedia.h:443
VLCMedia::VLCMediaTracksInformationDescription
NSString *const VLCMediaTracksInformationDescription
Definition: VLCMedia.h:377
VLCMedia::mediaSizeSuitableForDevice
BOOL mediaSizeSuitableForDevice
Definition: VLCMedia.h:325
VLCMedia::VLCMediaFetchLocal
@ VLCMediaFetchLocal
Fetch meta and covert art using local resources.
Definition: VLCMedia.h:516
VLCMedia::tracksInformation
NSArray * tracksInformation
Definition: VLCMedia.h:491
VLCMedia::numberOfDiscontinuties
NSInteger numberOfDiscontinuties
Definition: VLCMedia.h:688
VLCMedia
Definition: VLCMedia.h:113
VLCMedia::state
VLCMediaState state
Definition: VLCMedia.h:320
VLCMedia::VLCMediaTracksInformationFrameRateDenominator
NSString *const VLCMediaTracksInformationFrameRateDenominator
Definition: VLCMedia.h:432
VLCMedia::VLCMediaDoInteract
@ VLCMediaDoInteract
Interact with the user when preparsing this item (and not its sub items). Set this flag in order to r...
Definition: VLCMedia.h:518
-[VLCMedia NS_ENUM]
typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
Definition: VLCMedia.h:267
VLCMedia::subitems
VLCMediaList * subitems
Definition: VLCMedia.h:288
VLCMedia::VLCMediaTracksInformationCodecProfile
NSString *const VLCMediaTracksInformationCodecProfile
Definition: VLCMedia.h:356
VLCMedia::stats
NSDictionary * stats
Definition: VLCMedia.h:603
VLCMedia::VLCMediaTracksInformationTypeUnknown
NSString *const VLCMediaTracksInformationTypeUnknown
Definition: VLCMedia.h:455
VLCMedia::VLCMediaTracksInformationAudioChannelsNumber
NSString *const VLCMediaTracksInformationAudioChannelsNumber
Definition: VLCMedia.h:383
VLCMedia::VLCMediaTracksInformationVideoProjection
NSString *const VLCMediaTracksInformationVideoProjection
Definition: VLCMedia.h:410
VLCMedia::VLCMediaTracksInformationVideoHeight
NSString *const VLCMediaTracksInformationVideoHeight
Definition: VLCMedia.h:394
VLCMedia::numberOfLostPictures
NSInteger numberOfLostPictures
Definition: VLCMedia.h:649
VLCMedia::VLCMediaTracksInformationSourceAspectRatio
NSString *const VLCMediaTracksInformationSourceAspectRatio
Definition: VLCMedia.h:416
VLCMedia::numberOfLostAudioBuffers
NSInteger numberOfLostAudioBuffers
Definition: VLCMedia.h:660
-[VLCMedia parseStop]
void parseStop()
VLCMedia::inputBitrate
float inputBitrate
Definition: VLCMedia.h:616
VLCMedia::VLCMediaTracksInformationSourceAspectRatioDenominator
NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator
Definition: VLCMedia.h:421
-[VLCMedia NS_ENUM]
typedef NS_ENUM(NSUInteger, VLCMediaProjection)
Definition: VLCMedia.h:200
VLCMedia::VLCMediaParseLocal
@ VLCMediaParseLocal
Parse media if it's a local file.
Definition: VLCMedia.h:514
VLCMedia::numberOfCorruptedDataPackets
NSInteger numberOfCorruptedDataPackets
Definition: VLCMedia.h:682
VLCMediaDelegate-p
Definition: VLCMedia.h:86
VLCMedia::VLCMediaTracksInformationVideoWidth
NSString *const VLCMediaTracksInformationVideoWidth
Definition: VLCMedia.h:399
-[VLCMedia clearStoredCookies]
void clearStoredCookies()
VLCMedia::url
NSURL * url
Definition: VLCMedia.h:283
VLCMedia::numberOfReadBytesOnDemux
NSInteger numberOfReadBytesOnDemux
Definition: VLCMedia.h:622
VLCMedia::numberOfDecodedVideoBlocks
NSInteger numberOfDecodedVideoBlocks
Definition: VLCMedia.h:633
VLCMedia::length
VLCTime * length
Definition: VLCMedia.h:246
VLCMedia::parsedStatus
VLCMediaParsedStatus parsedStatus
Definition: VLCMedia.h:274
VLCMedia::VLCMediaTracksInformationTextEncoding
NSString *const VLCMediaTracksInformationTextEncoding
Definition: VLCMedia.h:438
VLCMedia::numberOfSentPackets
NSInteger numberOfSentPackets
Definition: VLCMedia.h:666
-[VLCMedia __attribute__]
(deprecated __attribute__()
VLCMedia::VLCMediaParsingOptions
int VLCMediaParsingOptions
Definition: VLCMedia.h:524
VLCMedia::metaDictionary
NSDictionary * metaDictionary
Definition: VLCMedia.h:315
VLCMedia::VLCMediaFetchNetwork
@ VLCMediaFetchNetwork
Fetch meta and covert art using network resources.
Definition: VLCMedia.h:517
VLCMedia::VLCMediaTracksInformationCodecLevel
NSString *const VLCMediaTracksInformationCodecLevel
Definition: VLCMedia.h:361
VLCMedia::VLCMediaTracksInformationTypeVideo
NSString *const VLCMediaTracksInformationTypeVideo
Definition: VLCMedia.h:447
VLCMedia::VLCMediaTracksInformationTypeText
NSString *const VLCMediaTracksInformationTypeText
Definition: VLCMedia.h:451
VLCMedia::saveMetadata
BOOL saveMetadata
Definition: VLCMedia.h:310
VLCMedia::VLCMediaTracksInformationBitrate
NSString *const VLCMediaTracksInformationBitrate
Definition: VLCMedia.h:367
VLCMedia::VLCMediaTracksInformationFrameRate
NSString *const VLCMediaTracksInformationFrameRate
Definition: VLCMedia.h:427
VLCMedia::VLCMediaTracksInformationType
NSString *const VLCMediaTracksInformationType
Definition: VLCMedia.h:350
VLCMedia::mediaType
VLCMediaType mediaType
Definition: VLCMedia.h:216
VLCMedia::VLCMediaTracksInformationAudioRate
NSString *const VLCMediaTracksInformationAudioRate
Definition: VLCMedia.h:388
-[VLCMedia __attribute__]
BOOL isParsed __attribute__((deprecated))
VLCMedia::VLCMediaTracksInformationId
NSString *const VLCMediaTracksInformationId
Definition: VLCMedia.h:341
VLCTime
Definition: VLCTime.h:31