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 
44 /* Notification Messages */
45 extern NSString *const VLCMediaPlayerTimeChanged;
46 extern NSString *const VLCMediaPlayerStateChanged;
47 extern NSString *const VLCMediaPlayerTitleChanged;
48 extern NSString *const VLCMediaPlayerChapterChanged;
49 
53 typedef NS_ENUM(NSInteger, VLCMediaPlayerState)
54 {
55  VLCMediaPlayerStateStopped,
56  VLCMediaPlayerStateOpening,
57  VLCMediaPlayerStateBuffering,
58  VLCMediaPlayerStateEnded,
59  VLCMediaPlayerStateError,
60  VLCMediaPlayerStatePlaying,
61  VLCMediaPlayerStatePaused
62 };
63 
67 typedef NS_ENUM(unsigned, VLCMediaPlaybackNavigationAction)
68 {
69  VLCMediaPlaybackNavigationActionActivate = 0,
70  VLCMediaPlaybackNavigationActionUp,
71  VLCMediaPlaybackNavigationActionDown,
72  VLCMediaPlaybackNavigationActionLeft,
73  VLCMediaPlaybackNavigationActionRight
74 };
75 
81 extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
82 
88 
89 @optional
95 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
96 
102 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
103 
110 - (void)mediaPlayerTitleChanged:(NSNotification *)aNotification;
111 
117 - (void)mediaPlayerChapterChanged:(NSNotification *)aNotification;
118 
119 #if TARGET_OS_PHONE
120 
125 - (void)mediaPlayerSnapshot:(NSNotification *)aNotification;
126 #endif
127 
128 @end
129 
130 
134 @interface VLCMediaPlayer : NSObject
135 
139 @property (nonatomic, readonly) VLCLibrary *libraryInstance;
143 @property (weak, nonatomic) id<VLCMediaPlayerDelegate> delegate;
144 
145 #if !TARGET_OS_IPHONE
146 /* Initializers */
152 - (instancetype)initWithVideoView:(VLCVideoView *)aVideoView;
158 - (instancetype)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
159 #endif
160 
165 - (instancetype)initWithOptions:(NSArray *)options;
172 - (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library;
173 
174 /* Video View Options */
175 // TODO: Should be it's own object?
176 
177 #pragma mark -
178 #pragma mark video functionality
179 
180 #if !TARGET_OS_IPHONE
181 
186 - (void)setVideoView:(VLCVideoView *)aVideoView;
192 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
193 #endif
194 
199 @property (strong) id drawable; /* The videoView or videoLayer */
200 
209 @property (NS_NONATOMIC_IOSONLY) char *videoAspectRatio;
210 
217 @property (NS_NONATOMIC_IOSONLY) char *videoCropGeometry;
218 
228 @property (nonatomic) float scaleFactor;
229 
240 - (void)saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height;
241 
247 - (void)setDeinterlaceFilter: (NSString *)name;
248 
254 @property (nonatomic) BOOL adjustFilterEnabled;
260 @property (nonatomic) float contrast;
266 @property (nonatomic) float brightness;
272 @property (nonatomic) float hue;
278 @property (nonatomic) float saturation;
284 @property (nonatomic) float gamma;
285 
294 @property (nonatomic) float rate;
295 
300 @property (nonatomic, readonly, weak) VLCAudio * audio;
301 
302 /* Video Information */
307 @property (NS_NONATOMIC_IOSONLY, readonly) CGSize videoSize;
308 
315 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasVideoOut;
316 
322 @property (NS_NONATOMIC_IOSONLY, readonly) float framesPerSecond __attribute__((deprecated));
323 
324 #pragma mark -
325 #pragma mark time
326 
336 @property (NS_NONATOMIC_IOSONLY, strong) VLCTime *time;
337 
343 @property (nonatomic, readonly, weak) VLCTime *remainingTime;
344 
345 #pragma mark -
346 #pragma mark ES track handling
347 
355 @property (readwrite) int currentVideoTrackIndex;
356 
361 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackNames;
362 
367 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackIndexes;
368 
373 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfVideoTracks;
374 
382 @property (readwrite) int currentVideoSubTitleIndex;
383 
388 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesNames;
389 
394 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesIndexes;
395 
400 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfSubtitlesTracks;
401 
407 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path __attribute__((deprecated));
408 
412 typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
413 {
414  VLCMediaPlaybackSlaveTypeSubtitle = 0,
415  VLCMediaPlaybackSlaveTypeAudio
416 };
417 
426 - (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection;
427 
434 @property (readwrite) NSInteger currentVideoSubTitleDelay;
435 
445 @property (readwrite) int currentChapterIndex;
449 - (void)previousChapter;
453 - (void)nextChapter;
458 - (int)numberOfChaptersForTitle:(int)titleIndex;
459 
464 - (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
465 
469 extern NSString *const VLCChapterDescriptionName;
473 extern NSString *const VLCChapterDescriptionTimeOffset;
477 extern NSString *const VLCChapterDescriptionDuration;
478 
489 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex;
490 
495 @property (readwrite) int currentTitleIndex;
500 @property (readonly) int numberOfTitles;
501 
506 @property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
511 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
512 
516 extern NSString *const VLCTitleDescriptionName;
520 extern NSString *const VLCTitleDescriptionDuration;
524 extern NSString *const VLCTitleDescriptionIsMenu;
525 
535 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titleDescriptions;
536 
541 @property (readonly) int indexOfLongestTitle;
542 
543 /* Audio Options */
544 
552 @property (readwrite) int currentAudioTrackIndex;
553 
558 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackNames;
559 
564 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackIndexes;
565 
570 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfAudioTracks;
571 
572 #pragma mark -
573 #pragma mark audio functionality
574 
579 @property (NS_NONATOMIC_IOSONLY) int audioChannel;
580 
587 @property (readwrite) NSInteger currentAudioPlaybackDelay;
588 
589 #pragma mark -
590 #pragma mark equalizer
591 
599 @property (weak, readonly) NSArray *equalizerProfiles;
600 
605 - (void)resetEqualizerFromProfile:(unsigned)profile;
606 
611 @property (readwrite) BOOL equalizerEnabled;
612 
618 @property (readwrite) CGFloat preAmplification;
619 
623 @property (readonly) unsigned numberOfBands;
624 
629 - (CGFloat)frequencyOfBandAtIndex:(unsigned)index;
630 
635 - (void)setAmplification:(CGFloat)amplification forBand:(unsigned)index;
636 
641 - (CGFloat)amplificationOfBand:(unsigned)index;
642 
643 #pragma mark -
644 #pragma mark media handling
645 
646 /* Media Options */
650 @property (NS_NONATOMIC_IOSONLY, strong) VLCMedia *media;
651 
652 #pragma mark -
653 #pragma mark playback operations
654 
659 - (void)play;
660 
664 - (void)pause;
665 
669 - (void)stop;
670 
674 - (void)gotoNextFrame;
675 
679 - (void)fastForward;
680 
685 - (void)fastForwardAtRate:(float)rate;
686 
690 - (void)rewind;
691 
696 - (void)rewindAtRate:(float)rate;
697 
702 - (void)jumpBackward:(int)interval;
703 
708 - (void)jumpForward:(int)interval;
709 
713 - (void)extraShortJumpBackward;
714 
718 - (void)extraShortJumpForward;
719 
723 - (void)shortJumpBackward;
724 
728 - (void)shortJumpForward;
729 
733 - (void)mediumJumpBackward;
734 
738 - (void)mediumJumpForward;
739 
743 - (void)longJumpBackward;
744 
748 - (void)longJumpForward;
749 
753 - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
754 
765 - (BOOL)updateViewpoint:(CGFloat)yaw pitch:(CGFloat)pitch roll:(CGFloat)roll fov:(CGFloat)fov absolute:(BOOL)absolute;
766 
767 #pragma mark -
768 #pragma mark playback information
769 
773 @property (NS_NONATOMIC_IOSONLY, getter=isPlaying, readonly) BOOL playing;
774 
779 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL willPlay;
780 
785 @property (NS_NONATOMIC_IOSONLY, readonly) VLCMediaPlayerState state;
786 
791 @property (NS_NONATOMIC_IOSONLY) float position;
792 
797 @property (NS_NONATOMIC_IOSONLY, getter=isSeekable, readonly) BOOL seekable;
798 
803 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL canPause;
804 
805 #if TARGET_OS_IPHONE
806 
811 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *snapshots;
812 
819 @property (NS_NONATOMIC_IOSONLY, readonly) UIImage *lastSnapshot;
820 #endif
821 
822 @end
float position
Definition: VLCMediaPlayer.h:791
float contrast
Definition: VLCMediaPlayer.h:260
VLCMedia * media
Definition: VLCMediaPlayer.h:650
Definition: VLCVideoView.h:31
void shortJumpForward()
void shortJumpBackward()
char * videoCropGeometry
Definition: VLCMediaPlayer.h:217
int currentVideoSubTitleIndex
Definition: VLCMediaPlayer.h:382
unsigned numberOfBands
Definition: VLCMediaPlayer.h:623
VLCAudio * audio
Definition: VLCMediaPlayer.h:300
int numberOfSubtitlesTracks
Definition: VLCMediaPlayer.h:400
BOOL playing
Definition: VLCMediaPlayer.h:773
VLCTime * remainingTime
Definition: VLCMediaPlayer.h:343
int numberOfAudioTracks
Definition: VLCMediaPlayer.h:570
BOOL adjustFilterEnabled
Definition: VLCMediaPlayer.h:254
int currentChapterIndex
Definition: VLCMediaPlayer.h:445
Definition: VLCMediaPlayer.h:87
int numberOfTitles
Definition: VLCMediaPlayer.h:500
void extraShortJumpBackward()
void previousChapter()
VLCLibrary * libraryInstance
Definition: VLCMediaPlayer.h:139
float gamma
Definition: VLCMediaPlayer.h:284
typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
Definition: VLCMediaPlayer.h:412
NSArray * audioTrackNames
Definition: VLCMediaPlayer.h:558
float scaleFactor
Definition: VLCMediaPlayer.h:228
NSString *const VLCTitleDescriptionIsMenu
Definition: VLCMediaPlayer.h:524
NSInteger currentVideoSubTitleDelay
Definition: VLCMediaPlayer.h:434
int currentTitleIndex
Definition: VLCMediaPlayer.h:495
id drawable
Definition: VLCMediaPlayer.h:199
id< VLCMediaPlayerDelegate > delegate
Definition: VLCMediaPlayer.h:143
BOOL hasVideoOut
Definition: VLCMediaPlayer.h:315
Definition: VLCLibrary.h:41
NSArray * videoTrackNames
Definition: VLCMediaPlayer.h:361
VLCTime * time
Definition: VLCMediaPlayer.h:336
float hue
Definition: VLCMediaPlayer.h:272
NSArray * titleDescriptions
Definition: VLCMediaPlayer.h:535
float saturation
Definition: VLCMediaPlayer.h:278
NSArray * videoSubTitlesNames
Definition: VLCMediaPlayer.h:388
void longJumpForward()
int currentVideoTrackIndex
Definition: VLCMediaPlayer.h:355
NSString *const VLCTitleDescriptionName
Definition: VLCMediaPlayer.h:516
int audioChannel
Definition: VLCMediaPlayer.h:579
NSString *const VLCTitleDescriptionDuration
Definition: VLCMediaPlayer.h:520
void extraShortJumpForward()
int currentAudioTrackIndex
Definition: VLCMediaPlayer.h:552
char * videoAspectRatio
Definition: VLCMediaPlayer.h:209
Definition: VLCMediaPlayer.h:134
VLCMediaPlayerState state
Definition: VLCMediaPlayer.h:785
CGSize videoSize
Definition: VLCMediaPlayer.h:307
Definition: VLCVideoLayer.h:30
float brightness
Definition: VLCMediaPlayer.h:266
CGFloat preAmplification
Definition: VLCMediaPlayer.h:618
float rate
Definition: VLCMediaPlayer.h:294
void mediumJumpBackward()
Definition: VLCMedia.h:112
NSArray * videoTrackIndexes
Definition: VLCMediaPlayer.h:367
NSArray * equalizerProfiles
Definition: VLCMediaPlayer.h:599
Definition: VLCAudio.h:36
NSArray * videoSubTitlesIndexes
Definition: VLCMediaPlayer.h:394
int indexOfLongestTitle
Definition: VLCMediaPlayer.h:541
BOOL equalizerEnabled
Definition: VLCMediaPlayer.h:611
NSInteger currentAudioPlaybackDelay
Definition: VLCMediaPlayer.h:587
float framesPerSecond __attribute__((deprecated))
BOOL canPause
Definition: VLCMediaPlayer.h:803
NSArray * audioTrackIndexes
Definition: VLCMediaPlayer.h:564
NSString *const VLCChapterDescriptionDuration
Definition: VLCMediaPlayer.h:477
NSString *const VLCChapterDescriptionTimeOffset
Definition: VLCMediaPlayer.h:473
BOOL willPlay
Definition: VLCMediaPlayer.h:779
BOOL seekable
Definition: VLCMediaPlayer.h:797
void longJumpBackward()
Definition: VLCTime.h:30
NSString *const VLCChapterDescriptionName
Definition: VLCMediaPlayer.h:469
void mediumJumpForward()
int numberOfVideoTracks
Definition: VLCMediaPlayer.h:373