VLCMediaList.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*****************************************************************************
  2. * VLCMediaList.h: VLCKit.framework VLCMediaList header
  3. *****************************************************************************
  4. * Copyright (C) 2007 Pierre d'Herbemont
  5. * Copyright (C) 2015 Felix Paul Kühne
  6. * Copyright (C) 2007, 2015 VLC authors and VideoLAN
  7. * $Id$
  8. *
  9. * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU Lesser General Public License as published by
  13. * the Free Software Foundation; either version 2.1 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public License
  22. * along with this program; if not, write to the Free Software Foundation,
  23. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  24. *****************************************************************************/
  25. #import <Foundation/Foundation.h>
  26. #import "VLCMedia.h"
  27. /**
  28. * notification name if a list item was added
  29. */
  30. extern NSString *const VLCMediaListItemAdded;
  31. /**
  32. * notification name if a list item was deleted
  33. */
  34. extern NSString *const VLCMediaListItemDeleted;
  35. @class VLCMedia;
  36. @class VLCMediaList;
  37. /**
  38. * VLCMediaListDelegate
  39. */
  40. @protocol VLCMediaListDelegate
  41. @optional
  42. /**
  43. * delegate method triggered when a media was added to the list
  44. *
  45. * \param aMediaList the media list
  46. * \param media the media object that was added
  47. * \param index the index the media object was added at
  48. */
  49. - (void)mediaList:(VLCMediaList *)aMediaList mediaAdded:(VLCMedia *)media atIndex:(NSInteger)index;
  50. /**
  51. * delegate method triggered when a media was removed from the list
  52. *
  53. * \param aMediaList the media list
  54. * \param index the index a media item was deleted at
  55. */
  56. - (void)mediaList:(VLCMediaList *)aMediaList mediaRemovedAtIndex:(NSInteger)index;
  57. @end
  58. /**
  59. * VLCMediaList
  60. */
  61. @interface VLCMediaList : NSObject
  62. /**
  63. * initializer with a set of VLCMedia instances
  64. * \param array the NSArray of VLCMedia instances
  65. * \return instance of VLCMediaList equipped with the VLCMedia instances
  66. * \see VLCMedia
  67. */
  68. - (instancetype)initWithArray:(NSArray *)array;
  69. /* Operations */
  70. /**
  71. * lock the media list from being edited by another thread
  72. */
  73. - (void)lock;
  74. /**
  75. * unlock the media list from being edited by another thread
  76. */
  77. - (void)unlock;
  78. /**
  79. * add a media to a read-write list
  80. *
  81. * \param media the media object to add
  82. * \return the index of the newly added media
  83. * \note this function silently fails if the list is read-only
  84. */
  85. - (NSInteger)addMedia:(VLCMedia *)media;
  86. /**
  87. * add a media to a read-write list at a given position
  88. *
  89. * \param media the media object to add
  90. * \param index the index where to add the given media
  91. * \note this function silently fails if the list is read-only
  92. */
  93. - (void)insertMedia:(VLCMedia *)media atIndex:(NSInteger)index;
  94. /**
  95. * remove a media from a given position
  96. *
  97. * \param index the index of the media to remove
  98. * \note this function silently fails if the list is read-only
  99. */
  100. - (void)removeMediaAtIndex:(NSInteger)index;
  101. /**
  102. * retrieve a media from a given position
  103. *
  104. * \param index the index of the media you want
  105. * \return the media object
  106. */
  107. - (VLCMedia *)mediaAtIndex:(NSInteger)index;
  108. /**
  109. * retrieve the position of a media item
  110. *
  111. * \param media the media object to search for
  112. * \return the index position of the media in the list or -1 if not found
  113. */
  114. - (NSInteger)indexOfMedia:(VLCMedia *)media;
  115. /* Properties */
  116. /**
  117. * count number of media items in the list
  118. * \return the number of media objects
  119. */
  120. @property (readonly) NSInteger count;
  121. /**
  122. * delegate property to listen to addition/removal events
  123. */
  124. @property (weak, nonatomic) id delegate;
  125. /**
  126. * read-only property to check if the media list is writable or not
  127. * \return boolean value if the list is read-only
  128. */
  129. @property (readonly) BOOL isReadOnly;
  130. @end