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

📄 controls.m

📁 uclinux 下的vlc播放器源代码
💻 M
📖 第 1 页 / 共 3 页
字号:
/***************************************************************************** * controls.m: MacOS X interface module ***************************************************************************** * Copyright (C) 2002-2006 the VideoLAN team * $Id: controls.m 18961 2007-02-23 13:22:13Z fkuehne $ * * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> *          Christophe Massiot <massiot@via.ecp.fr> *          Derk-Jan Hartman <hartman at videolan dot org> *          Benjamin Pracht <bigben at videolan doit org> *          Felix K焗ne <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 <stdlib.h>                                      /* malloc(), free() */#include <sys/param.h>                                    /* for MAXPATHLEN */#include <string.h>#import "intf.h"#import "vout.h"#import "open.h"#import "controls.h"#import "playlist.h"#include <vlc_osd.h>/***************************************************************************** * VLCControls implementation  *****************************************************************************/@implementation VLCControls- (id)init{    [super init];    o_fs_panel = [[VLCFSPanel alloc] init];    return self;}- (void)awakeFromNib{    [o_specificTime_mi setTitle: _NS("Jump To Time")];    [o_specificTime_cancel_btn setTitle: _NS("Cancel")];    [o_specificTime_ok_btn setTitle: _NS("OK")];    [o_specificTime_sec_lbl setStringValue: _NS("sec.")];    [o_specificTime_goTo_lbl setStringValue: _NS("Jump to time")];}- (IBAction)play:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                        FIND_ANYWHERE );    if( p_playlist )    {        vlc_mutex_lock( &p_playlist->object_lock );        if( p_playlist->i_size <= 0 )        {            vlc_mutex_unlock( &p_playlist->object_lock );            vlc_object_release( p_playlist );            [o_main intfOpenFileGeneric: (id)sender];        }        else        {            vlc_mutex_unlock( &p_playlist->object_lock );            vlc_object_release( p_playlist );        }    }    val.i_int = config_GetInt( p_intf, "key-play-pause" );    var_Set( p_intf->p_vlc, "key-pressed", val );}/* Small helper method */-(id) getVoutView{    id o_window;    id o_vout_view = nil;    id o_embedded_vout_list = [[VLCMain sharedInstance] getEmbeddedList];    NSEnumerator *o_enumerator = [[NSApp orderedWindows] objectEnumerator];    while( !o_vout_view && ( o_window = [o_enumerator nextObject] ) )    {        /* We have an embedded vout */        if( [o_embedded_vout_list windowContainsEmbedded: o_window] )        {            o_vout_view = [o_embedded_vout_list getViewForWindow: o_window];        }        /* We have a detached vout */        else if( [[o_window className] isEqualToString: @"VLCWindow"] )        {            msg_Dbg( VLCIntf, "detached vout controls.m call getVoutView" );            o_vout_view = [o_window getVoutView];        }    }    return o_vout_view;}- (IBAction)stop:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    val.i_int = config_GetInt( p_intf, "key-stop" );    var_Set( p_intf->p_vlc, "key-pressed", val );}- (IBAction)faster:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    val.i_int = config_GetInt( p_intf, "key-faster" );    var_Set( p_intf->p_vlc, "key-pressed", val );}- (IBAction)slower:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    val.i_int = config_GetInt( p_intf, "key-slower" );    var_Set( p_intf->p_vlc, "key-pressed", val );}- (IBAction)prev:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    val.i_int = config_GetInt( p_intf, "key-prev" );    var_Set( p_intf->p_vlc, "key-pressed", val );}- (IBAction)next:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    val.i_int = config_GetInt( p_intf, "key-next" );    var_Set( p_intf->p_vlc, "key-pressed", val );}- (IBAction)random:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                                       FIND_ANYWHERE );    if( p_playlist == NULL )    {        return;    }    var_Get( p_playlist, "random", &val );    val.b_bool = !val.b_bool;    var_Set( p_playlist, "random", val );    if( val.b_bool )    {        vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random On" ) );        config_PutInt( p_playlist, "random", 1 );    }    else    {        vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random Off" ) );        config_PutInt( p_playlist, "random", 0 );    }    p_intf->p_sys->b_playmode_update = VLC_TRUE;    p_intf->p_sys->b_intf_update = VLC_TRUE;    vlc_object_release( p_playlist );}/* three little ugly helpers */- (void)repeatOne{    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat_single_embedded_blue"]];    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_embedded_blue"]];}- (void)repeatAll{    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat_embedded_blue"]];    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_embedded"]];}- (void)repeatOff{    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat_embedded"]];    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_single_embedded_blue"]];}- (void)shuffle{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                               FIND_ANYWHERE );    if( p_playlist == NULL )    {        return;    }    var_Get( p_playlist, "random", &val );    [o_btn_shuffle setState: val.b_bool];    vlc_object_release( p_playlist );}- (IBAction)repeatButtonAction:(id)sender{    vlc_value_t looping,repeating;    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );    if( p_playlist == NULL )    {        return;    }        var_Get( p_playlist, "repeat", &repeating );    var_Get( p_playlist, "loop", &looping );        if( !repeating.b_bool && !looping.b_bool )    {        /* was: no repeating at all, switching to Repeat One */                /* set our button's look */        [self repeatOne];                /* prepare core communication */        repeating.b_bool = VLC_TRUE;        looping.b_bool = VLC_FALSE;        config_PutInt( p_playlist, "repeat", 1 );        config_PutInt( p_playlist, "loop", 0 );                 /* show the change */        vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );    }    else if( repeating.b_bool && !looping.b_bool )    {        /* was: Repeat One, switching to Repeat All */                /* set our button's look */        [self repeatAll];                /* prepare core communication */        repeating.b_bool = VLC_FALSE;        looping.b_bool = VLC_TRUE;        config_PutInt( p_playlist, "repeat", 0 );         config_PutInt( p_playlist, "loop", 1 );                 /* show the change */        vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );    }    else    {        /* was: Repeat All or bug in VLC, switching to Repeat Off */                /* set our button's look */        [self repeatOff];                /* prepare core communication */        repeating.b_bool = VLC_FALSE;        looping.b_bool = VLC_FALSE;        config_PutInt( p_playlist, "repeat", 0 );         config_PutInt( p_playlist, "loop", 0 );                 /* show the change */        vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );    }        /* communicate with core and the main intf loop */    var_Set( p_playlist, "repeat", repeating );    var_Set( p_playlist, "loop", looping );        p_intf->p_sys->b_playmode_update = VLC_TRUE;    p_intf->p_sys->b_intf_update = VLC_TRUE;        vlc_object_release( p_playlist );}- (IBAction)repeat:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                                       FIND_ANYWHERE );    if( p_playlist == NULL )    {        return;    }    var_Get( p_playlist, "repeat", &val );    if (!val.b_bool)    {        var_Set( p_playlist, "loop", val );    }    val.b_bool = !val.b_bool;    var_Set( p_playlist, "repeat", val );    if( val.b_bool )    {        vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );        config_PutInt( p_playlist, "repeat", 1 );    }    else    {        vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );        config_PutInt( p_playlist, "repeat", 0 );    }        p_intf->p_sys->b_playmode_update = VLC_TRUE;    p_intf->p_sys->b_intf_update = VLC_TRUE;    vlc_object_release( p_playlist );}- (IBAction)loop:(id)sender{    vlc_value_t val;    intf_thread_t * p_intf = VLCIntf;    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                                       FIND_ANYWHERE );    if( p_playlist == NULL )    {        return;    }

⌨️ 快捷键说明

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