summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-06 07:13:57 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-06 07:13:57 +0000
commit08b4af80fac1446b54413219173aeb2e64d8f99d (patch)
tree02d1cdc41b35f56defc6c4930b11f1acc161db47
parent414248ded1fc5c3e32d98124548caaf4828b8407 (diff)
downloadmpv-08b4af80fac1446b54413219173aeb2e64d8f99d.tar.bz2
mpv-08b4af80fac1446b54413219173aeb2e64d8f99d.tar.xz
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
-rw-r--r--Gui/mplayer/gtk/menu.c1
-rw-r--r--Gui/mplayer/mw.h4
-rw-r--r--input/input.c4
-rw-r--r--input/input.h1
-rw-r--r--libvo/mga_common.c1
-rw-r--r--libvo/vo_xmga.c6
-rw-r--r--libvo/vo_xv.c3
-rw-r--r--libvo/vo_xvidix.c4
-rw-r--r--mixer.c16
-rw-r--r--mixer.h2
-rw-r--r--mplayer.c4
11 files changed, 38 insertions, 8 deletions
diff --git a/Gui/mplayer/gtk/menu.c b/Gui/mplayer/gtk/menu.c
index 78bf212eac..41eb584b49 100644
--- a/Gui/mplayer/gtk/menu.c
+++ b/Gui/mplayer/gtk/menu.c
@@ -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 );
diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h
index dfc094f1c9..1a4c881f75 100644
--- a/Gui/mplayer/mw.h
+++ b/Gui/mplayer/mw.h
@@ -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;
diff --git a/input/input.c b/input/input.c
index 16899f62fd..8a5fab5ef3 100644
--- a/input/input.c
+++ b/input/input.c
@@ -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" },
diff --git a/input/input.h b/input/input.h
index 462c142b62..c989c8f585 100644
--- a/input/input.h
+++ b/input/input.h
@@ -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
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index bf3b61eb01..7da081f1be 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -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 ) )
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
index 96e30880f4..9a1f63e3ee 100644
--- a/libvo/vo_xmga.c
+++ b/libvo/vo_xmga.c
@@ -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;
}
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 317941a04e..5f4eca87e6 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -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();
diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c
index c9df998db4..af6ab734d9 100644
--- a/libvo/vo_xvidix.c
+++ b/libvo/vo_xvidix.c
@@ -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 ) )
diff --git a/mixer.c b/mixer.c
index 1d723f65c6..7b647e5b71 100644
--- a/mixer.c
+++ b/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;
+ }
+}
diff --git a/mixer.h b/mixer.h
index 92a59ffc92..5f62375d1a 100644
--- a/mixer.h
+++ b/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 )
diff --git a/mplayer.c b/mplayer.c
index e27a9d5112..640792271c 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -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;