VLCMediaThumbnailer.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*****************************************************************************
  2. * VLCKit: VLCMediaThumbnailer
  3. *****************************************************************************
  4. * Copyright (C) 2010-2012 Pierre d'Herbemont and VideoLAN
  5. *
  6. * Authors: Pierre d'Herbemont
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation; either version 2.1 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with this program; if not, write to the Free Software Foundation,
  20. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  21. *****************************************************************************/
  22. #import <Foundation/Foundation.h>
  23. #if TARGET_OS_IPHONE
  24. # import <CoreGraphics/CoreGraphics.h>
  25. #endif
  26. @class VLCMedia;
  27. @class VLCLibrary;
  28. @protocol VLCMediaThumbnailerDelegate;
  29. /**
  30. * a facility allowing you to do thumbnails in an efficient manner
  31. */
  32. @interface VLCMediaThumbnailer : NSObject
  33. /**
  34. * initializer
  35. * \param media the media item to thumbnail
  36. * \param delegate the delegate implementing the required protocol
  37. * \return the thumbnailer instance
  38. * \note This will use the default shared library instance
  39. */
  40. + (VLCMediaThumbnailer *)thumbnailerWithMedia:(VLCMedia *)media andDelegate:(id<VLCMediaThumbnailerDelegate>)delegate;
  41. /**
  42. * initializer
  43. * \param media the media item to thumbnail
  44. * \param delegate the delegate implementing the required protocol
  45. * \param library a library instance, potentially configured by you in a special way
  46. * \return the thumbnailer instance
  47. */
  48. + (VLCMediaThumbnailer *)thumbnailerWithMedia:(VLCMedia *)media delegate:(id<VLCMediaThumbnailerDelegate>)delegate andVLCLibrary:(VLCLibrary *)library;
  49. /**
  50. * Starts the thumbnailing process
  51. */
  52. - (void)fetchThumbnail;
  53. /**
  54. * delegate object associated with the thumbnailer instance implementing the required protocol
  55. */
  56. @property (readwrite, weak, nonatomic) id<VLCMediaThumbnailerDelegate> delegate;
  57. /**
  58. * the media object that is being thumbnailed
  59. */
  60. @property (readwrite, nonatomic) VLCMedia *media;
  61. /**
  62. * The thumbnail created for the media object
  63. */
  64. @property (readwrite, assign, nonatomic) CGImageRef thumbnail;
  65. /**
  66. * the libvlc instance used for thumbnailing
  67. * \note Whatever you do, using this instance is most likely wrong
  68. */
  69. @property (readwrite) void * libVLCinstance;
  70. /**
  71. * Thumbnail Height
  72. * You shouldn't change this after -fetchThumbnail
  73. * has been called.
  74. * @return thumbnail height. Default value 240.
  75. */
  76. @property (readwrite, assign, nonatomic) CGFloat thumbnailHeight;
  77. /**
  78. * Thumbnail Width
  79. * You shouldn't change this after -fetchThumbnail
  80. * has been called.
  81. * @return thumbnail height. Default value 320
  82. */
  83. @property (readwrite, assign, nonatomic) CGFloat thumbnailWidth;
  84. /**
  85. * Snapshot Position
  86. * You shouldn't change this after -fetchThumbnail
  87. * has been called.
  88. * @return snapshot position. Default value 0.3
  89. */
  90. @property (readwrite, assign, nonatomic) float snapshotPosition;
  91. @end
  92. /**
  93. * the required delegate protocol for VLCMediaThumbnailer
  94. */
  95. @protocol VLCMediaThumbnailerDelegate
  96. @required
  97. /**
  98. * called when the thumbnailing process timed-out
  99. * \param mediaThumbnailer the thumbnailer instance that timed out
  100. * \note The time-out duration depends on various factors outside your control and will not be the same for different media
  101. */
  102. - (void)mediaThumbnailerDidTimeOut:(VLCMediaThumbnailer *)mediaThumbnailer;
  103. /**
  104. * called when the thumbnailer did successfully created a thumbnail
  105. * \param mediaThumbnailer the thumbnailer instance that was successful
  106. * \param thumbnail the thumbnail that was created
  107. */
  108. - (void)mediaThumbnailer:(VLCMediaThumbnailer *)mediaThumbnailer didFinishThumbnail:(CGImageRef)thumbnail;
  109. @end