VLCMediaPlayer.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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 "VLCTime.h"
  28. /* Notification Messages */
  29. extern NSString * VLCMediaPlayerTimeChanged;
  30. extern NSString * VLCMediaPlayerStateChanged;
  31. /**
  32. * TODO: Documentation VLCMediaPlayerState
  33. */
  34. typedef enum VLCMediaPlayerState
  35. {
  36. VLCMediaPlayerStateStopped, //< Player has stopped
  37. VLCMediaPlayerStateOpening, //< Stream is opening
  38. VLCMediaPlayerStateBuffering, //< Stream is buffering
  39. VLCMediaPlayerStateEnded, //< Stream has ended
  40. VLCMediaPlayerStateError, //< Player has generated an error
  41. VLCMediaPlayerStatePlaying, //< Stream is playing
  42. VLCMediaPlayerStatePaused //< Stream is paused
  43. } VLCMediaPlayerState;
  44. /**
  45. * TODO: Documentation extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState)
  46. */
  47. extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
  48. /**
  49. * Formal protocol declaration for playback delegates. Allows playback messages
  50. * to be trapped by delegated objects.
  51. */
  52. @protocol VLCMediaPlayerDelegate
  53. /**
  54. * TODO: Documentation - [VLCMediaPlayerDelegate ]
  55. */
  56. - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
  57. /**
  58. * TODO: Documentation - [VLCMediaPlayerDelegate ]
  59. */
  60. - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
  61. @end
  62. // TODO: Should we use medialist_player or our own flavor of media player?
  63. @interface VLCMediaPlayer : NSObject
  64. {
  65. id delegate; //< Object delegate
  66. VLCVideoView * videoView; //< NSView instance where media is rendered to
  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. /* Properties */
  76. - (void)setDelegate:(id)value;
  77. - (id)delegate;
  78. /* Video View Options */
  79. // TODO: Should be it's own object?
  80. // TODO: use VLCVideoView instead of NSView
  81. - (void)setVideoView:(VLCVideoView *)value;
  82. - (VLCVideoView *)videoView;
  83. - (void)setFullscreen:(BOOL)value;
  84. - (BOOL)fullscreen;
  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. - (void)setRate:(int)value;
  94. - (int)rate;
  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. * Fast forwards through the feed at the standard 1x rate.
  135. */
  136. //- (void)fastForward;
  137. /**
  138. * Fast forwards through the feed at the rate specified.
  139. * \param rate Rate at which the feed should be fast forwarded.
  140. */
  141. //- (void)fastForwardAtRate:(int)rate;
  142. /**
  143. * Rewinds through the feed at the standard 1x rate.
  144. */
  145. //- (void)rewind;
  146. /**
  147. * Rewinds through the feed at the rate specified.
  148. * \param rate Rate at which the feed should be fast rewound.
  149. */
  150. //- (void)rewindAtRate:(int)rate;
  151. /* Playback Information */
  152. /**
  153. * Playback state flag identifying that the stream is currently playing.
  154. * \return TRUE if the feed is playing, FALSE if otherwise.
  155. */
  156. - (BOOL)isPlaying;
  157. /**
  158. * Playback state flag identifying wheather the stream will play.
  159. * \return TRUE if the feed is ready for playback, FALSE if otherwise.
  160. */
  161. - (BOOL)willPlay;
  162. /**
  163. * Playback's current state.
  164. * \see VLCMediaState
  165. */
  166. - (VLCMediaPlayerState)state;
  167. /**
  168. * Returns the receiver's position in the reading.
  169. * \return A number between 0 and 1. indicating the position
  170. */
  171. - (float)position;
  172. - (void)setPosition:(float)newPosition;
  173. - (BOOL)isSeekable;
  174. @end