2009/4/10 Michael Conrad <[email protected]>

> On Fri, 10 Apr 2009 06:09:46 -0400, Nicolas Krieger <[email protected]>
> wrote:
>
>>
>> What I have tried was not good and make me think that the information
>> mono/stereo is in the data I give to the soundcard (I first thought there
>> was data for left and data for right).
>>
>
> Sound data ("PCM") is as you describe, "data for left and data for right".
>  They are usually stored in the buffer as a 16-bit left-channel value
> followed by a 16-bit right-channel value, again and again for N samples in
> the buffer.
>
> How does your program open the sound device?  If you are using SDL, you
> need to set "channels = 2" and then take your mono buffers and copy each
> 16-bit value twice into the SDL output buffer.  Or, you can tell SDL that
> you have mono data, and then let SDL convert it for you.
>
> If you wanted silence in the left channel and the mono audio in the right
> channel (as your previous post seemed to say) then you would write 0x0000
> for the left value and then copy 2 bytes from your buffer for the right
> value.
>


I'm not using sdl.
I open the /dev/audio device. I set the number of channels (it is set with
the codec.channels) and the sample rate.
This is how I write datas :
write(_fileDescriptor, buffer, size)
where "buffer" contains the datas decoded by ffmpeg (avcodec_decode_audio2).

Nicolas Krieger
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to