Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Windows::Media::StreamingStreamSink Class Reference

#include <HWStreamingMediaSink.h>

Inheritance diagram for Harlinn::Windows::Media::StreamingStreamSink:
[legend]
Collaboration diagram for Harlinn::Windows::Media::StreamingStreamSink:
[legend]

Public Member Functions

virtual HRESULT STDMETHODCALLTYPE GetEvent (DWORD dwFlags, __RPC__deref_out_opt IMFMediaEvent **ppEvent) override
 Retrieves the next event in the queue. This method is synchronous.
 
virtual HRESULT STDMETHODCALLTYPE BeginGetEvent (IMFAsyncCallback *pCallback, IUnknown *punkState) override
 Begins an asynchronous request for the next event in the queue.
 
virtual HRESULT STDMETHODCALLTYPE EndGetEvent (IMFAsyncResult *pResult, _Out_ IMFMediaEvent **ppEvent) override
 Completes an asynchronous request for the next event in the queue.
 
virtual HRESULT STDMETHODCALLTYPE QueueEvent (MediaEventType met, __RPC__in REFGUID guidExtendedType, HRESULT hrStatus, __RPC__in_opt const PROPVARIANT *pvValue) override
 Puts a new event in the object's queue.
 
virtual HRESULT STDMETHODCALLTYPE GetMediaSink (__RPC__deref_out_opt IMFMediaSink **ppMediaSink) override
 Retrieves the media sink that owns this stream sink.
 
virtual HRESULT STDMETHODCALLTYPE GetIdentifier (__RPC__out DWORD *pdwIdentifier) override
 Retrieves the stream identifier for this stream sink.
 
virtual HRESULT STDMETHODCALLTYPE GetMediaTypeHandler (__RPC__deref_out_opt IMFMediaTypeHandler **ppHandler) override
 Retrieves the media type handler for the stream sink. You can use the media type handler to find which formats the stream supports, and to set the media type on the stream.
 
virtual HRESULT STDMETHODCALLTYPE ProcessSample (__RPC__in_opt IMFSample *pSample) override
 Delivers a sample to the stream. The media sink processes the sample.
 
virtual HRESULT STDMETHODCALLTYPE PlaceMarker (MFSTREAMSINK_MARKER_TYPE eMarkerType, __RPC__in const PROPVARIANT *pvarMarkerValue, __RPC__in const PROPVARIANT *pvarContextValue) override
 Places a marker in the stream.
 
virtual HRESULT STDMETHODCALLTYPE Flush () override
 Causes the stream sink to drop any samples that it has received and has not rendered yet.
 
virtual HRESULT STDMETHODCALLTYPE IsMediaTypeSupported (IMFMediaType *pMediaType, _Outptr_opt_result_maybenull_ IMFMediaType **ppMediaType) override
 Queries whether the object supports a specified media type.
 
virtual HRESULT STDMETHODCALLTYPE GetMediaTypeCount (__RPC__out DWORD *pdwTypeCount) override
 Retrieves the number of media types in the object's list of supported media types.
 
virtual HRESULT STDMETHODCALLTYPE GetMediaTypeByIndex (DWORD dwIndex, _Outptr_ IMFMediaType **ppType) override
 Retrieves a media type from the object's list of supported media types.
 
virtual HRESULT STDMETHODCALLTYPE SetCurrentMediaType (IMFMediaType *pMediaType) override
 Sets the object's media type.
 
virtual HRESULT STDMETHODCALLTYPE GetCurrentMediaType (_Outptr_ IMFMediaType **ppMediaType) override
 Retrieves the current media type of the object.
 
virtual HRESULT STDMETHODCALLTYPE GetMajorType (__RPC__out GUID *pguidMajorType) override
 Gets the major media type of the object.
 

Private Attributes

DWORD streamId_ = 0
 

Member Function Documentation

◆ BeginGetEvent()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::BeginGetEvent ( IMFAsyncCallback * pCallback,
IUnknown * punkState )
inlineoverridevirtual

Begins an asynchronous request for the next event in the queue.

Parameters
pCallbackPointer to the IMFAsyncCallback interface of a callback object. The client must implement this interface.
punkStatePointer to the IUnknown interface of a state object, defined by the caller. This parameter can be NULL. You can use this object to hold state information. The object is returned to the caller when the callback is invoked.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • E_INVALIDARG: NULL pointer argument.
  • MF_E_MULTIPLE_BEGIN: There is a pending request with the same callback pointerand a different state object.
  • MF_E_MULTIPLE_SUBSCRIBERS: There is a pending request with a different callback pointer.
  • MF_E_SHUTDOWN: The object was shut down.
  • MF_S_MULTIPLE_BEGIN: There is a pending request with the same callback pointerand state object.

When a new event is available, the event generator calls the IMFAsyncCallback::Invoke method. The Invoke method should call IMFMediaEventGenerator::EndGetEvent to get a pointer to the IMFMediaEvent interface, and use that interface to examine the event.

Do not call BeginGetEvent a second time before calling EndGetEvent. While the first call is still pending, additional calls to the same object will fail. Also, the IMFMediaEventGenerator::GetEvent method fails if an asynchronous request is still pending.

◆ EndGetEvent()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::EndGetEvent ( IMFAsyncResult * pResult,
_Out_ IMFMediaEvent ** ppEvent )
inlineoverridevirtual

Completes an asynchronous request for the next event in the queue.

Parameters
pResultPointer to the IMFAsyncResult interface. Pass in the same pointer that your callback object received in the Invoke method.
ppEventReceives a pointer to the IMFMediaEvent interface. The caller must release the interface.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_SHUTDOWN: The object was shut down.

Call this method from inside your application's IMFAsyncCallback::Invoke method.

◆ Flush()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::Flush ( )
inlineoverridevirtual

Causes the stream sink to drop any samples that it has received and has not rendered yet.

Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_NOT_INITIALIZED: The stream sink has not been initialized yet.You might need to set a media type.
  • MF_E_SHUTDOWN: The media sink's Shutdown method has been called.
  • MF_E_STREAMSINK_REMOVED: This stream was removed from the media sinkand is no longer valid.

If any samples are still queued from previous calls to the IMFStreamSink::ProcessSample method, the media sink immediately discards them, without processing them. This can cause a glitch in the rendered output. The running state of the sink (running, paused, or stopped) does not change.

Any pending marker events from the IMFStreamSink::PlaceMarker method are dispatched immediately, with the status code E_ABORT.

This method is synchronous. It does not return until the sink has discarded all pending samples.

◆ GetCurrentMediaType()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetCurrentMediaType ( _Outptr_ IMFMediaType ** ppMediaType)
inlineoverridevirtual

Retrieves the current media type of the object.

Parameters
ppMediaTypeReceives a pointer to the IMFMediaType interface. The caller must release the interface.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_NOT_INITIALIZED: No media type is set.

◆ GetEvent()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetEvent ( DWORD dwFlags,
__RPC__deref_out_opt IMFMediaEvent ** ppEvent )
inlineoverridevirtual

Retrieves the next event in the queue. This method is synchronous.

Parameters
dwFlags

Specifies one of the following values:

  • 0: The method blocks until the event generator queues an event.
  • MF_EVENT_FLAG_NO_WAIT: The method returns immediately.
Parameters
ppEventReceives a pointer to the IMFMediaEvent interface. The caller must release the interface.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • E_INVALIDARG: NULL pointer argument.
  • MF_E_MULTIPLE_SUBSCRIBERS: There is a pending request.
  • MF_E_NO_EVENTS_AVAILABLE: There are no events in the queue.
  • MF_E_SHUTDOWN: The object was shut down.

This method executes synchronously.

If the queue already contains an event, the method returns S_OK immediately. If the queue does not contain an event, the behavior depends on the value of dwFlags:

  • If dwFlags is 0, the method blocks indefinitely until a new event is queued, or until the event generator is shut down.
  • If dwFlags is MF_EVENT_FLAG_NO_WAIT, the method fails immediately with the return code MF_E_NO_EVENTS_AVAILABLE.

This method returns MF_E_MULTIPLE_SUBSCRIBERS if you previously called IMFMediaEventGenerator::BeginGetEvent and have not yet called IMFMediaEventGenerator::EndGetEvent.

◆ GetIdentifier()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetIdentifier ( __RPC__out DWORD * pdwIdentifier)
inlineoverridevirtual

Retrieves the stream identifier for this stream sink.

Parameters
pdwIdentifierReceives the stream identifier. If this stream sink was added by calling IMFMediaSink::AddStreamSink, the stream identifier is in the dwStreamSinkIdentifier parameter of that method. Otherwise, the media sink defines the identifier.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_SHUTDOWN: The media sink's Shutdown method has been called.
  • MF_E_STREAMSINK_REMOVED: This stream was removed from the media sinkand is no longer valid.

◆ GetMajorType()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetMajorType ( __RPC__out GUID * pguidMajorType)
inlineoverridevirtual

Gets the major media type of the object.

Parameters
pguidMajorTypeReceives a GUID that identifies the major type. For a list of possible values, see Major Media Types.
Returns
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

The major type identifies what kind of data is in the stream, such as audio or video. To get the specific details of the format, call IMFMediaTypeHandler::GetCurrentMediaType.

◆ GetMediaSink()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetMediaSink ( __RPC__deref_out_opt IMFMediaSink ** ppMediaSink)
inlineoverridevirtual

Retrieves the media sink that owns this stream sink.

Parameters
ppMediaSinkReceives a pointer to the media sink's IMFMediaSink interface. The caller must release the interface.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_SHUTDOWN: The media sink's Shutdown method has been called.
  • MF_E_STREAMSINK_REMOVED: This stream was removed from the media sinkand is no longer valid.

◆ GetMediaTypeByIndex()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetMediaTypeByIndex ( DWORD dwIndex,
_Outptr_ IMFMediaType ** ppType )
inlineoverridevirtual

Retrieves a media type from the object's list of supported media types.

Parameters
dwIndexZero-based index of the media type to retrieve. To get the number of media types in the list, call IMFMediaTypeHandler::GetMediaTypeCount.
ppTypeReceives a pointer to the IMFMediaType interface. The caller must release the interface.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_NO_MORE_TYPES: The dwIndex parameter is out of range.

Media types are returned in the approximate order of preference. The list of supported types is not guaranteed to be complete. To test whether a particular media type is supported, call IMFMediaTypeHandler::IsMediaTypeSupported.

◆ GetMediaTypeCount()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetMediaTypeCount ( __RPC__out DWORD * pdwTypeCount)
inlineoverridevirtual

Retrieves the number of media types in the object's list of supported media types.

Parameters
pdwTypeCountReceives the number of media types in the list.
Returns
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

To get the supported media types, call IMFMediaTypeHandler::GetMediaTypeByIndex.

For a media source, the media type handler for each stream must contain at least one supported media type. For media sinks, the media type handler for each stream might contain zero media types. In that case, the application must provide the media type. To test whether a particular media type is supported, call IMFMediaTypeHandler::IsMediaTypeSupported.

◆ GetMediaTypeHandler()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::GetMediaTypeHandler ( __RPC__deref_out_opt IMFMediaTypeHandler ** ppHandler)
inlineoverridevirtual

Retrieves the media type handler for the stream sink. You can use the media type handler to find which formats the stream supports, and to set the media type on the stream.

Parameters
ppHandlerReceives a pointer to the IMFMediaTypeHandler interface. The caller must release the interface.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_SHUTDOWN: The media sink's Shutdown method has been called.
  • MF_E_STREAMSINK_REMOVED: This stream was removed from the media sinkand is no longer valid.

If the stream sink currently does not support any media types, this method returns a media type handler that fails any calls to IMFMediaTypeHandler::GetCurrentMediaType and IMFMediaTypeHandler::IsMediaTypeSupported.

◆ IsMediaTypeSupported()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::IsMediaTypeSupported ( IMFMediaType * pMediaType,
_Outptr_opt_result_maybenull_ IMFMediaType ** ppMediaType )
inlineoverridevirtual

Queries whether the object supports a specified media type.

Parameters
pMediaTypePointer to the IMFMediaType interface of the media type to check.
ppMediaTypeReceives a pointer to the IMFMediaType interface of the closest matching media type, or receives the value NULL. If non-NULL, the caller must release the interface. This parameter can be NULL. See Remarks.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_INVALIDMEDIATYPE: The object does not support this media type.

If the object supports the media type given in pMediaType, the method returns S_OK. For a media source, it means the source can generate data that conforms to that media type. For a media sink, it means the sink can receive data that conforms to that media type. If the object does not support the media type, the method fails.

The ppMediaType parameter is optional. If the method fails, the object might use ppMediaType to return a media type that the object does support, and which closely matches the one given in pMediaType. The method is not guaranteed to return a media type in ppMediaType. If no type is returned, this parameter receives a NULL pointer. If the method succeeds, this parameter receives a NULL pointer. If the caller sets ppMediaType to NULL, this parameter is ignored.

◆ PlaceMarker()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::PlaceMarker ( MFSTREAMSINK_MARKER_TYPE eMarkerType,
__RPC__in const PROPVARIANT * pvarMarkerValue,
__RPC__in const PROPVARIANT * pvarContextValue )
inlineoverridevirtual

Places a marker in the stream.

Parameters
eMarkerTypeSpecifies the marker type, as a member of the MFSTREAMSINK_MARKER_TYPE enumeration.
pvarMarkerValueOptional pointer to a PROPVARIANT that contains additional information related to the marker. The meaning of this value depends on the marker type. This parameter can be NULL.
pvarContextValueOptional pointer to a PROPVARIANT that is attached to the MEStreamSinkMarker event. Call IMFMediaEvent::GetValue to get this value from the event. The caller can use this information for any purpose. This parameter can be NULL.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_SHUTDOWN: The media sink's Shutdown method has been called.
  • MF_E_STREAMSINK_REMOVED: This stream was removed from the media sinkand is no longer valid.

This method causes the stream sink to send an MEStreamSinkMarker event after the stream sink consumes all of the samples that were delivered up to this point (before the call to PlaceMarker).

◆ ProcessSample()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::ProcessSample ( __RPC__in_opt IMFSample * pSample)
inlineoverridevirtual

Delivers a sample to the stream. The media sink processes the sample.

Parameters
pSamplePointer to the IMFSample interface of a sample that contains valid data for the stream.
Returns
The method returns an HRESULT. Possible values include, but are not limited to, the following:
  • S_OK: The method succeeded.
  • MF_E_INVALID_STATE_TRANSITION: The media sink is in the wrong state to receive a sample. For example, preroll is complete but the presentation clock has not started yet.
  • MF_E_INVALID_TIMESTAMP: The sample has an invalid time stamp.See Remarks.
  • MF_E_INVALIDREQUEST: The media sink is paused or stopped and cannot process the sample.
  • MF_E_NO_CLOCK: The presentation clock was not set.Call IMFMediaSink::SetPresentationClock.
  • MF_E_NO_SAMPLE_TIMESTAMP: The sample does not have a time stamp.
  • MF_E_NOT_INITIALIZED: The stream sink has not been initialized.
  • MF_E_SHUTDOWN: The media sink's Shutdown method has been called.
  • MF_E_STREAMSINK_REMOVED: This stream was removed from the media sinkand is no longer valid.

Call this method when the stream sink sends an MEStreamSinkRequestSample event.

This method can return MF_E_INVALID_TIMESTAMP for various reasons, depending on the implementation of the media sink:

  • Negative time stamps.
  • Time stamps that jump backward (within the same stream).
  • The time stamps for one stream have drifted too far from the time stamps on another stream within the same media sink (for example, an archive sink that multiplexes the streams).

Not every media sink returns an error code in these situations.

◆ QueueEvent()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::QueueEvent ( MediaEventType met,
__RPC__in REFGUID guidExtendedType,
HRESULT hrStatus,
__RPC__in_opt const PROPVARIANT * pvValue )
inlineoverridevirtual

◆ SetCurrentMediaType()

virtual HRESULT STDMETHODCALLTYPE Harlinn::Windows::Media::StreamingStreamSink::SetCurrentMediaType ( IMFMediaType * pMediaType)
inlineoverridevirtual

Sets the object's media type.

Parameters
pMediaTypePointer to the IMFMediaType interface of the new media type.
Returns

The method returns an HRESULT. Possible values include, but are not limited to, the following:

  • S_OK: The method succeeded.
  • MF_E_INVALIDREQUEST: Invalid request.

For media sources, setting the media type means the source will generate data that conforms to that media type. For media sinks, setting the media type means the sink can receive data that conforms to that media type.

Any implementation of this method should check whether pMediaType differs from the object's current media type. If the types are identical, the method should return S_OK but avoid releasing and recreating resources unnecessarily. If the types are not identical, the method should validate the new type.

</remakrs>

Member Data Documentation

◆ streamId_

DWORD Harlinn::Windows::Media::StreamingStreamSink::streamId_ = 0
private

The documentation for this class was generated from the following file: