VLCMediaPlayer.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /*****************************************************************************
  2. * VLCMediaPlayer.h: VLC.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. /* Notification Messages */
  30. extern NSString * VLCMediaPlayerTimeChanged;
  31. extern NSString * VLCMediaPlayerStateChanged;
  32. /**
  33. * TODO: Documentation VLCMediaPlayerState
  34. */
  35. typedef enum VLCMediaPlayerState
  36. {
  37. VLCMediaPlayerStateStopped, //< Player has stopped
  38. VLCMediaPlayerStateOpening, //< Stream is opening
  39. VLCMediaPlayerStateBuffering, //< Stream is buffering
  40. VLCMediaPlayerStateEnded, //< Stream has ended
  41. VLCMediaPlayerStateError, //< Player has generated an error
  42. VLCMediaPlayerStatePlaying, //< Stream is playing
  43. VLCMediaPlayerStatePaused //< Stream is paused
  44. } VLCMediaPlayerState;
  45. /**
  46. * TODO: Documentation extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState)
  47. */
  48. extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
  49. /**
  50. * Formal protocol declaration for playback delegates. Allows playback messages
  51. * to be trapped by delegated objects.
  52. */
  53. @protocol VLCMediaPlayerDelegate
  54. /**
  55. * TODO: Documentation - [VLCMediaPlayerDelegate ]
  56. */
  57. - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
  58. /**
  59. * TODO: Documentation - [VLCMediaPlayerDelegate ]
  60. */
  61. - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
  62. @end
  63. // TODO: Should we use medialist_player or our own flavor of media player?
  64. @interface VLCMediaPlayer : NSObject
  65. {
  66. id delegate; //< Object delegate
  67. void * instance; // Internal
  68. VLCMedia * media; //< Current media being played
  69. VLCTime * cachedTime;
  70. VLCMediaPlayerState cachedState;
  71. float position;
  72. }
  73. /* Initializers */
  74. - (id)initWithVideoView:(VLCVideoView *)aVideoView;
  75. - (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
  76. /* Properties */
  77. - (void)setDelegate:(id)value;
  78. - (id)delegate;
  79. /* Video View Options */
  80. // TODO: Should be it's own object?
  81. - (void)setVideoView:(VLCVideoView *)aVideoView;
  82. - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
  83. @property (retain) id drawable; /* The videoView or videoLayer */
  84. - (void)setVideoAspectRatio:(char *)value;
  85. - (char *)videoAspectRatio;
  86. - (void)setVideoSubTitles:(int)value;
  87. - (int)videoSubTitles;
  88. - (void)setVideoCropGeometry:(char *)value;
  89. - (char *)videoCropGeometry;
  90. - (void)setVideoTeleText:(int)value;
  91. - (int)videoTeleText;
  92. @property float rate;
  93. @property (readonly) VLCAudio * audio;
  94. /* Video Information */
  95. - (NSSize)videoSize;
  96. - (BOOL)hasVideoOut;
  97. - (float)framesPerSecond;
  98. /**
  99. * Sets the current position (or time) of the feed.
  100. * \param value New time to set the current position to. If time is [VLCTime nullTime], 0 is assumed.
  101. */
  102. - (void)setTime:(VLCTime *)value;
  103. /**
  104. * Returns the current position (or time) of the feed.
  105. * \return VLCTIme object with current time.
  106. */
  107. - (VLCTime *)time;
  108. - (void)setChapter:(int)value;
  109. - (int)chapter;
  110. - (int)countOfChapters;
  111. /* Audio Options */
  112. - (void)setAudioTrack:(int)value;
  113. - (int)audioTrack;
  114. - (int)countOfAudioTracks;
  115. - (void)setAudioChannel:(int)value;
  116. - (int)audioChannel;
  117. /* Media Options */
  118. - (void)setMedia:(VLCMedia *)value;
  119. - (VLCMedia *)media;
  120. /* Playback Operations */
  121. /**
  122. * Plays a media resource using the currently selected media controller (or
  123. * default controller. If feed was paused then the feed resumes at the position
  124. * it was paused in.
  125. * \return A Boolean determining whether the stream was played or not.
  126. */
  127. - (BOOL)play;
  128. /**
  129. * Toggle's the pause state of the feed.
  130. */
  131. - (void)pause;
  132. /**
  133. * Stop the playing.
  134. */
  135. - (void)stop;
  136. /**
  137. * Fast forwards through the feed at the standard 1x rate.
  138. */
  139. - (void)fastForward;
  140. /**
  141. * Fast forwards through the feed at the rate specified.
  142. * \param rate Rate at which the feed should be fast forwarded.
  143. */
  144. - (void)fastForwardAtRate:(float)rate;
  145. /**
  146. * Rewinds through the feed at the standard 1x rate.
  147. */
  148. - (void)rewind;
  149. /**
  150. * Rewinds through the feed at the rate specified.
  151. * \param rate Rate at which the feed should be fast rewound.
  152. */
  153. - (void)rewindAtRate:(float)rate;
  154. /* Playback Information */
  155. /**
  156. * Playback state flag identifying that the stream is currently playing.
  157. * \return TRUE if the feed is playing, FALSE if otherwise.
  158. */
  159. - (BOOL)isPlaying;
  160. /**
  161. * Playback state flag identifying wheather the stream will play.
  162. * \return TRUE if the feed is ready for playback, FALSE if otherwise.
  163. */
  164. - (BOOL)willPlay;
  165. /**
  166. * Playback's current state.
  167. * \see VLCMediaState
  168. */
  169. - (VLCMediaPlayerState)state;
  170. /**
  171. * Returns the receiver's position in the reading.
  172. * \return A number between 0 and 1. indicating the position
  173. */
  174. - (float)position;
  175. - (void)setPosition:(float)newPosition;
  176. - (BOOL)isSeekable;
  177. - (BOOL)canPause;
  178. @end