gnash-dev
[Top][All Lists]
Advanced

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

[Gnash-dev] NetStream (episode 3): Decoders, and full picture


From: strk
Subject: [Gnash-dev] NetStream (episode 3): Decoders, and full picture
Date: Wed, 21 May 2008 14:51:16 +0200

Previous episodes summary: the buffers and playhead
---------------------------------------------------

                +--------------+
                | input stream |
                +--------------+
                       |
                       v
                  ( parser )
                       |
            +----------+-----------+
            |                      |
            v                      v
    +------------------+    +------------------+
    | VideoBuffer      |    | AudioBuffer      |
    +------------------+    +------------------+
    | VideoFrameInfo[] |    | AudioFrameInfo[] |
    +------------------+    +------------------+

The parser process would run in its thread and fill the video/audio
buffers till end of input stream is reached.
The buffers will contain information about frames found in input
(offsets, timestamps).

The parser process would run in its thread and fill the video/audio
buffers till end of input stream is reached.
The buffers will contain information about frames found in input
(offsets, timestamps).

    +------------------+
    | PlayHead         |
    +------------------+
    | currPosition     |
    | playState        |
    | consumeState     |
    +------------------+


The PlayHead is the device controlling final output.

It maintains a play state (PLAYING, PAUSED) which
is only changed by ActionScript processing (NetBuffer.pause).

It maintains a current position (timestamp) which can
be moved by ActionScript (NetBuffer.seek) or by consumers
(decoders).

It maintains a comsume state, which keeps track about
which decoders consumed the current position.


Episode 3: The Decoders, and full picture
-----------------------------------------

The decoders are the consumer of the buffer elements.
They query the [PlayHead] (currPosition, consumeState)
to figure what to decode next (if not done so already)
then access the buffers to do the decoding.

Also, they'll advance the PlayHead position if the current one is found
to be consumed by all decoders.


                             +--------------+
                             | input stream |
                             +--------------+
                                    |
                                    v
                               ( parser )
                                    |
           +------------------------+------------------------+
           |                                                 |
           v                                                 v
  +------------------+                              +------------------+
  | VideoBuffer      |                              | AudioBuffer      |
  +------------------+     +------------------+     +------------------+
  | VideoFrameInfo[] |     | PlayHead         |     | AudioFrameInfo[] |
  +------------------+     +------------------+     +------------------+
           |               | currPosition     |              |
           v               | playState        |              v
    (video_decoder) <----- | consumeState     | -----> (audio_decoder)
           |               |                  |              |
           v               +------------------+              v
  +------------------+                              +------------------+
  |   VideoOutput    |                              |   AudioOutput    |
  +------------------+                              +------------------+


As usual, comments are welcome.

--strk; 

 ()   ASCII Ribbon Campaign
 /\   Keep it simple! 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]