[FFmpeg-devel] [PATCH] lavd/oss: support for more than 2 channels

Paul B Mahol onemda at gmail.com
Fri Jul 20 18:29:47 CEST 2012


On 7/20/12, Paul B Mahol <onemda at gmail.com> wrote:
> On 7/20/12, Nicolas George <nicolas.george at normalesup.org> wrote:
>> Le tridi 3 thermidor, an CCXX, Paul B Mahol a ecrit :
>>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>>> ---
>>>  libavdevice/oss_audio.c |   19 ++++++++++++++-----
>>>  1 files changed, 14 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
>>> index 53acba3..feb3bb2 100644
>>> --- a/libavdevice/oss_audio.c
>>> +++ b/libavdevice/oss_audio.c
>>> @@ -119,11 +119,20 @@ static int audio_open(AVFormatContext *s1, int
>>> is_output, const char *audio_devi
>>>          goto fail;
>>>      }
>>>
>>> -    tmp = (s->channels == 2);
>>> -    err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
>>> -    if (err < 0) {
>>> -        av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_STEREO: %s\n",
>>> strerror(errno));
>>> -        goto fail;
>>> +    if (s->channels > 2) {
>>> +        tmp = s->channels;
>>> +        err = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &tmp);
>>> +        if (err < 0) {
>>> +            av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_CHANNELS: %s\n",
>>> strerror(errno));
>>> +            goto fail;
>>> +        }
>>
>> What is OSS's channel order? My guess is it is the same as ALSA, and if
>> soit
>> needs reordering.
>
> Really? Channel ordering have nothing to do with this patch, without this
> patch more than 2 channels data is not played correctly at all.
> (So better something than nothing). This is what mplayer(2) use.
>

Read this and tell me is that what alsa uses?
http://manuals.opensound.com/developer/SNDCTL_DSP_GET_CHNORDER.html


More information about the ffmpeg-devel mailing list