* Confused about 'default' device
@ 2007-10-23 19:40 Timur Tabi
2007-10-23 20:45 ` Timur Tabi
2007-10-24 8:54 ` Takashi Iwai
0 siblings, 2 replies; 15+ messages in thread
From: Timur Tabi @ 2007-10-23 19:40 UTC (permalink / raw)
To: alsa-devel
I'm having a hard time understand when ALSA does sample rate and format
conversion, and when it doesn't.
When I issue the following command:
mplayer -ao alsa filename.mov -v
I get this output:
Building audio filter chain for 48000Hz/2ch/s24le -> 0Hz/0ch/s8...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s24le
[dummy] Was reinitialized: 48000Hz/2ch/s24le
alsa-init: requested format: 48000 Hz, 2 channels, 11
alsa-init: using ALSA 1.0.8
alsa-init: setup for 1/2 channel(s)
alsa-init: using device default
alsa-init: pcm opend in blocking mode
alsa-init: format s24le are not supported by hardware, trying default
alsa-lib: pcm_plug.c:729:(snd_pcm_plug_hw_refine_schange) Unable to find
an usable access for 'default'
alsa-init: unable to set format: Invalid argument
Sure enough, my device can't handle s24le. It can only handle s16be.
I was under the impression that ALSA can do format and sample rate conversion if
necessary, but I guess that's not always the case. I know ALSA has a bunch of
plug-ins for that, but I guess they're not used by default.
What do I need to do to tell ALSA to convert s24le to s16be?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-23 19:40 Confused about 'default' device Timur Tabi
@ 2007-10-23 20:45 ` Timur Tabi
2007-10-24 8:54 ` Takashi Iwai
1 sibling, 0 replies; 15+ messages in thread
From: Timur Tabi @ 2007-10-23 20:45 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel
Timur Tabi wrote:
> I'm having a hard time understand when ALSA does sample rate and format
> conversion, and when it doesn't.
Some more info:
I'm trying to play a movie with 441000 Hz audio.
If I specify "-ao alsa", mplayer calls snd_pcm_hw_params_set_rate_near() with a
value of 44100. The call fails and returns an error code.
If I specify "-ao alsa:device=hw=0.0", snd_pcm_hw_params_set_rate_near() does
not fail, even though it's being passed the same parameters.
So what is it about the default device that makes
snd_pcm_hw_params_set_rate_near() fail?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-23 19:40 Confused about 'default' device Timur Tabi
2007-10-23 20:45 ` Timur Tabi
@ 2007-10-24 8:54 ` Takashi Iwai
2007-10-24 11:37 ` Clemens Ladisch
1 sibling, 1 reply; 15+ messages in thread
From: Takashi Iwai @ 2007-10-24 8:54 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel
At Tue, 23 Oct 2007 14:40:26 -0500,
Timur Tabi wrote:
>
> I'm having a hard time understand when ALSA does sample rate and format
> conversion, and when it doesn't.
>
> When I issue the following command:
>
> mplayer -ao alsa filename.mov -v
>
> I get this output:
>
> Building audio filter chain for 48000Hz/2ch/s24le -> 0Hz/0ch/s8...
> [libaf] Adding filter dummy
> [dummy] Was reinitialized: 48000Hz/2ch/s24le
> [dummy] Was reinitialized: 48000Hz/2ch/s24le
> alsa-init: requested format: 48000 Hz, 2 channels, 11
> alsa-init: using ALSA 1.0.8
> alsa-init: setup for 1/2 channel(s)
> alsa-init: using device default
> alsa-init: pcm opend in blocking mode
> alsa-init: format s24le are not supported by hardware, trying default
> alsa-lib: pcm_plug.c:729:(snd_pcm_plug_hw_refine_schange) Unable to find
> an usable access for 'default'
> alsa-init: unable to set format: Invalid argument
>
> Sure enough, my device can't handle s24le. It can only handle s16be.
>
> I was under the impression that ALSA can do format and sample rate conversion if
> necessary, but I guess that's not always the case.
It does. mplayer seems to try first the hardware device without
conversion and falls back to "default" PCM. The problem appears to be
the access type, such as, SND_PCM_ACCESS_RW_INTERLEAVED, MMAP, etc.
Try to set LIBASOUND_DEBUG=1 to see what parameters are being used.
Takashi
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-24 8:54 ` Takashi Iwai
@ 2007-10-24 11:37 ` Clemens Ladisch
2007-10-24 12:35 ` Rene Herman
2007-10-24 16:36 ` Timur Tabi
0 siblings, 2 replies; 15+ messages in thread
From: Clemens Ladisch @ 2007-10-24 11:37 UTC (permalink / raw)
To: Takashi Iwai, Timur Tabi; +Cc: alsa-devel
Takashi Iwai wrote:
> Timur Tabi wrote:
> > I'm having a hard time understand when ALSA does sample rate and format
> > conversion, and when it doesn't.
> >
> > When I issue the following command:
> >
> > mplayer -ao alsa filename.mov -v
> >
> > I get this output:
> > ...
> > alsa-init: using device default
> > alsa-init: format s24le are not supported by hardware
> >
> > I was under the impression that ALSA can do format and sample rate conversion if
> > necessary, but I guess that's not always the case.
>
> It does. mplayer seems to try first the hardware device without
> conversion and falls back to "default" PCM.
In this case, it uses only the "default" PCM device. There seems to be
some problem with its definition.
Are there any definitions in ~/.asoundrc or /etc/asound.conf? If not,
what driver is used, and does it have a file in /usr/share/alsa/cards/?
Regards,
Clemens
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-24 11:37 ` Clemens Ladisch
@ 2007-10-24 12:35 ` Rene Herman
2007-10-24 12:41 ` Clemens Ladisch
2007-10-24 16:36 ` Timur Tabi
1 sibling, 1 reply; 15+ messages in thread
From: Rene Herman @ 2007-10-24 12:35 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel, Timur Tabi
On 10/24/2007 01:37 PM, Clemens Ladisch wrote:
> Takashi Iwai wrote:
>> Timur Tabi wrote:
>>> I'm having a hard time understand when ALSA does sample rate and format
>>> conversion, and when it doesn't.
>>>
>>> When I issue the following command:
>>>
>>> mplayer -ao alsa filename.mov -v
>>>
>>> I get this output:
>>> ...
>>> alsa-init: using device default
>>> alsa-init: format s24le are not supported by hardware
>>>
>>> I was under the impression that ALSA can do format and sample rate conversion if
>>> necessary, but I guess that's not always the case.
>> It does. mplayer seems to try first the hardware device without
>> conversion and falls back to "default" PCM.
>
> In this case, it uses only the "default" PCM device. There seems to be
> some problem with its definition.
>
> Are there any definitions in ~/.asoundrc or /etc/asound.conf? If not,
> what driver is used, and does it have a file in /usr/share/alsa/cards/?
Just in case you guys missed it -- he posted:
===
alsa-init: using ALSA 1.0.8
===
Isn't 1.0.8 from before ALSA did any mixing by default?
Rene.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-24 12:35 ` Rene Herman
@ 2007-10-24 12:41 ` Clemens Ladisch
2007-10-24 12:42 ` Rene Herman
0 siblings, 1 reply; 15+ messages in thread
From: Clemens Ladisch @ 2007-10-24 12:41 UTC (permalink / raw)
To: Rene Herman; +Cc: Takashi Iwai, alsa-devel, Timur Tabi
Rene Herman wrote:
> On 10/24/2007 01:37 PM, Clemens Ladisch wrote:
> > In this case, it uses only the "default" PCM device. There seems to be
> > some problem with its definition.
>
> Just in case you guys missed it -- he posted:
>
> ===
> alsa-init: using ALSA 1.0.8
> ===
>
> Isn't 1.0.8 from before ALSA did any mixing by default?
The default "default" device would do automatic sample format
conversion even in that version.
Regards,
Clemens
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-24 12:41 ` Clemens Ladisch
@ 2007-10-24 12:42 ` Rene Herman
0 siblings, 0 replies; 15+ messages in thread
From: Rene Herman @ 2007-10-24 12:42 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel, Timur Tabi
On 10/24/2007 02:41 PM, Clemens Ladisch wrote:
> Rene Herman wrote:
>> On 10/24/2007 01:37 PM, Clemens Ladisch wrote:
>>> In this case, it uses only the "default" PCM device. There seems to be
>>> some problem with its definition.
>> Just in case you guys missed it -- he posted:
>>
>> ===
>> alsa-init: using ALSA 1.0.8
>> ===
>>
>> Isn't 1.0.8 from before ALSA did any mixing by default?
>
> The default "default" device would do automatic sample format
> conversion even in that version.
Erm, yes, wasn't about mixing. Misread. Never mind.
Rene.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-24 11:37 ` Clemens Ladisch
2007-10-24 12:35 ` Rene Herman
@ 2007-10-24 16:36 ` Timur Tabi
2007-10-25 7:02 ` Clemens Ladisch
1 sibling, 1 reply; 15+ messages in thread
From: Timur Tabi @ 2007-10-24 16:36 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel
Clemens Ladisch wrote:
> Takashi Iwai wrote:
>> Timur Tabi wrote:
>>> I'm having a hard time understand when ALSA does sample rate and format
>>> conversion, and when it doesn't.
>>>
>>> When I issue the following command:
>>>
>>> mplayer -ao alsa filename.mov -v
>>>
>>> I get this output:
>>> ...
>>> alsa-init: using device default
>>> alsa-init: format s24le are not supported by hardware
>>>
>>> I was under the impression that ALSA can do format and sample rate conversion if
>>> necessary, but I guess that's not always the case.
>> It does. mplayer seems to try first the hardware device without
>> conversion and falls back to "default" PCM.
>
> In this case, it uses only the "default" PCM device. There seems to be
> some problem with its definition.
>
> Are there any definitions in ~/.asoundrc or /etc/asound.conf? If not,
> what driver is used, and does it have a file in /usr/share/alsa/cards/?
Ok, I made some progress.
According to http://alsa.opensrc.org/.asoundrc, because I'm using ALSA 1.0.8, I
need to have an .asoundrc. So I added this .asoundrc:
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
And now sample rate conversion works! However, sample format conversion does
not work. When I try to play a movie with an s24le sound track, I get this:
$ MPlayer-1.0rc1/mplayer -ao alsa
video/320x240/sm3_sneak_peek.mov
MPlayer 1.0rc1-3.3.5 (C) 2000-2006 MPlayer Team
AltiVec found
CPU: PowerPC
Playing video/320x240/sm3_sneak_peek.mov.
ISO: File Type Major Brand: Original QuickTime
Quicktime/MOV file format detected.
VIDEO: [avc1] 320x240 24bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s)
vo: couldn't open the X11 display ()!
vo: couldn't open the X11 display ()!
VO XOverlay need a subdriver
vo: couldn't open the X11 display ()!
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 48000 Hz, 2 ch, s24le, 2304.0 kbit/100.00% (ratio:
288000->288000)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
alsa-init: format s24le are not supported by hardware, trying default
alsa-init: unable to set format: Invalid argument
Could not open/initialize audio device -> no sound.
Audio: no sound
Starting playback...
VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: using unscaled yuv420p -> rgb32 special converter
VO: [fbdev] 320x240 => 320x240 ARGB
V: 2.4 74/ 74 4% 5% 0.0% 0 0
Exiting... (Quit)
Does this mean that sample rate conversion is supported, but not sample format
conversion?
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: Confused about 'default' device
2007-10-24 16:36 ` Timur Tabi
@ 2007-10-25 7:02 ` Clemens Ladisch
2007-10-25 14:16 ` Timur Tabi
0 siblings, 1 reply; 15+ messages in thread
From: Clemens Ladisch @ 2007-10-25 7:02 UTC (permalink / raw)
To: Timur Tabi; +Cc: Takashi Iwai, alsa-devel
Timur Tabi wrote:
> Clemens Ladisch wrote:
> > Takashi Iwai wrote:
> >> Timur Tabi wrote:
> > Are there any definitions in ~/.asoundrc or /etc/asound.conf? If not,
> > what driver is used, and does it have a file in /usr/share/alsa/cards/?
>
> Ok, I made some progress.
>
> According to http://alsa.opensrc.org/.asoundrc, because I'm using ALSA
> 1.0.8, I need to have an .asoundrc.
You'd need it to activate dmix, but sample rate/format conversion
already works with earlier versions.
> So I added this .asoundrc:
>
> pcm.!default {
> type hw
> card 0
> }
This disables all automatic conversions.
> And now sample rate conversion works!
Well, it always worked because mplayer does it itself.
Please try this:
pcm.!default = "plughw:0"
And if this works, there is something wrong with you default device
definitions. Please tell us the driver name and whether it has a file
in /usr/share/alsa/cards/.
Regards,
Clemens
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: Confused about 'default' device
2007-10-25 7:02 ` Clemens Ladisch
@ 2007-10-25 14:16 ` Timur Tabi
2007-10-25 15:02 ` Clemens Ladisch
0 siblings, 1 reply; 15+ messages in thread
From: Timur Tabi @ 2007-10-25 14:16 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel
Clemens Ladisch wrote:
> Well, it always worked because mplayer does it itself.
I'm confused. Are you saying the addition of .asoundrc somehow forces mplayer
to do sample-rate conversion where before it didn't because it assumed that Alsa
would do it?
> Please try this:
>
> pcm.!default = "plughw:0"
>
> And if this works, there is something wrong with you default device
> definitions. Please tell us the driver name and whether it has a file
> in /usr/share/alsa/cards/.
I definitely did not add anything to /usr/share/alsa/cards for my audio driver.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-25 14:16 ` Timur Tabi
@ 2007-10-25 15:02 ` Clemens Ladisch
2007-10-25 15:03 ` Timur Tabi
0 siblings, 1 reply; 15+ messages in thread
From: Clemens Ladisch @ 2007-10-25 15:02 UTC (permalink / raw)
To: Timur Tabi; +Cc: Takashi Iwai, alsa-devel
Timur Tabi wrote:
> Clemens Ladisch wrote:
> > Well, it always worked because mplayer does it itself.
>
> I'm confused. Are you saying the addition of .asoundrc somehow forces mplayer
> to do sample-rate conversion where before it didn't because it assumed that Alsa
> would do it?
mplayer disables ALSA's sample rate conversion and always uses its own.
Regards,
Clemens
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-25 15:02 ` Clemens Ladisch
@ 2007-10-25 15:03 ` Timur Tabi
2007-10-26 6:45 ` Clemens Ladisch
0 siblings, 1 reply; 15+ messages in thread
From: Timur Tabi @ 2007-10-25 15:03 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel
Clemens Ladisch wrote:
> mplayer disables ALSA's sample rate conversion and always uses its own.
I don't think that's true. If it always uses its own, then how much it works on
some video files and not others, and how come including a .asoundrc changes the
behavior of mplayer?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-25 15:03 ` Timur Tabi
@ 2007-10-26 6:45 ` Clemens Ladisch
2007-10-26 14:00 ` Timur Tabi
0 siblings, 1 reply; 15+ messages in thread
From: Clemens Ladisch @ 2007-10-26 6:45 UTC (permalink / raw)
To: Timur Tabi; +Cc: Takashi Iwai, alsa-devel
Timur Tabi wrote:
> Clemens Ladisch wrote:
> > mplayer disables ALSA's sample rate conversion and always uses its own.
>
> I don't think that's true.
It's true if you use alsa-lib 1.0.9 or later.
> If it always uses its own, then how much it works on some video files
> and not others, and how come including a .asoundrc changes the
> behavior of mplayer?
mplayer relies on ALSA to do sample _format_ conversion.
Regards,
Clemens
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-26 6:45 ` Clemens Ladisch
@ 2007-10-26 14:00 ` Timur Tabi
2007-10-26 14:43 ` Clemens Ladisch
0 siblings, 1 reply; 15+ messages in thread
From: Timur Tabi @ 2007-10-26 14:00 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel
Clemens Ladisch wrote:
> Timur Tabi wrote:
>> Clemens Ladisch wrote:
>>> mplayer disables ALSA's sample rate conversion and always uses its own.
>> I don't think that's true.
>
> It's true if you use alsa-lib 1.0.9 or later.
What is different between 1.0.8 and 1.0.9 that triggers mplayer to behave
differently?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Confused about 'default' device
2007-10-26 14:00 ` Timur Tabi
@ 2007-10-26 14:43 ` Clemens Ladisch
0 siblings, 0 replies; 15+ messages in thread
From: Clemens Ladisch @ 2007-10-26 14:43 UTC (permalink / raw)
To: Timur Tabi; +Cc: Takashi Iwai, alsa-devel
Timur Tabi wrote:
> Clemens Ladisch wrote:
> > Timur Tabi wrote:
> >> Clemens Ladisch wrote:
> >>> mplayer disables ALSA's sample rate conversion and always uses its own.
> >> I don't think that's true.
> >
> > It's true if you use alsa-lib 1.0.9 or later.
>
> What is different between 1.0.8 and 1.0.9 that triggers mplayer to behave
> differently?
alsa-lib 1.0.9 allows do disable its resampler.
Regards,
Clemens
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2007-10-26 14:43 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-23 19:40 Confused about 'default' device Timur Tabi
2007-10-23 20:45 ` Timur Tabi
2007-10-24 8:54 ` Takashi Iwai
2007-10-24 11:37 ` Clemens Ladisch
2007-10-24 12:35 ` Rene Herman
2007-10-24 12:41 ` Clemens Ladisch
2007-10-24 12:42 ` Rene Herman
2007-10-24 16:36 ` Timur Tabi
2007-10-25 7:02 ` Clemens Ladisch
2007-10-25 14:16 ` Timur Tabi
2007-10-25 15:02 ` Clemens Ladisch
2007-10-25 15:03 ` Timur Tabi
2007-10-26 6:45 ` Clemens Ladisch
2007-10-26 14:00 ` Timur Tabi
2007-10-26 14:43 ` Clemens Ladisch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.