IMpeg2Stream::SupplyDataBuffer Method

The SupplyDataBuffer method provides a buffer for the Mpeg2Stream object to write data.


HRESULT SupplyDataBuffer(
  [in]  PMPEG_STREAM_BUFFER pStreamBuffer


  • pStreamBuffer [in]
    Pointer to an MPEG_STREAM_BUFFER structure allocated by the caller. This structure contains a pointer to the buffer, also allocated by the caller. The buffer must be at least 4096 bytes.

Return Value

The method returns an HRESULT. Possible values include those in the following table.

Return code Description


The method succeeded.


Invalid argument or NULL parameter.


Insufficient memory.




The first time this method is called, it starts a worker thread that streams data to the buffer. When the data arrives, the MPEG2Stream object signals the event that was passed to the IMpeg2Stream::Initialize method. (Typically an application specifies the event handle when it calls IMpeg2Data::GetStreamOfSections.)

When the event is signaled, examine the hr field of the MPEG_STREAM_BUFFER structure. If this value is a success code, the request was successful and the buffer contains valid data. To get more data, call the SupplyDataBuffer method again and wait for the event to be signaled.

The section headers are not converted from network byte order or otherwise processed.

If the object is still waiting for data, this method returns E_FAIL.


Header Declared in Mpeg2data.h.

See Also

IMpeg2Stream Interface

Send comments about this topic to Microsoft

Build date: 12/4/2008