VLCMediaPlayer.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. #import <Cocoa/Cocoa.h>
  25. #import "VLCMedia.h"
  26. #import "VLCVideoView.h"
  27. #import "VLCVideoLayer.h"
  28. #import "VLCTime.h"
  29. #import "VLCAudio.h"
  30. /* Notification Messages */
  31. extern NSString * VLCMediaPlayerTimeChanged;
  32. extern NSString * VLCMediaPlayerStateChanged;
  33. /**
  34. * VLCMediaPlayerState describes the state of the media player.
  35. */
  36. typedef enum VLCMediaPlayerState
  37. {
  38. VLCMediaPlayerStateStopped, //< Player has stopped
  39. VLCMediaPlayerStateOpening, //< Stream is opening
  40. VLCMediaPlayerStateBuffering, //< Stream is buffering
  41. VLCMediaPlayerStateEnded, //< Stream has ended
  42. VLCMediaPlayerStateError, //< Player has generated an error
  43. VLCMediaPlayerStatePlaying, //< Stream is playing
  44. VLCMediaPlayerStatePaused //< Stream is paused
  45. } VLCMediaPlayerState;
  46. /**
  47. * Returns the name of the player state as a string.
  48. * \param state The player state.
  49. * \return A string containing the name of state. If state is not a valid state, returns nil.
  50. */
  51. extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
  52. /**
  53. * Formal protocol declaration for playback delegates. Allows playback messages
  54. * to be trapped by delegated objects.
  55. */
  56. @protocol VLCMediaPlayerDelegate
  57. /**
  58. * Sent by the default notification center whenever the player's time has changed.
  59. * \details Discussion The value of aNotification is always an VLCMediaPlayerTimeChanged notification. You can retrieve
  60. * the VLCMediaPlayer object in question by sending object to aNotification.
  61. */
  62. - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
  63. /**
  64. * Sent by the default notification center whenever the player's state has changed.
  65. * \details Discussion The value of aNotification is always an VLCMediaPlayerStateChanged notification. You can retrieve
  66. * the VLCMediaPlayer object in question by sending object to aNotification.
  67. */
  68. - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
  69. @end
  70. // TODO: Should we use medialist_player or our own flavor of media player?
  71. @interface VLCMediaPlayer : NSObject
  72. {
  73. id delegate; //< Object delegate
  74. void * instance; // Internal
  75. VLCMedia * media; //< Current media being played
  76. VLCTime * cachedTime; //< Cached time of the media being played
  77. VLCMediaPlayerState cachedState; //< Cached state of the media being played
  78. float position; //< The position of the media being played
  79. }
  80. /* Initializers */
  81. - (id)initWithVideoView:(VLCVideoView *)aVideoView;
  82. - (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
  83. /* Properties */
  84. - (void)setDelegate:(id)value;
  85. - (id)delegate;
  86. /* Video View Options */
  87. // TODO: Should be it's own object?
  88. - (void)setVideoView:(VLCVideoView *)aVideoView;
  89. - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
  90. @property (retain) id drawable; /* The videoView or videoLayer */
  91. - (void)setVideoAspectRatio:(char *)value;
  92. - (char *)videoAspectRatio;
  93. - (void)setVideoSubTitles:(int)value;
  94. - (int)videoSubTitles;
  95. - (void)setVideoCropGeometry:(char *)value;
  96. - (char *)videoCropGeometry;
  97. - (void)setVideoTeleText:(int)value;
  98. - (int)videoTeleText;
  99. /**
  100. * Take a snapshot of the current video.
  101. *
  102. * If width AND height is 0, original size is used.
  103. * If width OR height is 0, original aspect-ratio is preserved.
  104. *
  105. * \param path the path where to save the screenshot to
  106. * \param width the snapshot's width
  107. * \param height the snapshot's height
  108. */
  109. - (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height;
  110. /**
  111. * Enable or disable deinterlace filter
  112. *
  113. * \param name of deinterlace filter to use (availability depends on underlying VLC version)
  114. * \param enable boolean to enable or disable deinterlace filter
  115. */
  116. - (void)setDeinterlaceFilter: (NSString *)name enabled: (BOOL)enabled;
  117. @property float rate;
  118. @property (readonly) VLCAudio * audio;
  119. /* Video Information */
  120. - (NSSize)videoSize;
  121. - (BOOL)hasVideoOut;
  122. - (float)framesPerSecond;
  123. /**
  124. * Sets the current position (or time) of the feed.
  125. * \param value New time to set the current position to. If time is [VLCTime nullTime], 0 is assumed.
  126. */
  127. - (void)setTime:(VLCTime *)value;
  128. /**
  129. * Returns the current position (or time) of the feed.
  130. * \return VLCTIme object with current time.
  131. */
  132. - (VLCTime *)time;
  133. - (void)setChapter:(int)value;
  134. - (int)chapter;
  135. - (int)countOfChapters;
  136. /* Audio Options */
  137. - (void)setAudioTrack:(int)value;
  138. - (int)audioTrack;
  139. - (int)countOfAudioTracks;
  140. - (void)setAudioChannel:(int)value;
  141. - (int)audioChannel;
  142. /* Media Options */
  143. - (void)setMedia:(VLCMedia *)value;
  144. - (VLCMedia *)media;
  145. /* Playback Operations */
  146. /**
  147. * Plays a media resource using the currently selected media controller (or
  148. * default controller. If feed was paused then the feed resumes at the position
  149. * it was paused in.
  150. * \return A Boolean determining whether the stream was played or not.
  151. */
  152. - (BOOL)play;
  153. /**
  154. * Toggle's the pause state of the feed.
  155. */
  156. - (void)pause;
  157. /**
  158. * Stop the playing.
  159. */
  160. - (void)stop;
  161. /**
  162. * Fast forwards through the feed at the standard 1x rate.
  163. */
  164. - (void)fastForward;
  165. /**
  166. * Fast forwards through the feed at the rate specified.
  167. * \param rate Rate at which the feed should be fast forwarded.
  168. */
  169. - (void)fastForwardAtRate:(float)rate;
  170. /**
  171. * Rewinds through the feed at the standard 1x rate.
  172. */
  173. - (void)rewind;
  174. /**
  175. * Rewinds through the feed at the rate specified.
  176. * \param rate Rate at which the feed should be fast rewound.
  177. */
  178. - (void)rewindAtRate:(float)rate;
  179. /**
  180. * Jumps shortly backward in current stream if seeking is supported.
  181. * \param interval to skip, in sec.
  182. */
  183. - (void)jumpBackward:(NSInteger)interval;
  184. /**
  185. * Jumps shortly forward in current stream if seeking is supported.
  186. * \param interval to skip, in sec.
  187. */
  188. - (void)jumpForward:(NSInteger)interval;
  189. /**
  190. * Jumps shortly backward in current stream if seeking is supported.
  191. */
  192. - (void)extraShortJumpBackward;
  193. /**
  194. * Jumps shortly forward in current stream if seeking is supported.
  195. */
  196. - (void)extraShortJumpForward;
  197. /**
  198. * Jumps shortly backward in current stream if seeking is supported.
  199. */
  200. - (void)shortJumpBackward;
  201. /**
  202. * Jumps shortly forward in current stream if seeking is supported.
  203. */
  204. - (void)shortJumpForward;
  205. /**
  206. * Jumps shortly backward in current stream if seeking is supported.
  207. */
  208. - (void)mediumJumpBackward;
  209. /**
  210. * Jumps shortly forward in current stream if seeking is supported.
  211. */
  212. - (void)mediumJumpForward;
  213. /**
  214. * Jumps shortly backward in current stream if seeking is supported.
  215. */
  216. - (void)longJumpBackward;
  217. /**
  218. * Jumps shortly forward in current stream if seeking is supported.
  219. */
  220. - (void)longJumpForward;
  221. /* Playback Information */
  222. /**
  223. * Playback state flag identifying that the stream is currently playing.
  224. * \return TRUE if the feed is playing, FALSE if otherwise.
  225. */
  226. - (BOOL)isPlaying;
  227. /**
  228. * Playback state flag identifying wheather the stream will play.
  229. * \return TRUE if the feed is ready for playback, FALSE if otherwise.
  230. */
  231. - (BOOL)willPlay;
  232. /**
  233. * Playback's current state.
  234. * \see VLCMediaState
  235. */
  236. - (VLCMediaPlayerState)state;
  237. /**
  238. * Returns the receiver's position in the reading.
  239. * \return A number between 0 and 1. indicating the position
  240. */
  241. - (float)position;
  242. - (void)setPosition:(float)newPosition;
  243. - (BOOL)isSeekable;
  244. - (BOOL)canPause;
  245. @end