Places a marker in the specified stream.
public:
HRESULT PlaceMarker(
DWORD dwStreamIndex,
LPVOID pvContext
)
dwStreamIndex
Type: DWORD
[in] The zero-based index of the stream.
pvContext
Type: LPVOID
[in] Pointer to an application-defined value. The value of this parameter is returned to the caller in the pvContext parameter of the caller’s IMFSinkWriterCallback::OnMarker callback method. The application is responsible for any memory allocation associated with this data. This parameter can be NULL.
Type: HRESULT
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
| Return code | Description |
|---|---|
| S_OK | The method succeeded. |
| MF_E_INVALIDREQUEST | The request is invalid. |
Refer to Media Foundation return codes.
To use this method, you must provide an asynchronous callback when you create the sink writer. Otherwise, the method returns MF_E_INVALIDREQUEST. For more information, see MF_SINK_WRITER_ASYNC_CALLBACK.
Markers provide a way to be notified when the media sink consumes all of the samples in a stream up to a certain point. The media sink does not process the marker until it has processed all of the samples that came before the marker. When the media sink processes the marker, the sink writer calls the application’s OnMarker method. When the callback is invoked, you know that the sink has consumed all of the previous samples for that stream.
For example, to change the format midstream, call PlaceMarker at the point where the format changes. When OnMarker is called, it is safe to call IMFSinkWriter::SetInputMediaType to change the input type (assuming that the media sink supports dynamic format changes).
Internally, this method calls PlaceMarker on the media sink.
Note
The pvContext parameter of the IMFSinkWriter::PlaceMarker method is not passed to the pvarContextValue parameter of the PlaceMarker method. These two parameters are not directly related.
This interface is available on Windows Vista if Platform Update Supplement for Windows Vista is installed.
Header: Declared in mfreadwrite.h.