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

📄 timer.cpp

📁 video linux conference
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** * timer.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2005 VideoLAN * $Id: timer.cpp 10815 2005-04-26 07:24:39Z fenrir $ * * Authors: Gildas Bazin <gbazin@videolan.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., 59 Temple Place - Suite 330, Boston, MA  02111, USA. *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#include <stdlib.h>                                      /* malloc(), free() */#include <errno.h>                                                 /* ENOMEM */#include <string.h>                                            /* strerror() */#include <stdio.h>#include <vlc/vlc.h>#include <vlc/aout.h>#include <vlc/intf.h>#include "vlc_meta.h"#include "wxwindows.h"#include <wx/timer.h>//void DisplayStreamDate( wxControl *, intf_thread_t *, int );/* Callback prototypes */static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,                        vlc_value_t old_val, vlc_value_t new_val, void *param );static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,                       vlc_value_t old_val, vlc_value_t new_val, void *param );/***************************************************************************** * Constructor. *****************************************************************************/Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface ){    p_intf = _p_intf;    p_main_interface = _p_main_interface;    b_init = 0;    i_old_playing_status = PAUSE_S;    i_old_rate = INPUT_RATE_DEFAULT;    /* Register callback for the intf-popupmenu variable */    playlist_t *p_playlist =        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                       FIND_ANYWHERE );    if( p_playlist != NULL )    {        var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );        var_AddCallback( p_playlist, "intf-show", IntfShowCB, p_intf );        vlc_object_release( p_playlist );    }    Start( 100 /*milliseconds*/, wxTIMER_CONTINUOUS );}Timer::~Timer(){    /* Unregister callback */    playlist_t *p_playlist =        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                       FIND_ANYWHERE );    if( p_playlist != NULL )    {        var_DelCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );        var_DelCallback( p_playlist, "intf-show", IntfShowCB, p_intf );        vlc_object_release( p_playlist );    }    vlc_mutex_lock( &p_intf->change_lock );    if( p_intf->p_sys->p_input ) vlc_object_release( p_intf->p_sys->p_input );    p_intf->p_sys->p_input = NULL;    vlc_mutex_unlock( &p_intf->change_lock );}/***************************************************************************** * Private methods. *****************************************************************************//***************************************************************************** * Manage: manage main thread messages ***************************************************************************** * In this function, called approx. 10 times a second, we check what the * main program wanted to tell us. *****************************************************************************/void Timer::Notify(){#if defined( __WXMSW__ ) /* Work-around a bug with accelerators */    if( !b_init )    {        p_main_interface->Init();        b_init = VLC_TRUE;    }#endif    vlc_mutex_lock( &p_intf->change_lock );    /* Update the input */    if( p_intf->p_sys->p_input == NULL )    {        playlist_t *p_playlist =            (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                           FIND_ANYWHERE );        if( p_playlist != NULL )        {            LockPlaylist( p_intf->p_sys, p_playlist );            p_intf->p_sys->p_input = p_playlist->p_input;            if( p_intf->p_sys->p_input )                vlc_object_yield( p_intf->p_sys->p_input );            UnlockPlaylist( p_intf->p_sys, p_playlist );            vlc_object_release( p_playlist );        }        /* Refresh interface */        if( p_intf->p_sys->p_input )        {            p_main_interface->slider->SetValue( 0 );            char *psz_now_playing = vlc_input_item_GetInfo(                p_intf->p_sys->p_input->input.p_item,                _("Meta-information"), _(VLC_META_NOW_PLAYING) );            if( psz_now_playing && *psz_now_playing )            {                p_main_interface->statusbar->SetStatusText(                    wxString(wxU(psz_now_playing)) + wxT( " - " ) +                    wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );            }            else            {                p_main_interface->statusbar->SetStatusText(                    wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );            }            free( psz_now_playing );            p_main_interface->TogglePlayButton( PLAYING_S );#ifdef wxHAS_TASK_BAR_ICON            if( p_main_interface->p_systray )            {                p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing")));            }#endif            i_old_playing_status = PLAYING_S;        }    }    else if( p_intf->p_sys->p_input->b_dead )    {        //controls auto-hide after a timer        p_main_interface->m_controls_timer.Start(200, wxTIMER_ONE_SHOT);        p_main_interface->TogglePlayButton( PAUSE_S );        i_old_playing_status = PAUSE_S;        p_main_interface->statusbar->SetStatusText( wxT(""), 0 );        p_main_interface->statusbar->SetStatusText( wxT(""), 2 );#ifdef wxHAS_TASK_BAR_ICON        if( p_main_interface->p_systray )        {            p_main_interface->p_systray->UpdateTooltip( wxString(wxT("VLC media player - ")) + wxU(_("Stopped")) );        }#endif        vlc_object_release( p_intf->p_sys->p_input );        p_intf->p_sys->p_input = NULL;    }    if( p_intf->p_sys->p_input )    {        input_thread_t *p_input = p_intf->p_sys->p_input;        vlc_value_t val;        if( !p_input->b_die )        {            vlc_value_t pos;            //prevent the controls from auto-hiding            p_main_interface->m_controls_timer.Stop();            /* New input or stream map change */            p_intf->p_sys->b_playing = 1;            /* Update the item name */            char *psz_now_playing = vlc_input_item_GetInfo(                p_intf->p_sys->p_input->input.p_item,                _("Meta-information"), _(VLC_META_NOW_PLAYING) );            if( psz_now_playing && *psz_now_playing )            {                p_main_interface->statusbar->SetStatusText(                    wxString(wxU(psz_now_playing)) + wxT( " - " ) +                    wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );

⌨️ 快捷键说明

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