ILMMpg2MxT Interface

This is the interface for the LEAD MPEG2 Transport Multiplexer.

Interface Properties:

 

Type

 

Name

Description

long

 

OutputType

Controls the format of the output stream. Set to a bitwise or of a flag from each of the output type categories (only one flag from each category). See Note 1 at the end of this topic for the possible values.

VARIANT_BOOL

 

AutoClosePrivateData

Set to VARIANT_TRUE to allow the multiplexer to close the application provided private data stream when the normal audio/video stream has reached its end. Otherwise, the multiplexer will wait until the user has called ClosePrivateData. This is typically set to VARIANT_TRUE in a live capture situation.

VARIANT_BOOL

 

EnablePrivateData

Set to VARIANT_TRUE to enable the use of application provided private data.

VARAINT_BOOL

 

IsEndOfStream

A read-only property that indicates whether the multiplexer is at the end of the audio/video streams.

ILMKlvBuilder *

 

KlvBuilder

A read-only property. Contains a pointer to the multiplexer's default KLVBuilder object. This object can be used to construct KLV-specific private data.

long

 

PrivateDataFormatID

The 32 bit Format ID used in the application-provided private data’s registration descriptor. For example mmioFOURCC('K', 'L', 'V', 'A').

long

 

PrivateDataPID

The PID of the application-provided private data.

double

 

ResyncInterval

Specifies the time interval (in seconds) between header packets. This will effectively set the maximum time required for a demultiplexer to start decoding the stream at any given point.

 

Interface Methods:

 

HRESULT ClosePrivateData();

Description

Informs the multiplexer that the application will not be providing any more private data. This will allow the multiplexer to properly close the output stream. This method is not required if the AutoClosePrivateData property is set to VARIANT_TRUE.

Returns

S_OK if successful, < 0 if an error occurred.

 

HRESULT GetPrivateDataFormatInfo(VARIANT* pInfo);

Parameters

pInfo

Pointer to a location to be filled with a byte array containing the user-specified private format information.

Description

Retrieves the information set with SetPrivateFormatInfo.

Returns

S_OK if successful, < 0 if an error occurred.

Common error codes:

E_POINTER                  [0x80004003] pInfo is NULL

 

 

HRESULT SetPrivateDataFormatInfo(VARIANT Info, long InfoLength);

Parameters

pInfo

Variant containing a byte array with user-specified private format information

InfoLength

The size of the data to be written.

Description

Sets the user-specified private format information. It is used as the additional identification information in the registration descriptor. By default, no additional information is written.

Returns

S_OK if successful, < 0 if an error occurred.

Common error codes:

E_INVALIDARG             [0x80070057] Info is not a byte array variant

 

 

HRESULT WritePrivateData(long Flags, double PTS, VARAINT Data, long DataLength);

Parameters

Flags

Long value containing combinations of the Mpg2MxT_WriteFlag constants.

PTS

A double value containing the presentation time stamp of the user-provided data.

Data

A variant containing a byte array of user-provided data.

DataLength

The length of the data to write.

Description

Writes the application-provided data to multiplexer output.

Returns

S_OK if successful, < 0 if an error occurred.

Common error codes:

E_INVALIDARG             [0x80070057] Data is not a byte array variant

 

HRESULT ResetToDefaultsEx(Mpg2MxT_APILEVEL ApiLevel);

Parameters

ApiLevel

The desired API level for reset. Pass Mpg2MxT_APILEVEL_1.

Description

Call this method to ensure future versions of the multiplexer will use the same defaults as the current version. You should call this method before calling any other method in this interface.

If you do not call this method, the multiplexer will use the defaults that were last set by the user in the property page.

Returns

S_OK if successful, < 0 if an error occurred.

Common error codes:

N/A

 

Data types:


Flags being passed to WritePrivateData method:

typedef enum Mpg2MxT_WriteFlag

{

   Mpg2MxT_WriteFlag_PTSValid = 0x00000001,              /* The PTS value is valid */

   Mpg2MxT_WriteFlag_PTSInSeconds = 0x00000002,          /* The PTS value is specified in seconds */

   Mpg2MxT_WriteFlag_UseStreamPTS = 0x00000004,          /* The current stream time should be used instead of the provided PTS */

   Mpg2MxT_WriteFlag_SyncPoint = 0x00000008,             /* The data is a synchronization point, and is seekable */

   Mpg2MxT_WriteFlag_Discontinuity = 0x00000010,         /* reserved */

} Mpg2MxT_WriteFlags;

  

Flags being for the OutputType property:

typedef enum Mpg2MxT_OutputType

{

   Mpg2MxT_OutputType_Default = 0x00000000,              /* Default output mode (non-broadcast) */

   Mpg2MxT_OutputType_Broadcast = 0x00000001,            /* Broadcast mode */

   Mpg2MxT_OutputType_UsePadding = 0x00000010,           /* Use padding to achieve constant bitrate */

   Mpg2MxT_OutputType_AsynchronousMetadata = 0x00000000, /* Write metadata using Asynchronous streams */

   Mpg2MxT_OutputType_SynchronousMetadata = 0x00000020,  /* Write metadata using Synchronous streams */

   Mpg2MxT_OutputType_ValidFlags = 0x00000031,           /* Internal use - Mask used to indicate OutputType flags are valid */

} Mpg2MxT_OutputType;

 

Possible values passed to ResetToDefaultsEx:

typedef enum Mpg2MxT_APILEVEL

{

Mpg2MxT_APILEVEL_1 = 0,                          

} Mpg2MxT_APILEVEL;

 

Note 1: Possible values for the OutputType property

The OutputType property can be set to a bitwise or of at most one flag from each of the following categories. You cannot or two flags from the same category:

 

Output type category:

 

Mpg2MxT_OutputType_Default

 

[0x00000000] Default output mode (non-broadcast)

Mpg2MxT_OutputType_Broadcast

 

[0x00000001] Generate streams compatible with broadcast industry standards.

Padding category:

 

Mpg2MxT_OutputType_UsePadding

 

[0x00000010] Add padding packets to achieve constant bitrate.

Metadata (private data) category:

 

Mpg2MxT_OutputType_AsynchronousMetadata

 

[0x00000000] Write metadata using Asynchronous streams

Mpg2MxT_OutputType_SynchronousMetadata

 

[0x00000020]  Write metadata using Synchronous streams.

 

 

Example 1. To generate non-broadcast streams with Synchronous metadata and no padding, set OutputType to the following value:

Mpg2MxT_OutputType_Default | Mpg2MxT_OutputType_SynchronousMetadata

 

Example 2. To generate broadcast streams with padding, set OutputType to the following value:

Mpg2MxT_OutputType_Broadcast | Mpg2MxT_OutputType_Padding