VLCRendererItem.m 2.19 KB
Newer Older
Soomin Lee's avatar
Soomin Lee committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*****************************************************************************
 * VLCRendererItem.m
 *****************************************************************************
 * Copyright © 2018 VLC authors, VideoLAN
 * Copyright © 2018 Videolabs
 *
 * Authors: Soomin Lee<bubu@mikan.io>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

24
#import "VLCRendererItem.h"
Soomin Lee's avatar
Soomin Lee committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

@interface VLCRendererItem()
{
    libvlc_renderer_item_t *_item;
}
@end

@implementation VLCRendererItem

- (void)dealloc
{
    if (_item) {
        libvlc_renderer_item_release(_item);
    }
}

@end

43
@implementation VLCRendererItem (VLCRendererItemBridging)
Soomin Lee's avatar
Soomin Lee committed
44

45
- (instancetype)initWithRendererItem:(void *)item
Soomin Lee's avatar
Soomin Lee committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
{
    self = [super init];
    if (self) {
        if (!item) {
            NSAssert(!item, @"Renderer item is NULL");
            return nil;
        }

        _item = libvlc_renderer_item_hold(item);

        _name = [NSString stringWithUTF8String:libvlc_renderer_item_name(_item)];
        NSAssert(!_name, @"VLCRendererItem: name is NULL");

        _type = [NSString stringWithUTF8String:libvlc_renderer_item_type(_item)];
        NSAssert(!_type, @"VLCRendererItem: type is NULL");

        _iconURI = [NSString stringWithUTF8String:libvlc_renderer_item_icon_uri(_item)];
        NSAssert(!_iconURI, @"VLCRendererItem: iconURI is NULL");

        _flags = libvlc_renderer_item_flags(_item);
    }
    return self;
}

70
- (void *)libVLCRendererItem
Soomin Lee's avatar
Soomin Lee committed
71 72 73 74 75
{
    return _item;
}

@end