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 extern NSString *const VLCMediaPlayerLoudnessChanged;
52 
56 typedef NS_ENUM(NSInteger, VLCMediaPlayerState)
57 {
58  VLCMediaPlayerStateStopped,
59  VLCMediaPlayerStateOpening,
60  VLCMediaPlayerStateBuffering,
61  VLCMediaPlayerStateEnded,
62  VLCMediaPlayerStateError,
63  VLCMediaPlayerStatePlaying,
64  VLCMediaPlayerStatePaused,
65  VLCMediaPlayerStateESAdded
66 };
67 
71 typedef NS_ENUM(unsigned, VLCMediaPlaybackNavigationAction)
72 {
73  VLCMediaPlaybackNavigationActionActivate = 0,
74  VLCMediaPlaybackNavigationActionUp,
75  VLCMediaPlaybackNavigationActionDown,
76  VLCMediaPlaybackNavigationActionLeft,
77  VLCMediaPlaybackNavigationActionRight
78 };
79 
83 typedef NS_ENUM(NSInteger, VLCDeinterlace)
84 {
85  VLCDeinterlaceAuto = -1,
86  VLCDeinterlaceOn = 1,
87  VLCDeinterlaceOff = 0
88 };
89 
93 @interface VLCMediaLoudness : NSObject
94 
99 @property (readonly) double loudnessValue;
100 
105 @property (readonly) int64_t date;
106 
107 @end
108 
114 extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
115 
120 @protocol VLCMediaPlayerDelegate <NSObject>
121 
122 @optional
128 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
129 
135 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
136 
143 - (void)mediaPlayerTitleChanged:(NSNotification *)aNotification;
144 
150 - (void)mediaPlayerChapterChanged:(NSNotification *)aNotification;
151 
157 - (void)mediaPlayerLoudnessChanged:(NSNotification *)aNotification;
158 
164 - (void)mediaPlayerSnapshot:(NSNotification *)aNotification;
165 
170 - (void)mediaPlayerStartedRecording:(VLCMediaPlayer *)player;
171 
177 - (void)mediaPlayer:(VLCMediaPlayer *)player recordingStoppedAtPath:(NSString *)path;
178 
179 @end
180 
181 
185 @interface VLCMediaPlayer : NSObject
186 
190 @property (nonatomic, readonly) VLCLibrary *libraryInstance;
194 @property (weak, nonatomic) id<VLCMediaPlayerDelegate> delegate;
195 
196 #if !TARGET_OS_IPHONE
197 /* Initializers */
203 - (instancetype)initWithVideoView:(VLCVideoView *)aVideoView;
209 - (instancetype)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
210 #endif
211 
216 - (instancetype)initWithOptions:(NSArray *)options;
223 - (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library;
224 
225 /* Video View Options */
226 // TODO: Should be it's own object?
227 
228 #pragma mark -
229 #pragma mark video functionality
230 
231 #if !TARGET_OS_IPHONE
232 
237 - (void)setVideoView:(VLCVideoView *)aVideoView;
243 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
244 #endif
245 
250 @property (strong) id drawable; /* The videoView or videoLayer */
251 
260 @property (NS_NONATOMIC_IOSONLY) char *videoAspectRatio;
261 
268 @property (NS_NONATOMIC_IOSONLY) char *videoCropGeometry;
269 
279 @property (nonatomic) float scaleFactor;
280 
291 - (void)saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height;
292 
298 - (void)setDeinterlaceFilter: (NSString *)name;
299 
306 - (void)setDeinterlace:(VLCDeinterlace)deinterlace withFilter:(NSString *)name;
307 
313 @property (nonatomic) BOOL adjustFilterEnabled;
319 @property (nonatomic) float contrast;
325 @property (nonatomic) float brightness;
331 @property (nonatomic) float hue;
337 @property (nonatomic) float saturation;
343 @property (nonatomic) float gamma;
344 
353 @property (nonatomic) float rate;
354 
359 @property (nonatomic, readonly, weak) VLCAudio * audio;
360 
361 /* Video Information */
366 @property (NS_NONATOMIC_IOSONLY, readonly) CGSize videoSize;
367 
374 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasVideoOut;
375 
381 @property (NS_NONATOMIC_IOSONLY, readonly) float framesPerSecond __attribute__((deprecated));
382 
383 #pragma mark -
384 #pragma mark time
385 
395 @property (NS_NONATOMIC_IOSONLY, strong) VLCTime *time;
396 
402 @property (nonatomic, readonly, weak) VLCTime *remainingTime;
403 
404 #pragma mark -
405 #pragma mark ES track handling
406 
414 @property (readwrite) int currentVideoTrackIndex;
415 
420 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackNames;
421 
426 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackIndexes;
427 
432 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfVideoTracks;
433 
441 @property (readwrite) int currentVideoSubTitleIndex;
442 
447 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesNames;
448 
453 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesIndexes;
454 
459 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfSubtitlesTracks;
460 
466 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path __attribute__((deprecated));
467 
471 typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
472 {
473  VLCMediaPlaybackSlaveTypeSubtitle = 0,
474  VLCMediaPlaybackSlaveTypeAudio
475 };
476 
485 - (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection;
486 
493 @property (readwrite) NSInteger currentVideoSubTitleDelay;
494 
504 @property (readwrite) int currentChapterIndex;
508 - (void)previousChapter;
512 - (void)nextChapter;
517 - (int)numberOfChaptersForTitle:(int)titleIndex;
518 
523 - (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
524 
528 extern NSString *const VLCChapterDescriptionName;
532 extern NSString *const VLCChapterDescriptionTimeOffset;
536 extern NSString *const VLCChapterDescriptionDuration;
537 
548 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex;
549 
554 @property (readwrite) int currentTitleIndex;
559 @property (readonly) int numberOfTitles;
560 
565 @property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
570 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
571 
575 extern NSString *const VLCTitleDescriptionName;
579 extern NSString *const VLCTitleDescriptionDuration;
583 extern NSString *const VLCTitleDescriptionIsMenu;
584 
594 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titleDescriptions;
595 
600 @property (readonly) int indexOfLongestTitle;
601 
602 /* Audio Options */
603 
611 @property (readwrite) int currentAudioTrackIndex;
612 
617 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackNames;
618 
623 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackIndexes;
624 
629 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfAudioTracks;
630 
631 #pragma mark -
632 #pragma mark audio functionality
633 
638 @property (NS_NONATOMIC_IOSONLY) int audioChannel;
639 
646 @property (readwrite) NSInteger currentAudioPlaybackDelay;
647 
651 @property (readonly) VLCMediaLoudness *momentaryLoudness;
652 
653 #pragma mark -
654 #pragma mark equalizer
655 
663 @property (weak, readonly) NSArray *equalizerProfiles;
664 
669 - (void)resetEqualizerFromProfile:(unsigned)profile;
670 
676 @property (readwrite) BOOL equalizerEnabled;
677 
683 @property (readwrite) CGFloat preAmplification;
684 
688 @property (readonly) unsigned numberOfBands;
689 
694 - (CGFloat)frequencyOfBandAtIndex:(unsigned)index;
695 
700 - (void)setAmplification:(CGFloat)amplification forBand:(unsigned)index;
701 
706 - (CGFloat)amplificationOfBand:(unsigned)index;
707 
708 #pragma mark -
709 #pragma mark media handling
710 
711 /* Media Options */
715 @property (NS_NONATOMIC_IOSONLY, strong) VLCMedia *media;
716 
717 #pragma mark -
718 #pragma mark playback operations
719 
724 - (void)play;
725 
729 - (void)pause;
730 
734 - (void)stop;
735 
739 - (void)gotoNextFrame;
740 
744 - (void)fastForward;
745 
750 - (void)fastForwardAtRate:(float)rate;
751 
755 - (void)rewind;
756 
761 - (void)rewindAtRate:(float)rate;
762 
767 - (void)jumpBackward:(int)interval;
768 
773 - (void)jumpForward:(int)interval;
774 
778 - (void)extraShortJumpBackward;
779 
783 - (void)extraShortJumpForward;
784 
788 - (void)shortJumpBackward;
789 
793 - (void)shortJumpForward;
794 
798 - (void)mediumJumpBackward;
799 
803 - (void)mediumJumpForward;
804 
808 - (void)longJumpBackward;
809 
813 - (void)longJumpForward;
814 
818 - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
819 
831 - (BOOL)updateViewpoint:(float)yaw pitch:(float)pitch roll:(float)roll fov:(float)fov absolute:(BOOL)absolute;
832 
838 @property (nonatomic) float yaw;
839 
845 @property (nonatomic) float pitch;
846 
852 @property (nonatomic) float roll;
853 
859 @property (nonatomic) float fov;
860 
861 #pragma mark -
862 #pragma mark playback information
863 
867 @property (NS_NONATOMIC_IOSONLY, getter=isPlaying, readonly) BOOL playing;
868 
873 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL willPlay;
874 
879 @property (NS_NONATOMIC_IOSONLY, readonly) VLCMediaPlayerState state;
880 
885 @property (NS_NONATOMIC_IOSONLY) float position;
886 
892 @property (NS_NONATOMIC_IOSONLY, getter=isSeekable, readonly) BOOL seekable;
893 
898 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL canPause;
899 
905 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *snapshots;
906 
907 #if TARGET_OS_IPHONE
908 
914 @property (NS_NONATOMIC_IOSONLY, readonly) UIImage *lastSnapshot;
915 #else
916 
922 @property (NS_NONATOMIC_IOSONLY, readonly) NSImage *lastSnapshot;
923 #endif
924 
930 - (BOOL)startRecordingAtPath:(NSString *)path;
931 
936 - (BOOL)stopRecording;
937 
938 #pragma mark -
939 #pragma mark Renderer
940 
949 - (BOOL)setRendererItem:(VLCRendererItem *)item;
950 
951 @end
VLCMediaPlayer::VLCChapterDescriptionName
NSString *const VLCChapterDescriptionName
Definition: VLCMediaPlayer.h:528
VLCMediaLoudness::date
int64_t date
Definition: VLCMediaPlayer.h:105
VLCMedia
Definition: VLCMedia.h:113
VLCMediaPlayer
Definition: VLCMediaPlayer.h:186
VLCMediaPlayerDelegate-p
Definition: VLCMediaPlayer.h:120
VLCRendererItem
Definition: VLCRendererItem.h:37
VLCMediaPlayer::VLCTitleDescriptionIsMenu
NSString *const VLCTitleDescriptionIsMenu
Definition: VLCMediaPlayer.h:583
VLCMediaPlayer::VLCTitleDescriptionName
NSString *const VLCTitleDescriptionName
Definition: VLCMediaPlayer.h:575
-[VLCMediaPlayer NS_ENUM]
typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
Definition: VLCMediaPlayer.h:471
VLCAudio
Definition: VLCAudio.h:37
VLCLibrary
Definition: VLCLibrary.h:47
VLCMediaPlayer::VLCChapterDescriptionDuration
NSString *const VLCChapterDescriptionDuration
Definition: VLCMediaPlayer.h:536
VLCMediaPlayer::VLCTitleDescriptionDuration
NSString *const VLCTitleDescriptionDuration
Definition: VLCMediaPlayer.h:579
VLCVideoLayer
Definition: VLCVideoLayer.h:31
-[VLCMediaPlayer __attribute__]
NSArray *titles __attribute__((deprecated))
VLCMediaLoudness::loudnessValue
double loudnessValue
Definition: VLCMediaPlayer.h:99
-[VLCMediaPlayer __attribute__]
float framesPerSecond __attribute__((deprecated))
VLCMediaLoudness
Definition: VLCMediaPlayer.h:94
-[VLCMediaPlayer __attribute__]
NSUInteger countOfTitles __attribute__((deprecated))
VLCMediaPlayer::VLCChapterDescriptionTimeOffset
NSString *const VLCChapterDescriptionTimeOffset
Definition: VLCMediaPlayer.h:532
VLCVideoView
Definition: VLCVideoView.h:32
VLCTime
Definition: VLCTime.h:31