VLCMediaThumbnailer.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. OBJC_VISIBLE
  33. @interface VLCMediaThumbnailer : NSObject
  34. /**
  35. * initializer
  36. * \param media the media item to thumbnail
  37. * \param delegate the delegate implementing the required protocol
  38. * \return the thumbnailer instance
  39. * \note This will use the default shared library instance
  40. */
  41. + (VLCMediaThumbnailer *)thumbnailerWithMedia:(VLCMedia *)media andDelegate:(id<VLCMediaThumbnailerDelegate>)delegate;
  42. /**
  43. * initializer
  44. * \param media the media item to thumbnail
  45. * \param delegate the delegate implementing the required protocol
  46. * \param library a library instance, potentially configured by you in a special way
  47. * \return the thumbnailer instance
  48. */
  49. + (VLCMediaThumbnailer *)thumbnailerWithMedia:(VLCMedia *)media delegate:(id<VLCMediaThumbnailerDelegate>)delegate andVLCLibrary:(VLCLibrary *)library;
  50. /**
  51. * Starts the thumbnailing process
  52. */
  53. - (void)fetchThumbnail;
  54. /**
  55. * delegate object associated with the thumbnailer instance implementing the required protocol
  56. */
  57. @property (readwrite, weak, nonatomic) id<VLCMediaThumbnailerDelegate> delegate;
  58. /**
  59. * the media object that is being thumbnailed
  60. */
  61. @property (readwrite, nonatomic) VLCMedia *media;
  62. /**
  63. * The thumbnail created for the media object
  64. */
  65. @property (readwrite, assign, nonatomic) CGImageRef thumbnail;
  66. /**
  67. * the libvlc instance used for thumbnailing
  68. * \note Whatever you do, using this instance is most likely wrong
  69. */
  70. @property (readwrite) void * libVLCinstance;
  71. /**
  72. * Thumbnail Height
  73. * You shouldn't change this after -fetchThumbnail
  74. * has been called.
  75. * @return thumbnail height. Default value 240.
  76. */
  77. @property (readwrite, assign, nonatomic) CGFloat thumbnailHeight;
  78. /**
  79. * Thumbnail Width
  80. * You shouldn't change this after -fetchThumbnail
  81. * has been called.
  82. * @return thumbnail height. Default value 320
  83. */
  84. @property (readwrite, assign, nonatomic) CGFloat thumbnailWidth;
  85. /**
  86. * Snapshot Position
  87. * You shouldn't change this after -fetchThumbnail
  88. * has been called.
  89. * @return snapshot position. Default value 0.3
  90. */
  91. @property (readwrite, assign, nonatomic) float snapshotPosition;
  92. @end
  93. /**
  94. * the required delegate protocol for VLCMediaThumbnailer
  95. */
  96. @protocol VLCMediaThumbnailerDelegate
  97. @required
  98. /**
  99. * called when the thumbnailing process timed-out
  100. * \param mediaThumbnailer the thumbnailer instance that timed out
  101. * \note The time-out duration depends on various factors outside your control and will not be the same for different media
  102. */
  103. - (void)mediaThumbnailerDidTimeOut:(VLCMediaThumbnailer *)mediaThumbnailer;
  104. /**
  105. * called when the thumbnailer did successfully created a thumbnail
  106. * \param mediaThumbnailer the thumbnailer instance that was successful
  107. * \param thumbnail the thumbnail that was created
  108. */
  109. - (void)mediaThumbnailer:(VLCMediaThumbnailer *)mediaThumbnailer didFinishThumbnail:(CGImageRef)thumbnail;
  110. @end