共用方式為


IWMWriterAdvanced2::SetInputSetting method (wmsdkidl.h)

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The SetInputSetting method specifies a named setting for a particular input.

Syntax

HRESULT SetInputSetting(
  [in] DWORD             dwInputNum,
  [in] LPCWSTR           pszName,
  [in] WMT_ATTR_DATATYPE Type,
  [in] const BYTE        *pValue,
  [in] WORD              cbLength
);

Parameters

[in] dwInputNum

DWORD containing the input number.

[in] pszName

Pointer to a wide-character null-terminated string containing the setting name. For a list of valid settings, see Input Settings.

[in] Type

Pointer to a value from the WMT_ATTR_DATATYPE enumeration type.

[in] pValue

Pointer to a byte array containing the setting.

[in] cbLength

Size of pValue, in bytes.

Return value

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.
NS_E_NOT_CONFIGURED
The input profile has not yet been set.
E_INVALIDARG
dwInputNum is larger than the number of existing inputs

OR

pValue or pszName is NULL.

NS_E_INVALID_REQUEST
This setting cannot be changed while the writer is running.
E_UNEXPECTED
Unspecified error.

Remarks

The encoding settings set with this method are not persisted in the output file. If you want your custom player to have access to this information, you must save the values as custom metadata attributes in the file header.

Only g_wszDeinterlaceMode, g_wszInitialPatternForInverseTelecine, g_wszInterlacedCoding, and g_wszJPEGCompressionQuality can be set after IWMWriter::BeginWriting has been called.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 7 SDK, or later versions of the SDK
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wmsdkidl.h (include Wmsdk.h)
Library Wmvcore.lib; WMStubDRM.lib (if you use DRM)

See also

IWMWriterAdvanced2 Interface

IWMWriterAdvanced2::GetInputSetting

Input Formats, Input Settings, and Data Unit Extensions

To Set Input Settings