]> git.sesse.net Git - vlc/blob - projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
macosx/framework: improve comments in VLCMediaPlayer.h.
[vlc] / projects / macosx / framework / Headers / Public / VLCMediaPlayer.h
1 /*****************************************************************************
2  * VLCMediaPlayer.h: VLCKit.framework VLCMediaPlayer header
3  *****************************************************************************
4  * Copyright (C) 2007-2009 Pierre d'Herbemont
5  * Copyright (C) 2007-2009 the VideoLAN team
6  * Partial Copyright (C) 2009 Felix Paul Kühne
7  * $Id$
8  *
9  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
10  *          Felix Paul Kühne <fkuehne # videolan.org>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 #import "VLCMedia.h"
28 #import "VLCVideoView.h"
29 #import "VLCVideoLayer.h"
30 #import "VLCTime.h"
31 #import "VLCAudio.h"
32
33 /* Notification Messages */
34 extern NSString * VLCMediaPlayerTimeChanged;
35 extern NSString * VLCMediaPlayerStateChanged;
36
37 /**
38  * VLCMediaPlayerState describes the state of the media player.
39  */
40 typedef enum VLCMediaPlayerState
41 {
42     VLCMediaPlayerStateStopped,        //< Player has stopped
43     VLCMediaPlayerStateOpening,        //< Stream is opening
44     VLCMediaPlayerStateBuffering,      //< Stream is buffering
45     VLCMediaPlayerStateEnded,          //< Stream has ended
46     VLCMediaPlayerStateError,          //< Player has generated an error
47     VLCMediaPlayerStatePlaying,        //< Stream is playing
48     VLCMediaPlayerStatePaused          //< Stream is paused
49 } VLCMediaPlayerState;
50
51 /**
52  * Returns the name of the player state as a string.
53  * \param state The player state.
54  * \return A string containing the name of state. If state is not a valid state, returns nil.
55  */
56 extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
57
58 /**
59  * Formal protocol declaration for playback delegates.  Allows playback messages
60  * to be trapped by delegated objects.
61  */
62 @protocol VLCMediaPlayerDelegate
63 /**
64  * Sent by the default notification center whenever the player's time has changed.
65  * \details Discussion The value of aNotification is always an VLCMediaPlayerTimeChanged notification. You can retrieve 
66  * the VLCMediaPlayer object in question by sending object to aNotification.
67  */
68 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
69
70 /**
71  * Sent by the default notification center whenever the player's state has changed.
72  * \details Discussion The value of aNotification is always an VLCMediaPlayerStateChanged notification. You can retrieve 
73  * the VLCMediaPlayer object in question by sending object to aNotification.
74  */
75 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
76 @end
77
78 // TODO: Should we use medialist_player or our own flavor of media player?
79 @interface VLCMediaPlayer : NSObject 
80 {
81     id delegate;                        //< Object delegate
82     void * instance;                    //  Internal
83     VLCMedia * media;                   //< Current media being played
84     VLCTime * cachedTime;               //< Cached time of the media being played
85     VLCMediaPlayerState cachedState;    //< Cached state of the media being played
86     float position;                     //< The position of the media being played
87     id drawable;                        //< The drawable associated to this media player
88 }
89
90 /* Initializers */
91 - (id)initWithVideoView:(VLCVideoView *)aVideoView;
92 - (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
93
94 /* Properties */
95 - (void)setDelegate:(id)value;
96 - (id)delegate;
97
98 /* Video View Options */
99 // TODO: Should be it's own object?
100
101 - (void)setVideoView:(VLCVideoView *)aVideoView;
102 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
103
104 @property (retain) id drawable; /* The videoView or videoLayer */
105
106 - (void)setVideoAspectRatio:(char *)value;
107 - (char *)videoAspectRatio;
108
109 - (void)setVideoCropGeometry:(char *)value;
110 - (char *)videoCropGeometry;
111
112 - (void)setVideoTeleText:(int)value;
113 - (int)videoTeleText;
114
115 /**
116  * Take a snapshot of the current video.
117  *
118  * If width AND height is 0, original size is used.
119  * If width OR height is 0, original aspect-ratio is preserved.
120  *
121  * \param path the path where to save the screenshot to
122  * \param width the snapshot's width
123  * \param height the snapshot's height
124  */
125 - (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height;
126
127 /**
128  * Enable or disable deinterlace filter
129  *
130  * \param name of deinterlace filter to use (availability depends on underlying VLC version)
131  * \param enable boolean to enable or disable deinterlace filter
132  */
133 - (void)setDeinterlaceFilter: (NSString *)name enabled: (BOOL)enabled;
134
135 @property float rate;
136
137 @property (readonly) VLCAudio * audio;
138
139 /* Video Information */
140 - (NSSize)videoSize;
141 - (BOOL)hasVideoOut;
142 - (float)framesPerSecond;
143
144 /**
145  * Sets the current position (or time) of the feed.
146  * \param value New time to set the current position to.  If time is [VLCTime nullTime], 0 is assumed.
147  */
148 - (void)setTime:(VLCTime *)value;
149
150 /** 
151  * Returns the current position (or time) of the feed.
152  * \return VLCTIme object with current time.
153  */
154 - (VLCTime *)time;
155
156 @property (readonly) VLCTime *remainingTime;
157 @property (readonly) int fps;
158
159 /**
160  * Return the current video subtitle index
161  * \return 0 if none is set.
162  *
163  * Pass 0 to disable.
164  */
165 @property (readwrite) NSUInteger currentVideoSubTitleIndex;
166
167 /**
168  * Return the video subtitle tracks
169  *
170  * It includes the disabled fake track at index 0.
171  */
172 - (NSArray *)videoSubTitles;
173
174 /**
175  * Load and set a specific video subtitle, from a file.
176  * \param path to a file
177  * \return if the call succeed..
178  */
179 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path;
180
181 /**
182  * Chapter selection and enumeration, it is bound
183  * to a title option.
184  */
185
186 /**
187  * Return the current video subtitle index, or
188  * \return NSNotFound if none is set.
189  *
190  * To disable subtitle pass NSNotFound.
191  */
192 @property (readwrite) NSUInteger currentChapterIndex;
193 - (void)previousChapter;
194 - (void)nextChapter;
195 - (NSArray *)chaptersForTitleIndex:(NSUInteger)titleIndex;
196
197 /**
198  * Title selection and enumeration
199  * \return NSNotFound if none is set.
200  */
201 @property (readwrite) NSUInteger currentTitleIndex;
202 - (NSArray *)titles;
203
204 /* Audio Options */
205
206 /**
207  * Return the current audio track index
208  * \return 0 if none is set.
209  *
210  * Pass 0 to disable.
211  */
212 @property (readwrite) NSUInteger currentAudioTrackIndex;
213
214 /**
215  * Return the audio tracks
216  *
217  * It includes the "Disable" fake track at index 0.
218  */
219 - (NSArray *)audioTracks;
220
221 - (void)setAudioChannel:(int)value;
222 - (int)audioChannel;
223
224 /* Media Options */
225 - (void)setMedia:(VLCMedia *)value;
226 - (VLCMedia *)media;
227
228 /* Playback Operations */
229 /**
230  * Plays a media resource using the currently selected media controller (or 
231  * default controller.  If feed was paused then the feed resumes at the position 
232  * it was paused in.
233  * \return A Boolean determining whether the stream was played or not.
234  */
235 - (BOOL)play;
236
237 /**
238  * Toggle's the pause state of the feed.
239  */
240 - (void)pause;
241
242 /**
243  * Stop the playing.
244  */
245 - (void)stop;
246
247 /**
248  * Fast forwards through the feed at the standard 1x rate.
249  */
250 - (void)fastForward;
251
252 /**
253  * Fast forwards through the feed at the rate specified.
254  * \param rate Rate at which the feed should be fast forwarded.
255  */
256 - (void)fastForwardAtRate:(float)rate;
257
258 /**
259  * Rewinds through the feed at the standard 1x rate.
260  */
261 - (void)rewind;
262
263 /**
264  * Rewinds through the feed at the rate specified.
265  * \param rate Rate at which the feed should be fast rewound.
266  */
267 - (void)rewindAtRate:(float)rate;
268
269 /**
270  * Jumps shortly backward in current stream if seeking is supported.
271  * \param interval to skip, in sec.
272  */
273 - (void)jumpBackward:(NSInteger)interval;
274
275 /**
276  * Jumps shortly forward in current stream if seeking is supported.
277  * \param interval to skip, in sec.
278  */
279 - (void)jumpForward:(NSInteger)interval;
280
281 /**
282  * Jumps shortly backward in current stream if seeking is supported.
283  */
284 - (void)extraShortJumpBackward;
285
286 /**
287  * Jumps shortly forward in current stream if seeking is supported.
288  */
289 - (void)extraShortJumpForward;
290
291 /**
292  * Jumps shortly backward in current stream if seeking is supported.
293  */
294 - (void)shortJumpBackward;
295
296 /**
297  * Jumps shortly forward in current stream if seeking is supported.
298  */
299 - (void)shortJumpForward;
300
301 /**
302  * Jumps shortly backward in current stream if seeking is supported.
303  */
304 - (void)mediumJumpBackward;
305
306 /**
307  * Jumps shortly forward in current stream if seeking is supported.
308  */
309 - (void)mediumJumpForward;
310
311 /**
312  * Jumps shortly backward in current stream if seeking is supported.
313  */
314 - (void)longJumpBackward;
315
316 /**
317  * Jumps shortly forward in current stream if seeking is supported.
318  */
319 - (void)longJumpForward;
320
321 /* Playback Information */
322 /**
323  * Playback state flag identifying that the stream is currently playing.
324  * \return TRUE if the feed is playing, FALSE if otherwise.
325  */
326 - (BOOL)isPlaying;
327
328 /**
329  * Playback state flag identifying wheather the stream will play.
330  * \return TRUE if the feed is ready for playback, FALSE if otherwise.
331  */
332 - (BOOL)willPlay;
333
334 /**
335  * Playback's current state.
336  * \see VLCMediaState
337  */
338 - (VLCMediaPlayerState)state;
339
340 /**
341  * Returns the receiver's position in the reading. 
342  * \return A number between 0 and 1. indicating the position
343  */
344 - (float)position;
345 - (void)setPosition:(float)newPosition;
346
347 - (BOOL)isSeekable;
348
349 - (BOOL)canPause;
350
351 @end