VLCMediaPlayer.h 5.5 KB

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