tony2008
24th December 2007, 06:21
Now I use WMF to convert one file to wmv file,and I need to set the wmv file's aspect ratio.
I followed the SDK document and did like this:
1.I invokeed AddDataUnitExtension(WM_SampleExtensionGUID_PixelAspectRatio,WM_SampleExtension_PixelAspectRatio_Size,NULL,0);
2.set inputsettings:
COMRef<IServiceProvider> pSp;
COMRef<IWMWriterAdvanced2> pWMWA2;
hr = pWriterFilter->QueryInterface(IID_IServiceProvider,(void**)&pSp);
if ( FAILED(hr) )
{
return hr;
}
hr = pSp->QueryService(IID_IWMWriterAdvanced2,IID_IWMWriterAdvanced2,(void**)&pWMWA2);
if ( FAILED(hr) )
{
return hr;
}
BOOL value = TRUE;
hr = pWMWA2->SetInputSetting(1,g_wszInterlacedCoding,WMT_TYPE_BOOL,(const BYTE*)&value,sizeof(WMT_TYPE_BOOL));
if ( FAILED(hr) )
{
return hr;
}
3.at last,in the asf writer's callback function,I invoked the INSSBuffer3 and set the aspect ratio property.
But the resulting file,the aspect ratio is (width*aspectx)/(height*aspecty).
I don't know why,or it always been like this.
Does anybody know this?
thank you in advance.
I followed the SDK document and did like this:
1.I invokeed AddDataUnitExtension(WM_SampleExtensionGUID_PixelAspectRatio,WM_SampleExtension_PixelAspectRatio_Size,NULL,0);
2.set inputsettings:
COMRef<IServiceProvider> pSp;
COMRef<IWMWriterAdvanced2> pWMWA2;
hr = pWriterFilter->QueryInterface(IID_IServiceProvider,(void**)&pSp);
if ( FAILED(hr) )
{
return hr;
}
hr = pSp->QueryService(IID_IWMWriterAdvanced2,IID_IWMWriterAdvanced2,(void**)&pWMWA2);
if ( FAILED(hr) )
{
return hr;
}
BOOL value = TRUE;
hr = pWMWA2->SetInputSetting(1,g_wszInterlacedCoding,WMT_TYPE_BOOL,(const BYTE*)&value,sizeof(WMT_TYPE_BOOL));
if ( FAILED(hr) )
{
return hr;
}
3.at last,in the asf writer's callback function,I invoked the INSSBuffer3 and set the aspect ratio property.
But the resulting file,the aspect ratio is (width*aspectx)/(height*aspecty).
I don't know why,or it always been like this.
Does anybody know this?
thank you in advance.