#include <BltPlayer.h>
Public Types | |
|
typedef BLT_DecoderClient_MessageHandler | EventListener |
| A class must derive from this interface class if it wants to receive event notifications from the player. | |
Public Member Functions | |
| BLT_Player (NPT_MessageQueue *queue=NULL) | |
| Construct a new instance. | |
| virtual | ~BLT_Player () |
| Destruct an instance. | |
| void | SetEventListener (EventListener *listener) |
| Set the event listener that will be called when notification messages are received. | |
| virtual BLT_Result | PumpMessage (bool blocking=true) |
| Dequeue and dispatch one message from the queue. | |
| virtual BLT_Result | SetInput (BLT_CString name, BLT_CString type=NULL) |
| Set the input of the decoder. | |
| virtual BLT_Result | SetOutput (BLT_CString name, BLT_CString type=NULL) |
| Set the output of the decoder. | |
| virtual BLT_Result | Play () |
| Instruct the decoder to start decoding media packets and send them to the output. | |
| virtual BLT_Result | Stop () |
| Instruct the decoder to stop decoding and become idle. | |
| virtual BLT_Result | Pause () |
| Instruct the decoder to pause decoding and become idle. | |
| virtual BLT_Result | SeekToTime (BLT_UInt32 time) |
| Instruct the decoder to seek to a specifc time value. | |
| virtual BLT_Result | SeekToTimeStamp (BLT_UInt8 h, BLT_UInt8 m, BLT_UInt8 s, BLT_UInt8 f) |
| Instruct the decoder to seek to a specific time stamp. | |
| virtual BLT_Result | SeekToPosition (BLT_Size offset, BLT_Size range) |
| Instruct the decoder to seek to a specific position. | |
| virtual BLT_Result | Ping (const void *cookie) |
| Ping the decoder. | |
| virtual BLT_Result | RegisterModule (BLT_Module *module) |
| Register a module with the decoder. | |
| virtual BLT_Result | AddNode (BLT_CString name) |
| Instruct the decoder to instantiate a new node and add it to its decoding stream. | |
| virtual BLT_Result | SetProperty (BLT_PropertyScope scope, const char *target, const char *name, const ATX_PropertyValue *value) |
| Set a property. | |
| virtual BLT_Result | Shutdown () |
| Shutdown the player. | |
| virtual BLT_Result | Interrupt () |
| Send this player a NPT_TerminateMessage message that will cause any caller waiting for a message on the incoming message queue to be unblocked. | |
Protected Member Functions | |
| virtual void | OnAckNotification (BLT_DecoderServer_Message::CommandId id) |
| virtual void | OnNackNotification (BLT_DecoderServer_Message::CommandId id, BLT_Result result) |
| virtual void | OnPongNotification (const void *cookie) |
| virtual void | OnDecoderStateNotification (BLT_DecoderServer::State state) |
| virtual void | OnStreamTimeCodeNotification (BLT_TimeCode timecode) |
| virtual void | OnStreamPositionNotification (BLT_StreamPosition &position) |
| virtual void | OnStreamInfoNotification (BLT_Mask update_mask, BLT_StreamInfo &info) |
| virtual void | OnPropertyNotification (BLT_PropertyScope scope, const char *source, const char *name, const ATX_PropertyValue *value) |
A BLT_Player player creates internally a thread in which a decoder (BLT_Decoder) runs in a decoding loop. The decoding loop receives commands that are sent to it when calling some of the methods of this class. Those commands perform basic player controls, such as the ability to select the input, the output, to play, stop, pause, seek, etc...
An application can choose to either subclass this class and override one or more of the virtual notification callbacks methods (the OnXXX methods of the BLT_DecoderClient_MessageHandler interface class from which this class inherits), or create an instance of this class and pass an event listener to the SetEventListener() method to receive notification callbacks.
| BLT_Player::BLT_Player | ( | NPT_MessageQueue * | queue = NULL |
) |
Construct a new instance.
| queue | pointer to a message queue that should receive messages from the decoder thread. If this parameter is NULL, a message queue will be created automatically. WARNING: it is important that this queue not be destroyed before this player object is destroyed, because it may receive notification messages. If you need to destroy the queue in the destructor of a subclass of this class, call the Shutdown() method before destroying the message queue to ensure that no more notification messages will be posted to the queue. |
| void BLT_Player::SetEventListener | ( | EventListener * | listener | ) |
Set the event listener that will be called when notification messages are received.
By default, there is no event listener when a player is created, so notification messages are just ignored, unless a subclass of this class overrides the virtual methods that handle notification messages (OnXXX virtual methods of the BLT_DecoderClient_MessageHandler class).
| virtual BLT_Result BLT_Player::PumpMessage | ( | bool | blocking = true |
) | [virtual] |
Dequeue and dispatch one message from the queue.
| blocking | Indicate whether this call should block until a message is available, or if it should return right away, regardless of whether a message is available or not. |
| virtual BLT_Result BLT_Player::SetInput | ( | BLT_CString | name, | |
| BLT_CString | type = NULL | |||
| ) | [virtual] |
Set the input of the decoder.
| name | Name of the input | |
| type | Mime-type of the input, if known, or NULL |
| virtual BLT_Result BLT_Player::SetOutput | ( | BLT_CString | name, | |
| BLT_CString | type = NULL | |||
| ) | [virtual] |
Set the output of the decoder.
| name | Name of the output | |
| type | Mime-type of the output, if known. |
| virtual BLT_Result BLT_Player::Pause | ( | ) | [virtual] |
| virtual BLT_Result BLT_Player::SeekToTime | ( | BLT_UInt32 | time | ) | [virtual] |
Instruct the decoder to seek to a specifc time value.
| time | the time to seek to, expressed in milliseconds. |
| virtual BLT_Result BLT_Player::SeekToTimeStamp | ( | BLT_UInt8 | h, | |
| BLT_UInt8 | m, | |||
| BLT_UInt8 | s, | |||
| BLT_UInt8 | f | |||
| ) | [virtual] |
Instruct the decoder to seek to a specific time stamp.
| h | Hours | |
| m | Minutes | |
| s | Seconds | |
| f | Fractions |
| virtual BLT_Result BLT_Player::SeekToPosition | ( | BLT_Size | offset, | |
| BLT_Size | range | |||
| ) | [virtual] |
Instruct the decoder to seek to a specific position.
| offset | Offset between 0 and range | |
| range | Maximum value of offset. The range is an arbitrary scale. For example, if offset=1 and range=2, this means that the decoder should seek to exacly the middle point of the input. Or if offset=25 and range=100, this means that the decoder should seek to the point that is at 25/100 of the total input. |
| virtual BLT_Result BLT_Player::Ping | ( | const void * | cookie | ) | [virtual] |
Ping the decoder.
When the decoding thread processes the ping message, it sends back a pong reply, which will invoke the OnPongNotification notification method when received.
| cookie | Arbitrary pointer value that will be passed back along with the pong notification message. This is typically used by the caller to keep any state information associated with this call. |
| virtual BLT_Result BLT_Player::RegisterModule | ( | BLT_Module * | module | ) | [virtual] |
Register a module with the decoder.
NOTE: the module's methods will be called in the context of the decoding thread. The caller of this method should not make any call to the module's methods after this method call returns.
| module | Pointer to a module object. |
| virtual BLT_Result BLT_Player::AddNode | ( | BLT_CString | name | ) | [virtual] |
Instruct the decoder to instantiate a new node and add it to its decoding stream.
| name | Name of the node to add. |
| virtual BLT_Result BLT_Player::SetProperty | ( | BLT_PropertyScope | scope, | |
| const char * | target, | |||
| const char * | name, | |||
| const ATX_PropertyValue * | value | |||
| ) | [virtual] |
Set a property.
| scope | Scope enum specifying what type of property is being set. | |
| target | Name of the target to which this property applies. For Core (BLT_PROPERTY_SCOPE_CORE) and Stream (BLT_PROPERTY_SCOPE_STREAM) scopes this parameter must be NULL. | |
| name | Name of the property to set. | |
| value | Pointer to the property's value. If this parameter is NULL, the property will be deleted. |
| virtual BLT_Result BLT_Player::Shutdown | ( | ) | [virtual] |
Shutdown the player.
Use this method before deleting the player if you need to ensure that no more asynchronous event callbacks will be made. When this method returns, no other method can be called appart from the destructor.
| virtual BLT_Result BLT_Player::Interrupt | ( | ) | [virtual] |
Send this player a NPT_TerminateMessage message that will cause any caller waiting for a message on the incoming message queue to be unblocked.
CAUTION: this is an advanced function. Only call this is you know exactly what you are doing (it is not often needed).