[MPlayer-dev-eng] Two questions about the correct behaviour of demuxers

Arpi arpi at thot.banki.hu
Thu Sep 26 20:56:41 CEST 2002


Hi,

> Two questions came to my mind while working on my PVA demuxer, about the 
> behaviour MPlayer expects:
> 
> *    Does the demuxer have to behave in some particular way when 
> -nosound is specified on commandline, or is it in a later stage that the 
> audio data is discarded? I ask this because in order to make -nosound 
> work I had to change my demux_open function so that it checks for 
> demuxer->audio->id >=-1 and does not create the sh_audio structure if it 
> is false (-noaudio sets demuxer->audio->id to -2, doesn't it?). Is this 
> the correct way?

yes.
actually, you shouldn't even read the audio stream, if ds->id!=-1 &&
ds->id!=stream_id

(-1 is special, it means autodetect, so when you find teh first audio
packet, and id==-1 you should set that id to the id of teh packet)

> *    Is it a problem if the demuxer delivers more than one 
> demux_packet_t in one call of demux_fill_buffer() ? This one came to my 
no. but don't deliver too much, it may cause buffer overflow.

> mind while testing my demuxer with -dumpaudio/dumpvideo. It exits 
> complaining about "too many video(/audio) packets in the buffer", after 
it happens because you read the a/v stream even if its id is set to -2
(==ignore it).

> a variable amount of time depending on the file. Since in some 
> situations it might happen that it delivered two video packets in the 
> same fill_buffer call, I thought it might be the problem. But even 
no

the main rule: do not ignore the value if ds->id (demuxer->audio|video->id).
if it's -1, set it to the first available steram id, if it != with the
audio/video stream it then ignore the stream (do not read).


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu



More information about the MPlayer-dev-eng mailing list