mirror of
https://github.com/mpv-player/mpv
synced 2024-12-21 22:30:22 +00:00
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6312 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
414248ded1
commit
08b4af80fa
@ -380,6 +380,7 @@ GtkWidget * create_PopUpMenu( void )
|
||||
}
|
||||
#endif
|
||||
AddSeparator( Menu );
|
||||
AddMenuItem( Menu,"Mute", evMute );
|
||||
AddMenuItem( Menu,MSGTR_MENU_PlayList, evPlayList );
|
||||
AddMenuItem( Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
|
||||
AddMenuItem( Menu,MSGTR_MENU_Preferences, evPreferences );
|
||||
|
@ -2,6 +2,7 @@
|
||||
// main window
|
||||
|
||||
#include "../../libmpdemux/stream.h"
|
||||
#include "../../mixer.h"
|
||||
|
||||
unsigned char * mplDrawBuffer = NULL;
|
||||
int mplMainRender = 1;
|
||||
@ -99,6 +100,7 @@ calclengthmmmmss:
|
||||
case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break;
|
||||
case 'e': if ( guiIntfStruct.Playing == 2 ) strcat( trbuf,"e" ); break;
|
||||
case 'a':
|
||||
// if ( guiIntfStruct.Mute ) { strcat( trbuf,"n" ); break; }
|
||||
switch ( guiIntfStruct.AudioType )
|
||||
{
|
||||
case 0: strcat( trbuf,"n" ); break;
|
||||
@ -373,7 +375,7 @@ NoPause:
|
||||
|
||||
case evIncVolume: vo_x11_putkey( wsGrayMul ); break;
|
||||
case evDecVolume: vo_x11_putkey( wsGrayDiv ); break;
|
||||
case evMute: guiIntfStruct.Mute=1; break;
|
||||
case evMute: mixer_mute(); guiIntfStruct.Mute=muted; break;
|
||||
case evSetVolume:
|
||||
case evSetBalance: guiIntfStruct.VolumeChanged=1; break;
|
||||
|
||||
|
@ -52,6 +52,7 @@ static mp_cmd_t mp_cmds[] = {
|
||||
{ MP_CMD_OSD, "osd",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
|
||||
{ MP_CMD_VOLUME, "volume", 1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } },
|
||||
{ MP_CMD_MIXER_USEMASTER, "use_master", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_MUTE, "mute", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_CONTRAST, "contrast",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_BRIGHTNESS, "brightness",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_HUE, "hue",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
@ -205,6 +206,7 @@ static mp_cmd_bind_t def_cmd_binds[] = {
|
||||
{ { '/', 0 }, "volume -1" },
|
||||
{ { '0', 0 }, "volume 1" },
|
||||
{ { '*', 0 }, "volume 1" },
|
||||
{ { 'm', 0 }, "mute" },
|
||||
{ { '1', 0 }, "contrast -1" },
|
||||
{ { '2', 0 }, "contrast 1" },
|
||||
{ { '3', 0 }, "brightness -1" },
|
||||
@ -220,7 +222,7 @@ static mp_cmd_bind_t def_cmd_binds[] = {
|
||||
{ { 'h', 0 }, "tv_step_channel 1" },
|
||||
{ { 'k', 0 }, "tv_step_channel -1" },
|
||||
{ { 'n', 0 }, "tv_step_norm" },
|
||||
{ { 'm', 0 }, "tv_step_chanlist" },
|
||||
{ { 'u', 0 }, "tv_step_chanlist" },
|
||||
#endif
|
||||
#ifdef HAVE_NEW_GUI
|
||||
{ { 'l', 0 }, "gui_loadfile" },
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define MP_CMD_DVDNAV 22
|
||||
#define MP_CMD_SCREENSHOT 23
|
||||
#define MP_CMD_PANSCAN 24
|
||||
#define MP_CMD_MUTE 25
|
||||
|
||||
#define MP_CMD_GUI_EVENTS 5000
|
||||
#define MP_CMD_GUI_LOADFILE 5001
|
||||
|
@ -282,6 +282,7 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||
#endif
|
||||
#ifdef VO_XMGA
|
||||
case VOCTRL_GET_PANSCAN:
|
||||
if ( !inited || !vo_fs ) return VO_FALSE;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_SET_PANSCAN:
|
||||
if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
|
||||
|
@ -90,6 +90,8 @@ static uint32_t drwcX,drwcY,dwidth,dheight;
|
||||
|
||||
static XSetWindowAttributes xWAttribs;
|
||||
|
||||
static int inited=0;
|
||||
|
||||
#define VO_XMGA
|
||||
#include "mga_common.c"
|
||||
#undef VO_XMGA
|
||||
@ -201,8 +203,6 @@ static void flip_page(void){
|
||||
vo_mga_flip_page();
|
||||
}
|
||||
|
||||
static int inited=0;
|
||||
|
||||
static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t* info)
|
||||
{
|
||||
char * mTitle=(title == NULL) ? "XMGA render" : title;
|
||||
@ -340,7 +340,7 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
|
||||
XSync( mDisplay,False );
|
||||
|
||||
saver_off(mDisplay);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -859,10 +859,9 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||
case VOCTRL_GUISUPPORT:
|
||||
return VO_TRUE;
|
||||
case VOCTRL_GET_PANSCAN:
|
||||
if ( !vo_config_count || !vo_fs ) return VO_FALSE;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_SET_PANSCAN:
|
||||
|
||||
// if((vo_fs && (vo_panscan != vo_panscan_amount)) || (!vo_fs && vo_panscan_amount))
|
||||
if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
|
||||
{
|
||||
panscan_calc();
|
||||
|
@ -370,6 +370,8 @@ else
|
||||
XSync(mDisplay, False);
|
||||
|
||||
saver_off(mDisplay); /* turning off screen saver */
|
||||
|
||||
vo_config_count++;
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -430,6 +432,7 @@ static uint32_t query_format(uint32_t format)
|
||||
|
||||
static void uninit(void)
|
||||
{
|
||||
if ( vo_config_count ) return;
|
||||
vidix_term();
|
||||
|
||||
saver_on(mDisplay); /* screen saver back on */
|
||||
@ -464,6 +467,7 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||
vo_x11_fullscreen();
|
||||
return VO_TRUE;
|
||||
case VOCTRL_GET_PANSCAN:
|
||||
if ( !vo_config_count || !vo_fs ) return VO_FALSE;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_SET_PANSCAN:
|
||||
if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
|
||||
|
16
mixer.c
16
mixer.c
@ -13,6 +13,10 @@ extern ao_functions_t *audio_out;
|
||||
|
||||
char * mixer_device=NULL;
|
||||
|
||||
int muted = 0;
|
||||
float mute_l = 0.0f;
|
||||
float mute_r = 0.0f;
|
||||
|
||||
void mixer_getvolume( float *l,float *r )
|
||||
{
|
||||
ao_control_vol_t vol;
|
||||
@ -33,6 +37,7 @@ void mixer_setvolume( float l,float r )
|
||||
if(CONTROL_OK != audio_out->control(AOCONTROL_SET_VOLUME,(int)&vol))
|
||||
return;
|
||||
}
|
||||
muted=0;
|
||||
}
|
||||
|
||||
#define MIXER_CHANGE 3
|
||||
@ -66,7 +71,16 @@ float mixer_getbothvolume( void )
|
||||
return ( mixer_l + mixer_r ) / 2;
|
||||
}
|
||||
|
||||
|
||||
void mixer_mute( void )
|
||||
{
|
||||
if ( muted ) mixer_setvolume( mute_l,mute_r );
|
||||
else
|
||||
{
|
||||
mixer_getvolume( &mute_l,&mute_r );
|
||||
mixer_setvolume( 0,0 );
|
||||
muted=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
2
mixer.h
2
mixer.h
@ -3,12 +3,14 @@
|
||||
#define __MPLAYER_MIXER
|
||||
|
||||
extern char * mixer_device;
|
||||
extern int muted;
|
||||
|
||||
extern void mixer_getvolume( float *l,float *r );
|
||||
extern void mixer_setvolume( float l,float r );
|
||||
extern void mixer_incvolume( void );
|
||||
extern void mixer_decvolume( void );
|
||||
extern float mixer_getbothvolume( void );
|
||||
void mixer_mute( void );
|
||||
|
||||
//extern void mixer_setbothvolume( int v );
|
||||
#define mixer_setbothvolume( v ) mixer_setvolume( v,v )
|
||||
|
@ -2404,6 +2404,9 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
case MP_CMD_MUTE: {
|
||||
mixer_mute();
|
||||
}
|
||||
case MP_CMD_MIXER_USEMASTER : {
|
||||
} break;
|
||||
case MP_CMD_CONTRAST : {
|
||||
@ -2545,6 +2548,7 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
|
||||
if(video_out && vo_config_count) video_out->control(VOCTRL_FULLSCREEN, 0);
|
||||
} break;
|
||||
case MP_CMD_PANSCAN : {
|
||||
if ( !video_out ) break;
|
||||
if ( video_out->control( VOCTRL_GET_PANSCAN,NULL ) == VO_TRUE )
|
||||
{
|
||||
int abs= cmd->args[1].v.i;
|
||||
|
Loading…
Reference in New Issue
Block a user