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