⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playlistinfo.m

📁 uclinux 下的vlc播放器源代码
💻 M
📖 第 1 页 / 共 2 页
字号:
        [o_sent_bytes_txt setStringValue: [NSString stringWithFormat: @"%8.0f kB", \            (float)(p_item->input.p_stats->i_sent_bytes)/1000]];        [o_sent_bitrate_txt setStringValue: [NSString stringWithFormat: \            @"%6.0f kb/s", (float)(p_item->input.p_stats->f_send_bitrate*8)*1000]];        /* Audio */        [o_audio_decoded_txt setStringValue: [NSString stringWithFormat: @"%5i", \            p_item->input.p_stats->i_decoded_audio]];        [o_played_abuffers_txt setStringValue: [NSString stringWithFormat: @"%5i", \            p_item->input.p_stats->i_played_abuffers]];        [o_lost_abuffers_txt setStringValue: [NSString stringWithFormat: @"%5i", \            p_item->input.p_stats->i_lost_abuffers]];        vlc_mutex_unlock( &p_item->input.p_stats->lock );    }}- (IBAction)infoCancel:(id)sender{    [self windowShouldClose: nil];    [o_info_window orderOut: self];}- (IBAction)infoOk:(id)sender{    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                          FIND_ANYWHERE );    vlc_value_t val;    if( [self isItemInPlaylist: p_item] )    {        vlc_mutex_lock( &p_item->input.lock );        p_item->input.psz_uri = strdup( [[o_uri_txt stringValue] UTF8String] );        p_item->input.psz_name = strdup( [[o_title_txt stringValue] UTF8String] );        vlc_mutex_unlock( &p_item->input.lock );        vlc_input_item_AddInfo( &p_item->input, _("Meta-information"), _("Artist"), [[o_author_txt stringValue] UTF8String]);                val.b_bool = VLC_TRUE;        var_Set( p_playlist, "intf-change", val );    }    vlc_object_release( p_playlist );    [self windowShouldClose: nil];    [o_info_window orderOut: self];}- (playlist_item_t *)getItem{    return p_item;}- (BOOL)isItemInPlaylist:(playlist_item_t *)p_local_item{    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                          FIND_ANYWHERE );    int i;    if( p_playlist == NULL )    {        return NO;    }    for( i = 0 ; i < p_playlist->i_all_size ; i++ )    {        if( p_playlist->pp_all_items[i] == p_local_item )        {            vlc_object_release( p_playlist );            return YES;        }    }    vlc_object_release( p_playlist );    return NO;}- (BOOL)windowShouldClose:(id)sender{    if( o_statUpdateTimer )    {        [o_statUpdateTimer invalidate];        [o_statUpdateTimer release];    }    return YES;}@end@implementation VLCInfo (NSMenuValidation)- (BOOL)validateMenuItem:(NSMenuItem *)o_mi{    BOOL bEnabled = TRUE;    intf_thread_t * p_intf = VLCIntf;    input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,                                                       FIND_ANYWHERE );    if( [[o_mi title] isEqualToString: _NS("Information")] )    {        if( p_input == NULL )        {            bEnabled = FALSE;        }    }    if( p_input ) vlc_object_release( p_input );    return( bEnabled );}@end@implementation VLCInfo (NSTableDataSource)- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item{    return (item == nil) ? [[VLCInfoTreeItem rootItem] numberOfChildren] : [item numberOfChildren];}- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {    return ([item numberOfChildren] > 0);}- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item{    return (item == nil) ? [[VLCInfoTreeItem rootItem] childAtIndex:index] : (id)[item childAtIndex:index];}- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item{    if ([[tableColumn identifier] isEqualToString:@"0"])    {        return (item == nil) ? @"" : (id)[item getName];    }    else    {        return (item == nil) ? @"" : (id)[item getValue];    }}@end@implementation VLCInfoTreeItemstatic VLCInfoTreeItem *o_root_item = nil;#define IsALeafNode ((id)-1)- (id)initWithName: (NSString *)o_item_name value: (NSString *)o_item_value ID: (int)i_id parent:(VLCInfoTreeItem *)o_parent_item{    self = [super init];    if( self != nil )    {        o_name = [o_item_name copy];        o_value = [o_item_value copy];        i_object_id = i_id;        o_parent = o_parent_item;        if( [[VLCMain sharedInstance] getInfo] != nil )            p_item = [[[VLCMain sharedInstance] getInfo] getItem];        else            p_item = NULL;    }    return( self );}+ (VLCInfoTreeItem *)rootItem {    if (o_root_item == nil) o_root_item = [[VLCInfoTreeItem alloc] initWithName:@"main" value: @"" ID: 0 parent:nil];    return o_root_item;}- (void)dealloc{    if( o_children != IsALeafNode ) [o_children release];    [o_name release];    [super dealloc];}/* Creates and returns the array of children * Loads children incrementally */- (NSArray *)children{    if (o_children == NULL)    {        int i;        if( [[[VLCMain sharedInstance] getInfo] isItemInPlaylist: p_item] )        {            if( self == o_root_item )            {                vlc_mutex_lock( &p_item->input.lock );                o_children = [[NSMutableArray alloc] initWithCapacity:                                                p_item->input.i_categories];                for (i = 0 ; i < p_item->input.i_categories ; i++)                {                    [o_children addObject:[[VLCInfoTreeItem alloc]                        initWithName: [NSString stringWithUTF8String:                            p_item->input.pp_categories[i]->psz_name]                        value: @""                        ID: i                        parent: self]];                }                vlc_mutex_unlock( &p_item->input.lock );            }            else if( o_parent == o_root_item )            {                vlc_mutex_lock( &p_item->input.lock );                o_children = [[NSMutableArray alloc] initWithCapacity:                    p_item->input.pp_categories[i_object_id]->i_infos];                for (i = 0 ; i < p_item->input.pp_categories[i_object_id]->i_infos ; i++)                {                    [o_children addObject:[[VLCInfoTreeItem alloc]                    initWithName: [NSString stringWithUTF8String:                            p_item->input.pp_categories[i_object_id]->pp_infos[i]->psz_name]                        value: [NSString stringWithUTF8String:                            p_item->input.pp_categories[i_object_id]->pp_infos[i]->psz_value]                        ID: i                        parent: self]];                }                vlc_mutex_unlock( &p_item->input.lock );            }            else            {                o_children = IsALeafNode;            }        }    }    return o_children;}- (NSString *)getName{    return o_name;}- (NSString *)getValue{    return o_value;}- (VLCInfoTreeItem *)childAtIndex:(int)i_index {    return [[self children] objectAtIndex:i_index];}- (int)numberOfChildren {    id i_tmp = [self children];    return ( i_tmp == IsALeafNode ) ? (-1) : (int)[i_tmp count];}/*- (int)selectedPlaylistItem{    return i_item;}*/- (void)refresh{    p_item = [[[VLCMain sharedInstance] getInfo] getItem];    if( o_children != NULL )    {        [o_children release];        o_children = NULL;    }}@end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -