]> git.sesse.net Git - vlc/blob - projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
e95124c4fd9cacf06359308864adba0f53708102
[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 - (void)setVideoSubTitles:(int)value;
109 - (int)videoSubTitles;
110
111 - (void)setVideoCropGeometry:(char *)value;
112 - (char *)videoCropGeometry;
113
114 - (void)setVideoTeleText:(int)value;
115 - (int)videoTeleText;
116
117 /**
118  * Take a snapshot of the current video.
119  *
120  * If width AND height is 0, original size is used.
121  * If width OR height is 0, original aspect-ratio is preserved.
122  *
123  * \param path the path where to save the screenshot to
124  * \param width the snapshot's width
125  * \param height the snapshot's height
126  */
127 - (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height;
128
129 /**
130  * Enable or disable deinterlace filter
131  *
132  * \param name of deinterlace filter to use (availability depends on underlying VLC version)
133  * \param enable boolean to enable or disable deinterlace filter
134  */
135 - (void)setDeinterlaceFilter: (NSString *)name enabled: (BOOL)enabled;
136
137 @property float rate;
138
139 @property (readonly) VLCAudio * audio;
140
141 /* Video Information */
142 - (NSSize)videoSize;
143 - (BOOL)hasVideoOut;
144 - (float)framesPerSecond;
145
146 /**
147  * Sets the current position (or time) of the feed.
148  * \param value New time to set the current position to.  If time is [VLCTime nullTime], 0 is assumed.
149  */
150 - (void)setTime:(VLCTime *)value;
151
152 /** 
153  * Returns the current position (or time) of the feed.
154  * \return VLCTIme object with current time.
155  */
156 - (VLCTime *)time;
157
158 @property (readonly) VLCTime *remainingTime;
159 @property (readonly) int fps;
160
161 - (void)setChapter:(int)value;
162 - (int)chapter;
163 - (int)countOfChapters;
164
165 - (void)setTitle:(int)value;
166 - (int)title;
167 - (int)countOfTitles;
168
169 /* Audio Options */
170 - (void)setAudioTrack:(int)value;
171 - (int)audioTrack;
172 - (int)countOfAudioTracks;
173
174 - (void)setAudioChannel:(int)value;
175 - (int)audioChannel;
176
177 /* Media Options */
178 - (void)setMedia:(VLCMedia *)value;
179 - (VLCMedia *)media;
180
181 /* Playback Operations */
182 /**
183  * Plays a media resource using the currently selected media controller (or 
184  * default controller.  If feed was paused then the feed resumes at the position 
185  * it was paused in.
186  * \return A Boolean determining whether the stream was played or not.
187  */
188 - (BOOL)play;
189
190 /**
191  * Toggle's the pause state of the feed.
192  */
193 - (void)pause;
194
195 /**
196  * Stop the playing.
197  */
198 - (void)stop;
199
200 /**
201  * Fast forwards through the feed at the standard 1x rate.
202  */
203 - (void)fastForward;
204
205 /**
206  * Fast forwards through the feed at the rate specified.
207  * \param rate Rate at which the feed should be fast forwarded.
208  */
209 - (void)fastForwardAtRate:(float)rate;
210
211 /**
212  * Rewinds through the feed at the standard 1x rate.
213  */
214 - (void)rewind;
215
216 /**
217  * Rewinds through the feed at the rate specified.
218  * \param rate Rate at which the feed should be fast rewound.
219  */
220 - (void)rewindAtRate:(float)rate;
221
222 /**
223  * Jumps shortly backward in current stream if seeking is supported.
224  * \param interval to skip, in sec.
225  */
226 - (void)jumpBackward:(NSInteger)interval;
227
228 /**
229  * Jumps shortly forward in current stream if seeking is supported.
230  * \param interval to skip, in sec.
231  */
232 - (void)jumpForward:(NSInteger)interval;
233
234 /**
235  * Jumps shortly backward in current stream if seeking is supported.
236  */
237 - (void)extraShortJumpBackward;
238
239 /**
240  * Jumps shortly forward in current stream if seeking is supported.
241  */
242 - (void)extraShortJumpForward;
243
244 /**
245  * Jumps shortly backward in current stream if seeking is supported.
246  */
247 - (void)shortJumpBackward;
248
249 /**
250  * Jumps shortly forward in current stream if seeking is supported.
251  */
252 - (void)shortJumpForward;
253
254 /**
255  * Jumps shortly backward in current stream if seeking is supported.
256  */
257 - (void)mediumJumpBackward;
258
259 /**
260  * Jumps shortly forward in current stream if seeking is supported.
261  */
262 - (void)mediumJumpForward;
263
264 /**
265  * Jumps shortly backward in current stream if seeking is supported.
266  */
267 - (void)longJumpBackward;
268
269 /**
270  * Jumps shortly forward in current stream if seeking is supported.
271  */
272 - (void)longJumpForward;
273
274 /* Playback Information */
275 /**
276  * Playback state flag identifying that the stream is currently playing.
277  * \return TRUE if the feed is playing, FALSE if otherwise.
278  */
279 - (BOOL)isPlaying;
280
281 /**
282  * Playback state flag identifying wheather the stream will play.
283  * \return TRUE if the feed is ready for playback, FALSE if otherwise.
284  */
285 - (BOOL)willPlay;
286
287 /**
288  * Playback's current state.
289  * \see VLCMediaState
290  */
291 - (VLCMediaPlayerState)state;
292
293 /**
294  * Returns the receiver's position in the reading. 
295  * \return A number between 0 and 1. indicating the position
296  */
297 - (float)position;
298 - (void)setPosition:(float)newPosition;
299
300 - (BOOL)isSeekable;
301
302 - (BOOL)canPause;
303
304 @end