org.hfbk.vid.AVStreamingThread Class Reference

Collaboration diagram for org.hfbk.vid.AVStreamingThread:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AVStreamingThread (String url, int maxPixels)
void run ()
void setPlaying (boolean playing)
synchronized void start ()
ByteBuffer getFrame (float dt)
int getAudioSource ()

Public Attributes

boolean running = true

Protected Member Functions

void close ()
void finalize () throws Throwable

Package Functions

void open (final String url, int maxPixels)

Package Attributes

AVAudioThread audioThread
AVVideoThread videoThread
AVFormatContext formatCtx
int audioTrack
int videoTrack

Detailed Description

a media streaming engine based on libavcodec.

playing a media can use up to three threads apart the host application: -this Stream thread to read media from web or file -a AVVideoThread to decode video frames for polling by the host -a AVAudioThread to decode audio data and feed it to OpenAL

the Stream, Audio- and Video- Thread have independent boolean running state. the media is said "playing" of at least one of the Audio- and Video- threads is running. The AVStreamingThread can finish earlier if all media data is already buffered.

the reason for this complicated setup is that we want to play back the video in realtime without any preprocessing. we have to use several ressources to their limits (net download, cpu decoding) so we cannot spoil time on one job waiting for another.

video frames must be polled by the getFrame() method frequently, the audio is handled internally. getAudioSource() can be used to retrieve an OpenAL source to place and control the audio playback.

the media is decoded at a constant rate. however, some glitches may occur: -the Stream is not able to deliver enough data, due to slow drive or web connection. the playback then pauses. -the host application is not able to handle all video frames in time. the stream engine is not influenced by this and the host may pull just as much frames it could handle.

Author:
paul

Definition at line 52 of file AVStreamingThread.java.


Constructor & Destructor Documentation

org.hfbk.vid.AVStreamingThread.AVStreamingThread ( String  url,
int  maxPixels 
)

generate a new Streaming from given url or local file source. this can take quite a long time and maybe fails at all if no connection could be established. the failiure cannot revoke creation of this, but lead to an unusable Streamer.

to begin streaming this Thread needs to be start()ed.

Parameters:
url url to stream media from.

Definition at line 81 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamingThread.audioThread, org.hfbk.vid.AVStreamThread.bytes, org.hfbk.vid.AVStreamingThread.open(), org.hfbk.vid.AVStreamingThread.run(), org.hfbk.vid.AVStreamingThread.running, org.hfbk.vid.AVVideoThread.time, org.hfbk.vid.AVAudioThread.time, and org.hfbk.vid.AVStreamingThread.videoThread.

Here is the call graph for this function:


Member Function Documentation

void org.hfbk.vid.AVStreamingThread.open ( final String  url,
int  maxPixels 
) [package]

Definition at line 106 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamingThread.audioThread, org.hfbk.vid.AVStreamingThread.audioTrack, net.sf.ffmpeg_java.AVCodecLibrary.AVCodecContext.codec_type, org.hfbk.vid.AVStreamingThread.formatCtx, net.sf.ffmpeg_java.AVFormatLibrary.AVFormatContext.getStreams(), net.sf.ffmpeg_java.AVFormatLibrary.AVFormatContext.nb_streams, org.hfbk.vid.AVVideoThread.time, org.hfbk.vid.AVStreamingThread.videoThread, and org.hfbk.vid.AVStreamingThread.videoTrack.

Referenced by org.hfbk.vid.AVStreamingThread.AVStreamingThread().

Here is the call graph for this function:

Here is the caller graph for this function:

void org.hfbk.vid.AVStreamingThread.run (  ) 

streaming main loop. Streams the media from file or web to the responsible AVAudio/VideoThreads.

Definition at line 182 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamThread.add(), org.hfbk.vid.AVStreamingThread.audioThread, org.hfbk.vid.AVStreamingThread.audioTrack, org.hfbk.vid.AVStreamingThread.close(), org.hfbk.vid.AVStreamThread.finished, org.hfbk.vid.AVStreamingThread.formatCtx, org.hfbk.vid.AVStreamThread.getFree(), org.hfbk.vid.AVStreamingThread.running, net.sf.ffmpeg_java.AVFormatLibrary.AVPacket.stream_index, org.hfbk.vid.AVStreamingThread.videoThread, and org.hfbk.vid.AVStreamingThread.videoTrack.

Referenced by org.hfbk.vid.AVStreamingThread.AVStreamingThread().

Here is the call graph for this function:

Here is the caller graph for this function:

void org.hfbk.vid.AVStreamingThread.setPlaying ( boolean  playing  ) 

set the playing state of this stream, can be toggled at any time.

Definition at line 213 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamingThread.audioThread, org.hfbk.vid.AVAudioThread.setPlaying(), org.hfbk.vid.AVStreamThread.setPlaying(), and org.hfbk.vid.AVStreamingThread.videoThread.

Referenced by org.hfbk.vis.visnode.VisVideo.handleEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void org.hfbk.vid.AVStreamingThread.start (  ) 

start the streaming.

Definition at line 219 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamingThread.audioThread, and org.hfbk.vid.AVStreamingThread.videoThread.

Referenced by org.hfbk.vid.AVStreamingThread.getFrame(), and org.hfbk.vis.visnode.VisAudio.renderSelf().

Here is the caller graph for this function:

ByteBuffer org.hfbk.vid.AVStreamingThread.getFrame ( float  dt  ) 

poll one frame of this Stream. does not block.

Returns:
a ByteBuffer containing raw rgb frame compatible to GL_RGB(8) mode or null if it is not the time for the next frame or the Stream is finished.

Definition at line 230 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamingThread.audioThread, org.hfbk.vid.AVVideoThread.out, org.hfbk.vid.AVStreamingThread.start(), org.hfbk.vid.AVVideoThread.time, and org.hfbk.vid.AVStreamingThread.videoThread.

Referenced by org.hfbk.vid.VideoTexture.render().

Here is the call graph for this function:

Here is the caller graph for this function:

int org.hfbk.vid.AVStreamingThread.getAudioSource (  ) 

get the OpenAL audio source associatied with this Stream, if exists.

Returns:
OpenAL source id or 0

Definition at line 251 of file AVStreamingThread.java.

References org.hfbk.vid.AVAudioThread.alThread, org.hfbk.vid.AVStreamingThread.audioThread, and org.dronus.al.ALAudioThread.source.

Referenced by org.hfbk.vis.visnode.VisVideo.renderSelf(), and org.hfbk.vis.visnode.VisAudio.renderSelf().

Here is the caller graph for this function:

void org.hfbk.vid.AVStreamingThread.close (  )  [protected]

closes this Stream, thus stopping fetching and decoding. this is not agressive, audio may keep playing till buffers are emptied.

Definition at line 260 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamingThread.audioThread, org.hfbk.vid.AVStreamingThread.formatCtx, org.hfbk.vid.AVAudioThread.setRunning(), org.hfbk.vid.AVStreamThread.setRunning(), and org.hfbk.vid.AVStreamingThread.videoThread.

Referenced by org.hfbk.vid.AVImageLoader.AVImageLoader(), and org.hfbk.vid.AVStreamingThread.run().

Here is the call graph for this function:

Here is the caller graph for this function:

void org.hfbk.vid.AVStreamingThread.finalize (  )  throws Throwable [protected]

Definition at line 283 of file AVStreamingThread.java.

References org.hfbk.vid.AVStreamingThread.running.


Member Data Documentation

boolean org.hfbk.vid.AVStreamingThread.running = true

this streaming's running state. setting this to false will stop the streaming and close all dependent streams.

Definition at line 56 of file AVStreamingThread.java.

Referenced by org.hfbk.vid.AVStreamingThread.AVStreamingThread(), org.hfbk.vid.VideoTexture.close(), org.hfbk.vid.AVStreamingThread.finalize(), and org.hfbk.vid.AVStreamingThread.run().

AVAudioThread org.hfbk.vid.AVStreamingThread.audioThread [package]

Definition at line 59 of file AVStreamingThread.java.

Referenced by org.hfbk.vid.AVStreamingThread.AVStreamingThread(), org.hfbk.vid.AVStreamingThread.close(), org.hfbk.vid.AVStreamingThread.getAudioSource(), org.hfbk.vid.AVStreamingThread.getFrame(), org.hfbk.vid.AVStreamingThread.open(), org.hfbk.vid.AVStreamingThread.run(), org.hfbk.vid.AVStreamingThread.setPlaying(), and org.hfbk.vid.AVStreamingThread.start().

AVVideoThread org.hfbk.vid.AVStreamingThread.videoThread [package]

Definition at line 60 of file AVStreamingThread.java.

Referenced by org.hfbk.vid.AVImageLoader.AVImageLoader(), org.hfbk.vid.AVStreamingThread.AVStreamingThread(), org.hfbk.vid.AVStreamingThread.close(), org.hfbk.vid.AVStreamingThread.getFrame(), org.hfbk.vid.AVStreamingThread.open(), org.hfbk.vid.AVStreamingThread.run(), org.hfbk.vid.AVStreamingThread.setPlaying(), org.hfbk.vid.AVStreamingThread.start(), and org.hfbk.vid.VideoTexture.VideoTexture().

AVFormatContext org.hfbk.vid.AVStreamingThread.formatCtx [package]

Definition at line 66 of file AVStreamingThread.java.

Referenced by org.hfbk.vid.AVImageLoader.AVImageLoader(), org.hfbk.vid.AVStreamingThread.close(), org.hfbk.vid.AVStreamingThread.open(), and org.hfbk.vid.AVStreamingThread.run().

int org.hfbk.vid.AVStreamingThread.audioTrack [package]

Definition at line 69 of file AVStreamingThread.java.

Referenced by org.hfbk.vid.AVStreamingThread.open(), and org.hfbk.vid.AVStreamingThread.run().

int org.hfbk.vid.AVStreamingThread.videoTrack [package]

Definition at line 69 of file AVStreamingThread.java.

Referenced by org.hfbk.vid.AVImageLoader.AVImageLoader(), org.hfbk.vid.AVStreamingThread.open(), and org.hfbk.vid.AVStreamingThread.run().


The documentation for this class was generated from the following file:
Generated on Tue Apr 7 17:57:59 2009 for visclient by  doxygen 1.5.1