VLCKit
VLCMediaPlayer.h
1 /*****************************************************************************
2  * VLCMediaPlayer.h: VLCKit.framework VLCMediaPlayer header
3  *****************************************************************************
4  * Copyright (C) 2007-2009 Pierre d'Herbemont
5  * Copyright (C) 2007-2022 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  * Maxime Chapelet <umxprime # videolabs.io>
13  *
14  * This program is free software; you can redistribute it and/or modify it
15  * under the terms of the GNU Lesser General Public License as published by
16  * the Free Software Foundation; either version 2.1 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with this program; if not, write to the Free Software Foundation,
26  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27  *****************************************************************************/
28 
29 #import <Foundation/Foundation.h>
30 #if TARGET_OS_IPHONE
31 # import <CoreGraphics/CoreGraphics.h>
32 # import <UIKit/UIKit.h>
33 #endif // TARGET_OS_IPHONE
34 
35 NS_ASSUME_NONNULL_BEGIN
36 
38 #if !TARGET_OS_IPHONE
40 #endif // !TARGET_OS_IPHONE
41 #if !TARGET_OS_TV
42 @class VLCRendererItem;
43 #endif // !TARGET_OS_TV
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 extern NSString *const VLCMediaPlayerLoudnessChanged;
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 
92 @interface VLCMediaLoudness : NSObject
93 
98 @property (readonly, atomic) double loudnessValue;
99 
104 @property (readonly, atomic) int64_t date;
105 
106 @end
107 
113 extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
114 
119 @protocol VLCMediaPlayerDelegate <NSObject>
120 
121 @optional
127 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
128 
134 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
135 
142 - (void)mediaPlayerTitleChanged:(NSNotification *)aNotification;
143 
149 - (void)mediaPlayerChapterChanged:(NSNotification *)aNotification;
150 
156 - (void)mediaPlayerLoudnessChanged:(NSNotification *)aNotification;
157 
163 - (void)mediaPlayerSnapshot:(NSNotification *)aNotification;
164 
169 - (void)mediaPlayerStartedRecording:(VLCMediaPlayer *)player;
170 
176 - (void)mediaPlayer:(VLCMediaPlayer *)player recordingStoppedAtPath:(NSString *)path;
177 
178 @end
179 
180 
184 @interface VLCMediaPlayer : NSObject
185 
189 @property (nonatomic, readonly) VLCLibrary *libraryInstance;
193 @property (weak, nonatomic, nullable) id<VLCMediaPlayerDelegate> delegate;
194 
195 #if !TARGET_OS_IPHONE
196 /* Initializers */
202 - (instancetype)initWithVideoView:(VLCVideoView *)aVideoView;
208 - (instancetype)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
209 #endif
210 
214 - (instancetype)initWithLibrary:(VLCLibrary *)library;
220 - (instancetype)initWithOptions:(NSArray *)options;
227 - (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library;
228 
229 /* Video View Options */
230 // TODO: Should be it's own object?
231 
232 #pragma mark -
233 #pragma mark video functionality
234 
235 #if !TARGET_OS_IPHONE
236 
241 - (void)setVideoView:(VLCVideoView *)aVideoView;
247 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
248 #endif
249 
254 @property (strong, nullable) id drawable; /* The videoView or videoLayer */
255 
264 @property (NS_NONATOMIC_IOSONLY, nullable) char *videoAspectRatio;
265 
272 @property (NS_NONATOMIC_IOSONLY, nullable) char *videoCropGeometry;
273 
283 @property (nonatomic) float scaleFactor;
284 
295 - (void)saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height;
296 
302 - (void)setDeinterlaceFilter: (nullable NSString *)name;
303 
310 - (void)setDeinterlace:(VLCDeinterlace)deinterlace withFilter:(NSString *)name;
311 
315 @property (nonatomic, readonly) VLCAdjustFilter *adjustFilter;
316 
322 @property (nonatomic) BOOL adjustFilterEnabled __deprecated_msg("Use -[VLCMediaPlayer adjustFilter].enabled instead");
328 @property (nonatomic) float contrast __deprecated_msg("Use -[VLCMediaPlayer adjustFilter].contrast instead");
334 @property (nonatomic) float brightness __deprecated_msg("Use -[VLCMediaPlayer adjustFilter].brightness instead");
340 @property (nonatomic) float hue __deprecated_msg("Use -[VLCMediaPlayer adjustFilter].hue instead");
346 @property (nonatomic) float saturation __deprecated_msg("Use -[VLCMediaPlayer adjustFilter].saturation instead");
352 @property (nonatomic) float gamma __deprecated_msg("Use -[VLCMediaPlayer adjustFilter].gamma instead");
353 
362 @property (nonatomic) float rate;
363 
368 @property (nonatomic, readonly, weak) VLCAudio * audio;
369 
370 /* Video Information */
375 @property (NS_NONATOMIC_IOSONLY, readonly) CGSize videoSize;
376 
383 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasVideoOut;
384 
390 @property (NS_NONATOMIC_IOSONLY, readonly) float framesPerSecond __attribute__((deprecated));
391 
392 #pragma mark -
393 #pragma mark time
394 
404 @property (NS_NONATOMIC_IOSONLY, strong) VLCTime *time;
405 
411 @property (nonatomic, readonly, weak) VLCTime *remainingTime;
412 
413 #pragma mark -
414 #pragma mark ES track handling
415 
423 @property (readwrite) int currentVideoTrackIndex;
424 
429 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackNames;
430 
435 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoTrackIndexes;
436 
441 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfVideoTracks;
442 
450 @property (readwrite) int currentVideoSubTitleIndex;
451 
456 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesNames;
457 
462 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *videoSubTitlesIndexes;
463 
468 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfSubtitlesTracks;
469 
475 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path __attribute__((deprecated));
476 
480 typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
481 {
482  VLCMediaPlaybackSlaveTypeSubtitle = 0,
483  VLCMediaPlaybackSlaveTypeAudio
484 };
485 
494 - (int)addPlaybackSlave:(NSURL *)slaveURL type:(VLCMediaPlaybackSlaveType)slaveType enforce:(BOOL)enforceSelection;
495 
502 @property (readwrite) NSInteger currentVideoSubTitleDelay;
503 
513 @property (readwrite) int currentChapterIndex;
517 - (void)previousChapter;
521 - (void)nextChapter;
526 - (int)numberOfChaptersForTitle:(int)titleIndex;
527 
532 - (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
533 
537 extern NSString *const VLCChapterDescriptionName;
541 extern NSString *const VLCChapterDescriptionTimeOffset;
545 extern NSString *const VLCChapterDescriptionDuration;
546 
557 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex;
558 
563 @property (readwrite) int currentTitleIndex;
568 @property (readonly) int numberOfTitles;
569 
574 @property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
579 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
580 
584 extern NSString *const VLCTitleDescriptionName;
588 extern NSString *const VLCTitleDescriptionDuration;
592 extern NSString *const VLCTitleDescriptionIsMenu;
593 
603 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titleDescriptions;
604 
609 @property (readonly) int indexOfLongestTitle;
610 
611 /* Audio Options */
612 
620 @property (readwrite) int currentAudioTrackIndex;
621 
626 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackNames;
627 
632 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *audioTrackIndexes;
633 
638 @property (NS_NONATOMIC_IOSONLY, readonly) int numberOfAudioTracks;
639 
640 #pragma mark -
641 #pragma mark audio functionality
642 
647 @property (NS_NONATOMIC_IOSONLY) int audioChannel;
648 
655 @property (readwrite) NSInteger currentAudioPlaybackDelay;
656 
660 @property (readonly, nullable) VLCMediaLoudness *momentaryLoudness;
661 
662 #pragma mark -
663 #pragma mark equalizer
664 
666 @property (nonatomic, nullable) VLCAudioEqualizer *equalizer;
667 
675 @property (weak, readonly) NSArray *equalizerProfiles DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
676 
681 - (void)resetEqualizerFromProfile:(unsigned)profile DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
682 
688 @property (readwrite) BOOL equalizerEnabled DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
689 
695 @property (readwrite) CGFloat preAmplification DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
696 
700 @property (readonly) unsigned numberOfBands DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
701 
706 - (CGFloat)frequencyOfBandAtIndex:(unsigned)index DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
707 
712 - (void)setAmplification:(CGFloat)amplification forBand:(unsigned)index DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
713 
718 - (CGFloat)amplificationOfBand:(unsigned)index DEPRECATED_MSG_ATTRIBUTE("Use -[VLCMediaPlayer equalizer] instead");
719 
720 #pragma mark -
721 #pragma mark media handling
722 
723 /* Media Options */
727 @property (NS_NONATOMIC_IOSONLY, strong, nullable) VLCMedia *media;
728 
729 #pragma mark -
730 #pragma mark playback operations
731 
736 - (void)play;
737 
741 - (void)pause;
742 
746 - (void)stop;
747 
751 - (void)gotoNextFrame;
752 
756 - (void)fastForward;
757 
762 - (void)fastForwardAtRate:(float)rate;
763 
767 - (void)rewind;
768 
773 - (void)rewindAtRate:(float)rate;
774 
779 - (void)jumpBackward:(int)interval;
780 
785 - (void)jumpForward:(int)interval;
786 
790 - (void)extraShortJumpBackward;
791 
795 - (void)extraShortJumpForward;
796 
800 - (void)shortJumpBackward;
801 
805 - (void)shortJumpForward;
806 
810 - (void)mediumJumpBackward;
811 
815 - (void)mediumJumpForward;
816 
820 - (void)longJumpBackward;
821 
825 - (void)longJumpForward;
826 
830 - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
831 
843 - (BOOL)updateViewpoint:(float)yaw pitch:(float)pitch roll:(float)roll fov:(float)fov absolute:(BOOL)absolute;
844 
850 @property (nonatomic) float yaw;
851 
857 @property (nonatomic) float pitch;
858 
864 @property (nonatomic) float roll;
865 
871 @property (nonatomic) float fov;
872 
873 #pragma mark -
874 #pragma mark playback information
875 
879 @property (NS_NONATOMIC_IOSONLY, getter=isPlaying, readonly) BOOL playing;
880 
885 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL willPlay;
886 
891 @property (NS_NONATOMIC_IOSONLY, readonly) VLCMediaPlayerState state;
892 
897 @property (NS_NONATOMIC_IOSONLY) float position;
898 
904 @property (NS_NONATOMIC_IOSONLY, getter=isSeekable, readonly) BOOL seekable;
905 
910 @property (NS_NONATOMIC_IOSONLY, readonly) BOOL canPause;
911 
917 @property (NS_NONATOMIC_IOSONLY, readonly, copy, nullable) NSArray *snapshots;
918 
919 #if TARGET_OS_IPHONE
920 
926 @property (NS_NONATOMIC_IOSONLY, readonly, nullable) UIImage *lastSnapshot;
927 #else
928 
934 @property (NS_NONATOMIC_IOSONLY, readonly, nullable) NSImage *lastSnapshot;
935 #endif
936 
942 - (BOOL)startRecordingAtPath:(NSString *)path;
943 
948 - (BOOL)stopRecording;
949 
950 #pragma mark -
951 #pragma mark Renderer
952 #if !TARGET_OS_TV
953 
961 - (BOOL)setRendererItem:(nullable VLCRendererItem *)item;
962 #endif // !TARGET_OS_TV
963 @end
964 NS_ASSUME_NONNULL_END
VLCMediaPlayer::VLCChapterDescriptionName
NSString *const VLCChapterDescriptionName
Definition: VLCMediaPlayer.h:537
VLCMediaLoudness::date
int64_t date
Definition: VLCMediaPlayer.h:104
VLCMedia
Definition: VLCMedia.h:112
VLCMediaPlayer
Definition: VLCMediaPlayer.h:184
VLCMediaPlayerDelegate-p
Definition: VLCMediaPlayer.h:119
VLCAudioEqualizer
VLCAudioEqualizer.
Definition: VLCAudioEqualizer.h:68
VLCRendererItem
Definition: VLCRendererItem.h:36
VLCMediaPlayer::VLCTitleDescriptionIsMenu
NSString *const VLCTitleDescriptionIsMenu
Definition: VLCMediaPlayer.h:592
VLCMediaPlayer::VLCTitleDescriptionName
NSString *const VLCTitleDescriptionName
Definition: VLCMediaPlayer.h:584
-[VLCMediaPlayer NS_ENUM]
typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
Definition: VLCMediaPlayer.h:480
VLCAdjustFilter
Definition: VLCAdjustFilter.h:43
VLCAudio
Definition: VLCAudio.h:38
VLCLibrary
Definition: VLCLibrary.h:44
VLCMediaPlayer::VLCChapterDescriptionDuration
NSString *const VLCChapterDescriptionDuration
Definition: VLCMediaPlayer.h:545
VLCMediaPlayer::VLCTitleDescriptionDuration
NSString *const VLCTitleDescriptionDuration
Definition: VLCMediaPlayer.h:588
VLCVideoLayer
Definition: VLCVideoLayer.h:32
VLCMediaLoudness::loudnessValue
double loudnessValue
Definition: VLCMediaPlayer.h:98
VLCMediaLoudness
Definition: VLCMediaPlayer.h:92
VLCMediaPlayer::VLCChapterDescriptionTimeOffset
NSString *const VLCChapterDescriptionTimeOffset
Definition: VLCMediaPlayer.h:541
VLCVideoView
Definition: VLCVideoView.h:33
VLCTime
Definition: VLCTime.h:32