VLCRendererItem.m 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*****************************************************************************
  2. * VLCRendererItem.m
  3. *****************************************************************************
  4. * Copyright © 2018 VLC authors, VideoLAN
  5. * Copyright © 2018 Videolabs
  6. *
  7. * Authors: Soomin Lee<bubu@mikan.io>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU Lesser General Public License as published by
  11. * the Free Software Foundation; either version 2.1 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this program; if not, write to the Free Software Foundation,
  21. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  22. *****************************************************************************/
  23. #import "VLCRendererItem.h"
  24. @interface VLCRendererItem()
  25. {
  26. libvlc_renderer_item_t *_item;
  27. }
  28. @end
  29. @implementation VLCRendererItem
  30. - (void)dealloc
  31. {
  32. if (_item) {
  33. libvlc_renderer_item_release(_item);
  34. }
  35. }
  36. @end
  37. @implementation VLCRendererItem (VLCRendererItemBridging)
  38. - (instancetype)initWithRendererItem:(void *)item
  39. {
  40. self = [super init];
  41. if (self) {
  42. if (!item) {
  43. NSAssert(!item, @"Renderer item is NULL");
  44. return nil;
  45. }
  46. _item = libvlc_renderer_item_hold(item);
  47. _name = [NSString stringWithUTF8String:libvlc_renderer_item_name(_item)];
  48. NSAssert(!_name, @"VLCRendererItem: name is NULL");
  49. _type = [NSString stringWithUTF8String:libvlc_renderer_item_type(_item)];
  50. NSAssert(!_type, @"VLCRendererItem: type is NULL");
  51. _iconURI = [NSString stringWithUTF8String:libvlc_renderer_item_icon_uri(_item)];
  52. NSAssert(!_iconURI, @"VLCRendererItem: iconURI is NULL");
  53. _flags = libvlc_renderer_item_flags(_item);
  54. }
  55. return self;
  56. }
  57. - (void *)libVLCRendererItem
  58. {
  59. return _item;
  60. }
  61. @end