VLCMediaPlayer.h 8.8 KB

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