mirror of
https://github.com/mpv-player/mpv
synced 2025-03-10 08:13:03 +00:00
ALSA syc is not so good as OSS - small corrections
added Motif hints memorizing before switching to full screen because WM can modify decorations of the app window git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12097 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
36a536128f
commit
9de08fa0eb
@ -20,13 +20,8 @@
|
||||
#include "../config.h"
|
||||
#include "../mixer.h"
|
||||
|
||||
#if HAVE_SYS_ASOUNDLIB_H
|
||||
#include <sys/asoundlib.h>
|
||||
#elif HAVE_ALSA_ASOUNDLIB_H
|
||||
#define ALSA_PCM_OLD_HW_PARAMS_API
|
||||
#include <alsa/asoundlib.h>
|
||||
#else
|
||||
#error "asoundlib.h is not in sys/ or alsa/ - please bugreport"
|
||||
#endif
|
||||
|
||||
#include "audio_out.h"
|
||||
#include "audio_out_internal.h"
|
||||
@ -44,7 +39,6 @@ static ao_info_t info =
|
||||
|
||||
LIBAO_EXTERN(alsa9)
|
||||
|
||||
|
||||
static snd_pcm_t *alsa_handler;
|
||||
static snd_pcm_format_t alsa_format;
|
||||
static snd_pcm_hw_params_t *alsa_hwparams;
|
||||
@ -75,8 +69,8 @@ static int alsa_can_pause = 0;
|
||||
|
||||
#define ALSA_DEVICE_SIZE 48
|
||||
|
||||
#undef BUFFERTIME
|
||||
#define SET_CHUNKSIZE
|
||||
//#undef BUFFERTIME
|
||||
//#undef SET_CHUNKSIZE
|
||||
#undef USE_POLL
|
||||
|
||||
|
||||
@ -625,7 +619,7 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
snd_strerror(err));
|
||||
return(0);
|
||||
}
|
||||
if (verbose>0)
|
||||
/ if (verbose>0)
|
||||
printf("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, err);
|
||||
}
|
||||
#endif
|
||||
@ -635,12 +629,13 @@ static int init(int rate_hz, int channels, int format, int flags)
|
||||
//set chunksize
|
||||
if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler, alsa_hwparams, chunk_size, 0)) < 0)
|
||||
{
|
||||
printf("alsa-init: unable to set periodsize: %s\n", snd_strerror(err));
|
||||
printf("alsa-init: unable to set periodsize(%d): %s\n",
|
||||
chunk_size, snd_strerror(err));
|
||||
return(0);
|
||||
}
|
||||
else if (verbose>0) {
|
||||
else // if (verbose>0) {
|
||||
printf("alsa-init: chunksize set to %i\n", chunk_size);
|
||||
}
|
||||
// }
|
||||
|
||||
//set period_count
|
||||
if ((period_val = snd_pcm_hw_params_get_periods_max(alsa_hwparams, 0)) < alsa_fragcount) {
|
||||
|
@ -608,19 +608,15 @@ extern int vo_screenheight;
|
||||
static MotifWmHints vo_MotifWmHints;
|
||||
static Atom vo_MotifHints = None;
|
||||
|
||||
// Note: always d==0 !
|
||||
void vo_x11_decoration( Display * vo_Display,Window w,int d )
|
||||
{
|
||||
|
||||
static unsigned int olddecor = MWM_DECOR_ALL;
|
||||
static unsigned int oldfuncs = MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE;
|
||||
Atom mtype;
|
||||
int mformat;
|
||||
unsigned long mn,mb;
|
||||
if ( !WinID ) return;
|
||||
|
||||
if(vo_fsmode&1){
|
||||
XSetWindowAttributes attr;
|
||||
attr.override_redirect = (!d) ? True : False;
|
||||
XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr);
|
||||
// XMapWindow(vo_Display, w);
|
||||
}
|
||||
|
||||
if(vo_fsmode&8){
|
||||
XSetTransientForHint (vo_Display, w, RootWindow(vo_Display,mScreen));
|
||||
}
|
||||
@ -628,12 +624,26 @@ void vo_x11_decoration( Display * vo_Display,Window w,int d )
|
||||
vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 );
|
||||
if ( vo_MotifHints != None )
|
||||
{
|
||||
if (!d) {
|
||||
MotifWmHints *mhints=NULL;
|
||||
XGetWindowProperty(vo_Display,w, vo_MotifHints, 0, 20, False,
|
||||
vo_MotifHints, &mtype, &mformat, &mn,
|
||||
&mb, (unsigned char **)&mhints) ;
|
||||
if (mhints){
|
||||
if (mhints->flags & MWM_HINTS_DECORATIONS)
|
||||
olddecor = mhints->decorations;
|
||||
if (mhints->flags & MWM_HINTS_FUNCTIONS)
|
||||
oldfuncs = mhints->functions;
|
||||
XFree (mhints);
|
||||
}
|
||||
}
|
||||
|
||||
memset( &vo_MotifWmHints,0,sizeof( MotifWmHints ) );
|
||||
vo_MotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
if ( d )
|
||||
{
|
||||
vo_MotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE;
|
||||
d=MWM_DECOR_ALL;
|
||||
vo_MotifWmHints.functions= oldfuncs;
|
||||
d=olddecor;
|
||||
}
|
||||
#if 0
|
||||
vo_MotifWmHints.decorations=d|((vo_fsmode&2)?0:MWM_DECOR_MENU);
|
||||
|
Loading…
Reference in New Issue
Block a user