VLCMediaPlayer.h 8.9 KB

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