Share via


DirectShow Registry Settings

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The DirectShow registry settings allow you to configure Windows Media codec playback performance, maintain a smooth audio or video playback, control the settings of the video renderer, establish quality levels and associated parameters for image encoding, control the number and size of the buffers that are available on the input pin, and specify the number and size of MediaSamples that are allocated for the connection between the MPEG-2 Program Stream Multiplexer Filter and the DVR Engine Sink filter.

The following topics describe programming elements that can add, delete, enumerate, or represent DirectShow registry settings:

AMovieDllRegisterServer function

DMORegister function

IFilterMapper Interface interface

IFilterMapper::RegisterFilter method

IFilterMapper::RegisterPin method

IFilterMapper::UnregisterFilter method

IFilterMapper::UnregisterFilterInstance method

IFilterMapper::UnregisterPin method

REGFILTER structure

Audio and Video Thread Priorities

If DirectShow is using a high percentage of the available CPU on a device when the device is decoding video, the audio and video performance may be uneven if other threads with higher priorities also need to use the CPU.

To maintain a smooth audio or smooth video playback at all times, you can use the following registry subkey to fine tune the priorities for the audio and video threads: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority

The following table describes the named values for this subkey.

Name Type Description

Highest

REG_DWORD

Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_HIGHEST.

The default setting is the hexadecimal value F9, which is identical to the remapped value of THREAD_PRIORITY_HIGHEST (249).

AboveNormal

REG_DWORD

Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_ABOVE_NORMAL.

The default setting is the hexadecimal value FA, which is identical to the remapped value of THREAD_PRIORITY_ABOVE_NORMAL (250).

Normal

REG_DWORD

Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_NORMAL.

The default setting is the hexadecimal value FB, which is identical to the remapped value of THREAD_PRIORITY_NORMAL (251).

BelowNormal

REG_DWORD

Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_BELOW_NORMAL.

The default setting is the hexadecimal value FC, which is identical to the remapped value of THREAD_PRIORITY_BELOW_NORMAL (252).

Video

REG_DWORD

Sets a new thread priority for the video rendering thread in DirectShow.

The default setting is the hexadecimal value FB, which is identical to the remapped value of THREAD_PRIORITY_NORMAL (251).

The setting for Normal does not affect the video rendering thread.

The named values Highest, AboveNormal, Normal, and BelowNormal are all associated with standard operating system thread priority levels.

DirectShow threads that are identified with the standard operating system thread priorities run at the priority levels that are specified by those registry settings instead of the values that are described in the preceding table. These settings affect only threads that are owned by DirectShow. They do not affect the global operating system thread priority levels, and they do not affect threads that are owned by Windows Media Player.

For more information about Windows Mobile thread priorities, see Priority Levels.

The following registry key example shows the default values for the registry subkey

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority]
    "Highest"=DWORD:F9
    "AboveNormal"= DWORD:FA
    "Normal"= DWORD:FB
    "BelowNormal"= DWORD:FC
    "Video"= DWORD:FB

Notes

  • The default settings for DirectShow thread priorities provide satisfactory results for almost all devices; these values should not be changed unless absolutely necessary.
  • Changing values for DirectShow thread priorities from their default values can be very risky because the new values can cause unexpected performance problems for other applications that are running concurrently with DirectShow. It can be difficult to test for, diagnose, and resolve these types of problems.
  • If you must adjust the DirectShow audio and video thread priorities, make sure that the DirectShow priorities are higher than the audio and video driver priorities in your operating system design. Also, make sure that the audio priority is higher than the priority of the software mixer. Failing to take these steps almost always results in audio and video playback performance problems.

Video Renderer Settings

You can control the settings of the video renderer with the registry subkey:HKEY_LOCAL_MACHINE\Software\Microsoft\DirectX\DirectShow\Video Renderer

The following table shows the named values for this subkey.

Name Type Description

MaxBackBuffers

REG_DWORD

Controls the number of back buffers the video renderer can use.

SurfaceTypes

REG_DWORD

Defines the types of video surfaces that the video renderer uses.

It is a bitwise combination of the DirectShow DirectDraw Surface (AMDDS) definitions that are described in the next table.

Always set this to a hexadecimal value, not to a symbolic constant.

If you set this value to 0x00 (AMDDS_NONE), the video renderer uses GDI.

UseOverlayStretch

REG_DWORD

Controls aspect ratio preservation in the overlay area.

The default setting is 1.

Set this value to 1 to stretch the video image to fill the overlay area.

Set this value to 0 to preserve the aspect ratio of the video image.

UseScanLine

REG_DWORD

Defines whether the video renderer will use IDirectDraw::GetScanLine to determine when to blit or flip.

This is typically an expensive operation, so it is turned off by default. The default setting is 0.

Set this value to 1 to turn it on.

KeyColor

REG_DWORD

Defines the color key when playing back video using an overlay on a non-palletized display, that is, a display with a color depth that is greater than 8 bpp.

This is a hexadecimal RGB value.

KeyIndex

REG_DWORD

Defines the color key when the device plays back video by using an overlay on a palletized display, that is, a display with a color depth of less than or equal to 8 bpp.

This is a hexadecimal value in the range of 0 to 2^(color depth) - 1.

The following table describes the AMDDS flag values to use with the SurfaceTypes named value.

Flag Hexadecimal value Description

AMDDS_NONE

0x00

No support for Device Control Interface (DCI) or DirectDraw.

AMDDS_DCIPS

0x01

Uses DCI primary surface.

AMDDS_PS

0x02

Uses DirectDraw primary surface.

AMDDS_RGBOVR

0x04

Uses RGB overlay surfaces.

AMDDS_YUVOVR

0x08

Uses YUV overlay surfaces.

AMDDS_RGBOFF

0x10

Uses RGB off-screen surfaces.

AMDDS_YUVOFF

0x20

Uses YUV off-screen surfaces.

AMDDS_RGBFLP

0x40

Uses RGB flipping surfaces.

AMDDS_YUVFLP

0x80

Uses YUV flipping surfaces.

AMDDS_ALL

0xFF

Uses all available surfaces.

AMDDS_DEFAULT

0xFF

Uses all available surfaces.

AMDDS_YUV

0xA8

(AMDDS_YUVOFF | AMDDS_YUVOVR | AMDDS_YUVFLP)

AMDDS_RGB

0x58

(AMDDS_RGBOFF | AMDDS_RGBOVR | AMDDS_RGBFLP)

AMDDS_PRIMARY

0x03

(AMDDS_DCIPS | AMDDS_PS)

Encoder Quality Settings

You can establish quality levels and associated parameters for image encoding with the following registry subkey:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ImageSink\Quality\ <Quality Level> \ <File Extension> \ <Parameter Name>

The IImageSinkFilter Interface interface uses this subkey to obtain parameter values that are passed on to the image encoding factory. The designated encoder quality level, the file extension, and the parameter name are all integral to the path of the registry subkey.

The following table shows the named values for a parameter. Each of these values corresponds to a member of a StructEncoderParameter structure.

Name Type Description

GUID

REG_BINARY

The GUID for the encoding parameter.

There is no default setting.

NumberOfValues

REG_DWORD

The number of parameter values that are contained in Value.

There is no default setting.

Type

REG_DWORD

The data type for the parameter.

There is no default setting.

Value

REG_DWORD

The value of the parameter.

If NumberOfValues is greater than1, Value must be provided with binary data that encodes all of these values.

There is no default setting.

The following example shows a registry entry that sets a value for the Compression parameter when the device is encoding a .jpg file at quality level 0.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ImageSink\Quality\0\jpg\Compression]
"GUID"="0xe09d739d-ccd4-44ee-8eba-3fbf8be4fc58"
"Value"=dword:00000003
"Type"=dword:00000004
"NumberOfValues"=dword:00000001

Memory Use and Performance During Streaming

You can use the following registry key to control how much memory is allowed for the buffer during streamed playback of media by using Windows Media Technologies:

HKEY_CURRENT_USER\Software\Microsoft\Netshow\Player\

This key allows you to choose between memory use and performance. For high bit-rate, High Definition video files, you must allow a large amount of memory to prevent the device from running out of buffer space when a long stream of hard frames arrives.

The registry key named values are multipliers of the pre-roll values that are set in the file. The values should be specified as percentage numbers. For example, a number of 300 denotes a multiplier of 3x, and 1 denotes a multiplier of 0.01X.

Name Type Description

PrerollMinMultiplier

REG_DWORD

This is the low-water mark. A freeze is issued if the buffer space goes below the multiplier * pre-roll value.

PrerollMaxMultiplier

REG_DWORD

This is the high-water mark. Buffering is limited to the amount of memory that is specified by the pre-roll * multiplier value.

Settings for the MPEG-2 Program Stream Multiplexer Filter

You can specify the number and size of MediaSamples that are allocated for the connection between the MPEG-2 Program Stream Multiplexer Filter and the DVR Engine Sink filter by using the following subkey:

HKEY_LOCAL_MACHINE\Software\Microsoft\Dvr\DvrPsMux

The following table shows the named values for this subkey. These values are not set by default.

Name Type Description

OutputBufferCount

REG_DWORD

The number of samples.

Choose a value on the basis of system memory constraints and performance requirements.

OutputBufferSize

REG_DWORD

The media sample size.

The default is 128Kb.

This value is the most important.

If you want the device to process video streams that are larger than the MPEG-2 video constraints that are specified in the DVD-Video specification (section 5.4.1.2), increase the media sample size to a value that is greater than the default value.

You must choose a sample size that is large enough to hold a complete I-frame, plus any audio data that may accompany it.

See Also

Reference

DMO Wrapper Filter

Other Resources

DirectShow Application Development