1 /*****************************************************************************
2 * VLCMediaPlayer.h: VLC.framework VLCMediaPlayer header
3 *****************************************************************************
4 * Copyright (C) 2007 Pierre d'Herbemont
5 * Copyright (C) 2007 the VideoLAN team
8 * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
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.
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.
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 *****************************************************************************/
25 #import <Cocoa/Cocoa.h>
28 /* Notification Messages */
29 extern NSString * VLCMediaPlayerTimeChanged;
30 extern NSString * VLCMediaPlayerStateChanged;
32 // TODO: Documentation
33 typedef enum VLCMediaPlayerState
35 VLCMediaPlayerStateStopped, //< Player has stopped
36 VLCMediaPlayerStateOpening, //< Stream is opening
37 VLCMediaPlayerStateBuffering, //< Stream is buffering
38 VLCMediaPlayerStateEnded, //< Stream has ended
39 VLCMediaPlayerStateError, //< Player has generated an error
40 VLCMediaPlayerStatePlaying, //< Stream is playing
41 VLCMediaPlayerStatePaused //< Stream is paused
42 } VLCMediaPlayerState;
44 extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
47 * Formal protocol declaration for playback delegates. Allows playback messages
48 * to be trapped by delegated objects.
50 @protocol VLCMediaPlayerDelegate
51 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
52 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
55 // TODO: Should we use medialist_player or our own flavor of media player?
56 @interface VLCMediaPlayer : NSObject
58 id delegate; //< Object delegate
59 VLCVideoView *videoView;//< NSView instance where media is rendered to
61 void *instance; // Internal
62 VLCMedia *media; //< Current media being played
66 - (id)initWithVideoView:(VLCVideoView *)aVideoView;
69 - (void)setDelegate:(id)value;
72 /* Video View Options */
73 // TODO: Should be it's own object?
75 // TODO: use VLCVideoView instead of NSView
76 - (void)setVideoView:(VLCVideoView *)value;
77 - (VLCVideoView *)videoView;
79 - (void)setFullscreen:(BOOL)value;
82 - (void)setVideoAspectRatio:(char *)value;
83 - (char *)videoAspectRatio;
84 - (void)setVideoSubTitles:(int)value;
85 - (int)videoSubTitles;
87 - (void)setVideoCropGeometry:(char *)value;
88 - (char *)videoCropGeometry;
90 - (void)setVideoTeleText:(int)value;
93 - (void)setRate:(int)value;
96 /* Video Information */
99 - (float)framesPerSecond;
102 * Sets the current position (or time) of the feed.
103 * \param value New time to set the current position to. If time is [VLCTime nullTime], 0 is assumed.
105 - (void)setTime:(VLCTime *)value;
108 * Returns the current position (or time) of the feed.
109 * \return VLCTIme object with current time.
114 - (void)setAudioTrack:(int)value;
117 - (void)setAudioChannel:(int)value;
121 - (void)setMedia:(VLCMedia *)value;
124 /* Playback Operations */
126 * Plays a media resource using the currently selected media controller (or
127 * default controller. If feed was paused then the feed resumes at the position
129 * \return A Boolean determining whether the stream was played or not.
134 * Toggle's the pause state of the feed.
139 * Fast forwards through the feed at the standard 1x rate.
141 //- (void)fastForward;
144 * Fast forwards through the feed at the rate specified.
145 * \param rate Rate at which the feed should be fast forwarded.
147 //- (void)fastForwardAtRate:(int)rate;
150 * Rewinds through the feed at the standard 1x rate.
155 * Rewinds through the feed at the rate specified.
156 * \param rate Rate at which the feed should be fast rewound.
158 //- (void)rewindAtRate:(int)rate;
160 /* Playback Information */
162 * Playback state flag identifying that the stream is currently playing.
163 * \return TRUE if the feed is playing, FALSE if otherwise.
168 * Playback state flag identifying wheather the stream will play.
169 * \return TRUE if the feed is ready for playback, FALSE if otherwise.
174 * Playback's current state.
177 - (VLCMediaPlayerState)state;