VLCVideoLayer.m 2.5 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. #import "VLCVideoCommon.h"
  28. /* Libvlc */
  29. #include <vlc/vlc.h>
  30. #include <vlc/libvlc.h>
  31. #import <QuartzCore/QuartzCore.h>
  32. /******************************************************************************
  33. * VLCVideoView (Private)
  34. */
  35. @interface VLCVideoLayer (Private)
  36. /* Method */
  37. - (void)addVoutLayer:(CALayer *)aLayer;
  38. @end
  39. /******************************************************************************
  40. * Implementation VLCVideoLayer
  41. */
  42. @implementation VLCVideoLayer
  43. @end
  44. /******************************************************************************
  45. * Implementation VLCVideoLayer (Private)
  46. */
  47. @implementation VLCVideoLayer (Private)
  48. /* This is called by the libvlc module 'opengllayer' as soon as there is one
  49. * vout available
  50. */
  51. - (void)addVoutLayer:(CALayer *)voutLayer
  52. {
  53. [CATransaction begin];
  54. voutLayer.name = @"vlcopengllayer";
  55. VLCVideoLayoutManager * layoutManager = [VLCVideoLayoutManager layoutManager];
  56. layoutManager.originalVideoSize = voutLayer.bounds.size;
  57. self.layoutManager = layoutManager;
  58. [self insertSublayer:voutLayer atIndex:0];
  59. [CATransaction commit];
  60. }
  61. - (void)removeVoutLayer:(CALayer*)voutLayer
  62. {
  63. [CATransaction begin];
  64. [voutLayer removeFromSuperlayer];
  65. [CATransaction commit];
  66. }
  67. @end