AVBlocks for C++  1.9
Audio and Video Software Development Kit
MediaSocket Class Reference

An input or output point of the Transcoder. More...

Inherits Reference.

List of all members.

Public Member Functions

virtual void setFile (const char_t *filename)=0
 Sets the file associated with the media socket.
virtual const char_t * file () const =0
 Returns the file associated with the media socket and previously set via setFile().
virtual void setStream (primo::Stream *stream)=0
 Sets the user stream associated with the media socket.
virtual primo::Streamstream () const =0
 Returns the associated user stream previously set via setStream().
virtual void setStreamType (primo::codecs::StreamType::Enum streamType)=0
 Sets explicitly the format of the associated file or stream.
virtual
primo::codecs::StreamType::Enum 
streamType () const =0
 Returns the stream type of the associated file or user stream.
virtual void setStreamSubType (primo::codecs::StreamSubType::Enum streamSubType)=0
 Sets explicitly the stream subtype of the associated file or user stream.
virtual
primo::codecs::StreamSubType::Enum 
streamSubType () const =0
 Returns the stream subtype of the associated file or user stream.
virtual ParameterListparams () const =0
 Returns a collection of socket parameters.
virtual void setParams (ParameterList *params)=0
 Sets the socket parameters.
virtual MediaPinListpins () const =0
 Returns a modifiable collection with all the pins (elementary streams) that are defined for this socket.
virtual void setTimePosition (double time)=0
 Sets the socket time position.
virtual double timePosition () const =0
 Returns the socket time position.
virtual primo::codecs::Metadatametadata () const =0
 Returns the socket metadata.
virtual void setMetadata (primo::codecs::Metadata *metadata)=0
 Sets the socket metadata.

Static Public Member Functions

static MediaSocketcreateFromMediaInfo (MediaInfo *mediaInfo)
 Creates a media socket from a MediaInfo object.
static MediaSocketcreateFromPreset (Preset::Enum preset, Quality::Enum quality)
 Creates a media socket from an AVBlocks Preset.

Protected Member Functions

 ~MediaSocket ()
 This object can be destroyed only by the AVBlocks library.

Detailed Description

An input or output point of the Transcoder.

A MediaSocket object describes either a container (WAV, AVI, MP4, etc.) with one or more streams or simply an elementary stream (MP3, M2V, etc.).

When MediaSocket describes a container the child collection of media pins can contain one or more items (for each contained stream). The socket stream type designates the container type.

When MediaSocket describes an elementary stream the child collection of media pins contains a single item which is the elementary stream itself. The socket stream type is the same as the pin stream type.

See also:
Library::createMediaSocket
Object Management

Member Function Documentation

MediaSocket * createFromMediaInfo ( MediaInfo mediaInfo) [static]

Creates a media socket from a MediaInfo object.

Parameters:
mediaInfo[in] A pointer to a MediaInfo object with loaded audio/video information. This object is not needed once this method returns.
Returns:
A pointer to a new MediaSocket object which contains the information supplied by the mediaInfo parameter. The caller is responsible for releasing the returned media socket when it is not needed anymore.

This method is meant to help in setting correctly the inputs of the Transcoder. The intended usage is as follows:

  1. Use MediaInfo to load information for a file or user stream.
  2. Create a media socket from the MediaInfo object (MediaSocket::createFromMediaInfo()).
  3. Add the newly created socket to the inputs of the Transcoder (Transcoder::inputs(), MediaSocketList::add()).
  4. Release the media socket if it will not be used outside of the Transcoder.
See also:
MediaInfo
Object Management

References avb_create_media_socket_from_media_info().

MediaSocket * createFromPreset ( Preset::Enum  preset,
Quality::Enum  quality = Quality::Normal 
) [static]

Creates a media socket from an AVBlocks Preset.

Parameters:
preset[in] A constant from the Preset enum.
quality[in] The required quality of the preset. A constant from the Quality enum. Some presets supports various levels of quality, while others support only a fixed quality in which case the quality parameter is ignored.
Returns:
A pointer to a new MediaSocket object which is configured for the specified preset. The caller is responsible for releasing the returned media socket when it is not needed anymore.

This method is meant to help in setting correctly the outputs of the Transcoder. The intended usage is as follows:

  1. Create a media socket from an AVBlocks Preset. (MediaSocket::createFromPreset()).
  2. Add the newly created socket to the outputs of the Transcoder (Transcoder::outputs(), MediaSocketList::add()).
  3. Release the media socket if it will not be used outside of the Transcoder.
See also:
Preset::Enum
Object Management

References avb_create_media_socket_from_preset().

virtual const char_t* file ( ) const [pure virtual]

Returns the file associated with the media socket and previously set via setFile().

Returns:
A filename as a Unicode zero terminated string. Can be NULL if the file is not set. The default value is NULL.
virtual primo::codecs::Metadata* metadata ( ) const [pure virtual]

Returns the socket metadata.

Returns:
A pointer to a Metadata object. Can be NULL if the socket has no metadata.
virtual ParameterList* params ( ) const [pure virtual]

Returns a collection of socket parameters.

These parameters are used when splitting the input or multiplexing the output defined by this media socket.

Returns:
A ParameterList object. Can be NULL if the collection is not set. The default value is NULL.

The caller is not required to release the returned object.

See also:
Object Management
virtual MediaPinList* pins ( ) const [pure virtual]

Returns a modifiable collection with all the pins (elementary streams) that are defined for this socket.

Returns:
A collection of MediaPin objects. The default value is an empty collection which can be modified but it cannot be replaced.

The returned collection exists only in the context of MediaSocket. The caller cannot influence the lifetime of the returned object.

virtual void setFile ( const char_t *  filename) [pure virtual]

Sets the file associated with the media socket.

Parameters:
filename[in] a filename as a Unicode zero terminated string. If NULL the filename is cleared. When not NULL the filename is copied internally and is not required after the method returns.
virtual void setMetadata ( primo::codecs::Metadata metadata) [pure virtual]

Sets the socket metadata.

When an output socket has metadata the transcoder tries to generate it regardless of the input metadata. When an output socket has no metadata (NULL) but an input socket has metadata (not NULL) the transcoder uses the input metadata as if it is set for the output.

Parameters:
metadata[in] A pointer to a Metadata object. Can be NULL in which case the metadata is cleared from the socket.
virtual void setParams ( ParameterList params) [pure virtual]

Sets the socket parameters.

Parameters:
params[in] A pointer to a ParameterList object. If NULL the stored collection is reset to NULL. Internally the ParameterList object is retained by MediaSocket, so it is safe to release it after this method returns.
See also:
Object Management
virtual void setStream ( primo::Stream stream) [pure virtual]

Sets the user stream associated with the media socket.

This is an alternative to setFile().

Parameters:
stream[in] A pointer to a Stream object. If NULL the stream object is cleared. Internally the Stream object is retained by MediaSocket, so it is safe to release it after this method returns.

When both a file and a user stream are associated with a socket the transcoder prefers the stream.

See also:
Object Management
virtual void setStreamType ( primo::codecs::StreamType::Enum  streamType) [pure virtual]

Sets explicitly the format of the associated file or stream.

Parameters:
streamType[in] stream type such as AVI, WAV, MP4, etc.

The Transcoder uses this format and the associated file or stream according to following rules:

Using File, Stream and Type in MediaSocket
File Stream Type How MediaSocket is treated by Transcoder
Y N N OK - the socket defines a file whose type is implicitly determined by the file extension.
Y N Y OK - the socket defines a file whose type is explicitly specified by the stream type.
Y,N Y Y OK - the socket defines a user stream whose type is explicitly specified.
Y,N Y N Error - the socket defines a user stream but its type is unknown.
N N Y OK - the socket does not have a physical storage. it only describes the input/output data. This is the required definition for input sockets when the push() method is used and also the required definition for output sockets when the pull() method is used.
N N N Error - undefined socket.
Returns:
TRUE if the stream type is successfully set, otherwise FALSE.
virtual void setTimePosition ( double  time) [pure virtual]

Sets the socket time position.

This property can be used on an input socket to start reading / decoding from a specific point in time. The transcoder tries to seek in the input socket to the time position before the transcoding operation starts.

Parameters:
time[in] Time position in seconds.
virtual primo::Stream* stream ( ) const [pure virtual]

Returns the associated user stream previously set via setStream().

Returns:
A Stream object. Can be NULL if the associated stream is not set. The default value is NULL.
virtual primo::codecs::StreamSubType::Enum streamSubType ( ) const [pure virtual]

Returns the stream subtype of the associated file or user stream.

Returns:
stream subtype. If not set StreamSubType::Unknown is returned.
virtual primo::codecs::StreamType::Enum streamType ( ) const [pure virtual]

Returns the stream type of the associated file or user stream.

Returns:
stream type. If not set StreamType::Unknown is returned.
virtual double timePosition ( ) const [pure virtual]

Returns the socket time position.

This property can be used on an input socket to start reading / decoding from a specific point in time. The transcoder tries to seek in the input socket to the time position before the transcoding operation starts.

Returns:
Time position in seconds.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator