[FFmpeg-devel] [PATCH] lavd/oss: support for more than 2 channels
Nicolas George
nicolas.george at normalesup.org
Fri Jul 20 09:43:05 CEST 2012
Le tridi 3 thermidor, an CCXX, Paul B Mahol a écrit :
> 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.
Note: I have been considering writing a set of common reordering functions
for some time. Now would probably be the time.
> + } else {
> + 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;
> + }
What happens if you call "SNDCTL_DSP_CHANNELS, 2" instead of
"SNDCTL_DSP_STEREO, 1"?
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120720/fa7403be/attachment.asc>
More information about the ffmpeg-devel
mailing list