ILMMpgDmxCallback Interface

The ILMMpgDmxCallback interface is a user-defined interface. It must be registered by setting the ILMMpgDmx::CallbackObj property. Once you do this, the LEAD MPEG-2 demultiplexers will call its members.

Data Types

FileTypeConstants

Summary

Specifies the format of the multiplexed stream.

Syntax

typedef enum FileTypeConstants 
{ 
   Mpeg2_Other_Stream, /* A stream other than MPEG-2 Program or Transport. 
   This is most likely a Raw data stream */ 
   Mpeg2_Program_Stream, /* MPEG-2 Program or MPEG-1 Systems stream */ 
   Mpeg2_Transport_Stream, /* MPEG-2 Transport stream */ 
} FileTypeConstants; 

PTSTypeConstants

Summary

Specifies the type of Presentation Time Stamp (PTS).

Syntax

typedef enum PTSTypeConstants 
{ 
   PTS_Invalid = 0, /* The PTS value is invalid because this sample does not have a PTS timestamp */ 
   PTS_Calculated, /* The PTS value is an approximation calculated by the demux. This sample does not contain a PTS timestamp */ 
   PTS_Valid /* The PTS value is correct and was obtained from the file */ 
} PTSTypeConstants; 

DataFlagConstants

Summary

Specifies the contents of private data packet.

Syntax

typedef enum DataFlagConstants 
{ 
   DataFlag_BeginSample = 1, /* This packet is the beginning of a private data sample */ 
   DataFlag_EndSample = 2, /* This packet is the end of a private data sample */ 
   DataFlag_IsKLV = 4, /* The buffer seems to be KLV data */ 
   DataFlag_IsAscii = 8, /* The buffer seems to be ASCII data */ 
   DataFlag_IsBinary = 0x10, /* The buffer is binary data */ 
   DataFlag_IsSyncPoint = 0x20, /* This is a sync point */ 
   DataFlag_EndOfStream = 0x40, /* The end of stream has been reached */ 
} DataFlagConstants; 

EventNotificationConstants

Summary

Specifies the event type.

Syntax

typedef enum EventNotificationConstants 
{ 
   EVENTTYPE_DISCONTINUITY	= 0, 
   EVENTTYPE_REBUILDNEEDED = ( EVENTTYPE_DISCONTINUITY + 1 ),     /* The stream has changed (the number of streams and the compression might have changed). The graph needs to be rebuilt. lParam1 is one of the RebuildReasonConstants values. */ 
   EVENTTYPE_CORRUPTEDPACKET = ( EVENTTYPE_REBUILDNEEDED + 1 ),   /* A corrupted packet has been discarded. Param1 = PTS timestamp of the packet which was discarded */ 
   EVENTTYPE_COMPRESSIONCHANGED = ( EVENTTYPE_CORRUPTEDPACKET + 1 ), 
   EVENTTYPE_SIZECHANGED = ( EVENTTYPE_COMPRESSIONCHANGED + 1 ), 
   EVENTTYPE_DECODINGSTOPPED = ( EVENTTYPE_SIZECHANGED + 1 ), 
   EVENTTYPE_ENDOFSTREAM = ( EVENTTYPE_DECODINGSTOPPED + 1 ),       /* The end of stream has been reached */ 
   EVENTTYPE_PROGRAMMAPPACKET = ( EVENTTYPE_ENDOFSTREAM + 1 ),  /* A program map packet has been received */ 
   EVENTTYPE_LATENCYINFO = ( EVENTTYPE_PROGRAMMAPPACKET + 1 ),       /* There is updated latency information. Param1 = the amount of data (in ms) buffered by the decoder. Param2 = the amount of data (in ms) buffered by the demux. The playback is most likely jerky if the sum of these values start to fall below 0 or is too close to 0 (for example, less than 100ms). In this case, if you pause the stream briefly the demux can buffer some data */ 
   EVENTTYPE_PROGRAMCOUNT = ( EVENTTYPE_LATENCYINFO + 1 ),      /* The program count has been detected. You can now call ProgramCount to get the number of programs and set CurrentProgram to indicate which program should be played or converted */ 
   EVENTTYPE_PROGRAMINFO = ( EVENTTYPE_PROGRAMCOUNT + 1 ),      /* The program information has been updated. Call GetProgramInfoAsString again to get the updated program information */ 
} EventNotificationConstants; 

RebuildReasonConstants

Summary

This enumeration contains the value for lParam1 when you receive the EVENTTYPE_REBUILDNEEDED notification.

Syntax

typedef enum RebuildReasonConstants 
{ 
   REBUILDREASON_GENERIC = 0, /* The number of streams, compression type or size has changed. It is enough to reconnect the output pins */ 
   REBUILDREASON_BADCLOCK = 1, /* The clock is bad and playback might freeze. The renderer filters probably need to be recreated */ 
} RebuildReasonConstants; 

Methods

HRESULT DataAvailable(VARIANT *pData, long lDataSize, FileTypeConstants fileType, long streamPID, long streamType, PTSTypeConstants PTSType, double PTS, long flags);

Description

Enumerates the private data packets present in the file.

Parameters

pData

Pointer to a variant containing the private data.

lDataSize

A value that represents the size of the data contained in pData.

fileType

An enumerated value describing the format of the multiplexed stream.

streamPID

A PID identifying the stream containing the private data. Use this value to distinguish between the different private data streams in the file.

streamType

The type of private data stream. If the fileType is Mpeg2_Program_Stream, the streamType is one of the values in Table 2-19 of the ISO/IEC 13818-1 specification. Due to copyright restrictions, we cannot place this table here. Example: 0xBF is Private Stream 2.If the fileType is Mpeg2_Transport_Stream, the streamType is one of the values in Table 2-36 of the ISO/IEC 13818-1 specification. Due to copyright restrictions, we cannot place this table here. Example: values 0x0A through 0x0D indicate streams of type KLVA through KLVD.

PTSType

Type of Presentation Time Stamp (PTS). Possible values: PTS_Invalid, PTS_Calculated, PTS_Valid.

PTS

Presentation Time Stamp indicates the time when this data was generated. The PTS should be ignored if PTSType is set to PTS_Invalid.

Flags

One or more DataFlagConstants enumeration values or-ed together.

Comments

There can be more than one private data stream in the file and you should use streamPID to distinguish between the various streams. This chunk might be a portion of a private data packet. Use the Flags value to determine whether this packet is:

If the private data stream is of KLV type (that is, if Flags has DataFlag_IsKLV set), then each packet contains a list of KLV keys and subkeys. In this case, we recommend you use ILMMpgDmx::GetKlvParser to obtain an ILMKlvParser interface. You can use the ILMKlvParser interface to enumerate all the KLV keys present in a packet. For more information on KLV keys and format, see SMPTE 336M-2001.

You can examine Flags to see if the data seems to be:

The demux estimates the type of data based on its contents. If you believe this estimation is wrong, you can interpret the data any way you want.

If DataFlag_EndOfStream is set, the method simply indicates the file playback or conversion has ended and that there are no more private data packets. In this case, you can ignore pData and lDataSize because they don't contain any data.

If you wish to convert and write the private data using the ILMMpg2MxT::WritePrivateData or ILMMpg2MxT::WriteKlvData method, you can convert the PTS to stream position (in seconds) using ILMMpgDmx::ConvertPTSToStreamPosition. See the ILMMpgDmx::ConvertPTSToStreamPosition method for an example.

Returns

Return Description
S_OK Successful.
< 0 Indicates an error situation and abort the playback or conversion.

HRESULT EventNotification(EventNotificationConstants lEventType, double Param1, double Param2);

Description

This method is called when certain events occur. See the EventNotificationConstants enumeration to see which events are currently defined.

Parameters

lEventType

Type of event. See the EventNotificationConstants enumeration for possible values.

Param1

First parameter. The value depends on the type of event. See the EventNotificationConstants enumeration to see which events use this parameter.

Param2

Second parameter. The value depends on the type of event. See the EventNotificationConstants enumeration to see which events use this parameter.

Returns

Return Description
S_OK Successful.
S_FALSE The demux to ask the multimedia toolkit to automatically rebuild the graph. This is valid only for the EVENTTYPE_REBUILDNEEDED event notification.
< 0 Indicates an error situation and abort the playback or conversion.
Help Version 23.0.2024.9.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Filters C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.