public class MediaObject : ComObject
Represents a DMO MediaObject.
MediaObject(IntPtr ptr)
Initializes a new instance of the MediaObject class.
public void MediaObject(IntPtr ptr)
Parameters
ptr
IntPtrThe native pointer of the COM object.
AllocateStreamingResources()
Allocates any resources needed by the DMO. Calling this method is always optional.
AllocateStreamingResourcesNative()
Allocates any resources needed by the DMO. Calling this method is always optional.
public Int32 AllocateStreamingResourcesNative()
Returns
HRESULT
Remarks
For more information, see .
ClearInputType(Int32 inputStreamIndex)
Clears the inputtype for a specific input stream.
public void ClearInputType(Int32 inputStreamIndex)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
ClearOutputType(Int32 outputStreamIndex)
Clears the outputtype for a specific output stream.
public void ClearOutputType(Int32 outputStreamIndex)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
Discontinuity(Int32 inputStreamIndex)
Signals a discontinuity on the specified input stream.
public void Discontinuity(Int32 inputStreamIndex)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
Remarks
A discontinuity represents a break in the input. A discontinuity might occur because no more data is expected, the format is changing, or there is a gap in the data. After a discontinuity, the DMO does not accept further input on that stream until all pending data has been processed. The application should call the ProcessOutput method until none of the streams returns the Incomplete (see Status) flag. This method might fail if it is called before the client sets the input and output types on the DMO.
DiscontinuityNative(Int32 inputStreamIndex)
Signals a discontinuity on the specified input stream.
public Int32 DiscontinuityNative(Int32 inputStreamIndex)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
Returns
HRESULT
Remarks
A discontinuity represents a break in the input. A discontinuity might occur because no more data is expected, the format is changing, or there is a gap in the data. After a discontinuity, the DMO does not accept further input on that stream until all pending data has been processed. The application should call the ProcessOutput method until none of the streams returns the Incomplete (see Status) flag. This method might fail if it is called before the client sets the input and output types on the DMO.
Flush()
This method flushes all internally buffered data.
FlushNative()
This method flushes all internally buffered data.
public Int32 FlushNative()
Returns
HRESULT
FreeStreamingResources()
Frees resources allocated by the DMO. Calling this method is always optional.
FreeStreamingResourcesNative()
Frees resources allocated by the DMO. Calling this method is always optional.
public Int32 FreeStreamingResourcesNative()
Returns
HREUSLT
Remarks
For more information, see .
FromComObject(ComObject comObject)
Creates a MediaObject from any ComObjects.
public static MediaObject FromComObject(ComObject comObject)
Parameters
comObject
ComObjectThe COM Object to cast to a MediaObject.
Returns
The MediaObject.
Remarks
Internally the IUnknown::QueryInterface method of the specified COM Object gets called.
GetInputCurrentType(Int32 inputStreamIndex)
Retrieves the media type that was set for an input stream, if any.
GetInputCurrentType(Int32 inputStreamIndex, MediaType& mediaType)
Retrieves the media type that was set for an input stream, if any.
public Int32 GetInputCurrentType(Int32 inputStreamIndex, MediaType& mediaType)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaType
MediaType&A variable that receives the retrieved media type of the specified input stream.
Returns
HRESULT
GetInputMaxLatency(Int32 inputStreamIndex)
Retrieves the maximum latency on a specified input stream.
GetInputMaxLatencyNative(Int32 inputStreamIndex, Int64& maxLatency)
Retrieves the maximum latency on a specified input stream.
public Int32 GetInputMaxLatencyNative(Int32 inputStreamIndex, Int64& maxLatency)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
maxLatency
Int64&Receives the maximum latency in reference type units. Unit = REFERENCE_TIME = 100 nanoseconds
Returns
HRESULT
GetInputSizeInfo(Int32 inputStreamIndex)
This method retrieves the buffer requirements for a specified input stream.
GetInputSizeInfoNative(Int32 inputStreamIndex, Int32& minSize, Int32& maxLookahead, Int32& alignment)
Retrieves the buffer requirements for a specified input stream.
public Int32 GetInputSizeInfoNative(Int32 inputStreamIndex, Int32& minSize, Int32& maxLookahead, Int32& alignment)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
minSize
Int32&Minimum size of an input buffer for this stream, in bytes.
maxLookahead
Int32&The maximum amount of data that the DMO will hold for a lookahead, in bytes. If the DMO does not perform a lookahead on the stream, the value is zero.
alignment
Int32&The required buffer alignment, in bytes. If the input stream has no alignment requirement, the value is 1.
Returns
HRESULT
GetInputStatus(Int32 inputStreamIndex)
Queries whether an input stream can accept more input data.
GetInputStatusNative(Int32 inputStreamIndex, InputStatusFlags& flags)
Queries whether an input stream can accept more input data.
public Int32 GetInputStatusNative(Int32 inputStreamIndex, InputStatusFlags& flags)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
flags
InputStatusFlags&A variable that receives either None or AcceptData.
Returns
HRESULT
Remarks
For more information, see .
GetInputStreamInfo(Int32 inputStreamIndex)
Retrieves information about a specified input stream.
GetInputStreamInfoNative(Int32 inputStreamIndex, DmoInputStreamInfoFlags& flags)
Retrieves information about a specified input stream.
public Int32 GetInputStreamInfoNative(Int32 inputStreamIndex, DmoInputStreamInfoFlags& flags)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
flags
DmoInputStreamInfoFlags&Bitwise combination of zero or more DmoInputStreamInfoFlags flags.
Returns
HRESULT
GetInputType(Int32 inputStreamIndex, Int32 typeIndex)
Retrieves a preferred media type for a specified input stream.
public MediaType GetInputType(Int32 inputStreamIndex, Int32 typeIndex)
Parameters
typeIndex
Int32Zero-based index on the set of acceptable media types.
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
Returns
The preferred media type for the specified input stream.
GetInputTypeNative(Int32 inputStreamIndex, Int32 typeIndex, Nullable& mediaType)
Retrieves a preferred media type for a specified input stream.
public Int32 GetInputTypeNative(Int32 inputStreamIndex, Int32 typeIndex, Nullable& mediaType)
Parameters
typeIndex
Int32Zero-based index on the set of acceptable media types.
mediaType
Nullable&Can be null to check whether the typeIndex argument is in range. If not, the errorcode will be DMOENOMOREITEMS (0x80040206).
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
Returns
HRESULT
GetOutputCurrentType(Int32 outputStreamIndex)
Retrieves the media type that was set for an output stream, if any.
GetOutputCurrentType(Int32 outputStreamIndex, MediaType& mediaType)
Retrieves the media type that was set for an output stream, if any.
public Int32 GetOutputCurrentType(Int32 outputStreamIndex, MediaType& mediaType)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
mediaType
MediaType&A variable that receives the retrieved media type of the specified output stream.
Returns
HRESULT
GetOutputSizeInfo(Int32 outputStreamIndex)
This method retrieves the buffer requirements for a specified output stream.
GetOutputSizeInfoNative(Int32 outputStreamIndex, Int32& minSize, Int32& alignment)
This method retrieves the buffer requirements for a specified output stream.
public Int32 GetOutputSizeInfoNative(Int32 outputStreamIndex, Int32& minSize, Int32& alignment)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
minSize
Int32&Minimum size of an output buffer for this stream, in bytes.
alignment
Int32&The required buffer alignment, in bytes. If the output stream has no alignment requirement, the value is 1.
Returns
HRESULT
GetOutputStreamInfo(Int32 outputStreamIndex)
Retrieves information about a specified output stream.
GetOutputStreamInfoNative(Int32 outputStreamIndex, DmoOutputStreamInfoFlags& flags)
Retrieves information about a specified output stream.
public Int32 GetOutputStreamInfoNative(Int32 outputStreamIndex, DmoOutputStreamInfoFlags& flags)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
flags
DmoOutputStreamInfoFlags&Bitwise combination of zero or more DmoOutputStreamInfoFlags flags.
Returns
HRESULT
GetOutputType(Int32 outputStreamIndex, Int32 typeIndex)
Retrieves a preferred media type for a specified output stream.
public MediaType GetOutputType(Int32 outputStreamIndex, Int32 typeIndex)
Parameters
typeIndex
Int32Zero-based index on the set of acceptable media types.
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
Returns
The preferred media type for the specified output stream.
GetOutputTypeNative(Int32 outputStreamIndex, Int32 typeIndex, Nullable& mediaType)
Retrieves a preferred media type for a specified output stream.
public Int32 GetOutputTypeNative(Int32 outputStreamIndex, Int32 typeIndex, Nullable& mediaType)
Parameters
typeIndex
Int32Zero-based index on the set of acceptable media types.
mediaType
Nullable&Can be null to check whether the typeIndex argument is in range. If not, the errorcode will be DMOENOMOREITEMS (0x80040206).
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
Returns
HRESULT
GetStreamCount(Int32& inputStreams, Int32& outputStreams)
Retrieves the number of input and output streams.
GetStreamCountNative(Int32& inputStreams, Int32& outputStreams)
Retrieves the number of input and output streams.
public Int32 GetStreamCountNative(Int32& inputStreams, Int32& outputStreams)
Parameters
inputStreams
Int32&A variable that receives the number of input streams.
outputStreams
Int32&A variable that receives the number of output streams.
Returns
HRESULT
IsReadyForInput(Int32 inputStreamIndex)
Queries whether an input stream can accept more input data.
public Boolean IsReadyForInput(Int32 inputStreamIndex)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
Returns
If the return value is True, the input stream can accept more input data. Otherwise false.
Lock()
Acquires or releases a lock on the DMO. Call this method to keep the DMO serialized when performing multiple operations.
public LockDisposable Lock()
Returns
A disposable object which can be used to unlock the MediaObject by calling its Dispose method.
Example
This example shows how to use the Lock method: partial class TestClass { public void DoStuff(MediaObject mediaObject) { using(var lock = mediaObject.Lock()) { //do some stuff } //the mediaObject gets automatically unlocked by the using statement after "doing your stuff" } }
Lock(Int64 bLock)
Acquires or releases a lock on the DMO. Call this method to keep the DMO serialized when performing multiple operations.
LockNative(Int64 bLock)
Acquires or releases a lock on the DMO. Call this method to keep the DMO serialized when performing multiple operations.
public Int32 LockNative(Int64 bLock)
Parameters
bLock
Int64Value that specifies whether to acquire or release the lock. If the value is non-zero, a lock is acquired. If the value is zero, the lock is released.
Returns
HRESULT
ProcessInput(Int32 inputStreamIndex, IMediaBuffer mediaBuffer)
Delivers a buffer to the specified input stream.
public void ProcessInput(Int32 inputStreamIndex, IMediaBuffer mediaBuffer)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaBuffer
IMediaBufferThe MediaBuffer to process.
ProcessInput(Int32 inputStreamIndex, IMediaBuffer mediaBuffer, InputDataBufferFlags flags)
Delivers a buffer to the specified input stream.
public void ProcessInput(Int32 inputStreamIndex, IMediaBuffer mediaBuffer, InputDataBufferFlags flags)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaBuffer
IMediaBufferThe MediaBuffer to process.
flags
InputDataBufferFlagsBitwise combination of None or more flags from the InputDataBufferFlags enumeration.
ProcessInput(Int32 inputStreamIndex, IMediaBuffer mediaBuffer, InputDataBufferFlags flags, Int64 timestamp, Int64 timeduration)
Delivers a buffer to the specified input stream.
public void ProcessInput(Int32 inputStreamIndex, IMediaBuffer mediaBuffer, InputDataBufferFlags flags, Int64 timestamp, Int64 timeduration)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaBuffer
IMediaBufferThe MediaBuffer to process.
flags
InputDataBufferFlagsBitwise combination of None or more flags from the InputDataBufferFlags enumeration.
timestamp
Int64Time stamp that specifies the start time of the data in the buffer. If the buffer has a valid time stamp, set the Time flag in the flags parameter.
timeduration
Int64Reference time specifying the duration of the data in the buffer. If the buffer has a valid time stamp, set the TimeLength flag in the flags parameter.
ProcessInputNative(Int32 inputStreamIndex, IMediaBuffer mediaBuffer, InputDataBufferFlags flags, Int64 timestamp, Int64 timeduration)
Delivers a buffer to the specified input stream.
public Int32 ProcessInputNative(Int32 inputStreamIndex, IMediaBuffer mediaBuffer, InputDataBufferFlags flags, Int64 timestamp, Int64 timeduration)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaBuffer
IMediaBufferThe MediaBuffer to process.
flags
InputDataBufferFlagsBitwise combination of None or more flags from the InputDataBufferFlags enumeration.
timestamp
Int64Time stamp that specifies the start time of the data in the buffer. If the buffer has a valid time stamp, set the Time flag in the flags parameter.
timeduration
Int64Reference time specifying the duration of the data in the buffer. If the buffer has a valid time stamp, set the TimeLength flag in the flags parameter.
Returns
HRESULT
ProcessOutput(ProcessOutputFlags flags, DmoOutputDataBuffer[] buffers)
Generates output from the current input data.
public void ProcessOutput(ProcessOutputFlags flags, DmoOutputDataBuffer[] buffers)
Parameters
flags
ProcessOutputFlagsBitwise combination of None or more flags from the ProcessOutputFlags enumeration.
buffers
DmoOutputDataBuffer[]An array of output buffers to process.
ProcessOutput(ProcessOutputFlags flags, DmoOutputDataBuffer[] buffers, Int32 bufferCount)
Generates output from the current input data.
public void ProcessOutput(ProcessOutputFlags flags, DmoOutputDataBuffer[] buffers, Int32 bufferCount)
Parameters
flags
ProcessOutputFlagsBitwise combination of None or more flags from the ProcessOutputFlags enumeration.
buffers
DmoOutputDataBuffer[]An array of output buffers to process.
bufferCount
Int32Number of output buffers.
ProcessOutputNative(ProcessOutputFlags flags, Int32 bufferCount, DmoOutputDataBuffer[] buffers, Int32& status)
Generates output from the current input data.
public Int32 ProcessOutputNative(ProcessOutputFlags flags, Int32 bufferCount, DmoOutputDataBuffer[] buffers, Int32& status)
Parameters
flags
ProcessOutputFlagsBitwise combination of None or more flags from the ProcessOutputFlags enumeration.
buffers
DmoOutputDataBuffer[]An array of output buffers to process.
bufferCount
Int32Number of output buffers.
status
Int32&Receives a reserved value (zero). The application should ignore this value.
Returns
HREUSLT
SetInputMaxLatency(Int32 inputStreamIndex, Int64 maxLatency)
Sets the maximum latency on a specified input stream.
public void SetInputMaxLatency(Int32 inputStreamIndex, Int64 maxLatency)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
maxLatency
Int64Maximum latency in reference time units. Unit = REFERENCE_TIME = 100 nanoseconds
Returns
HRESULT
Remarks
For the definition of maximum latency, see .
SetInputMaxLatencyNative(Int32 inputStreamIndex, Int64 maxLatency)
Sets the maximum latency on a specified input stream.
public Int32 SetInputMaxLatencyNative(Int32 inputStreamIndex, Int64 maxLatency)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
maxLatency
Int64Maximum latency in reference time units. Unit = REFERENCE_TIME = 100 nanoseconds
Returns
HRESULT
Remarks
For the definition of maximum latency, see .
SetInputType(Int32 inputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Sets the media type on an input stream.
public void SetInputType(Int32 inputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaType
MediaTypeThe new mediatype.
flags
SetTypeFlagsBitwise combination of zero or more flags from the SetTypeFlags enumeration.
SetInputType(Int32 inputStreamIndex, WaveFormat waveFormat)
Sets the media type on an input stream.
public void SetInputType(Int32 inputStreamIndex, WaveFormat waveFormat)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
waveFormat
WaveFormatThe format to set as the new MediaType for the specified input stream.
SetInputTypeNative(Int32 inputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Sets the media type on an input stream, or tests whether a media type is acceptable.
public Int32 SetInputTypeNative(Int32 inputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaType
MediaTypeThe new mediatype.
flags
SetTypeFlagsBitwise combination of zero or more flags from the SetTypeFlags enumeration.
Returns
HRESULT
SetOutputType(Int32 outputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Sets the MediaType on an output stream, or tests whether a MediaType is acceptable.
public void SetOutputType(Int32 outputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
mediaType
MediaTypeThe new MediaType.
flags
SetTypeFlagsBitwise combination of zero or more flags from the SetTypeFlags enumeration.
SetOutputType(Int32 outputStreamIndex, WaveFormat waveFormat)
Sets the MediaType on an output stream, or tests whether a MediaType is acceptable.
public void SetOutputType(Int32 outputStreamIndex, WaveFormat waveFormat)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
waveFormat
WaveFormatThe format to set as the new MediaType for the specified output stream.
SetOutputTypeNative(Int32 outputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Sets the MediaType on an output stream, or tests whether a MediaType is acceptable.
public Int32 SetOutputTypeNative(Int32 outputStreamIndex, MediaType mediaType, SetTypeFlags flags)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
mediaType
MediaTypeThe new MediaType.
flags
SetTypeFlagsBitwise combination of zero or more flags from the SetTypeFlags enumeration.
Returns
HRESULT
SupportsInputFormat(Int32 inputStreamIndex, MediaType mediaType)
Tests whether the given MediaType is supported.
public Boolean SupportsInputFormat(Int32 inputStreamIndex, MediaType mediaType)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
mediaType
MediaTypeThe MediaType to test whether it is supported.
Returns
True = supported, False = not supported
SupportsInputFormat(Int32 inputStreamIndex, WaveFormat waveFormat)
Tests whether the given WaveFormat is supported.
public Boolean SupportsInputFormat(Int32 inputStreamIndex, WaveFormat waveFormat)
Parameters
inputStreamIndex
Int32Zero-based index of an input stream on the DMO.
waveFormat
WaveFormatThe WaveFormat to test whether it is supported.
Returns
True = supported, False = not supported
SupportsOutputFormat(Int32 outputStreamIndex, MediaType mediaType)
Tests whether the given WaveFormat is supported.
public Boolean SupportsOutputFormat(Int32 outputStreamIndex, MediaType mediaType)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
mediaType
MediaTypeThe MediaType to test whether it is supported.
Returns
True = supported, False = not supported
SupportsOutputFormat(Int32 outputStreamIndex, WaveFormat waveFormat)
Tests whether the given WaveFormat is supported as OutputFormat.
public Boolean SupportsOutputFormat(Int32 outputStreamIndex, WaveFormat waveFormat)
Parameters
outputStreamIndex
Int32Zero-based index of an output stream on the DMO.
waveFormat
WaveFormatWaveFormat
Returns
True = supported, False = not supported
InputStreamCount
Gets the number of input streams.
public Int32 InputStreamCount { get; }
OutputStreamCount
Gets the number of output streams.
public Int32 OutputStreamCount { get; }