ILMFVResize Interface

This is the interface for the LEAD Video Resize transform.

Data types

QUICKRESIZE

typedef enum 
{ 
   SIZE_1OVER8 = 0, 
   SIZE_1OVER4 = 1, 
   SIZE_1OVER2 = 2, 
   SIZE_NORMAL = 3, 
   SIZE_X2     = 4, 
   SIZE_X4     = 5, 
   SIZE_X8     = 6 
} QUICKRESIZE; 

Holds the predefined resizing constants.

Constant Description
SIZE_1OVER8 The output width and height are 1/8 of the source width and height.
SIZE_1OVER4 The output width and height are 1/4 of the source width and height.
SIZE_1OVER2 The output width and height are 1/2 of the source width and height.
SIZE_NORMAL The output width and height are same as the source width and height.
SIZE_X2 The output width and height are 2X of the source width and height.
SIZE_X4 The output width and height are 4X of the source width and height.
SIZE_X8 The output width and height are 8X of the source width and height.

SIZETYPES

typedef enum 
{ 
   RESIZE_NORMAL = 0x0000, 
   RESIZE_BRESENHAM = 0x0001, 
   RESIZE_RESAMPLE = 0x0002, 
   RESIZE_BICUBIC = 0x0004, 
} SIZETYPES; 

Holds the resizing algorithms constants.

Constant Description
RESIZE_NORMAL Use the normal resizing method.
RESIZE_BRESENHAM Use Bresenham resizing.
RESIZE_RESAMPLE Use resampling.
RESIZE_BICUBIC Use bicubic resizing.

InputAspectRatioModeConstants

typedef enum 
{ 
   INPUTASPECTRATIO_SQUAREPIXELS    = 0, 
   INPUTASPECTRATIO_USEINPUT        = 1, 
   INPUTASPECTRATIO_CUSTOM          = 2, 
   INPUTASPECTRATIO_4_3             = 10, 
   INPUTASPECTRATIO_16_9            = 11, 
} InputAspectRatioModeConstants; 

Constant Description
INPUTASPECTRATIO_SQUAREPIXELS Ignore the any input aspect ratio and consider the input to be square pixels.
INPUTASPECTRATIO_USEINPUT Use the input aspect ratio (if present). Otherwise, consider the input to be square pixels.
INPUTASPECTRATIO_CUSTOM Ignore any input aspect ratio and consider it to be given by the CustomInputAspectRatioWidth and CustomInputAspectRatioHeight properties.
INPUTASPECTRATIO_4_3 Ignore the input aspect ratio and consider it to be 4:3.
INPUTASPECTRATIO_16_9 Ignore the input aspect ratio and consider it to be 16:9.

OutputAspectRatioModeConstants

typedef enum 
{ 
   OUTPUTASPECTRATIO_SQUAREPIXELS   = 0, 
   OUTPUTASPECTRATIO_USEINPUT       = 1, 
   OUTPUTASPECTRATIO_CUSTOM         = 2, 
   OUTPUTASPECTRATIO_4_3            = 10, 
   OUTPUTASPECTRATIO_16_9           = 11, 
} OutputAspectRatioModeConstants; 
Constant Description
OUTPUTASPECTRATIO_SQUAREPIXELS Make the output aspect ratio square pixels.
OUTPUTASPECTRATIO_USEINPUT Make the output aspect ratio be the same as the input aspect ratio.
OUTPUTASPECTRATIO_CUSTOM Use the output aspect ratio given by the CustomOutputAspectRatioWidth and CustomOutputAspectRatioHeight properties.
OUTPUTASPECTRATIO_4_3 Make the output have a 4:3 aspect ratio.
OUTPUTASPECTRATIO_16_9 Make the output have a 4:3 aspect ratio.

StretchModeConstants

typedef enum 
{ 
   STRETCHMODE_STRETCH, 
   STRETCHMODE_FITWIDTH, 
   STRETCHMODE_FITHEIGHT, 
   STRETCHMODE_FIT, 
   STRETCHMODE_ENLARGEDFIT, 
} StretchModeConstants; 
Constant Description
STRETCHMODE_STRETCH Ignore any input aspect ratio and stretch the video to the output width and height. Ignore the WidthControlMode and HeightControlMode properties (consider them both as Fixed).
STRETCHMODE_FITWIDTH Resize the video by preserving the aspect ratio and fit to width. This might cause colored bars on top and bottom of the video or it can cause the top and bottom of the video to be truncated.
STRETCHMODE_FITHEIGHT Resize the video by preserving the aspect ratio and fit to height. This might cause colored bars on left and rigth side of the video or it can cause the left and right side of the video to be truncated.
STRETCHMODE_FIT Resize the video by preserving the aspect ratio and fit both width and height inside the output rectangle. This might add colored bars on the edges.
STRETCHMODE_ENLARGEDFIT Resize the video by preserving the aspect ratio and enlarging the width or height so the output rectangle fits inside the resulting output. (This is the default resize mode performed by the Media Foundation renderers). This might cause video edges to be cropped.

SizeControlModeConstants

typedef enum 
{ 
   SIZECONTROL_FIXED, 
   SIZECONTROL_ADJUSTABLE, 
} SizeControlModeConstants; 
Constant Description
SIZECONTROL_FIXED Keep the output size (width or height) fixed.
SIZECONTROL_ADJUSTABLE You can adjust the output size (width or height) to preserve the input aspect ratio.

SquarePixelOutputModeConstants

typedef enum 
{ 
   SQUAREPIXELOUTPUT_SAMESIZE, 
   SQUAREPIXELOUTPUT_FITWIDTH, 
   SQUAREPIXELOUTPUT_FITHEIGHT, 
   SQUAREPIXELOUTPUT_INCREASESIZE, 
   SQUAREPIXELOUTPUT_DECREASESIZE, 
} SquarePixelOutputModeConstants; 
Constant Description
SQUAREPIXELOUTPUT_SAMESIZE Keep the output size unchanged. This might distort the output.
SQUAREPIXELOUTPUT_FITWIDTH Keep the output width the same and modify the output height to preserve the visual output ratio.
SQUAREPIXELOUTPUT_FITHEIGHT Keep the output height the same and modify the output width to preserve the visual output ratio.
SQUAREPIXELOUTPUT_INCREASESIZE Increase the video size (width or height) so the requested output size fits inside the new output size. (This is the default resizing performed by the Media Foundation video renderers).
SQUAREPIXELOUTPUT_DECREASESIZE Decrease the video size (width or height) so the new output size fits inside the requested output size.

LMVResize_APILEVEL

typedef enum 
{ 
   LMVResize_APILEVEL_1 = 0, 
   LMVResize_APILEVEL_2 = 1, 
} LMVResize_APILEVEL; 

 

Constant Description
LMVResize_APILEVEL_1 Use the defaults from the previous versions of the resize transform.
LMVResize_APILEVEL_2 Use the defaults from the current version of the resize transform.

AutoResizeModeConstants (obsolete, you should use StretchModeConstants instead):

typedef enum 
{ 
   AUTORESIZEMODE_INCREASE  = 0x00, 
   AUTORESIZEMODE_FITWIDTH  = 0x00, 
   AUTORESIZEMODE_DECREASE  = 0x01 
   AUTORESIZEMODE_FITHEIGHT = 0x01 
} AutoResizeModeConstants; 

Holds auto resizing mode constants

Constant Description
AUTORESIZEMODE_INCREASE Obsolete
AUTORESIZEMODE_DECREASE Obsolete
AUTORESIZEMODE_FITWIDTH The height will be changed according to the width.
AUTORESIZEMODE_FITHEIGHT The width will be changed according to the height.

Properties

Type Name Description
VARIANT_BOOL Enabled VARIANT_TRUE to enable resizing.
VARIANT_BOOL EnableQuickResize VARIANT_TRUE to enable predefined ratios selection.
VARIANT_BOOL AspectRatio Obsolete property, use StretchMode instead.VARIANT_TRUE to preserve the size aspect ratio, if the transform input is not connected, no aspect ratio is used.
VARIANT_BOOL AutoStop If VARIANT_TRUE, allows the graph to be stopped automatically. This is necessary when the dimensions change while the graph is running. The graph needs to be re-run after the change is applied.
long Width New width to use.
long Height New height to use.
QUICKRESIZE QuickResize If EnableQuickResize is VARIANT_TRUE, this property must be set to one of the QUICKRESIZE constants. When using the QUICKRESIZE constants the Width and Height properties are ignored.
SIZETYPES Flags One of the SIZETYPES constants, which specify the algorithm used for resizing.
VARIANT_BOOL IsLEADInputPinConnected Read only. Returns VARIANT_TRUE if the transforms input pin is connected.
VARIANT_BOOL IsLEADOutputPinConnected Read only; returns VARIANT_TRUE if the transforms output pin is connected.
long InWidth Read only; the input stream width.
long InHeight Read only; the input stream height.
long OutWidth Read only; the output stream width.
long OutHeight Read only; the output stream height.
long InBits Read only; the input stream bits per pixel.
long OutBits Read only; the output stream bits per pixel.
VARIANT_BOOL AutoSize Obsolete property, use WidthControlMode and HeightControlMode instead.If selected, preserves the actual video size aspect ratio. If the width changes then the height will be changed as well.
long FillColor The color that will be used to fill the different size.
AutoResizeModeConstants AutoResizeMode Obsolete property, use StretchMode instead.A value that represents the auto resize mode. It must be one of AutoResizeModeConstants values.
InputAspectRatioModeConstants InputAspectRatioMode Use this property to specify whether to use the video input aspect ratio or override it.
long CustomInputAspectRatioWidth Width component for custom aspect ratio. Used only ifInputAspectRatioMode is set to INPUTASPECTRATIO_CUSTOM.
long CustomInputAspectRatioHeight Height component for custom aspect ratio. Used only ifInputAspectRatioMode is set to INPUTASPECTRATIO_CUSTOM.
OutputAspectRatioModeConstants OutputAspectRatioMode Use this property to specify the desired output aspect ratio.
long CustomOutputAspectRatioWidth Width component for custom aspect ratio. Used only ifOutputAspectRatioMode is set to OUTPUTASPECTRATIO_CUSTOM.
long CustomOutputAspectRatioHeight Height component for custom aspect ratio. Used only ifOutputAspectRatioMode is set to OUTPUTASPECTRATIO_CUSTOM.
StretchModeConstants StretchMode Allows you to specify whether the input should be stretched to the output or whether the aspect ratio should be preserved.
SizeControlModeConstants WidthControlMode Specifies whether the transform can modify the output width if necessary to preserve the input aspect ratio. This property is ignored if StretchMode is set to STRETCHMODE_STRETCH.
SizeControlModeConstants HeightControlMode Specifies whether the transform can modify the output height if necessary to preserve the input aspect ratio. This property is ignored if StretchMode is set to STRETCHMODE_STRETCH.
SquarePixelOutputModeConstants SquarePixelOutputMode Specifies what to do if the output does not have square pixels and the downstream transform does not preserve the aspect ratio. This setting allows you to specify how to modify the output width and height if the downstream transform insists on a square pixel output. This option overrides the WidthControlMode and HeightControlMode properties. (In other words, this indicates what should be down if the output media type is not VIDEOINFO2).
VARIANT_BOOL ForceSquarePixelOutput Force the output to be square pixels (VIDEOINFO). In this case, the output might be resized as specified by the SquarePixelOutputMode property.

Interface Methods

HRESULT  StartChangingAttributes ()

Parameters

None.

Description

Call this method when you are about to change the resize attributes. The changes take effect when StopChangingAttributes is called with bCancelChanges set to VARIANT_FALSE.

Returns

S_OK if connected; otherwise, S_FALSE.

HRESULT   StopChangingAttributes (VARIANT_BOOL bCancelChanges)

Parameters

bCancelChanges

Description

Sets the resize attributes. Set to VARIANT_FALSE to set the resize attributes. Use VARIANT_TRUE to reset the resize attributes to the old one.

Returns

S_OK if connected; otherwise, S_FALSE.

HRESULT  ResetToDefaults ()

Parameters

None.

Description

✎ NOTE

This method is now obsolete. Call ResetToDefaultsEx(LMVResize_APILEVEL_1) instead.

Resets resizing to default values from the previous version of the transform.

Returns

S_OK if connected; otherwise, S_FALSE.

HRESULT  ResetToDefaultsEx (LMVResize_APILEVEL ApiLevel)

Parameters

LMVResize_APILEVEL ApiLevel.

Description

Resets resizing to default values. The ApiLevel determines which default values to use. Current applications should set ApiLevel to LMVResize_APILEVEL_2 = 1.

The resize transform might change in the future and have different properties or default behavior. Calling this method ensure the transform will have the same default values as they were at the time you developed your application.

It is recommended you call ResetToDefaultsEx(LMVResize_APILEVEL_2) before you start setting properties and start calling other methods for this interface.

Returns

S_OK if connected; otherwise, S_FALSE.

HRESULT LoadAttributes()

Parameters

None.

Description

Loads transform settings from the registry. The Media Foundation transforms import the settings from the registry only at creation time. This method will force the transform to re-load its settings from the registry. If the transform has no settings to load from the registry, E_NOTIMPL is returned.

Return

S_OK if successful; otherwise, S_FALSE.

HRESULT SaveAttributes()

Parameters

None.

Description

Writes transform settings to the registry. This method will force the transform to save its settings to the registry before its released.

If the transform has no settings to write to the registry, E_NOTIMPL is returned.

Return

S_OK if successful; otherwise, S_FALSE.

Note:

Changes that affect the video frame dimensions cannot be performed while the media session is active, as a result these changes will be reverted. You must close the currently open media, change the properties, and then re-open the media. 

For more information on how the transform's properties are used during the resizing process, please see the Notes and Comments section of the LEAD Video Resize Transform User Interface topic.

Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Transforms C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.