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  * 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 #if TARGET_OS_IPHONE
30 # import <CoreGraphics/CoreGraphics.h>
31 # import <UIKit/UIKit.h>
32 #endif
33 #import "VLCMedia.h"
34 #import "VLCTime.h"
35 #import "VLCAudio.h"
36 
37 #if !TARGET_OS_IPHONE
38 @class VLCVideoView;
39 @class VLCVideoLayer;
40 #endif
41 
42 @class VLCLibrary;
43 @class VLCMediaPlayer;
44 @class VLCRendererItem;
45 
46 /* Notification Messages */
47 extern NSString *const VLCMediaPlayerTimeChanged;
48 extern NSString *const VLCMediaPlayerStateChanged;
49 extern NSString *const VLCMediaPlayerTitleChanged;
50 extern NSString *const VLCMediaPlayerChapterChanged;
51 
55 typedef NS_ENUM(NSInteger, VLCMediaPlayerState)
56 {
57  VLCMediaPlayerStateStopped,
58  VLCMediaPlayerStateOpening,
59  VLCMediaPlayerStateBuffering,
60  VLCMediaPlayerStateEnded,
61  VLCMediaPlayerStateError,
62  VLCMediaPlayerStatePlaying,
63  VLCMediaPlayerStatePaused,
64  VLCMediaPlayerStateESAdded
65 };
66 
70 typedef NS_ENUM(unsigned, VLCMediaPlaybackNavigationAction)
71 {
72  VLCMediaPlaybackNavigationActionActivate = 0,
73  VLCMediaPlaybackNavigationActionUp,
74  VLCMediaPlaybackNavigationActionDown,
75  VLCMediaPlaybackNavigationActionLeft,
76  VLCMediaPlaybackNavigationActionRight
77 };
78 
82 typedef NS_ENUM(NSInteger, VLCDeinterlace)
83 {
84  VLCDeinterlaceAuto = -1,
85  VLCDeinterlaceOn = 1,
86  VLCDeinterlaceOff = 0
87 };
88 
94 extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
95 
100 @protocol VLCMediaPlayerDelegate <NSObject>
101 
102 @optional
108 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
109 
115 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
116 
123 - (void)mediaPlayerTitleChanged:(NSNotification *)aNotification;
124 
130 - (void)mediaPlayerChapterChanged:(NSNotification *)aNotification;
131 
137 - (void)mediaPlayerSnapshot:(NSNotification *)aNotification;
138 
143 - (void)mediaPlayerStartedRecording:(VLCMediaPlayer *)player;
144 
150 - (void)mediaPlayer:(VLCMediaPlayer *)player recordingStoppedAtPath:(NSString *)path;
151 
152 @end
153 
154 
158 @interface VLCMediaPlayer : NSObject
159 
163 @property (nonatomic, readonly) VLCLibrary *libraryInstance;
167 @property (weak, nonatomic) id<VLCMediaPlayerDelegate> delegate;
168 
169 #if !TARGET_OS_IPHONE
170 /* Initializers */
176 - (instancetype)initWithVideoView:(VLCVideoView *)aVideoView;
182 - (instancetype)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
183 #endif
184 
189 - (instancetype)initWithOptions:(NSArray *)options;
196 - (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library;
197 
198 /* Video View Options */
199 // TODO: Should be it's own object?
200 
201 #pragma mark -
202 #pragma mark video functionality
203 
204 #if !TARGET_OS_IPHONE
205 
210 - (void)setVideoView:(VLCVideoView *)aVideoView;
216 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
217 #endif
218 
223 @property (strong) id drawable; /* The videoView or videoLayer */
224 
233 @property (NS_NONATOMIC_IOSONLY) char *videoAspectRatio;
234 
241 @property (NS_NONATOMIC_IOSONLY) char *videoCropGeometry;
242 
252 @property (nonatomic) float scaleFactor;
253 
264 - (void)saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height;
265 
271 - (void)setDeinterlaceFilter: (NSString *)name;
272 
279 - (void)setDeinterlace:(VLCDeinterlace)deinterlace withFilter:(NSString *)name;
280 
286 @property (nonatomic) BOOL adjustFilterEnabled;
292 @property (nonatomic) float contrast;
298 @property (nonatomic) float brightness;
304 @property (nonatomic) float hue;
310 @property (nonatomic) float saturation;
316 @property (nonatomic) float gamma;
317 
326 @property (nonatomic) float rate;
327 
332 @property (nonatomic, readonly, weak) VLCAudio * audio;
333 
334 /* Video Information */
339 @property (NS_NONATOMIC_IOSONLY, readonly) CGSize videoSize;
340 
347 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasVideoOut;
348 
354 @property (NS_NONATOMIC_IOSONLY, readonly) float framesPerSecond __attribute__((deprecated));
355 
356 #pragma mark -
357 #pragma mark time
358 
368 @property (NS_NONATOMIC_IOSONLY, strong) VLCTime *time;
369 
375 @property (nonatomic, readonly, weak) VLCTime *remainingTime;
376 
377 #pragma mark -
378 #pragma mark ES track handling
379 
387 @property (readwrite) int currentVideoTrackIndex;
388 
393 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackNames;
394 
399 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackIndexes;
400 
405 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfVideoTracks;
406 
414 @property (readwrite) int currentVideoSubTitleIndex;
415 
420 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesNames;
421 
426 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesIndexes;
427 
432 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfSubtitlesTracks;
433 
439 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path __attribute__((deprecated));
440 
444 typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
445 {
446  VLCMediaPlaybackSlaveTypeSubtitle = 0,
447  VLCMediaPlaybackSlaveTypeAudio
448 };
449 
458 - (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection;
459 
466 @property (readwrite) NSInteger currentVideoSubTitleDelay;
467 
477 @property (readwrite) int currentChapterIndex;
481 - (void)previousChapter;
485 - (void)nextChapter;
490 - (int)numberOfChaptersForTitle:(int)titleIndex;
491 
496 - (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
497 
501 extern NSString *const VLCChapterDescriptionName;
505 extern NSString *const VLCChapterDescriptionTimeOffset;
509 extern NSString *const VLCChapterDescriptionDuration;
510 
521 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex;
522 
527 @property (readwrite) int currentTitleIndex;
532 @property (readonly) int numberOfTitles;
533 
538 @property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
543 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
544 
548 extern NSString *const VLCTitleDescriptionName;
552 extern NSString *const VLCTitleDescriptionDuration;
556 extern NSString *const VLCTitleDescriptionIsMenu;
557 
567 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titleDescriptions;
568 
573 @property (readonly) int indexOfLongestTitle;
574 
575 /* Audio Options */
576 
584 @property (readwrite) int currentAudioTrackIndex;
585 
590 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackNames;
591 
596 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackIndexes;
597 
602 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfAudioTracks;
603 
604 #pragma mark -
605 #pragma mark audio functionality
606 
611 @property (NS_NONATOMIC_IOSONLY) int audioChannel;
612 
619 @property (readwrite) NSInteger currentAudioPlaybackDelay;
620 
621 #pragma mark -
622 #pragma mark equalizer
623 
631 @property (weak, readonly) NSArray *equalizerProfiles;
632 
637 - (void)resetEqualizerFromProfile:(unsigned)profile;
638 
644 @property (readwrite) BOOL equalizerEnabled;
645 
651 @property (readwrite) CGFloat preAmplification;
652 
656 @property (readonly) unsigned numberOfBands;
657 
662 - (CGFloat)frequencyOfBandAtIndex:(unsigned)index;
663 
668 - (void)setAmplification:(CGFloat)amplification forBand:(unsigned)index;
669 
674 - (CGFloat)amplificationOfBand:(unsigned)index;
675 
676 #pragma mark -
677 #pragma mark media handling
678 
679 /* Media Options */
683 @property (NS_NONATOMIC_IOSONLY, strong) VLCMedia *media;
684 
685 #pragma mark -
686 #pragma mark playback operations
687 
692 - (void)play;
693 
697 - (void)pause;
698 
702 - (void)stop;
703 
707 - (void)gotoNextFrame;
708 
712 - (void)fastForward;
713 
718 - (void)fastForwardAtRate:(float)rate;
719 
723 - (void)rewind;
724 
729 - (void)rewindAtRate:(float)rate;
730 
735 - (void)jumpBackward:(int)interval;
736 
741 - (void)jumpForward:(int)interval;
742 
746 - (void)extraShortJumpBackward;
747 
751 - (void)extraShortJumpForward;
752 
756 - (void)shortJumpBackward;
757 
761 - (void)shortJumpForward;
762 
766 - (void)mediumJumpBackward;
767 
771 - (void)mediumJumpForward;
772 
776 - (void)longJumpBackward;
777 
781 - (void)longJumpForward;
782 
786 - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
787 
799 - (BOOL)updateViewpoint:(float)yaw pitch:(float)pitch roll:(float)roll fov:(float)fov absolute:(BOOL)absolute;
800 
806 @property (nonatomic) float yaw;
807 
813 @property (nonatomic) float pitch;
814 
820 @property (nonatomic) float roll;
821 
827 @property (nonatomic) float fov;
828 
829 #pragma mark -
830 #pragma mark playback information
831 
835 @property (NS_NONATOMIC_IOSONLY, getter=isPlaying, readonly) BOOL playing;
836 
841 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL willPlay;
842 
847 @property (NS_NONATOMIC_IOSONLY, readonly) VLCMediaPlayerState state;
848 
853 @property (NS_NONATOMIC_IOSONLY) float position;
854 
860 @property (NS_NONATOMIC_IOSONLY, getter=isSeekable, readonly) BOOL seekable;
861 
866 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL canPause;
867 
873 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *snapshots;
874 
875 #if TARGET_OS_IPHONE
876 
882 @property (NS_NONATOMIC_IOSONLY, readonly) UIImage *lastSnapshot;
883 #else
884 
890 @property (NS_NONATOMIC_IOSONLY, readonly) NSImage *lastSnapshot;
891 #endif
892 
898 - (BOOL)startRecordingAtPath:(NSString *)path;
899 
904 - (BOOL)stopRecording;
905 
906 #pragma mark -
907 #pragma mark Renderer
908 
917 - (BOOL)setRendererItem:(VLCRendererItem *)item;
918 
919 @end
float position
Definition: VLCMediaPlayer.h:853
float contrast
Definition: VLCMediaPlayer.h:292
VLCMedia * media
Definition: VLCMediaPlayer.h:683
Definition: VLCVideoView.h:31
void shortJumpForward()
void shortJumpBackward()
char * videoCropGeometry
Definition: VLCMediaPlayer.h:241
int currentVideoSubTitleIndex
Definition: VLCMediaPlayer.h:414
unsigned numberOfBands
Definition: VLCMediaPlayer.h:656
VLCAudio * audio
Definition: VLCMediaPlayer.h:332
int numberOfSubtitlesTracks
Definition: VLCMediaPlayer.h:432
BOOL playing
Definition: VLCMediaPlayer.h:835
VLCTime * remainingTime
Definition: VLCMediaPlayer.h:375
int numberOfAudioTracks
Definition: VLCMediaPlayer.h:602
BOOL adjustFilterEnabled
Definition: VLCMediaPlayer.h:286
int currentChapterIndex
Definition: VLCMediaPlayer.h:477
float fov
Definition: VLCMediaPlayer.h:827
Definition: VLCRendererItem.h:36
Definition: VLCMediaPlayer.h:100
int numberOfTitles
Definition: VLCMediaPlayer.h:532
void extraShortJumpBackward()
void previousChapter()
VLCLibrary * libraryInstance
Definition: VLCMediaPlayer.h:163
float gamma
Definition: VLCMediaPlayer.h:316
typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
Definition: VLCMediaPlayer.h:444
NSArray * audioTrackNames
Definition: VLCMediaPlayer.h:590
float scaleFactor
Definition: VLCMediaPlayer.h:252
NSString *const VLCTitleDescriptionIsMenu
Definition: VLCMediaPlayer.h:556
NSInteger currentVideoSubTitleDelay
Definition: VLCMediaPlayer.h:466
int currentTitleIndex
Definition: VLCMediaPlayer.h:527
id drawable
Definition: VLCMediaPlayer.h:223
NSArray * snapshots
Definition: VLCMediaPlayer.h:873
id< VLCMediaPlayerDelegate > delegate
Definition: VLCMediaPlayer.h:167
BOOL hasVideoOut
Definition: VLCMediaPlayer.h:347
Definition: VLCLibrary.h:41
NSArray * videoTrackNames
Definition: VLCMediaPlayer.h:393
VLCTime * time
Definition: VLCMediaPlayer.h:368
float hue
Definition: VLCMediaPlayer.h:304
NSArray * titleDescriptions
Definition: VLCMediaPlayer.h:567
float saturation
Definition: VLCMediaPlayer.h:310
NSArray * videoSubTitlesNames
Definition: VLCMediaPlayer.h:420
float yaw
Definition: VLCMediaPlayer.h:806
void longJumpForward()
int currentVideoTrackIndex
Definition: VLCMediaPlayer.h:387
NSString *const VLCTitleDescriptionName
Definition: VLCMediaPlayer.h:548
float roll
Definition: VLCMediaPlayer.h:820
int audioChannel
Definition: VLCMediaPlayer.h:611
NSString *const VLCTitleDescriptionDuration
Definition: VLCMediaPlayer.h:552
void extraShortJumpForward()
int currentAudioTrackIndex
Definition: VLCMediaPlayer.h:584
char * videoAspectRatio
Definition: VLCMediaPlayer.h:233
Definition: VLCMediaPlayer.h:158
VLCMediaPlayerState state
Definition: VLCMediaPlayer.h:847
CGSize videoSize
Definition: VLCMediaPlayer.h:339
Definition: VLCVideoLayer.h:30
float brightness
Definition: VLCMediaPlayer.h:298
CGFloat preAmplification
Definition: VLCMediaPlayer.h:651
float rate
Definition: VLCMediaPlayer.h:326
NSImage * lastSnapshot
Definition: VLCMediaPlayer.h:890
void mediumJumpBackward()
Definition: VLCMedia.h:112
NSArray * videoTrackIndexes
Definition: VLCMediaPlayer.h:399
NSArray * equalizerProfiles
Definition: VLCMediaPlayer.h:631
Definition: VLCAudio.h:36
float pitch
Definition: VLCMediaPlayer.h:813
NSArray * videoSubTitlesIndexes
Definition: VLCMediaPlayer.h:426
int indexOfLongestTitle
Definition: VLCMediaPlayer.h:573
BOOL equalizerEnabled
Definition: VLCMediaPlayer.h:644
NSInteger currentAudioPlaybackDelay
Definition: VLCMediaPlayer.h:619
float framesPerSecond __attribute__((deprecated))
BOOL canPause
Definition: VLCMediaPlayer.h:866
NSArray * audioTrackIndexes
Definition: VLCMediaPlayer.h:596
NSString *const VLCChapterDescriptionDuration
Definition: VLCMediaPlayer.h:509
NSString *const VLCChapterDescriptionTimeOffset
Definition: VLCMediaPlayer.h:505
BOOL willPlay
Definition: VLCMediaPlayer.h:841
BOOL seekable
Definition: VLCMediaPlayer.h:860
void longJumpBackward()
Definition: VLCTime.h:30
NSString *const VLCChapterDescriptionName
Definition: VLCMediaPlayer.h:501
void mediumJumpForward()
int numberOfVideoTracks
Definition: VLCMediaPlayer.h:405