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 VLCRendererItem;
44 
45 /* Notification Messages */
46 extern NSString *const VLCMediaPlayerTimeChanged;
47 extern NSString *const VLCMediaPlayerStateChanged;
48 extern NSString *const VLCMediaPlayerTitleChanged;
49 extern NSString *const VLCMediaPlayerChapterChanged;
50 
54 typedef NS_ENUM(NSInteger, VLCMediaPlayerState)
55 {
56  VLCMediaPlayerStateStopped,
57  VLCMediaPlayerStateOpening,
58  VLCMediaPlayerStateBuffering,
59  VLCMediaPlayerStateEnded,
60  VLCMediaPlayerStateError,
61  VLCMediaPlayerStatePlaying,
62  VLCMediaPlayerStatePaused,
63  VLCMediaPlayerStateESAdded
64 };
65 
69 typedef NS_ENUM(unsigned, VLCMediaPlaybackNavigationAction)
70 {
71  VLCMediaPlaybackNavigationActionActivate = 0,
72  VLCMediaPlaybackNavigationActionUp,
73  VLCMediaPlaybackNavigationActionDown,
74  VLCMediaPlaybackNavigationActionLeft,
75  VLCMediaPlaybackNavigationActionRight
76 };
77 
81 typedef NS_ENUM(NSInteger, VLCDeinterlace)
82 {
83  VLCDeinterlaceAuto = -1,
84  VLCDeinterlaceOn = 1,
85  VLCDeinterlaceOff = 0
86 };
87 
93 extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
94 
100 
101 @optional
107 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
108 
114 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
115 
122 - (void)mediaPlayerTitleChanged:(NSNotification *)aNotification;
123 
129 - (void)mediaPlayerChapterChanged:(NSNotification *)aNotification;
130 
136 - (void)mediaPlayerSnapshot:(NSNotification *)aNotification;
137 
138 @end
139 
140 
144 @interface VLCMediaPlayer : NSObject
145 
149 @property (nonatomic, readonly) VLCLibrary *libraryInstance;
153 @property (weak, nonatomic) id<VLCMediaPlayerDelegate> delegate;
154 
155 #if !TARGET_OS_IPHONE
156 /* Initializers */
162 - (instancetype)initWithVideoView:(VLCVideoView *)aVideoView;
168 - (instancetype)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
169 #endif
170 
175 - (instancetype)initWithOptions:(NSArray *)options;
182 - (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library;
183 
184 /* Video View Options */
185 // TODO: Should be it's own object?
186 
187 #pragma mark -
188 #pragma mark video functionality
189 
190 #if !TARGET_OS_IPHONE
191 
196 - (void)setVideoView:(VLCVideoView *)aVideoView;
202 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
203 #endif
204 
209 @property (strong) id drawable; /* The videoView or videoLayer */
210 
219 @property (NS_NONATOMIC_IOSONLY) char *videoAspectRatio;
220 
227 @property (NS_NONATOMIC_IOSONLY) char *videoCropGeometry;
228 
238 @property (nonatomic) float scaleFactor;
239 
250 - (void)saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height;
251 
257 - (void)setDeinterlaceFilter: (NSString *)name;
258 
265 - (void)setDeinterlace:(VLCDeinterlace)deinterlace withFilter:(NSString *)name;
266 
272 @property (nonatomic) BOOL adjustFilterEnabled;
278 @property (nonatomic) float contrast;
284 @property (nonatomic) float brightness;
290 @property (nonatomic) float hue;
296 @property (nonatomic) float saturation;
302 @property (nonatomic) float gamma;
303 
312 @property (nonatomic) float rate;
313 
318 @property (nonatomic, readonly, weak) VLCAudio * audio;
319 
320 /* Video Information */
325 @property (NS_NONATOMIC_IOSONLY, readonly) CGSize videoSize;
326 
333 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasVideoOut;
334 
340 @property (NS_NONATOMIC_IOSONLY, readonly) float framesPerSecond __attribute__((deprecated));
341 
342 #pragma mark -
343 #pragma mark time
344 
354 @property (NS_NONATOMIC_IOSONLY, strong) VLCTime *time;
355 
361 @property (nonatomic, readonly, weak) VLCTime *remainingTime;
362 
363 #pragma mark -
364 #pragma mark ES track handling
365 
373 @property (readwrite) int currentVideoTrackIndex;
374 
379 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackNames;
380 
385 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackIndexes;
386 
391 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfVideoTracks;
392 
400 @property (readwrite) int currentVideoSubTitleIndex;
401 
406 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesNames;
407 
412 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesIndexes;
413 
418 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfSubtitlesTracks;
419 
425 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path __attribute__((deprecated));
426 
430 typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
431 {
432  VLCMediaPlaybackSlaveTypeSubtitle = 0,
433  VLCMediaPlaybackSlaveTypeAudio
434 };
435 
444 - (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection;
445 
452 @property (readwrite) NSInteger currentVideoSubTitleDelay;
453 
463 @property (readwrite) int currentChapterIndex;
467 - (void)previousChapter;
471 - (void)nextChapter;
476 - (int)numberOfChaptersForTitle:(int)titleIndex;
477 
482 - (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
483 
487 extern NSString *const VLCChapterDescriptionName;
491 extern NSString *const VLCChapterDescriptionTimeOffset;
495 extern NSString *const VLCChapterDescriptionDuration;
496 
507 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex;
508 
513 @property (readwrite) int currentTitleIndex;
518 @property (readonly) int numberOfTitles;
519 
524 @property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
529 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
530 
534 extern NSString *const VLCTitleDescriptionName;
538 extern NSString *const VLCTitleDescriptionDuration;
542 extern NSString *const VLCTitleDescriptionIsMenu;
543 
553 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titleDescriptions;
554 
559 @property (readonly) int indexOfLongestTitle;
560 
561 /* Audio Options */
562 
570 @property (readwrite) int currentAudioTrackIndex;
571 
576 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackNames;
577 
582 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackIndexes;
583 
588 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfAudioTracks;
589 
590 #pragma mark -
591 #pragma mark audio functionality
592 
597 @property (NS_NONATOMIC_IOSONLY) int audioChannel;
598 
605 @property (readwrite) NSInteger currentAudioPlaybackDelay;
606 
607 #pragma mark -
608 #pragma mark equalizer
609 
617 @property (weak, readonly) NSArray *equalizerProfiles;
618 
623 - (void)resetEqualizerFromProfile:(unsigned)profile;
624 
630 @property (readwrite) BOOL equalizerEnabled;
631 
637 @property (readwrite) CGFloat preAmplification;
638 
642 @property (readonly) unsigned numberOfBands;
643 
648 - (CGFloat)frequencyOfBandAtIndex:(unsigned)index;
649 
654 - (void)setAmplification:(CGFloat)amplification forBand:(unsigned)index;
655 
660 - (CGFloat)amplificationOfBand:(unsigned)index;
661 
662 #pragma mark -
663 #pragma mark media handling
664 
665 /* Media Options */
669 @property (NS_NONATOMIC_IOSONLY, strong) VLCMedia *media;
670 
671 #pragma mark -
672 #pragma mark playback operations
673 
678 - (void)play;
679 
683 - (void)pause;
684 
688 - (void)stop;
689 
693 - (void)gotoNextFrame;
694 
698 - (void)fastForward;
699 
704 - (void)fastForwardAtRate:(float)rate;
705 
709 - (void)rewind;
710 
715 - (void)rewindAtRate:(float)rate;
716 
721 - (void)jumpBackward:(int)interval;
722 
727 - (void)jumpForward:(int)interval;
728 
732 - (void)extraShortJumpBackward;
733 
737 - (void)extraShortJumpForward;
738 
742 - (void)shortJumpBackward;
743 
747 - (void)shortJumpForward;
748 
752 - (void)mediumJumpBackward;
753 
757 - (void)mediumJumpForward;
758 
762 - (void)longJumpBackward;
763 
767 - (void)longJumpForward;
768 
772 - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
773 
785 - (BOOL)updateViewpoint:(float)yaw pitch:(float)pitch roll:(float)roll fov:(float)fov absolute:(BOOL)absolute;
786 
792 @property (nonatomic) float yaw;
793 
799 @property (nonatomic) float pitch;
800 
806 @property (nonatomic) float roll;
807 
813 @property (nonatomic) float fov;
814 
815 #pragma mark -
816 #pragma mark playback information
817 
821 @property (NS_NONATOMIC_IOSONLY, getter=isPlaying, readonly) BOOL playing;
822 
827 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL willPlay;
828 
833 @property (NS_NONATOMIC_IOSONLY, readonly) VLCMediaPlayerState state;
834 
839 @property (NS_NONATOMIC_IOSONLY) float position;
840 
845 @property (NS_NONATOMIC_IOSONLY, getter=isSeekable, readonly) BOOL seekable;
846 
851 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL canPause;
852 
858 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *snapshots;
859 
860 #if TARGET_OS_IPHONE
861 
867 @property (NS_NONATOMIC_IOSONLY, readonly) UIImage *lastSnapshot;
868 #else
869 
875 @property (NS_NONATOMIC_IOSONLY, readonly) NSImage *lastSnapshot;
876 #endif
877 
878 #pragma mark -
879 #pragma mark Renderer
880 
889 - (BOOL)setRendererItem:(VLCRendererItem *)item;
890 
891 @end
float position
Definition: VLCMediaPlayer.h:839
float contrast
Definition: VLCMediaPlayer.h:278
VLCMedia * media
Definition: VLCMediaPlayer.h:669
Definition: VLCVideoView.h:31
void shortJumpForward()
void shortJumpBackward()
char * videoCropGeometry
Definition: VLCMediaPlayer.h:227
int currentVideoSubTitleIndex
Definition: VLCMediaPlayer.h:400
unsigned numberOfBands
Definition: VLCMediaPlayer.h:642
VLCAudio * audio
Definition: VLCMediaPlayer.h:318
int numberOfSubtitlesTracks
Definition: VLCMediaPlayer.h:418
BOOL playing
Definition: VLCMediaPlayer.h:821
VLCTime * remainingTime
Definition: VLCMediaPlayer.h:361
int numberOfAudioTracks
Definition: VLCMediaPlayer.h:588
BOOL adjustFilterEnabled
Definition: VLCMediaPlayer.h:272
int currentChapterIndex
Definition: VLCMediaPlayer.h:463
float fov
Definition: VLCMediaPlayer.h:813
Definition: VLCRendererItem.h:36
Definition: VLCMediaPlayer.h:99
int numberOfTitles
Definition: VLCMediaPlayer.h:518
void extraShortJumpBackward()
void previousChapter()
VLCLibrary * libraryInstance
Definition: VLCMediaPlayer.h:149
float gamma
Definition: VLCMediaPlayer.h:302
typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
Definition: VLCMediaPlayer.h:430
NSArray * audioTrackNames
Definition: VLCMediaPlayer.h:576
float scaleFactor
Definition: VLCMediaPlayer.h:238
NSString *const VLCTitleDescriptionIsMenu
Definition: VLCMediaPlayer.h:542
NSInteger currentVideoSubTitleDelay
Definition: VLCMediaPlayer.h:452
int currentTitleIndex
Definition: VLCMediaPlayer.h:513
id drawable
Definition: VLCMediaPlayer.h:209
NSArray * snapshots
Definition: VLCMediaPlayer.h:858
id< VLCMediaPlayerDelegate > delegate
Definition: VLCMediaPlayer.h:153
BOOL hasVideoOut
Definition: VLCMediaPlayer.h:333
Definition: VLCLibrary.h:41
NSArray * videoTrackNames
Definition: VLCMediaPlayer.h:379
VLCTime * time
Definition: VLCMediaPlayer.h:354
float hue
Definition: VLCMediaPlayer.h:290
NSArray * titleDescriptions
Definition: VLCMediaPlayer.h:553
float saturation
Definition: VLCMediaPlayer.h:296
NSArray * videoSubTitlesNames
Definition: VLCMediaPlayer.h:406
float yaw
Definition: VLCMediaPlayer.h:792
void longJumpForward()
int currentVideoTrackIndex
Definition: VLCMediaPlayer.h:373
NSString *const VLCTitleDescriptionName
Definition: VLCMediaPlayer.h:534
float roll
Definition: VLCMediaPlayer.h:806
int audioChannel
Definition: VLCMediaPlayer.h:597
NSString *const VLCTitleDescriptionDuration
Definition: VLCMediaPlayer.h:538
void extraShortJumpForward()
int currentAudioTrackIndex
Definition: VLCMediaPlayer.h:570
char * videoAspectRatio
Definition: VLCMediaPlayer.h:219
Definition: VLCMediaPlayer.h:144
VLCMediaPlayerState state
Definition: VLCMediaPlayer.h:833
CGSize videoSize
Definition: VLCMediaPlayer.h:325
Definition: VLCVideoLayer.h:30
float brightness
Definition: VLCMediaPlayer.h:284
CGFloat preAmplification
Definition: VLCMediaPlayer.h:637
float rate
Definition: VLCMediaPlayer.h:312
NSImage * lastSnapshot
Definition: VLCMediaPlayer.h:875
void mediumJumpBackward()
Definition: VLCMedia.h:112
NSArray * videoTrackIndexes
Definition: VLCMediaPlayer.h:385
NSArray * equalizerProfiles
Definition: VLCMediaPlayer.h:617
Definition: VLCAudio.h:36
float pitch
Definition: VLCMediaPlayer.h:799
NSArray * videoSubTitlesIndexes
Definition: VLCMediaPlayer.h:412
int indexOfLongestTitle
Definition: VLCMediaPlayer.h:559
BOOL equalizerEnabled
Definition: VLCMediaPlayer.h:630
NSInteger currentAudioPlaybackDelay
Definition: VLCMediaPlayer.h:605
float framesPerSecond __attribute__((deprecated))
BOOL canPause
Definition: VLCMediaPlayer.h:851
NSArray * audioTrackIndexes
Definition: VLCMediaPlayer.h:582
NSString *const VLCChapterDescriptionDuration
Definition: VLCMediaPlayer.h:495
NSString *const VLCChapterDescriptionTimeOffset
Definition: VLCMediaPlayer.h:491
BOOL willPlay
Definition: VLCMediaPlayer.h:827
BOOL seekable
Definition: VLCMediaPlayer.h:845
void longJumpBackward()
Definition: VLCTime.h:30
NSString *const VLCChapterDescriptionName
Definition: VLCMediaPlayer.h:487
void mediumJumpForward()
int numberOfVideoTracks
Definition: VLCMediaPlayer.h:391