Actionscript/NetStream

From Gnash Project Wiki

Jump to: navigation, search

Contents

NetStream

[ Partially implemented --Tomas 2007-05-28 ]

Supports many fileformats and codecs, not just FLV.

Implemented:

  • method NetStream.close
  • method NetStream.play
  • method NetStream.pause
  • method NetStream.setBufferTime
  • method NetStream.seek
  • event NetStream.Buffer.Empty
  • event NetStream.Buffer.Full
  • event NetStream.Play.Play
  • event NetStream.Play.Stop
  • event NetStream.Play.StreamNotFound

Not implemented:

  • event NetStream.Seek.InvalidTime
  • event NetStream.Seek.Notify
  • ...

There are two implementations NetStreamFfmpeg and NetStreamGst, using ffmpeg and Gstreamer for media decoding respectively. Both are seeing a lot of changes to fix various issues, but here the current implementations will be described.

NetStreamFfmpeg

This uses ffmpeg for decoding the media. The current design features a decoding thread which makes sure that there (hopefully) always is video or audio data ready for the soundhandler or the render. The data is store on a video queue, and an audio queue, which is progressively emptied by the soundhandler and the render. When the queues are running low the decoding thread is "notified" and starts decoding more until the queues have been filled until a certain level, and then it sleeps until next notification.

Behavior for the three main control functions:

play(<url>): First time it is called, nothing has been setup, so the url is saved, and the decoding thread is started.

pause(<mode>): Sets the playback on pause or restart it. If the decoding thread doesn't exist it is created.

close(): Shuts down the decoding thread, and deletes all the decoding setup, except the FLV parser.

NetStreamGst

New Design

There is a new design underway, where NetStreamFfmpeg and NetStreamGst will be removed, and instead NetStream will use the new Libmedia.