Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: Problems playing LPCM audio



On 09 Apr 2002 Dave Chapman <dave@dchapman.com> wrote:

> I am working on an application that plays PCM audio over the DVB card. 

I have done the MP3 playback for VDR, so I have some experience
with LPCM replay, but I cannot give definitive answers.

> My first question is: Does the DVB card support mono playback?  For Stereo I 
> set the "channels" field of the LPCM header to "1".  Trying other values here 
> doesn't seem to set the decoder to mono.   This isn't a major problem (I can 
> always duplicate the data before sending it to the card), but it would be 
> nice to have a definitive answer.

I didn't found a way. I duplicate mono, too.

> My second problem concerns initialising the card for PCM audio playback.  I 
> am creating a PES stream and writing it to /dev/ost/audio, but this only 
> works with a newly loaded driver.  On running my program for a second time, I 
> just get silence.
> 
> What is the correct sequence of commands to initialise a card in an unknown 
> state for playing back of PCM audio?  Do I just need access to the 
> /dev/ost/audio device, or do I need to open and send commands to other 
> devices?  Is this possibly a bug in my PES stream?.

This is a real problem, I asked this before and never got a good
answer. With try&error I found a (weird) sequence which works
most of the time (videoDev is /dev/ost/video, audioDev is
/dev/ost/audio):

To start LPCM play:

ioctl(videoDev, VIDEO_SET_BLANK, true);
ioctl(audioDev, AUDIO_STOP, true);
ioctl(audioDev, AUDIO_CLEAR_BUFFER);
ioctl(audioDev, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY);
ioctl(audioDev, AUDIO_SET_AV_SYNC, false);
ioctl(audioDev, AUDIO_PLAY);

and for live video during play:
ioctl(videoDev, VIDEO_SET_BLANK, false);

or for a black screen during play:
ioctl(videoDev, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
ioctl(videoDev, VIDEO_PLAY);

To stop LPCM play:

ioctl(fd_video, VIDEO_SET_BLANK, true);
sleep(1);
ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
ioctl(fd_video, VIDEO_PLAY);
ioctl(fd_video, VIDEO_STOP, true);
ioctl(fd_audio, AUDIO_STOP, true);
ioctl(fd_video, VIDEO_CLEAR_BUFFER);
ioctl(fd_audio, AUDIO_CLEAR_BUFFER);
ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX);
ioctl(fd_audio, AUDIO_SET_AV_SYNC, true);
ioctl(fd_audio, AUDIO_SET_MUTE, false);

This looks completely erratic, but works most of the time. Most
of the time, means that some time audio is lost after LPCM replay
until tunning to a new channel.

If anyone have a better solution, please let me know.

CU

-- 
Stefan Huelswitt
huels@iname.com  | http://home.pages.de/~nathan


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.


Home | Main Index | Thread Index