VLCKit
VLCMediaPlayer.h
1 /*****************************************************************************
2  * VLCMediaPlayer.h: VLCKit.framework VLCMediaPlayer header
3  *****************************************************************************
4  * Copyright (C) 2007-2009 Pierre d'Herbemont
5  * Copyright (C) 2007-2015 VLC authors and VideoLAN
6  * Copyright (C) 2009-2015 Felix Paul Kühne
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 #if TARGET_OS_IPHONE
29 # import <CoreGraphics/CoreGraphics.h>
30 # import <UIKit/UIKit.h>
31 #endif
32 #import "VLCMedia.h"
33 #import "VLCTime.h"
34 #import "VLCAudio.h"
35 
36 #if !TARGET_OS_IPHONE
37 @class VLCVideoView;
38 @class VLCVideoLayer;
39 #endif
40 
41 @class VLCLibrary;
42 
43 /* Notification Messages */
44 extern NSString *const VLCMediaPlayerTimeChanged;
45 extern NSString *const VLCMediaPlayerStateChanged;
46 extern NSString *const VLCMediaPlayerTitleChanged;
47 extern NSString *const VLCMediaPlayerChapterChanged;
48 
52 typedef NS_ENUM(NSInteger, VLCMediaPlayerState)
53 {
54  VLCMediaPlayerStateStopped,
55  VLCMediaPlayerStateOpening,
56  VLCMediaPlayerStateBuffering,
57  VLCMediaPlayerStateEnded,
58  VLCMediaPlayerStateError,
59  VLCMediaPlayerStatePlaying,
60  VLCMediaPlayerStatePaused
61 };
62 
66 typedef NS_ENUM(unsigned, VLCMediaPlaybackNavigationAction)
67 {
68  VLCMediaPlaybackNavigationActionActivate = 0,
69  VLCMediaPlaybackNavigationActionUp,
70  VLCMediaPlaybackNavigationActionDown,
71  VLCMediaPlaybackNavigationActionLeft,
72  VLCMediaPlaybackNavigationActionRight
73 };
74 
80 extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
81 
87 
88 @optional
94 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
95 
101 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
102 
109 - (void)mediaPlayerTitleChanged:(NSNotification *)aNotification;
110 
116 - (void)mediaPlayerChapterChanged:(NSNotification *)aNotification;
117 
118 #if TARGET_OS_PHONE
119 
124 - (void)mediaPlayerSnapshot:(NSNotification *)aNotification;
125 #endif
126 
127 @end
128 
129 
133 @interface VLCMediaPlayer : NSObject
134 
138 @property (nonatomic, readonly) VLCLibrary *libraryInstance;
142 @property (weak, nonatomic) id<VLCMediaPlayerDelegate> delegate;
143 
144 #if !TARGET_OS_IPHONE
145 /* Initializers */
151 - (instancetype)initWithVideoView:(VLCVideoView *)aVideoView;
157 - (instancetype)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
158 #endif
159 
164 - (instancetype)initWithOptions:(NSArray *)options;
171 - (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library;
172 
173 /* Video View Options */
174 // TODO: Should be it's own object?
175 
176 #pragma mark -
177 #pragma mark video functionality
178 
179 #if !TARGET_OS_IPHONE
180 
185 - (void)setVideoView:(VLCVideoView *)aVideoView;
191 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
192 #endif
193 
198 @property (strong) id drawable; /* The videoView or videoLayer */
199 
208 @property (NS_NONATOMIC_IOSONLY) char *videoAspectRatio;
209 
216 @property (NS_NONATOMIC_IOSONLY) char *videoCropGeometry;
217 
227 @property (nonatomic) float scaleFactor;
228 
239 - (void)saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height;
240 
246 - (void)setDeinterlaceFilter: (NSString *)name;
247 
253 @property (nonatomic) BOOL adjustFilterEnabled;
259 @property (nonatomic) float contrast;
265 @property (nonatomic) float brightness;
271 @property (nonatomic) float hue;
277 @property (nonatomic) float saturation;
283 @property (nonatomic) float gamma;
284 
293 @property (nonatomic) float rate;
294 
299 @property (nonatomic, readonly, weak) VLCAudio * audio;
300 
301 /* Video Information */
306 @property (NS_NONATOMIC_IOSONLY, readonly) CGSize videoSize;
307 
314 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasVideoOut;
315 
321 @property (NS_NONATOMIC_IOSONLY, readonly) float framesPerSecond __attribute__((deprecated));
322 
323 #pragma mark -
324 #pragma mark time
325 
335 @property (NS_NONATOMIC_IOSONLY, strong) VLCTime *time;
336 
342 @property (nonatomic, readonly, weak) VLCTime *remainingTime;
343 
344 #pragma mark -
345 #pragma mark ES track handling
346 
354 @property (readwrite) int currentVideoTrackIndex;
355 
360 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackNames;
361 
366 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackIndexes;
367 
372 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfVideoTracks;
373 
381 @property (readwrite) int currentVideoSubTitleIndex;
382 
387 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesNames;
388 
393 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesIndexes;
394 
399 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfSubtitlesTracks;
400 
408 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path __attribute__((deprecated));
409 
413 typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
414 {
415  VLCMediaPlaybackSlaveTypeSubtitle = 0,
416  VLCMediaPlaybackSlaveTypeAudio
417 };
418 
427 - (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection;
428 
435 @property (readwrite) NSInteger currentVideoSubTitleDelay;
436 
446 @property (readwrite) int currentChapterIndex;
450 - (void)previousChapter;
454 - (void)nextChapter;
459 - (int)numberOfChaptersForTitle:(int)titleIndex;
460 
465 - (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
466 
470 extern NSString *const VLCChapterDescriptionName;
474 extern NSString *const VLCChapterDescriptionTimeOffset;
478 extern NSString *const VLCChapterDescriptionDuration;
479 
490 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex;
491 
496 @property (readwrite) int currentTitleIndex;
501 @property (readonly) int numberOfTitles;
502 
507 @property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
512 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
513 
517 extern NSString *const VLCTitleDescriptionName;
521 extern NSString *const VLCTitleDescriptionDuration;
525 extern NSString *const VLCTitleDescriptionIsMenu;
526 
536 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titleDescriptions;
537 
542 @property (readonly) int indexOfLongestTitle;
543 
544 /* Audio Options */
545 
553 @property (readwrite) int currentAudioTrackIndex;
554 
559 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackNames;
560 
565 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackIndexes;
566 
571 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfAudioTracks;
572 
573 #pragma mark -
574 #pragma mark audio functionality
575 
580 @property (NS_NONATOMIC_IOSONLY) int audioChannel;
581 
588 @property (readwrite) NSInteger currentAudioPlaybackDelay;
589 
590 #pragma mark -
591 #pragma mark equalizer
592 
600 @property (weak, readonly) NSArray *equalizerProfiles;
601 
606 - (void)resetEqualizerFromProfile:(unsigned)profile;
607 
612 @property (readwrite) BOOL equalizerEnabled;
613 
619 @property (readwrite) CGFloat preAmplification;
620 
624 @property (readonly) unsigned numberOfBands;
625 
630 - (CGFloat)frequencyOfBandAtIndex:(unsigned)index;
631 
636 - (void)setAmplification:(CGFloat)amplification forBand:(unsigned)index;
637 
642 - (CGFloat)amplificationOfBand:(unsigned)index;
643 
644 #pragma mark -
645 #pragma mark media handling
646 
647 /* Media Options */
651 @property (NS_NONATOMIC_IOSONLY, strong) VLCMedia *media;
652 
653 #pragma mark -
654 #pragma mark playback operations
655 
660 - (void)play;
661 
665 - (void)pause;
666 
670 - (void)stop;
671 
675 - (void)gotoNextFrame;
676 
680 - (void)fastForward;
681 
686 - (void)fastForwardAtRate:(float)rate;
687 
691 - (void)rewind;
692 
697 - (void)rewindAtRate:(float)rate;
698 
703 - (void)jumpBackward:(int)interval;
704 
709 - (void)jumpForward:(int)interval;
710 
714 - (void)extraShortJumpBackward;
715 
719 - (void)extraShortJumpForward;
720 
724 - (void)shortJumpBackward;
725 
729 - (void)shortJumpForward;
730 
734 - (void)mediumJumpBackward;
735 
739 - (void)mediumJumpForward;
740 
744 - (void)longJumpBackward;
745 
749 - (void)longJumpForward;
750 
754 - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
755 
756 #pragma mark -
757 #pragma mark playback information
758 
762 @property (NS_NONATOMIC_IOSONLY, getter=isPlaying, readonly) BOOL playing;
763 
768 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL willPlay;
769 
774 @property (NS_NONATOMIC_IOSONLY, readonly) VLCMediaPlayerState state;
775 
780 @property (NS_NONATOMIC_IOSONLY) float position;
781 
786 @property (NS_NONATOMIC_IOSONLY, getter=isSeekable, readonly) BOOL seekable;
787 
792 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL canPause;
793 
794 #if TARGET_OS_IPHONE
795 
800 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *snapshots;
801 
808 @property (NS_NONATOMIC_IOSONLY, readonly) UIImage *lastSnapshot;
809 #endif
810 
811 @end
float position
Definition: VLCMediaPlayer.h:780
float contrast
Definition: VLCMediaPlayer.h:259
VLCMedia * media
Definition: VLCMediaPlayer.h:651
Definition: VLCVideoView.h:31
void shortJumpForward()
void shortJumpBackward()
char * videoCropGeometry
Definition: VLCMediaPlayer.h:216
int currentVideoSubTitleIndex
Definition: VLCMediaPlayer.h:381
unsigned numberOfBands
Definition: VLCMediaPlayer.h:624
VLCAudio * audio
Definition: VLCMediaPlayer.h:299
int numberOfSubtitlesTracks
Definition: VLCMediaPlayer.h:399
BOOL playing
Definition: VLCMediaPlayer.h:762
VLCTime * remainingTime
Definition: VLCMediaPlayer.h:342
int numberOfAudioTracks
Definition: VLCMediaPlayer.h:571
BOOL adjustFilterEnabled
Definition: VLCMediaPlayer.h:253
int currentChapterIndex
Definition: VLCMediaPlayer.h:446
Definition: VLCMediaPlayer.h:86
int numberOfTitles
Definition: VLCMediaPlayer.h:501
void extraShortJumpBackward()
void previousChapter()
VLCLibrary * libraryInstance
Definition: VLCMediaPlayer.h:138
float gamma
Definition: VLCMediaPlayer.h:283
typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
Definition: VLCMediaPlayer.h:413
NSArray * audioTrackNames
Definition: VLCMediaPlayer.h:559
float scaleFactor
Definition: VLCMediaPlayer.h:227
NSString *const VLCTitleDescriptionIsMenu
Definition: VLCMediaPlayer.h:525
NSInteger currentVideoSubTitleDelay
Definition: VLCMediaPlayer.h:435
int currentTitleIndex
Definition: VLCMediaPlayer.h:496
id drawable
Definition: VLCMediaPlayer.h:198
id< VLCMediaPlayerDelegate > delegate
Definition: VLCMediaPlayer.h:142
BOOL hasVideoOut
Definition: VLCMediaPlayer.h:314
Definition: VLCLibrary.h:41
NSArray * videoTrackNames
Definition: VLCMediaPlayer.h:360
VLCTime * time
Definition: VLCMediaPlayer.h:335
float hue
Definition: VLCMediaPlayer.h:271
NSArray * titleDescriptions
Definition: VLCMediaPlayer.h:536
float saturation
Definition: VLCMediaPlayer.h:277
NSArray * videoSubTitlesNames
Definition: VLCMediaPlayer.h:387
void longJumpForward()
int currentVideoTrackIndex
Definition: VLCMediaPlayer.h:354
NSString *const VLCTitleDescriptionName
Definition: VLCMediaPlayer.h:517
int audioChannel
Definition: VLCMediaPlayer.h:580
NSString *const VLCTitleDescriptionDuration
Definition: VLCMediaPlayer.h:521
void extraShortJumpForward()
int currentAudioTrackIndex
Definition: VLCMediaPlayer.h:553
char * videoAspectRatio
Definition: VLCMediaPlayer.h:208
Definition: VLCMediaPlayer.h:133
VLCMediaPlayerState state
Definition: VLCMediaPlayer.h:774
CGSize videoSize
Definition: VLCMediaPlayer.h:306
Definition: VLCVideoLayer.h:30
float brightness
Definition: VLCMediaPlayer.h:265
CGFloat preAmplification
Definition: VLCMediaPlayer.h:619
float rate
Definition: VLCMediaPlayer.h:293
void mediumJumpBackward()
Definition: VLCMedia.h:109
NSArray * videoTrackIndexes
Definition: VLCMediaPlayer.h:366
NSArray * equalizerProfiles
Definition: VLCMediaPlayer.h:600
Definition: VLCAudio.h:36
NSArray * videoSubTitlesIndexes
Definition: VLCMediaPlayer.h:393
int indexOfLongestTitle
Definition: VLCMediaPlayer.h:542
BOOL equalizerEnabled
Definition: VLCMediaPlayer.h:612
NSInteger currentAudioPlaybackDelay
Definition: VLCMediaPlayer.h:588
float framesPerSecond __attribute__((deprecated))
BOOL canPause
Definition: VLCMediaPlayer.h:792
NSArray * audioTrackIndexes
Definition: VLCMediaPlayer.h:565
NSString *const VLCChapterDescriptionDuration
Definition: VLCMediaPlayer.h:478
NSString *const VLCChapterDescriptionTimeOffset
Definition: VLCMediaPlayer.h:474
BOOL willPlay
Definition: VLCMediaPlayer.h:768
BOOL seekable
Definition: VLCMediaPlayer.h:786
void longJumpBackward()
Definition: VLCTime.h:30
NSString *const VLCChapterDescriptionName
Definition: VLCMediaPlayer.h:470
void mediumJumpForward()
int numberOfVideoTracks
Definition: VLCMediaPlayer.h:372