mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 14:00:32 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62594 954022d7-b5bf-4e40-9824-e11837661b57
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#include "SvmConverter.h"
|
|
#include "OfficeSvmFile.h"
|
|
#include "ATLDefine.h"
|
|
|
|
#import "../../../Redist/ASCImageStudio3.dll" rename_namespace("ImageStudio")
|
|
|
|
void ConvertSvmToImage( const std::wstring & oSource, const std::wstring & oDestination )
|
|
{
|
|
std::wstring sXmlExt = L"Jpeg";
|
|
|
|
CoInitialize( NULL );
|
|
OfficeSvmFile oSvmFile;
|
|
BSTR bstrSource = SysAllocString(oSource.c_str()) ;
|
|
int nRes = oSvmFile.Open(bstrSource);
|
|
SysFreeString(bstrSource);
|
|
if( NOERROR != nRes )
|
|
return;
|
|
MediaCore::IAVSUncompressedVideoFrame* piImage = NULL;
|
|
piImage = oSvmFile.GetThumbnail();
|
|
if( NULL == piImage )
|
|
return;
|
|
|
|
ImageStudio::IImageTransforms* piTransform = NULL;
|
|
HRESULT hRes = CoCreateInstance( __uuidof( ImageStudio::ImageTransforms ), NULL, CLSCTX_INPROC, __uuidof( ImageStudio::IImageTransforms ), (void**)(&piTransform));
|
|
if( NULL == piTransform )
|
|
return;
|
|
VARIANT vImage;
|
|
vImage.punkVal = piImage;
|
|
vImage.vt = VT_UNKNOWN;
|
|
piTransform->SetSource( 0, vImage );
|
|
|
|
std::wstring sXml;
|
|
sXml.append( L"<ImageFile-SaveAs" );
|
|
sXml.append( sXmlExt );
|
|
sXml.append( L" destinationpath=\"" );
|
|
sXml.append( oDestination );
|
|
sXml.append( L"\" format=\"8888\"/>" );
|
|
|
|
if( piTransform->SetXml( sXml.c_str() ) )
|
|
if(piTransform->Transform())
|
|
piTransform->GetResult( 0, &vImage );
|
|
|
|
RELEASEINTERFACE( vImage.punkVal );
|
|
RELEASEINTERFACE( piTransform );
|
|
RELEASEINTERFACE( piImage );
|
|
|
|
oSvmFile.Close();
|
|
CoUninitialize();
|
|
} |