VLCVideoLayer.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*****************************************************************************
  2. * VLCVideoLayer.m: VLC.framework VLCVideoLayer implementation
  3. *****************************************************************************
  4. * Copyright (C) 2007 Pierre d'Herbemont
  5. * Copyright (C) 2007 the VideoLAN team
  6. * $Id: VLCVideoView.m 24023 2008-01-02 02:52:35Z pdherbemont $
  7. *
  8. * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23. *****************************************************************************/
  24. #import "VLCVideoLayer.h"
  25. #import "VLCLibrary.h"
  26. #import "VLCEventManager.h"
  27. /* Libvlc */
  28. #include <vlc/vlc.h>
  29. #include <vlc/libvlc.h>
  30. #import <QuartzCore/QuartzCore.h>
  31. /******************************************************************************
  32. * VLCVideoView (Private)
  33. */
  34. @interface VLCVideoLayer (Private)
  35. /* Method */
  36. - (void)addVoutLayer:(CALayer *)aLayer;
  37. @end
  38. /******************************************************************************
  39. * Implementation VLCVideoLayer
  40. */
  41. @implementation VLCVideoLayer
  42. + (id)layer
  43. {
  44. return [[CALayer alloc] init];
  45. }
  46. @end
  47. /******************************************************************************
  48. * Implementation VLCVideoLayer (Private)
  49. */
  50. @implementation VLCVideoLayer (Private)
  51. /* This is called by the libvlc module 'opengllayer' as soon as there is one
  52. * vout available
  53. */
  54. - (void)addVoutLayer:(CALayer *)aLayer
  55. {
  56. [CATransaction begin];
  57. aLayer.name = @"vlcopengllayer";
  58. [aLayer setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable];
  59. [self insertSublayer:aLayer atIndex:0];
  60. [aLayer setNeedsLayout];
  61. [aLayer setNeedsDisplay];
  62. [self setNeedsDisplay];
  63. [self layoutIfNeeded];
  64. [CATransaction commit];
  65. }
  66. @end