IWMEncProfile2::get_NonSquarePixelMode
![]() |
The get_NonSquarePixelMode method retrieves a Boolean value indicating whether the profile can produce output with pixels that are not square.
Syntax
HRESULT get_NonSquarePixelMode(
short iRenderSiteIndex,
VARIANT_BOOL* pfNonSquarePixelMode
);
Parameters
iRenderSiteIndex
[in] short containing the audience stream index. Because an audience can contain only one stream of each type, iRenderSiteIndex must be 0.
pfNonSquarePixelMode
[out] Pointer to a flag, VARIANT_TRUE indicating non-square pixel mode.
Return Values
If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.
| Return code | Number | Description |
| E_POINTER | 0x80004003 | The pointer to the Boolean is NULL. |
Remarks
Non-square pixels are pixels whose height and width are not equal. If your video input uses non-square pixels, set the put_NonSquarePixelMode method to VARIANT_TRUE, and use the IWMEncVideoSource2::put_PixelAspectRatioX and IWMEncVideoSource2::put_PixelAspectRatioY properties to specify the pixel aspect ratio.
Example Code
// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
// Declare variables.
HRESULT hr;
IWMEncoder* pEncoder;
IWMEncProfileCollection* pProColl;
IWMEncProfile* pPro;
IWMEncProfile2* pPro2;
// Initialize the COM library and retrieve a pointer to an IWMEncoder interface.
hr = CoInitialize(NULL);
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance(CLSID_WMEncoder,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncoder,
(void**) &pEncoder);
}
// Retrieve a specific profile.
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_ProfileCollection(&pProColl);
}
if ( SUCCEEDED( hr ) )
{
hr = pProColl->Item(11, &pPro);
}
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance(CLSID_WMEncProfile2,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncProfile2,
(void**) &pPro2);
}
if ( SUCCEEDED( hr ) )
{
hr = pPro2->LoadFromIWMProfile(pPro);
}
// Retrieve a value indicating whether non-square pixel mode is enabled.
VARIANT_BOOL bPixelMode;
if ( SUCCEEDED( hr ) )
{
hr = pPro2->get_NonSquarePixelMode(0, &bPixelMode);
}
// Enable non-square pixel output.
if ( SUCCEEDED( hr ) )
{
hr = pPro2->put_NonSquarePixelMode(0, VARIANT_TRUE);
}
// Release pointers.
if ( pPro2 )
{
pPro2->Release();
pPro2 = NULL;
}
Requirements
Header: wmencode.h
Library: wmenc.exe
See Also
.gif)