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 /* Meta Dictionary Keys */
35 extern NSString *const VLCMetaInformationTitle; /* NSString */
36 extern NSString *const VLCMetaInformationArtist; /* NSString */
37 extern NSString *const VLCMetaInformationGenre; /* NSString */
38 extern NSString *const VLCMetaInformationCopyright; /* NSString */
39 extern NSString *const VLCMetaInformationAlbum; /* NSString */
40 extern NSString *const VLCMetaInformationTrackNumber; /* NSString */
41 extern NSString *const VLCMetaInformationDescription; /* NSString */
42 extern NSString *const VLCMetaInformationRating; /* NSString */
43 extern NSString *const VLCMetaInformationDate; /* NSString */
44 extern NSString *const VLCMetaInformationSetting; /* NSString */
45 extern NSString *const VLCMetaInformationURL; /* NSString */
46 extern NSString *const VLCMetaInformationLanguage; /* NSString */
47 extern NSString *const VLCMetaInformationNowPlaying; /* NSString */
48 extern NSString *const VLCMetaInformationPublisher; /* NSString */
49 extern NSString *const VLCMetaInformationEncodedBy; /* NSString */
50 extern NSString *const VLCMetaInformationArtworkURL; /* NSString */
51 extern NSString *const VLCMetaInformationArtwork; /* NSImage */
52 extern NSString *const VLCMetaInformationTrackID; /* NSString */
53 extern NSString *const VLCMetaInformationTrackTotal; /* NSString */
54 extern NSString *const VLCMetaInformationDirector; /* NSString */
55 extern NSString *const VLCMetaInformationSeason; /* NSString */
56 extern NSString *const VLCMetaInformationEpisode; /* NSString */
57 extern NSString *const VLCMetaInformationShowName; /* NSString */
58 extern NSString *const VLCMetaInformationActors; /* NSString */
59 extern NSString *const VLCMetaInformationAlbumArtist; /* NSString */
60 extern NSString *const VLCMetaInformationDiscNumber; /* NSString */
61 
62 /* Notification Messages */
66 extern NSString *const VLCMediaMetaChanged;
67 
68 // Forward declarations, supresses compiler error messages
69 @class VLCMediaList;
70 @class VLCMedia;
71 
72 typedef NS_ENUM(NSInteger, VLCMediaState) {
73  VLCMediaStateNothingSpecial,
74  VLCMediaStateBuffering,
75  VLCMediaStatePlaying,
76  VLCMediaStateError,
77 };
78 
83 @protocol VLCMediaDelegate <NSObject>
84 
85 @optional
86 
92 - (void)mediaMetaDataDidChange:(VLCMedia *)aMedia;
93 
99 - (void)mediaDidFinishParsing:(VLCMedia *)aMedia;
100 @end
101 
109 @interface VLCMedia : NSObject
110 
111 /* Factories */
118 + (instancetype)mediaWithURL:(NSURL *)anURL;
119 
126 + (instancetype)mediaWithPath:(NSString *)aPath;
127 
134 + (NSString *)codecNameForFourCC:(uint32_t)fourcc trackType:(NSString *)trackType;
135 
143 + (instancetype)mediaAsNodeWithName:(NSString *)aName;
144 
145 /* Initializers */
151 - (instancetype)initWithURL:(NSURL *)anURL;
152 
158 - (instancetype)initWithPath:(NSString *)aPath;
159 
165 - (instancetype)initAsNodeWithName:(NSString *)aName;
166 
170 typedef NS_ENUM(NSUInteger, VLCMediaType) {
171  VLCMediaTypeUnknown,
172  VLCMediaTypeFile,
173  VLCMediaTypeDirectory,
174  VLCMediaTypeDisc,
175  VLCMediaTypeStream,
176  VLCMediaTypePlaylist,
177 };
178 
183 @property (readonly) VLCMediaType mediaType;
184 
194 - (NSComparisonResult)compare:(VLCMedia *)media;
195 
196 /* Properties */
200 @property (nonatomic, weak) id<VLCMediaDelegate> delegate;
201 
207 @property (nonatomic, readwrite, strong) VLCTime * length;
208 
217 - (VLCTime *)lengthWaitUntilDate:(NSDate *)aDate;
218 
223 @property (nonatomic, readonly) BOOL isParsed __attribute__((deprecated));
224 
228 typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
229 {
230  VLCMediaParsedStatusInit = 0,
231  VLCMediaParsedStatusSkipped,
232  VLCMediaParsedStatusFailed,
233  VLCMediaParsedStatusDone
234 };
238 @property (nonatomic, readonly) VLCMediaParsedStatus parsedStatus;
239 
243 @property (nonatomic, readonly, strong) NSURL * url;
244 
248 @property (nonatomic, readonly, strong) VLCMediaList * subitems;
249 
256 - (NSString *)metadataForKey:(NSString *)key;
257 
264 - (void)setMetadata:(NSString *)data forKey:(NSString *)key;
265 
270 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL saveMetadata;
271 
275 @property (nonatomic, readonly, copy) NSDictionary * metaDictionary;
276 
280 @property (nonatomic, readonly) VLCMediaState state;
281 
285 @property (NS_NONATOMIC_IOSONLY, getter=isMediaSizeSuitableForDevice, readonly) BOOL mediaSizeSuitableForDevice;
286 
295 extern NSString *const VLCMediaTracksInformationCodec;
296 
301 extern NSString *const VLCMediaTracksInformationId;
310 extern NSString *const VLCMediaTracksInformationType;
311 
321 extern NSString *const VLCMediaTracksInformationCodecLevel;
322 
327 extern NSString *const VLCMediaTracksInformationBitrate;
332 extern NSString *const VLCMediaTracksInformationLanguage;
338 
348 extern NSString *const VLCMediaTracksInformationAudioRate;
349 
359 extern NSString *const VLCMediaTracksInformationVideoWidth;
360 
371 
376 extern NSString *const VLCMediaTracksInformationFrameRate;
382 
388 
392 extern NSString *const VLCMediaTracksInformationTypeAudio;
396 extern NSString *const VLCMediaTracksInformationTypeVideo;
400 extern NSString *const VLCMediaTracksInformationTypeText;
405 
438 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *tracksInformation;
439 
450 - (void)parse __attribute__((deprecated));
451 
458 - (void)synchronousParse __attribute__((deprecated));
459 
460 
461 enum {
462  VLCMediaParseLocal = 0x00,
463  VLCMediaParseNetwork = 0x01,
464  VLCMediaFetchLocal = 0x02,
465  VLCMediaFetchNetwork = 0x04,
466 };
472 
483 - (int)parseWithOptions:(VLCMediaParsingOptions)options;
484 
496 - (int)parseWithOptions:(VLCMediaParsingOptions)options timeout:(int)timeoutValue;
497 
506 - (void) addOptions:(NSDictionary*) options;
507 
513 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSDictionary *stats;
514 
515 #pragma mark - individual stats
516 
521 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnInput;
526 @property (NS_NONATOMIC_IOSONLY, readonly) float inputBitrate;
527 
532 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfReadBytesOnDemux;
537 @property (NS_NONATOMIC_IOSONLY, readonly) float demuxBitrate;
538 
543 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedVideoBlocks;
548 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDecodedAudioBlocks;
549 
554 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDisplayedPictures;
559 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostPictures;
560 
565 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfPlayedAudioBuffers;
570 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfLostAudioBuffers;
571 
576 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentPackets;
581 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfSentBytes;
586 @property (NS_NONATOMIC_IOSONLY, readonly) float streamOutputBitrate;
592 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfCorruptedDataPackets;
598 @property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDiscontinuties;
599 
600 @end
NSInteger numberOfReadBytesOnInput
Definition: VLCMedia.h:521
NSString *const VLCMediaTracksInformationType
Definition: VLCMedia.h:310
NSString *const VLCMediaTracksInformationDescription
Definition: VLCMedia.h:337
(deprecated __attribute__()
float streamOutputBitrate
Definition: VLCMedia.h:586
NSInteger numberOfPlayedAudioBuffers
Definition: VLCMedia.h:565
NSString *const VLCMediaTracksInformationTypeUnknown
Definition: VLCMedia.h:404
NSString *const VLCMediaTracksInformationLanguage
Definition: VLCMedia.h:332
NSString *const VLCMediaTracksInformationBitrate
Definition: VLCMedia.h:327
NSString *const VLCMediaTracksInformationCodecLevel
Definition: VLCMedia.h:321
NSString *const VLCMediaTracksInformationFrameRate
Definition: VLCMedia.h:376
NSString *const VLCMediaTracksInformationCodec
Definition: VLCMedia.h:295
NSDictionary * stats
Definition: VLCMedia.h:513
id< VLCMediaDelegate > delegate
Definition: VLCMedia.h:200
NSString *const VLCMediaTracksInformationId
Definition: VLCMedia.h:301
NSString *const VLCMediaTracksInformationTypeText
Definition: VLCMedia.h:400
NSString *const VLCMediaTracksInformationVideoHeight
Definition: VLCMedia.h:354
float demuxBitrate
Definition: VLCMedia.h:537
BOOL saveMetadata
Definition: VLCMedia.h:270
NSString *const VLCMediaTracksInformationFrameRateDenominator
Definition: VLCMedia.h:381
BOOL mediaSizeSuitableForDevice
Definition: VLCMedia.h:285
NSInteger numberOfDisplayedPictures
Definition: VLCMedia.h:554
NSString *const VLCMediaTracksInformationCodecProfile
Definition: VLCMedia.h:316
NSArray * tracksInformation
Definition: VLCMedia.h:438
typedef NS_ENUM(unsigned, VLCMediaParsedStatus)
Definition: VLCMedia.h:228
VLCMediaList * subitems
Definition: VLCMedia.h:248
NSString *const VLCMediaTracksInformationSourceAspectRatio
Definition: VLCMedia.h:365
typedef NS_ENUM(NSUInteger, VLCMediaType)
Definition: VLCMedia.h:170
NSString *const VLCMediaTracksInformationTypeAudio
Definition: VLCMedia.h:392
NSInteger numberOfDecodedAudioBlocks
Definition: VLCMedia.h:548
VLCMediaState state
Definition: VLCMedia.h:280
NSInteger numberOfLostAudioBuffers
Definition: VLCMedia.h:570
Definition: VLCMediaList.h:67
NSString *const VLCMediaTracksInformationAudioChannelsNumber
Definition: VLCMedia.h:343
NSInteger numberOfSentPackets
Definition: VLCMedia.h:576
NSInteger numberOfLostPictures
Definition: VLCMedia.h:559
VLCTime * length
Definition: VLCMedia.h:207
float inputBitrate
Definition: VLCMedia.h:526
NSInteger numberOfReadBytesOnDemux
Definition: VLCMedia.h:532
NSString *const VLCMediaTracksInformationSourceAspectRatioDenominator
Definition: VLCMedia.h:370
NSInteger numberOfCorruptedDataPackets
Definition: VLCMedia.h:592
Definition: VLCMedia.h:109
NSString *const VLCMediaTracksInformationTextEncoding
Definition: VLCMedia.h:387
NSString *const VLCMediaTracksInformationAudioRate
Definition: VLCMedia.h:348
int VLCMediaParsingOptions
Definition: VLCMedia.h:471
NSDictionary * metaDictionary
Definition: VLCMedia.h:275
VLCMediaParsedStatus parsedStatus
Definition: VLCMedia.h:234
NSString *const VLCMediaTracksInformationTypeVideo
Definition: VLCMedia.h:396
NSInteger numberOfDecodedVideoBlocks
Definition: VLCMedia.h:543
NSString *const VLCMediaTracksInformationVideoWidth
Definition: VLCMedia.h:359
NSURL * url
Definition: VLCMedia.h:243
Definition: VLCTime.h:30
Definition: VLCMedia.h:83
NSInteger numberOfDiscontinuties
Definition: VLCMedia.h:598
NSInteger numberOfSentBytes
Definition: VLCMedia.h:581
VLCMediaType mediaType
Definition: VLCMedia.h:177