[vlc-devel] Re: Need some help writing a demux module

Chris Douty Chris_Douty at ampex.com
Sat Oct 2 01:14:48 CEST 2004

On Friday, October 1, 2004, at 02:52 AM, Derk-Jan Hartman wrote:

> On 01 okt 2004, at 04:58, Chris Douty wrote:
>> Hi VLC gurus,
>> First off, you all have my thanks for making this extremely versatile 
>> media player.
>> Now, I have some questions about writing a module from the 
>> perspective of a total neophyte up against a time wall.  My goal is 
>> to write two modules for our multiplexer/solid state recorder.  As a 
>> mux we create a particular format file that happens to contain a 
>> MPEG-2 TS along with a bunch of other junk. (non-audio PCM, gps 
>> readings, occasional timestamps, Death Star plans, etc.)  The other 
>> module will be an access module to connect directly to the recorder 
>> and read the data over a TCP/IP network.  Since I can download files 
>> from the recorder to a normal filesystem and the demux module is 
>> required to understand the data, I am working on it first.
> So you are working with Yet Another Custom Wrapper Fileformat :)
> Those are soooo stupid.

Actually I was being a little canny because this is an commercial 
project.  The actual multiplexer file format is IRIG 106 Chapter 10, 
which is a packetized telemetry format developed by or for the U.S. 
military.  The IRIG standards get worldwide use in both military and 
civilian avionics projects.  Generally the folks who develop these 
standards are pretty damned smart, although they have different needs 
than the MPEG folks for example.

So you are correct in a sense.  It is YACWF.  For our video channels we 
are using the predefined video packet type which slaps a mux header 
with timestamps onto a bundle of some number of ISO 13818-1 TS packets. 
  I think that they chose TS over PS because the fixed size TS packets 
look like PCM frames to telemetry folks which is part of the reason 
that TS packets look the way they do.


>> What am I missing?  How does rate control work?  Do I need to try to 
>> feed the clock? and what?
> You see, this is where these fileformats go wrong. In VLC rate control 
> is based on the timestamping info in your input. And your fileformat 
> probably doesn't have that. The TS has it, but currently sub demux 
> cannot do the rate controlling. So therefore there is no way this can 
> work. Or you need to have some custom time stamping which can be used. 
> a demux should present data to the decoder at a certain time and this 
> time is usually based on the timestamps in media files.

Well, I was trying to be lazy and not decode the whole complicated file 
format.  Chapter 10 has got timestamps out the yin-yang.  Remember the 
purpose of this format is to record sensors in a time-correlated 
fashion.  I've got periodic time packets (1s intervals I think) with 
IRIG B absolute times.  Then each video packets (containing some 
several TS packets) has at least a 10MHz relative counter.

What I don't understand is what to do with this wrt VLC.

> What you can do is either specify the rate yourself (which you are 
> sorta doing with your msleep), or retrieve the rate from the TS and 
> put that in your custom fileformat on the server. Both are suboptimal 
> solutions. It would be better to just provide the TS on the server 
> separately instead of wrapping it, but perhaps you have no control 
> over that.

The format does not have a bitrate per se.  I guess that I could find 
the time packets.  Which fields I what structure do I fill in?

Trying to grok the code I found that the input thread calls my Demux 
function, but it looks like a tight loop.  Do I set PTS or DTS 
somewhere?  Where?

> Another solution i cannot see atm.
>> I am also unsure how to respond to the various demux_query_e 
>> messages.  My base multiplex has a periodic time packet, but doesn't 
>> have a constant bit rate.  For simplicity's sake I don't think that I 
>> will allow seeking on my access module, at least at first.
> same story kinda.


Thanks for your help,

p.s.  Are there any debugging functions for displaying an object graph?
       I'd love to see the tree of objects created with thread ownership.
       Maybe in my spare time, eh?

Christopher Douty <Chris_Douty at ampexdata.com> +1-650-367-3129
Senior Engineer, Software & Systems  - AMPEX Data Systems Corp.

This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html

More information about the vlc-devel mailing list