# HG changeset patch # User gabucino # Date 984923826 0 # Node ID 642d64c1cc33122a392c49ddab6414baf89a5a09 # Parent b58a0827732c9e4635c4f7ac7aa1141b6aba99ae translation by Gabucino diff -r b58a0827732c -r 642d64c1cc33 DOCS/tech/general.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DOCS/tech/general.txt Sun Mar 18 13:57:06 2001 +0000 @@ -0,0 +1,152 @@ + +So, I'll describe how this stuff works. + +The basis of the program's structure is basically logical, however it's +a big hack :) + +The main modules: + +1. streamer.c: this is the input, this reads the file or the VCD. + what it has to know: appropriate buffering, seek, skip functions, + reading by bytes, or blocks with any size. + The stream_t structure describes the input stream, file/device. + +2. demuxer.c: this makes the demultiplexing of the input to audio and video + channels, and their reading by buffered packages. + The demuxer.c is basically a framework, which is the same for all the + input formats, and there are parsers for each of them (mpeg-es, + mpeg-ps, avi, avi-ni, asf), these are in the demux_*.c files. + The structure is the demuxer_t. There is only one demuxer. + +2.a. demuxer stream, that is DS. Its struct is demux_stream_t + Every channel (a/v) has one. + For now, there can be 2 for each demuxer, one for the audio and one + for the video. + +2.b. demux_packet_t, that is DP. + This contains one chunk (avi) or packet (asf,mpg). + In the memory they are stored as chained lists, since they are of + different sizes. + + Now, how this reading works? + - demuxer.c/demux_read_data() is called, it gets how many bytes, + and where (memory address), would we like to read, and from which + DS. The codecs call this. + - this checks if the given DS's buffer contains something, if so, it + reads from there as much as needed. If there isn't enough, it calls + ds_fill_buffer(), which: + - checks if the given DS has buffered packages (DP's), if so, it moves + the oldest to the buffer, and reads on. If the list is empty, it + calls demux_fill_buffer() : + - this calls the parser for the input format, which reads the file + onward, and moves the found packages to their buffers. + Well it we'd like an audio package, but only a bunch of video + packages are available, then sooner or later the: + DEMUXER: Too many (%d in %d bytes) audio packets in the buffer + error shows up. + +So everything is ok 'till now, I want to move them to a separate lib. + +Now, go on: + +3. mplayer.c - ooh, he's the boss :) + The timing is solved odd, since it has/recommended to be done differently + for each of the formats, and sometimes can be done by many ways. + There are the a_frame and v_frame float variables, they store the + just played a/v position is seconds. + A new frame is displayed if v_frame