[MPlayer-dev-eng] merging alsa9/alsa1.x
joy at pingfm.org
joy at pingfm.org
Mon Apr 19 14:55:26 CEST 2004
On Mon, 19 Apr 2004, James Courtier-Dutton wrote:
> joy at pingfm.org wrote:
> > On Fri, 16 Apr 2004, James Courtier-Dutton wrote:
> >>
> >>Why is there a difference between alsa 0.9 and alsa 1.x driver in mplayer.
> >>It is possible with only adding 2 lines to the source code, to make a
> >>single driver that works for 0.9.0rc2 and above.
> >
> > that is exactly what i want, or already did. it's about up to 5 lines,
> > but not many differences though.
> >
> > regards
> >
> > joy
> >
>
> Which 5 lines do you use ?
#ifdef HAVE_ALSA1X
if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler,
alsa_hwparams,
&ao_data.samplerate,
&dir)) < 0)
#else
if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler,
alsa_hwparams,
ao_data.samplerate, 0)) < 0)
#endif
'dir' has to be set to 0.
there would be more if SET_CHUNKSIZE would be set. since i don't think
it's really needed, cause 'chunksize' is set to a reasonable default by
the alsa-api that would be all real changes.
for completness i ifdefd also the SET_CHUNKSIZE part:
#ifdef HAVE_ALSA1X
dir=0;
if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler,
alsa_hwparams,
&chunk_size,
&dir)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set
periodsize(%d): %s\n",
chunk_size, snd_strerror(err));
}
else {
mp_msg(MSGT_AO,MSGL_V,"alsa-init: chunksize set to %i\n",
chunk_size);
}
if ((err = snd_pcm_hw_params_set_periods_near(alsa_handler,
alsa_hwparams,
&alsa_fragcount,
&dir)) < 0) {
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set periods:
%s\n",
snd_strerror(err));
}
else {
mp_msg(MSGT_AO,MSGL_V,"alsa-init: fragcount=%i\n",
alsa_fragcount);
}
#else
if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler,
alsa_hwparams,
chunk_size, 0))
< 0)
{
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set
periodsize(%d): %s\n",
chunk_size, snd_strerror(err));
}
else {
mp_msg(MSGT_AO,MSGL_V,"alsa-init: chunksize set to %i\n",
chunk_size);
}
if ((period_val = snd_pcm_hw_params_get_periods_max(alsa_hwparams,
0))
< alsa_fragcount) {
alsa_fragcount = period_val;
}
mp_msg(MSGT_AO,MSGL_V,"alsa-init: current val=%i, fragcount=%i\n",
period_val, alsa_fragcount);
if ((err = snd_pcm_hw_params_set_periods_near(alsa_handler,
alsa_hwparams,
alsa_fragcount, 0)) < 0) {
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set periods:
%s\n",
snd_strerror(err));
}
#endif
} //end SET_CHUNKSIZE
#endif
>
> My two lines are just to insert these 2 lines somewhere before
> "#include <alsa/asoundlib.h>"
>
> #define ALSA_PCM_NEW_HW_PARAMS_API
> #define ALSA_PCM_NEW_SW_PARAMS_API
>
> So, in your libao2/ao_alsa1x.c would change to: -
> #define ALSA_PCM_NEW_HW_PARAMS_API
> #define ALSA_PCM_NEW_SW_PARAMS_API
> #if HAVE_SYS_ASOUNDLIB_H
> #include <sys/asoundlib.h>
> #elif HAVE_ALSA_ASOUNDLIB_H
> #include <alsa/asoundlib.h>
> #else
> #error "asoundlib.h is not in sys/ or alsa/ - please bugreport"
> #endif
>
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>
regards
joy
________________________________________
do interactive tv on www.remote-tv.de
More information about the MPlayer-dev-eng
mailing list