Waave
An audio video engine
 All Data Structures Functions Variables Groups Pages
Data Fields
WVStreamingObject Struct Reference

Streaming method descriptor. More...

#include <WAAVE.h>


Detailed Description

Streaming method descriptor.

Describe all the methods needed to decode and display video frames. This object must be given as stream parameter to play any video data. However waave library come with a standard streaming object for sdl surface. See corresponding documentation. Note that all object methods will be called by the main thread if there are not declared thread safe.

Data Fields

int srcWidth
 The video native width (Set by decoder)
int srcHeight
 The video native height (Set by decoder)
enum PixelFormat srcFormat
 The video native pixel format (Set by decoder)
int nbSlots
 The number of decoding buffers (Set by user)
int getBufferMethod
 Type of buffer returned by the getBuffer method (Set by user)
int GLRMethod
 Get/Lock/Release synchronization (Set by user)
int getThreadSafety
 Get buffer method thread safety (Set by user)
int LRThreadSafety
 Lock/Release method thread safety (Set by user)
int(* init )(struct WVStreamingObject *streamObj)
 Initialize object parameters and build decoding slots.
WVStreamingBuffer(* getBuffer )(struct WVStreamingObject *streamObj, int slotIdx)
 Give a frame buffer.
int(* lockBuffer )(struct WVStreamingObject *streamObj, int slotIdx)
 Lock the frame buffer.
int(* filterBuffer )(struct WVStreamingObject *streamObj, int slotIdx, WVStreamingBuffer *buffer)
 Filter the buffer with a user defined method.
int(* releaseBuffer )(struct WVStreamingObject *streamObj, int slotIdx)
 Release the buffer after writing.
int(* refreshFrame )(struct WVStreamingObject *streamObj, int slotIdx)
 Refresh the frame by displaying its content.
int(* close )(struct WVStreamingObject *streamObj)
 Close the object.
void * objPrivate
 Private data of the object.

Field Documentation

int(* WVStreamingObject::close)(struct WVStreamingObject *streamObj)

Close the object.

Parameters:
streamObjThe streaming object

Close the object internal data by freeing all the slots.

int(* WVStreamingObject::filterBuffer)(struct WVStreamingObject *streamObj, int slotIdx, WVStreamingBuffer *buffer)

Filter the buffer with a user defined method.

Parameters:
streamObjThe streaming object
slotIdxThe associated slot index
bufferThe buffer previously given

Apply a filter after the decoding step. Need to be thread safe it will be called by the video decoder thread. If it's not, put the method in the releaseBuffer step. If this action is not needed set to NULL.

WVStreamingBuffer(* WVStreamingObject::getBuffer)(struct WVStreamingObject *streamObj, int slotIdx)

Give a frame buffer.

Parameters:
streamObjThe streaming object
slotIdxThe associated slot index

Return a decoding frame buffer. If static get method is used then this will be called one time per slots. If dynamic get is used then this will be called each time we decode a new frame in a slot. Set to NULL if useless !

int WVStreamingObject::getBufferMethod

Type of buffer returned by the getBuffer method (Set by user)

Must be set by user at objet creation or by the init method. Say if the getBuffer method will be called one time per slots so we can reuse the obtained buffers. Or if it is needed to reget a buffer each time we want to decode a frame.

Possible values :

Get buffer method Description
WV_STATIC_GET The buffer will be allocated just one time, so the decoder can reuse it.
WV_DYNAMIC_GET The buffer will be allocated each time the decoder decode a frame.
int WVStreamingObject::getThreadSafety

Get buffer method thread safety (Set by user)

Must be set by user at objet creation or by the init method. Say if the getBuffer method is thread safe and can be called directly by the decoder.

Get Thread Safety Description
WV_THREAD_SAFE Thread safe getBuffer
WV_NO_THREAD_SAFE No thread safe getBuffer
int WVStreamingObject::GLRMethod

Get/Lock/Release synchronization (Set by user)

Must be set by user at objet creation or by the init method. Say when the decoder can reuse a slot to decode a frame.

GLR method Description
WV_SYNC_GLR Just after the frame was displayed, reload the slot
WV_ASYNC_GLR We reload the slot just before the next slot was displayed

The choice depend on method thread safety and Get/Lock/Release behavior.

int(* WVStreamingObject::init)(struct WVStreamingObject *streamObj)

Initialize object parameters and build decoding slots.

Parameters:
streamObjThe streaming object

The init method must set all the object user variables if this has not been done at object creation. It initialize the decoding slot by reading the video native format and prepare decoding buffer creation. This method is always called by the main thread.

int(* WVStreamingObject::lockBuffer)(struct WVStreamingObject *streamObj, int slotIdx)

Lock the frame buffer.

Parameters:
streamObjThe streaming object
slotIdxThe associated slot index

Lock the frame buffer so the decoder can write data on it. If this action is not needed set to NULL.

int WVStreamingObject::LRThreadSafety

Lock/Release method thread safety (Set by user)

Must be set by user at objet creation or by the init method. Say if the lockBuffer and releaseBuffer methods are thread safe and can be called directly by the decoder.

L/R Thread Safety Description
WV_THREAD_SAFE Thread safe lock/release methods
WV_NO_THREAD_SAFE No thread safe lock/release methods
int WVStreamingObject::nbSlots

The number of decoding buffers (Set by user)

A slot is a place where we can decode a video frame independently of the others. The user decides the number of slots that will be built by setting the nbSlots var at object creation or with the init method. This must be bet !

void* WVStreamingObject::objPrivate

Private data of the object.

Private data used by the methods of the object.

int(* WVStreamingObject::refreshFrame)(struct WVStreamingObject *streamObj, int slotIdx)

Refresh the frame by displaying its content.

Parameters:
streamObjThe streaming object
slotIdxThe associated slot index

Method used to display a decoded frame. This will always called by the main thread by the WV_refreshVideoFrame function.

int(* WVStreamingObject::releaseBuffer)(struct WVStreamingObject *streamObj, int slotIdx)

Release the buffer after writing.

Parameters:
streamObjThe streaming object
slotIdxThe associated slot index

Release the buffer after the decoder have writed data on it. If this action is not needed set to NULL.

enum PixelFormat WVStreamingObject::srcFormat

The video native pixel format (Set by decoder)

This is initialized by the decoder and give the video native format (see ffmpeg documentation). This can be used by user methods to adjust the frame buffers relative to native format.

int WVStreamingObject::srcHeight

The video native height (Set by decoder)

This is initialized by the decoder and give the video native height. This can be used by user methods to adjust the frame buffers relative to native format.

int WVStreamingObject::srcWidth

The video native width (Set by decoder)

This is initialized by the decoder and give the video native width. This can be used by user methods to adjust the frame buffers relative to native format.


The documentation for this struct was generated from the following file: