The ILMFMpgSourceCallback interface is a user-defined interface. It must be registered by setting the ILMFMpgSource::CallbackObj property. Once you do this, the LEAD MPEG-2 media source will call its members.
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;
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;
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 */
} DataFlagConstants;
typedef enum EventNotificationConstants
{
EVENTTYPE_DISCONTINUITY = 0, /* A discontinuity has occurred. */
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 ),/* The compression has changed */
EVENTTYPE_SIZECHANGED = ( EVENTTYPE_COMPRESSIONCHANGED + 1 ), /* The video dimensions (width x height) have changed. */
EVENTTYPE_DECODINGSTOPPED = ( EVENTTYPE_SIZECHANGED + 1 ), /* The decoding has stopped. */
EVENTTYPE_ENDOFSTREAM = ( EVENTTYPE_DECODINGSTOPPED + 1 ), /* The end of stream has been reached */
EVENTTYPE_PROGRAMMAPPACKET = ( EVENTTYPE_ENDOFSTREAM + 1 ), /* A program map packet has been received */
} EventNotificationConstants;
Value | Description |
---|---|
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. |
This method is called to enumerate the private data packets present in the file. 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:
a whole packet (DataFlag_BeginSample
and DataFlag_EndSample
are both set) or
the beginning (only DataFlag_BeginSample
is set) or
the middle (neither DataFlag_BeginSample
or DataFlag_EndSample
is set)
the end (only DataFlag_EndSample
is set)
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:
KLV (DataFlag_IsKLV
is set)
Ascii (DataFlag_IsAscii
is set)
Binary (DataFlag_IsBinary
is set)
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.
S_OK if successful.
< 0 if you want to indicate an error situation and abort the playback or conversion.
Type of event. Possible values are:
Value | Meaning |
---|---|
EVENTTYPE_REBUILDNEEDED |
[0x0001] Indicates that the compression, video size or number of streams has changed and the graph needs to be rebuilt. Return S_OK if your program rebuilds the graph or S_FALSE if you want the demux to tell the MM toolkit to rebuild the graph. lParam1 and lParam2 are not used and should be ignored. |
EVENTTYPE_CORRUPTEDPACKET |
[0x0002] Indicates a corrupted packet has been discarded. lParam1 = PTS timestamp of the packet which was discarded. lParam2 is unused and should be ignored. |
First parameter. The value depends on the type of event. This is not used right now and is reserved for future events.
Second parameter. The value depends on the type of event. This is not used right now and is reserved for future events.
This method is called when certain events occur. The following events are currently defined:
EVENTTYPE_REBUILDNEEDED
:
The compression or the number or type of streams present have changed and that you need to rebuild the graph.
This event is usually sent while you are streaming.
If you are using LEADTOOLS Multimedia, you rebuild the graph by calling put_FileName
with the same input URL.
This event has no parameters (lParam1 and lParam2 should be ignored).
EVENTTYPE_CORRUPTEDPACKET
:lParam1 = PTS
timestamp of the packet which was discarded. lParam2 = should be ignored.
S_OK if successful.
S_FALSE if you want the demux to ask the multimedia toolkit to automatically rebuild the graph. This is valid only for the EVENTTYPE_REBUILDNEEDED
event notification.
< 0 if you want to indicate an error situation and abort the playback or conversion.