VLCMediaList.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. /* Notification Messages */
  28. extern NSString *const VLCMediaListItemAdded;
  29. extern NSString *const VLCMediaListItemDeleted;
  30. @class VLCMedia;
  31. @class VLCMediaList;
  32. /**
  33. * VLCMediaListDelegate
  34. */
  35. @protocol VLCMediaListDelegate
  36. @optional
  37. /**
  38. * delegate method triggered when a media was added to the list
  39. *
  40. * \param the media list
  41. * \param the media object that was added
  42. * \param the index the media object was added at
  43. */
  44. - (void)mediaList:(VLCMediaList *)aMediaList mediaAdded:(VLCMedia *)media atIndex:(NSInteger)index;
  45. /**
  46. * delegate method triggered when a media was removed from the list
  47. *
  48. * \param the media list
  49. * \param the index a media item was deleted at
  50. */
  51. - (void)mediaList:(VLCMediaList *)aMediaList mediaRemovedAtIndex:(NSInteger)index;
  52. @end
  53. /**
  54. * VLCMediaList
  55. */
  56. @interface VLCMediaList : NSObject
  57. - (instancetype)initWithArray:(NSArray *)array;
  58. /* Operations */
  59. /**
  60. * lock the media list from being edited by another thread
  61. */
  62. - (void)lock;
  63. /**
  64. * unlock the media list from being edited by another thread
  65. */
  66. - (void)unlock;
  67. /**
  68. * add a media to a read-write list
  69. *
  70. * \param the media object to add
  71. * \return the index of the newly added media
  72. * \note this function silently fails if the list is read-only
  73. */
  74. - (NSInteger)addMedia:(VLCMedia *)media;
  75. /**
  76. * add a media to a read-write list at a given position
  77. *
  78. * \param the media object to add
  79. * \param the index where to add the given media
  80. * \note this function silently fails if the list is read-only
  81. */
  82. - (void)insertMedia:(VLCMedia *)media atIndex:(NSInteger)index;
  83. /**
  84. * remove a media from a given position
  85. *
  86. * \param the index of the media to remove
  87. * \note this function silently fails if the list is read-only
  88. */
  89. - (void)removeMediaAtIndex:(NSInteger)index;
  90. /**
  91. * retrieve a media from a given position
  92. *
  93. * \param the index of the media you want
  94. * \return the media object
  95. */
  96. - (VLCMedia *)mediaAtIndex:(NSInteger)index;
  97. /**
  98. * retrieve the position of a media item
  99. *
  100. * \param the media object to search for
  101. * \return the index position of the media in the list or -1 if not found
  102. */
  103. - (NSInteger)indexOfMedia:(VLCMedia *)media;
  104. /* Properties */
  105. /**
  106. * number of media items in the list
  107. * \return the number of media objects
  108. */
  109. @property (readonly) NSInteger count;
  110. /**
  111. * delegate property to listen to addition/removal events
  112. */
  113. @property (weak, nonatomic) id delegate;
  114. /**
  115. * read-only property to check if the media list is writable or not
  116. * \return boolean value if the list is read-only
  117. */
  118. @property (readonly) BOOL isReadOnly;
  119. @end