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  *
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU Lesser General Public License as published by
14  * the Free Software Foundation; either version 2.1 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this program; if not, write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26 
27 #import <Foundation/Foundation.h>
28 #import "VLCMediaList.h"
29 #import "VLCTime.h"
30 
31 NS_ASSUME_NONNULL_BEGIN
32 
33 /* Meta Dictionary Keys */
37 extern NSString *const VLCMetaInformationTitle; /* NSString */
38 extern NSString *const VLCMetaInformationArtist; /* NSString */
39 extern NSString *const VLCMetaInformationGenre; /* NSString */
40 extern NSString *const VLCMetaInformationCopyright; /* NSString */
41 extern NSString *const VLCMetaInformationAlbum; /* NSString */
42 extern NSString *const VLCMetaInformationTrackNumber; /* NSString */
43 extern NSString *const VLCMetaInformationDescription; /* NSString */
44 extern NSString *const VLCMetaInformationRating; /* NSString */
45 extern NSString *const VLCMetaInformationDate; /* NSString */
46 extern NSString *const VLCMetaInformationSetting; /* NSString */
47 extern NSString *const VLCMetaInformationURL; /* NSString */
48 extern NSString *const VLCMetaInformationLanguage; /* NSString */
49 extern NSString *const VLCMetaInformationNowPlaying; /* NSString */
50 extern NSString *const VLCMetaInformationPublisher; /* NSString */
51 extern NSString *const VLCMetaInformationEncodedBy; /* NSString */
52 extern NSString *const VLCMetaInformationArtworkURL; /* NSString */
53 extern NSString *const VLCMetaInformationArtwork; /* NSImage */
54 extern NSString *const VLCMetaInformationTrackID; /* NSString */
55 extern NSString *const VLCMetaInformationTrackTotal; /* NSString */
56 extern NSString *const VLCMetaInformationDirector; /* NSString */
57 extern NSString *const VLCMetaInformationSeason; /* NSString */
58 extern NSString *const VLCMetaInformationEpisode; /* NSString */
59 extern NSString *const VLCMetaInformationShowName; /* NSString */
60 extern NSString *const VLCMetaInformationActors; /* NSString */
61 extern NSString *const VLCMetaInformationAlbumArtist; /* NSString */
62 extern NSString *const VLCMetaInformationDiscNumber; /* NSString */
63 
64 /* Notification Messages */
68 extern NSString *const VLCMediaMetaChanged;
69 
70 // Forward declarations, supresses compiler error messages
71 @class VLCMediaList;
72 @class VLCMedia;
73 
74 typedef NS_ENUM(NSInteger, VLCMediaState) {
75  VLCMediaStateNothingSpecial,
76  VLCMediaStateBuffering,
77  VLCMediaStatePlaying,
78  VLCMediaStateError,
79 };
80 
85 @protocol VLCMediaDelegate <NSObject>
86 
87 @optional
88 
94 - (void)mediaMetaDataDidChange:(VLCMedia *)aMedia;
95 
101 - (void)mediaDidFinishParsing:(VLCMedia *)aMedia;
102 @end
103 
111 @interface VLCMedia : NSObject
112 
113 /* Factories */
120 + (instancetype)mediaWithURL:(NSURL *)anURL;
121 
128 + (instancetype)mediaWithPath:(NSString *)aPath;
129 
136 + (NSString *)codecNameForFourCC:(uint32_t)fourcc trackType:(NSString *)trackType;
137 
145 + (instancetype)mediaAsNodeWithName:(NSString *)aName;
146 
147 /* Initializers */
153 - (instancetype)initWithURL:(NSURL *)anURL;
154 
160 - (instancetype)initWithPath:(NSString *)aPath;
161 
167 - (instancetype)initAsNodeWithName:(NSString *)aName;
168 
172 typedef NS_ENUM(NSUInteger, VLCMediaType) {
173  VLCMediaTypeUnknown,
174  VLCMediaTypeFile,
175  VLCMediaTypeDirectory,
176  VLCMediaTypeDisc,
177  VLCMediaTypeStream,
178  VLCMediaTypePlaylist,
179 };
180 
185 @property (readonly) VLCMediaType mediaType;
186 
196 - (NSComparisonResult)compare:(VLCMedia *)media;
197 
198 /* Properties */
202 @property (nonatomic, weak) id<VLCMediaDelegate> delegate;
203 
209 @property (nonatomic, readwrite, strong) VLCTime * length;
210 
219 - (VLCTime *)lengthWaitUntilDate:(NSDate *)aDate;
220 
225 @property (nonatomic, readonly) BOOL isParsed __attribute__((deprecated));
226 
230 typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
231 {
232  VLCMediaParsedStatusInit = 0,
233  VLCMediaParsedStatusSkipped,
234  VLCMediaParsedStatusFailed,
235  VLCMediaParsedStatusDone
236 };
240 @property (nonatomic, readonly) VLCMediaParsedStatus parsedStatus;
241 
245 @property (nonatomic, readonly, strong) NSURL * url;
246 
250 @property (nonatomic, readonly, strong) VLCMediaList * subitems;
251 
258 - (NSString *)metadataForKey:(NSString *)key;
259 
266 - (void)setMetadata:(NSString *)data forKey:(NSString *)key;
267 
272 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL saveMetadata;
273 
277 @property (nonatomic, readonly, copy) NSDictionary * metaDictionary;
278 
282 @property (nonatomic, readonly) VLCMediaState state;
283 
287 @property (NS_NONATOMIC_IOSONLY, getter=isMediaSizeSuitableForDevice, readonly) BOOL mediaSizeSuitableForDevice;
288 
297 extern NSString *const VLCMediaTracksInformationCodec;
298 
303 extern NSString *const VLCMediaTracksInformationId;
312 extern NSString *const VLCMediaTracksInformationType;
313 
323 extern NSString *const VLCMediaTracksInformationCodecLevel;
324 
329 extern NSString *const VLCMediaTracksInformationBitrate;
334 extern NSString *const VLCMediaTracksInformationLanguage;
340 
350 extern NSString *const VLCMediaTracksInformationAudioRate;
351 
361 extern NSString *const VLCMediaTracksInformationVideoWidth;
362 
373 
378 extern NSString *const VLCMediaTracksInformationFrameRate;
384 
390 
394 extern NSString *const VLCMediaTracksInformationTypeAudio;
398 extern NSString *const VLCMediaTracksInformationTypeVideo;
402 extern NSString *const VLCMediaTracksInformationTypeText;
407 
440 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *tracksInformation;
441 
452 - (void)parse __attribute__((deprecated));
453 
460 - (void)synchronousParse __attribute__((deprecated));
461 
462 
463 enum {
464  VLCMediaParseLocal = 0x00,
465  VLCMediaParseNetwork = 0x01,
466  VLCMediaFetchLocal = 0x02,
467  VLCMediaFetchNetwork = 0x04,
468 };
474 
485 - (int)parseWithOptions:(VLCMediaParsingOptions)options;
486 
498 - (int)parseWithOptions:(VLCMediaParsingOptions)options timeout:(int)timeoutValue;
499 
508 - (void)addOptions:(NSDictionary*)options;
509 
525 - (int)storeCookie:(NSString * _Nonnull)cookie
526  forHost:(NSString * _Nonnull)host
527  path:(NSString * _Nonnull)path;
528 
536 - (void)clearStoredCookies;
537 
543 @property (NS_NONATOMIC_IOSONLY, readonly, copy, nullable) NSDictionary *stats;
544 
545 #pragma mark - individual stats
546 
551 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnInput;
556 @property (NS_NONATOMIC_IOSONLY, readonly) float inputBitrate;
557 
562 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnDemux;
567 @property (NS_NONATOMIC_IOSONLY, readonly) float demuxBitrate;
568 
573 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedVideoBlocks;
578 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedAudioBlocks;
579 
584 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDisplayedPictures;
589 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostPictures;
590 
595 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfPlayedAudioBuffers;
600 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostAudioBuffers;
601 
606 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentPackets;
611 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentBytes;
616 @property (NS_NONATOMIC_IOSONLY, readonly) float streamOutputBitrate;
622 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfCorruptedDataPackets;
628 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDiscontinuties;
629 
630 @end
631 
632 NS_ASSUME_NONNULL_END
NSInteger numberOfReadBytesOnInput
Definition: VLCMedia.h:551
NSString *const VLCMediaTracksInformationType
Definition: VLCMedia.h:312
NSString *const VLCMediaTracksInformationDescription
Definition: VLCMedia.h:339
(deprecated __attribute__()
float streamOutputBitrate
Definition: VLCMedia.h:616
NSInteger numberOfPlayedAudioBuffers
Definition: VLCMedia.h:595
NSString *const VLCMediaTracksInformationTypeUnknown
Definition: VLCMedia.h:406
NSString *const VLCMediaTracksInformationLanguage
Definition: VLCMedia.h:334
NSString *const VLCMediaTracksInformationBitrate
Definition: VLCMedia.h:329
NSString *const VLCMediaTracksInformationCodecLevel
Definition: VLCMedia.h:323
NSString *const VLCMediaTracksInformationFrameRate
Definition: VLCMedia.h:378
NSString *const VLCMediaTracksInformationCodec
Definition: VLCMedia.h:297
NSDictionary * stats
Definition: VLCMedia.h:543
id< VLCMediaDelegate > delegate
Definition: VLCMedia.h:202
NSString *const VLCMediaTracksInformationId
Definition: VLCMedia.h:303
NSString *const VLCMediaTracksInformationTypeText
Definition: VLCMedia.h:402
NSString *const VLCMediaTracksInformationVideoHeight
Definition: VLCMedia.h:356
float demuxBitrate
Definition: VLCMedia.h:567
BOOL saveMetadata
Definition: VLCMedia.h:272
NSString *const VLCMediaTracksInformationFrameRateDenominator
Definition: VLCMedia.h:383
BOOL mediaSizeSuitableForDevice
Definition: VLCMedia.h:287
NSInteger numberOfDisplayedPictures
Definition: VLCMedia.h:584
NSString *const VLCMediaTracksInformationCodecProfile
Definition: VLCMedia.h:318
NSArray * tracksInformation
Definition: VLCMedia.h:440
typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
Definition: VLCMedia.h:230
VLCMediaList * subitems
Definition: VLCMedia.h:250
NSString *const VLCMediaTracksInformationSourceAspectRatio
Definition: VLCMedia.h:367
typedef NS_ENUM(NSUInteger, VLCMediaType)
Definition: VLCMedia.h:172
NSString *const VLCMediaTracksInformationTypeAudio
Definition: VLCMedia.h:394
NSInteger numberOfDecodedAudioBlocks
Definition: VLCMedia.h:578
VLCMediaState state
Definition: VLCMedia.h:282
NSInteger numberOfLostAudioBuffers
Definition: VLCMedia.h:600
Definition: VLCMediaList.h:67
NSString *const VLCMediaTracksInformationAudioChannelsNumber
Definition: VLCMedia.h:345
NSInteger numberOfSentPackets
Definition: VLCMedia.h:606
NSInteger numberOfLostPictures
Definition: VLCMedia.h:589
VLCTime * length
Definition: VLCMedia.h:209
float inputBitrate
Definition: VLCMedia.h:556
NSInteger numberOfReadBytesOnDemux
Definition: VLCMedia.h:562
NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator
Definition: VLCMedia.h:372
void clearStoredCookies()
NSInteger numberOfCorruptedDataPackets
Definition: VLCMedia.h:622
Definition: VLCMedia.h:111
NSString *const VLCMediaTracksInformationTextEncoding
Definition: VLCMedia.h:389
NSString *const VLCMediaTracksInformationAudioRate
Definition: VLCMedia.h:350
int VLCMediaParsingOptions
Definition: VLCMedia.h:473
NSDictionary * metaDictionary
Definition: VLCMedia.h:277
VLCMediaParsedStatus parsedStatus
Definition: VLCMedia.h:236
NSString *const VLCMediaTracksInformationTypeVideo
Definition: VLCMedia.h:398
NSInteger numberOfDecodedVideoBlocks
Definition: VLCMedia.h:573
NSString *const VLCMediaTracksInformationVideoWidth
Definition: VLCMedia.h:361
NSURL * url
Definition: VLCMedia.h:245
Definition: VLCTime.h:30
Definition: VLCMedia.h:85
NSInteger numberOfDiscontinuties
Definition: VLCMedia.h:628
NSInteger numberOfSentBytes
Definition: VLCMedia.h:611
VLCMediaType mediaType
Definition: VLCMedia.h:179