AVBlocks for .NET  1.22
Audio and Video Software Development Kit
MediaSocket Class Reference

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

Inheritance diagram for MediaSocket:

Public Member Functions

virtual object Clone ()
 Creates a deep copy of this object. More...
 

Static Public Member Functions

static MediaSocket FromMediaInfo (MediaInfo mediaInfo)
 Creates a media socket from a MediaInfo object. More...
 
static MediaSocket FromPreset (string preset)
 Creates a media socket from an AVBlocks Preset. More...
 

Properties

string File [get, set]
 The file associated with the media socket. More...
 
Metadata Metadata [get, set]
 The socket metadata. More...
 
IDictionary< string, object > Params [get, set]
 A collection of socket parameters. More...
 
IList< MediaPinPins [get]
 A modifiable collection with all the pins (elementary streams) that are defined for this socket. More...
 
System.IO.Stream Stream [get, set]
 The user stream associated with the media socket. More...
 
StreamSubType StreamSubType [get, set]
 Specifies explicitly the subtype of the associated MediaSocket.File or MediaSocket.Stream. More...
 
StreamType StreamType [get, set]
 Specifies explicitly the format of the associated MediaSocket.File or MediaSocket.Stream. More...
 
double TimePosition [get, set]
 Specifies the position within file / stream (in seconds). More...
 

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.

Member Function Documentation

virtual object Clone ( )
virtual

Creates a deep copy of this object.

Returns
A new MediaSocket object
Exceptions
System.OutOfMemoryExceptionThe object cannot be cloned because there's not enough memory.

References Metadata.Clone().

static MediaSocket FromMediaInfo ( MediaInfo  mediaInfo)
static

Creates a media socket from a MediaInfo object.

Parameters
mediaInfoA MediaInfo object with audio/video information. The object may or may not be loaded before calling this function.
This object is not needed after the method returns.
Returns
A new MediaSocket object or null. The MediaSocket object contains the information supplied by the mediaInfo parameter.
When MediaSocket.FromMediaInfo fails, it returns null. In that case use the MediaInfo.Error property to get error information.

This method is meant to help in setting correctly the inputs of a 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.FromMediaInfo(mediaInfo)).

  3. Add the newly created socket to the inputs of a Transcoder (Transcoder.Inputs.Add(socket)).

References MediaInfo.IsReady, and MediaInfo.Load().

static MediaSocket FromPreset ( string  preset)
static

Creates a media socket from an AVBlocks Preset.

Parameters
presetA constant from the Preset enum.
Returns
A new MediaSocket object which is configured for the specified preset .

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 a Preset (MediaSocket.FromPreset(preset)).

  2. Add the newly created socket to the outputs of the Transcoder (Transcoder.Outputs.Add(socket)).

Property Documentation

string File
getset

The file associated with the media socket.

The default value is null.

The socket metadata.

Can be null if the socket has no metadata.

IDictionary<string, object> Params
getset

A collection of socket parameters.

These parameters are used when demuxing the input or multiplexing the output defined by this media socket. The default value of this property is an empty list. A System.Collections.Generic.Dictionary instance can be used to set the parameters.

See Also
Param

Param

IList<MediaPin> Pins
get

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

The default value of this property is an empty collection which can be modified but it cannot be replaced.

System.IO.Stream Stream
getset

The user stream associated with the media socket.

The default value of this property is null.

This is an alternative to the File property. When both a file and a user stream are associated with a socket the Transcoder prefers the user stream.

Specifies explicitly the subtype of the associated MediaSocket.File or MediaSocket.Stream.

The default value of this property is StreamSubType.Unknown.

Specifies explicitly the format of the associated MediaSocket.File or MediaSocket.Stream.

The default value of this property is StreamType.Unknown.

double TimePosition
getset

Specifies the position within file / stream (in seconds).

The transcoder tries to seek to the time position before the transcoding operation starts.

Seeking is not possible while transcoder is open. The Transcoder needs to be closed before setting a new time position with this property.

Returns
Time position (in seconds).