VLCMediaThumbnailer.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. @protocol VLCMediaThumbnailerDelegate;
  28. @interface VLCMediaThumbnailer : NSObject {
  29. id<VLCMediaThumbnailerDelegate> _delegate;
  30. VLCMedia *_media;
  31. void *_mp;
  32. CGImageRef _thumbnail;
  33. void *_data;
  34. NSTimer *_parsingTimeoutTimer;
  35. NSTimer *_thumbnailingTimeoutTimer;
  36. CGFloat _thumbnailHeight,_thumbnailWidth,_snapshotPosition;
  37. CGFloat _effectiveThumbnailHeight,_effectiveThumbnailWidth;
  38. int _numberOfReceivedFrames;
  39. BOOL _shouldRejectFrames;
  40. }
  41. + (VLCMediaThumbnailer *)thumbnailerWithMedia:(VLCMedia *)media andDelegate:(id<VLCMediaThumbnailerDelegate>)delegate;
  42. - (void)fetchThumbnail;
  43. @property (readwrite, assign) id<VLCMediaThumbnailerDelegate> delegate;
  44. @property (readwrite, retain) VLCMedia *media;
  45. @property (readwrite, assign) CGImageRef thumbnail;
  46. /**
  47. * Thumbnail Height
  48. * You shouldn't change this after -fetchThumbnail
  49. * has been called.
  50. * @return thumbnail height. Default value 240.
  51. */
  52. @property (readwrite, assign) CGFloat thumbnailHeight;
  53. /**
  54. * Thumbnail Width
  55. * You shouldn't change this after -fetchThumbnail
  56. * has been called.
  57. * @return thumbnail height. Default value 320
  58. */
  59. @property (readwrite, assign) CGFloat thumbnailWidth;
  60. /**
  61. * Snapshot Position
  62. * You shouldn't change this after -fetchThumbnail
  63. * has been called.
  64. * @return snapshot position. Default value 0.5
  65. */
  66. @property (readwrite, assign) CGFloat snapshotPosition;
  67. @end
  68. @protocol VLCMediaThumbnailerDelegate
  69. @required
  70. - (void)mediaThumbnailerDidTimeOut:(VLCMediaThumbnailer *)mediaThumbnailer;
  71. - (void)mediaThumbnailer:(VLCMediaThumbnailer *)mediaThumbnailer didFinishThumbnail:(CGImageRef)thumbnail;
  72. @end