IltmmPlay::SetPreferredFilter

Summary

Sets a preferred filter (decoder or demultiplexer).

Syntax

#include "ltmm.h"

Language Syntax
C HRESULT IltmmPlay_SetPreferredFilter(pPlay, FilterType, Val)
C++ HRESULT SetPreferredFilter(FilterType, Val)

Parameters

IltmmPlay *pPlay

Pointer to an IltmmPlay interface.

long FilterType

Value that indicates filter type. For a list of possible values, refer to ltmmPlay_PreferredFilter Constants.

BSTR Val

String that has the following possible values:

Returns

Value Meaning
S_OK The function was successful.
<> S_OK An error occurred. Refer to the Error Codes or the HRESULT error codes in the DirectShow documentation.

Comments

By default, the toolkit uses filters according to the default DirectShow mechanism, which assigns a merit to each filter. The filters with the highest merits are tried first. If they fail, the filters with a lower merit are tried next until a combination of filters is found that can handle the graph. However, sometimes 3rd party filters get installed on some computers with a high merit and are used instead of the filters you shipped with your application. Unexpected problems can occur if 3rd party filters are not working properly. In Windows 7 and later, Microsoft introduced a list of preferred filters for handling certain video subtypes. The filters in this preferred list are used by default in all programs even if other DirectShow filters have higher merit and can handle the same subtype. Use this method to override the filters from that list.

The SetPreferredFilter method allows you to control which filters are used in your application. You can decide to use a certain decoder, demultiplexer or you can choose to use only the LEAD filters.

Filter is a string for the Display Name or Friendly Name of the filter. It is best to use "Display Name" since display names are unique and no two filters can have the same Display Name. Two different filters can have the same Friendly Name. When two filters have the same name this function works on the first filter it internally enumerates that has the specified friendly name.

DirectShow filters have a friendly name and a display name. The friendly name is easy to remember and is usually displayed by GraphEdit or other filter enumeration utilities. But there can be more than one filter with the same friendly name, so it is safer to use the display name, since no two filters have the same display name.

Display names for software filters have the following format: @device:sw:GUID\GUID.

For example Microsoft MPEG-2 Splitter has:

friendly name: MPEG-2 Splitter

display name: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{3AE86B20-7BE8-11D1-ABE6-00A0C905F375}.

The display name for a particular filter can be obtained from the "DirectShow Filter List Utility" shipped with the toolkit. See Examples Programs and Demos for Win32/x64 for more details.

If the FilterType argument is equal to ltmmPlay_PreferredFilter_Generic, then the possible values for the Filter argument are: ltmmFilter_LEADDefault or ltmmFilter_DontCare.

If ltmmFilter_LEADDefault is specified, then LEAD default decoders and demultiplexers will be set for ALL values listed in ltmmPlay_PreferredFilter.

If ltmmFilter_DontCare is specified, then the internal list of the preferred filters will be cleared and the DirectShow filter merit determines which filters will be used.

It is recommended that you use the ltmmFilter_XXX constants whenever possible. See the ltmmFilter Constants for a list of these predefined values.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

Language Example
C++ IltmmPlay::SetPreferredFilter
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Multimedia C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.