VLCMediaPlayer.h 5.9 KB

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