📄 mediaobj.cs
字号:
{
case DMOResults.E_InvalidStreamIndex:
sRet = "Invalid stream index.";
break;
case DMOResults.E_InvalidType:
sRet = "Invalid media type.";
break;
case DMOResults.E_TypeNotSet:
sRet = "Media type was not set. One or more streams require a media type before this operation can be performed.";
break;
case DMOResults.E_NotAccepting:
sRet = "Data cannot be accepted on this stream. You might need to process more output data; see IMediaObject::ProcessInput.";
break;
case DMOResults.E_TypeNotAccepted:
sRet = "Media type was not accepted.";
break;
case DMOResults.E_NoMoreItems:
sRet = "Media-type index is out of range.";
break;
default:
sRet = DsError.GetErrorText(hr);
break;
}
return sRet;
}
/// <summary>
/// If hr has a "failed" status code (E_*), throw an exception. Note that status
/// messages (S_*) are not considered failure codes. If DMO or DShow error text
/// is available, it is used to build the exception, otherwise a generic COM error
/// is thrown.
/// </summary>
/// <param name="hr">The HRESULT to check</param>
public static void ThrowExceptionForHR(int hr)
{
// If an error has occurred
if (hr < 0)
{
// If a string is returned, build a com error from it
string buf = GetErrorText(hr);
if (buf != null)
{
throw new COMException(buf, hr);
}
else
{
// No string, just use standard com error
Marshal.ThrowExceptionForHR(hr);
}
}
}
}
#endregion
#region Interfaces
#if ALLOW_UNTESTED_INTERFACES
[ComImport,
Guid("65ABEA96-CF36-453F-AF8A-705E98F16260"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IDMOQualityControl
{
[PreserveSig]
int SetNow(
[In] long rtNow
);
[PreserveSig]
int SetStatus(
[In] DMOQualityStatus dwFlags
);
[PreserveSig]
int GetStatus(
out DMOQualityStatus pdwFlags
);
}
#endif
[ComImport,
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("2C3CD98A-2BFA-4A53-9C27-5249BA64BA0F")]
public interface IEnumDMO
{
[PreserveSig]
int Next(
int cItemsToFetch,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] Guid[] pCLSID,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] string[] Names,
[Out] out int pcItemsFetched
);
[PreserveSig]
int Skip(
int cItemsToSkip
);
[PreserveSig]
int Reset();
[PreserveSig]
int Clone(
[MarshalAs(UnmanagedType.Interface)] out IEnumDMO ppEnum
);
}
[ComImport,
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("651B9AD0-0FC7-4AA9-9538-D89931010741")]
public interface IMediaObjectInPlace
{
[PreserveSig]
int Process(
[In] int ulSize,
[In] IntPtr pData,
[In] long refTimeStart,
[In] DMOInplaceProcess dwFlags
);
[PreserveSig]
int Clone(
[MarshalAs(UnmanagedType.Interface)] out IMediaObjectInPlace ppMediaObject
);
[PreserveSig]
int GetLatency(
out long pLatencyTime
);
}
[ComImport,
Guid("59EFF8B9-938C-4A26-82F2-95CB84CDC837"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMediaBuffer
{
[PreserveSig]
int SetLength(
int cbLength
);
[PreserveSig]
int GetMaxLength(
out int pcbMaxLength
);
[PreserveSig]
int GetBufferAndLength(
out IntPtr ppBuffer,
out int pcbLength
);
}
[ComImport,
Guid("D8AD0F58-5494-4102-97C5-EC798E59BCF4"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMediaObject
{
[PreserveSig]
int GetStreamCount(
out int pcInputStreams,
out int pcOutputStreams
);
[PreserveSig]
int GetInputStreamInfo(
int dwInputStreamIndex,
out DMOInputStreamInfo pdwFlags
);
[PreserveSig]
int GetOutputStreamInfo(
int dwOutputStreamIndex,
out DMOOutputStreamInfo pdwFlags
);
[PreserveSig]
int GetInputType(
int dwInputStreamIndex,
int dwTypeIndex,
[Out] AMMediaType pmt
);
[PreserveSig]
int GetOutputType(
int dwOutputStreamIndex,
int dwTypeIndex,
[Out] AMMediaType pmt
);
[PreserveSig]
int SetInputType(
int dwInputStreamIndex,
[In, MarshalAs(UnmanagedType.LPStruct)] AMMediaType pmt,
DMOSetType dwFlags
);
[PreserveSig]
int SetOutputType(
int dwOutputStreamIndex,
[In, MarshalAs(UnmanagedType.LPStruct)] AMMediaType pmt,
DMOSetType dwFlags
);
[PreserveSig]
int GetInputCurrentType(
int dwInputStreamIndex,
[Out] AMMediaType pmt
);
[PreserveSig]
int GetOutputCurrentType(
int dwOutputStreamIndex,
[Out] AMMediaType pmt
);
[PreserveSig]
int GetInputSizeInfo(
int dwInputStreamIndex,
out int pcbSize,
out int pcbMaxLookahead,
out int pcbAlignment
);
[PreserveSig]
int GetOutputSizeInfo(
int dwOutputStreamIndex,
out int pcbSize,
out int pcbAlignment
);
[PreserveSig]
int GetInputMaxLatency(
int dwInputStreamIndex,
out long prtMaxLatency
);
[PreserveSig]
int SetInputMaxLatency(
int dwInputStreamIndex,
long rtMaxLatency
);
[PreserveSig]
int Flush();
[PreserveSig]
int Discontinuity(
int dwInputStreamIndex
);
[PreserveSig]
int AllocateStreamingResources();
[PreserveSig]
int FreeStreamingResources();
[PreserveSig]
int GetInputStatus(
int dwInputStreamIndex,
out DMOInputStatusFlags dwFlags
);
[PreserveSig]
int ProcessInput(
int dwInputStreamIndex,
IMediaBuffer pBuffer,
DMOInputDataBuffer dwFlags,
long rtTimestamp,
long rtTimelength
);
[PreserveSig]
int ProcessOutput(
DMOProcessOutput dwFlags,
int cOutputBufferCount,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] DMOOutputDataBuffer [] pOutputBuffers,
out int pdwStatus
);
[PreserveSig]
int Lock(
[MarshalAs(UnmanagedType.Bool)] bool bLock
);
}
[ComImport,
Guid("BE8F4F4E-5B16-4D29-B350-7F6B5D9298AC"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IDMOVideoOutputOptimizations
{
[PreserveSig]
int QueryOperationModePreferences(
int ulOutputStreamIndex,
out DMOVideoOutputStream pdwRequestedCapabilities
);
[PreserveSig]
int SetOperationMode(
int ulOutputStreamIndex,
DMOVideoOutputStream dwEnabledFeatures
);
[PreserveSig]
int GetCurrentOperationMode(
int ulOutputStreamIndex,
out DMOVideoOutputStream pdwEnabledFeatures
);
[PreserveSig]
int GetCurrentSampleRequirements(
int ulOutputStreamIndex,
out DMOVideoOutputStream pdwRequestedFeatures
);
}
#endregion
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -