VLCMedia.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*****************************************************************************
  2. * VLCMedia.h: VLC.framework VLCMedia 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 "VLCMediaList.h"
  26. #import "VLCTime.h"
  27. /* Meta Dictionary Keys */
  28. /**
  29. * Standard dictionary keys for retreiving meta data.
  30. */
  31. extern NSString *VLCMetaInformationTitle; /* NSString */
  32. extern NSString *VLCMetaInformationArtist; /* NSString */
  33. extern NSString *VLCMetaInformationTitle; /* NSString */
  34. extern NSString *VLCMetaInformationArtist; /* NSString */
  35. extern NSString *VLCMetaInformationGenre; /* NSString */
  36. extern NSString *VLCMetaInformationCopyright; /* NSString */
  37. extern NSString *VLCMetaInformationAlbum; /* NSString */
  38. extern NSString *VLCMetaInformationTrackNumber; /* NSString */
  39. extern NSString *VLCMetaInformationDescription; /* NSString */
  40. extern NSString *VLCMetaInformationRating; /* NSString */
  41. extern NSString *VLCMetaInformationDate; /* NSString */
  42. extern NSString *VLCMetaInformationSetting; /* NSString */
  43. extern NSString *VLCMetaInformationURL; /* NSString */
  44. extern NSString *VLCMetaInformationLanguage; /* NSString */
  45. extern NSString *VLCMetaInformationNowPlaying; /* NSString */
  46. extern NSString *VLCMetaInformationPublisher; /* NSString */
  47. extern NSString *VLCMetaInformationEncodedBy; /* NSString */
  48. extern NSString *VLCMetaInformationArtworkURL; /* NSString */
  49. extern NSString *VLCMetaInformationArtwork; /* NSImage */
  50. extern NSString *VLCMetaInformationTrackID; /* NSString */
  51. /* Notification Messages */
  52. /**
  53. * Available notification messages.
  54. */
  55. extern NSString *VLCMediaMetaChanged; //< Notification message for when the media's meta data has changed
  56. // Forward declarations, supresses compiler error messages
  57. @class VLCMediaList;
  58. @class VLCMedia;
  59. /**
  60. * Informal protocol declaration for VLCMedia delegates. Allows data changes to be
  61. * trapped.
  62. */
  63. @protocol VLCMediaDelegate
  64. // TODO: SubItemAdded/SubItemRemoved implementation. Not sure if we really want to implement this.
  65. ///**
  66. // * Delegate method called whenever a sub item has been added to the specified VLCMedia.
  67. // * \param aMedia The media resource that has received the new sub item.
  68. // * \param childMedia The new sub item added.
  69. // * \param index Location of the new subitem in the aMedia's sublist.
  70. // */
  71. // - (void)media:(VLCMedia *)media addedSubItem:(VLCMedia *)childMedia atIndex:(int)index;
  72. ///**
  73. // * Delegate method called whenever a sub item has been removed from the specified VLCMedia.
  74. // * \param aMedia The media resource that has had a sub item removed from.
  75. // * \param childMedia The sub item removed.
  76. // * \param index The previous location of the recently removed sub item.
  77. // */
  78. // - (void)media:(VLCMedia *)aMedia removedSubItem:(VLCMedia *)childMedia atIndex:(int)index;
  79. /**
  80. * Delegate method called whenever the meta has changed for the receiver.
  81. * \param aMedia The media resource whose meta data has been changed.
  82. * \param oldValue The old meta data value.
  83. * \param key The key of the value that was changed.
  84. */
  85. - (void)media:(VLCMedia *)aMedia metaValueChangedFrom:(id)oldValue forKey:(NSString *)key;
  86. @end
  87. /**
  88. * Defines files and streams as a managed object. Each media object can be
  89. * administered seperately. VLCMediaPlayer or VLCMediaControl must be used
  90. * to execute the appropriate playback functions.
  91. * \see VLCMediaPlayer
  92. * \see VLCMediaControl
  93. */
  94. @interface VLCMedia : NSObject
  95. {
  96. void * p_md; //< Internal media descriptor instance
  97. NSString * url; //< URL for this media resource
  98. VLCMediaList * subitems; //< Sub list of items
  99. VLCTime * length; //< Duration of the media
  100. NSMutableDictionary * metaDictionary; //< Meta data storage
  101. id delegate; //< Delegate object
  102. BOOL preparsed; //< Value used to determine of the file has been preparsed
  103. }
  104. /* Object Factories */
  105. /**
  106. * Manufactures a new VLCMedia object using the URL specified. Will return nil if
  107. * the specified URL references a directory that does not comply with DVD file
  108. * structure.
  109. * \param anURL URL to media to be accessed.
  110. * \return A new VLCMedia object, only if there were no errors. This object
  111. * will be automatically released.
  112. * \see initWithMediaURL
  113. */
  114. + (id)mediaWithURL:(NSString *)anURL;
  115. /* Initializers */
  116. /**
  117. * Initializes a new VLCMedia object to use the specified URL. Will return nil if
  118. * the specified URL references a directory that does not comply with DVD file
  119. * structure.
  120. * \param anURL URL to media to be accessed.
  121. * \return A new VLCMedia object, only if there were no errors.
  122. */
  123. - (id)initWithURL:(NSString *)anURL;
  124. /**
  125. * Returns an NSComparisonResult value that indicates the lexical ordering of
  126. * the receiver and a given meda.
  127. * \param media The media with which to compare with the receiver.
  128. * \return NSOrderedAscending if the URL of the receiver precedes media in
  129. * lexical ordering, NSOrderedSame if the URL of the receiver and media are
  130. * equivalent in lexical value, and NSOrderedDescending if the URL of the
  131. * receiver follows media. If media is nil, returns NSOrderedDescending.
  132. */
  133. - (NSComparisonResult)compare:(VLCMedia *)media;
  134. /* Properties */
  135. /**
  136. * Sets the receiver's delegate.
  137. * \param delegate The delegate for the receiver.
  138. */
  139. - (void)setDelegate:(id)delegate;
  140. /**
  141. * Returns the receiver's delegate
  142. * \return The receiver's delegate
  143. */
  144. - (id)delegate;
  145. /**
  146. * Returns a VLCTime object describing the length of the media resource.
  147. * \return The length of the media resource.
  148. */
  149. - (VLCTime *)length;
  150. /**
  151. * Returns a VLCTime object describing the length of the media resource,
  152. * however, this is a blocking operation and will wait until the preparsing is
  153. * completed before returning anything.
  154. * \param aDate Time for operation to wait until, if there are no results
  155. * before specified date then nil is returned.
  156. * \return The length of the media resource, nil if it couldn't wait for it.
  157. */
  158. - (VLCTime *)lengthWaitUntilDate:(NSDate *)aDate;
  159. - (BOOL)isPreparsed;
  160. /**
  161. * Returns the URL for the receiver's media resource.
  162. * \return The URL for the receiver's media resource.
  163. */
  164. - (NSString *)url;
  165. /**
  166. * Returns the receiver's sub list.
  167. * \return The receiver's sub list.
  168. */
  169. - (VLCMediaList *)subitems;
  170. /**
  171. * Returns the receiver's meta data as a NSDictionary object.
  172. * \return The receiver's meta data as a NSDictionary object.
  173. */
  174. - (NSDictionary *)metaDictionary;
  175. @end