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

📄 playlistinfo.m

📁 uclinux 下的vlc播放器源代码
💻 M
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** r playlistinfo.m: MacOS X interface module ***************************************************************************** * Copyright (C) 2002-2006 the VideoLAN team * $Id: playlistinfo.m 14929 2006-03-25 18:54:58Z fkuehne $ * * Authors: Benjamin Pracht <bigben at videolan dot org> *          Felix Kühne <fkuehne at videolan dot org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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. *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#include "intf.h"#include "playlistinfo.h"#include "playlist.h"/***************************************************************************** * VLCPlaylistInfo Implementation *****************************************************************************/@implementation VLCInfo- (id)init{    self = [super init];    if( self != nil )    {        p_item = NULL;        o_statUpdateTimer = nil;    }    return( self );}- (void)awakeFromNib{    [o_info_window setExcludedFromWindowsMenu: TRUE];    [o_info_window setTitle: _NS("Information")];    [o_uri_lbl setStringValue: _NS("URI")];    [o_title_lbl setStringValue: _NS("Title")];    [o_author_lbl setStringValue: _NS("Author")];    [o_btn_ok setTitle: _NS("OK")];    [o_btn_cancel setTitle: _NS("Cancel")];        [[o_tab_view tabViewItemAtIndex: 0] setLabel: _NS("General")];    [[o_tab_view tabViewItemAtIndex: 1] setLabel: _NS("Advanced Information")];    [[o_tab_view tabViewItemAtIndex: 2] setLabel: _NS("Statistics")];    [o_tab_view selectTabViewItemAtIndex: 0];    /* constants defined in vlc_meta.h */    [o_genre_lbl setStringValue: _NS(VLC_META_GENRE)];    [o_copyright_lbl setStringValue: _NS(VLC_META_COPYRIGHT)];    [o_collection_lbl setStringValue: _NS(VLC_META_COLLECTION)];    [o_seqNum_lbl setStringValue: _NS(VLC_META_SEQ_NUM)];    [o_description_lbl setStringValue: _NS(VLC_META_DESCRIPTION)];    [o_rating_lbl setStringValue: _NS(VLC_META_RATING)];    [o_date_lbl setStringValue: _NS(VLC_META_DATE)];    [o_language_lbl setStringValue: _NS(VLC_META_LANGUAGE)];    [o_nowPlaying_lbl setStringValue: _NS(VLC_META_NOW_PLAYING)];    [o_publisher_lbl setStringValue: _NS(VLC_META_PUBLISHER)];        /* statistics */    [o_input_box setTitle: _NS("Input")];    [o_read_bytes_lbl setStringValue: _NS("Read at media")];    [o_input_bitrate_lbl setStringValue: _NS("Input bitrate")];    [o_demux_bytes_lbl setStringValue: _NS("Demuxed")];    [o_demux_bitrate_lbl setStringValue: _NS("Stream bitrate")];        [o_video_box setTitle: _NS("Video")];    [o_video_decoded_lbl setStringValue: _NS("Decoded blocks")];    [o_displayed_lbl setStringValue: _NS("Displayed frames")];    [o_lost_frames_lbl setStringValue: _NS("Lost frames")];        [o_sout_box setTitle: _NS("Streaming")];    [o_sent_packets_lbl setStringValue: _NS("Sent packets")];    [o_sent_bytes_lbl setStringValue: _NS("Sent bytes")];    [o_sent_bitrate_lbl setStringValue: _NS("Send rate")];        [o_audio_box setTitle: _NS("Audio")];    [o_audio_decoded_lbl setStringValue: _NS("Decoded blocks")];    [o_played_abuffers_lbl setStringValue: _NS("Played buffers")];    [o_lost_abuffers_lbl setStringValue: _NS("Lost buffers")];}- (void)dealloc{    /* make sure that it is released in any case */    if ( o_statUpdateTimer )        [o_statUpdateTimer release];    [super dealloc];}- (IBAction)togglePlaylistInfoPanel:(id)sender{    if( [o_info_window isVisible] )    {        [self windowShouldClose: nil];        [o_info_window orderOut: sender];    }    else    {        p_item = [[[VLCMain sharedInstance] getPlaylist] selectedPlaylistItem];        [self initPanel:sender];    }}- (IBAction)toggleInfoPanel:(id)sender{    if( [o_info_window isVisible] )    {        [self windowShouldClose: nil];        [o_info_window orderOut: sender];    }    else    {        intf_thread_t * p_intf = VLCIntf;        playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                          FIND_ANYWHERE );        if( p_playlist )        {            p_item = p_playlist->status.p_item;            vlc_object_release( p_playlist );        }        BOOL b_stats = config_GetInt(VLCIntf, "stats");        if( b_stats )        {            o_statUpdateTimer = [NSTimer scheduledTimerWithTimeInterval: 1 \                target: self selector: @selector(updateStatistics:) \                userInfo: nil repeats: YES];             [o_statUpdateTimer fire];            [o_statUpdateTimer retain];        }        else        {            if( [o_tab_view numberOfTabViewItems] > 2 )            [o_tab_view removeTabViewItem: [o_tab_view tabViewItemAtIndex: 2]];        }        [self initPanel:sender];    }}- (void)initPanel:(id)sender{    [self updatePanel];    [o_info_window makeKeyAndOrderFront: sender];}- (void)updatePanel{    /* make sure that we got the current item and not an outdated one */    intf_thread_t * p_intf = VLCIntf;        playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                          FIND_ANYWHERE );    if( p_playlist )    {        p_item = p_playlist->status.p_item;        vlc_object_release( p_playlist );    }    /* check whether our item is valid, because we would crash if not */    if(! [self isItemInPlaylist: p_item] ) return;    char *psz_temp;    vlc_mutex_lock( &p_item->input.lock );    /* fill uri / title / author info */    if( p_item->input.psz_uri )    {        [o_uri_txt setStringValue:            ([NSString stringWithUTF8String:p_item->input.psz_uri] == nil ) ?            [NSString stringWithCString:p_item->input.psz_uri] :            [NSString stringWithUTF8String:p_item->input.psz_uri]];    }    if( p_item->input.psz_name )    {        [o_title_txt setStringValue:            ([NSString stringWithUTF8String:p_item->input.psz_name] == nil ) ?            [NSString stringWithCString:p_item->input.psz_name] :            [NSString stringWithUTF8String:p_item->input.psz_name]];    }    vlc_mutex_unlock( &p_item->input.lock );    psz_temp = vlc_input_item_GetInfo( &p_item->input, _("Meta-information"), _("Artist") );    if( psz_temp )    {        [o_author_txt setStringValue: [NSString stringWithUTF8String: psz_temp]];        free( psz_temp );    }    /* fill the other fields */    [self setMeta: VLC_META_GENRE forLabel: o_genre_txt];    [self setMeta: VLC_META_COPYRIGHT forLabel: o_copyright_txt];    [self setMeta: VLC_META_COLLECTION forLabel: o_collection_txt];    [self setMeta: VLC_META_SEQ_NUM forLabel: o_seqNum_txt];    [self setMeta: VLC_META_DESCRIPTION forLabel: o_description_txt];    [self setMeta: VLC_META_RATING forLabel: o_rating_txt];    [self setMeta: VLC_META_DATE forLabel: o_date_txt];    [self setMeta: VLC_META_LANGUAGE forLabel: o_language_txt];    [self setMeta: VLC_META_NOW_PLAYING forLabel: o_nowPlaying_txt];    [self setMeta: VLC_META_PUBLISHER forLabel: o_publisher_txt];    /* reload the advanced table */    [[VLCInfoTreeItem rootItem] refresh];    [o_outline_view reloadData];    /* update the stats once to display p_item change faster */    [self updateStatistics: nil];}- (void)setMeta: (char *)meta forLabel: (id)theItem{    char *psz_meta = vlc_input_item_GetInfo( &p_item->input, \        _(VLC_META_INFO_CAT), _(meta) );    if( psz_meta != NULL && *psz_meta)        [theItem setStringValue: [NSString stringWithUTF8String: psz_meta]];    else        [theItem setStringValue: @"-"];}- (void)updateStatistics:(NSTimer*)theTimer{    if( [self isItemInPlaylist: p_item] )    {        /* we can only do that if there's a valid input around */        vlc_mutex_lock( &p_item->input.p_stats->lock );        /* input */        [o_read_bytes_txt setStringValue: [NSString stringWithFormat: \            @"%8.0f kB", (float)(p_item->input.p_stats->i_read_bytes)/1000]];        [o_input_bitrate_txt setStringValue: [NSString stringWithFormat: \            @"%6.0f kb/s", (float)(p_item->input.p_stats->f_input_bitrate)*8000]];        [o_demux_bytes_txt setStringValue: [NSString stringWithFormat: \            @"%8.0f kB", (float)(p_item->input.p_stats->i_demux_read_bytes)/1000]];        [o_demux_bitrate_txt setStringValue: [NSString stringWithFormat: \            @"%6.0f kb/s", (float)(p_item->input.p_stats->f_demux_bitrate)*8000]];        /* Video */        [o_video_decoded_txt setStringValue: [NSString stringWithFormat: @"%5i", \            p_item->input.p_stats->i_decoded_video]];        [o_displayed_txt setStringValue: [NSString stringWithFormat: @"%5i", \            p_item->input.p_stats->i_displayed_pictures]];        [o_lost_frames_txt setStringValue: [NSString stringWithFormat: @"%5i", \            p_item->input.p_stats->i_lost_pictures]];        /* Sout */        [o_sent_packets_txt setStringValue: [NSString stringWithFormat: @"%5i", \            p_item->input.p_stats->i_sent_packets]];

⌨️ 快捷键说明

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