mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 11:55:36 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52470 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
d3fe45b412
commit
7eec1902ef
@ -124,7 +124,7 @@ protected:
|
||||
CGdiPlusInit m_oGdiPlusInit;
|
||||
|
||||
Bitmap* m_bitmap;
|
||||
ImageVideoFile::IImageVideoFile4 *m_pImageVideoFile;
|
||||
|
||||
int m_nMultipagedFormat; // 0 - Tiff, 1 - GIF <20><><EFBFBD> APNG
|
||||
double m_dAnimationDuration; //<2F> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
long m_nAnimationWidth;
|
||||
@ -180,7 +180,7 @@ protected:
|
||||
|
||||
// setup default values
|
||||
m_bitmap = 0;
|
||||
m_pImageVideoFile = NULL;
|
||||
|
||||
m_nMultipagedFormat = 0;
|
||||
m_dAnimationDuration = 1000;
|
||||
m_nAnimationWidth = -1;
|
||||
@ -214,7 +214,6 @@ protected:
|
||||
}
|
||||
~ImageFile3()
|
||||
{
|
||||
RELEASEINTERFACE(m_pImageVideoFile);
|
||||
// delete existing memory
|
||||
ClearBitmap();
|
||||
|
||||
@ -1198,6 +1197,7 @@ protected:
|
||||
else
|
||||
if( eFileType ==_ImageFileFormats::c_RawFotos)
|
||||
{
|
||||
#ifndef NO_RAW_CHECKER
|
||||
const TCHAR * settingsXML = _T("<ImageRaw3 mode=\"0\" xmlns=\"http://tempuri.org/ImageRaw3Options.xsd\"> \
|
||||
<SimpleMode ver=\"1\"><CameraWhiteBalance use=\"1\"/><CameraMatrix use=\"0\"/> \
|
||||
</SimpleMode></ImageRaw3>");
|
||||
@ -1205,19 +1205,30 @@ protected:
|
||||
ImageStudio::IO::Raw oRenderRaw;
|
||||
bLoading = oRenderRaw.FromFile( sFilePath, nFormat, &oImage, settingsXML);
|
||||
bVerFlip = !(bVerFlip);
|
||||
#else
|
||||
bLoading = FALSE;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if( eFileType ==_ImageFileFormats::c_Sfw)
|
||||
{
|
||||
#ifndef NO_SWF_CHECKER
|
||||
ImageStudio::IO::Sfw oRenderSfw;
|
||||
bLoading = oRenderSfw.FromFile( sFilePath, nFormat, &oImage );
|
||||
bVerFlip = !(bVerFlip);
|
||||
#else
|
||||
bLoading = FALSE;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if( eFileType ==_ImageFileFormats::c_Swf)
|
||||
{
|
||||
#ifndef NO_SWF_CHECKER
|
||||
ImageStudio::IO::Swf oRenderSwf;
|
||||
bLoading = oRenderSwf.FromFile( sFilePath, nFormat, &oImage );
|
||||
#else
|
||||
bLoading = FALSE;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if( eFileType ==_ImageFileFormats::c_Svm)
|
||||
@ -1676,83 +1687,8 @@ protected:
|
||||
}
|
||||
VARIANT_BOOL SaveImageAsAnimated(BSTR Path, LONG Format, void** Image, BOOL bArrayOrInterface = TRUE)
|
||||
{
|
||||
m_nMultipagedFormat = 1;
|
||||
|
||||
RELEASEINTERFACE( m_pImageVideoFile );
|
||||
::CoCreateInstance( __uuidof(ImageVideoFile::CImageVideoFile3), NULL, CLSCTX_INPROC, __uuidof(ImageVideoFile::IImageVideoFile4), (void**)&m_pImageVideoFile );
|
||||
if ( !m_pImageVideoFile )
|
||||
return VARIANT_FALSE;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD> VideoFormat <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Width, Height, ColorSpace
|
||||
MediaFormat::IAVSVideoFormat *piVideoFormat = NULL;
|
||||
CoCreateInstance(MediaFormat::CLSID_CAVSVideoFormat, NULL, CLSCTX_ALL, MediaFormat::IID_IAVSVideoFormat, (void**)&piVideoFormat);
|
||||
if ( NULL == piVideoFormat )
|
||||
{
|
||||
RELEASEINTERFACE( m_pImageVideoFile );
|
||||
return VARIANT_FALSE;
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - GIF
|
||||
if( IMAGEFORMAT_PNG == Format )
|
||||
m_pImageVideoFile->put_FileType( 2 );//<2F><><EFBFBD> APNG
|
||||
else
|
||||
m_pImageVideoFile->put_FileType( 1 );//<2F><><EFBFBD> GIF
|
||||
|
||||
//Width, Height <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> IAVSVideoFormat
|
||||
//Duration - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IAVSUncompressedVideoFrame
|
||||
MediaCore::IAVSUncompressedVideoFrame* piVideoFrame = NULL;
|
||||
((IUnknown*)*Image)->QueryInterface( __uuidof(MediaCore::IAVSUncompressedVideoFrame), (void**)&piVideoFrame );
|
||||
if( NULL != piVideoFrame )
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> duration
|
||||
piVideoFrame->put_Duration( m_dAnimationDuration );
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_nAnimationWidth <20><><EFBFBD> m_nAnimationHeight, <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if( -1 == m_nAnimationWidth || -1 == m_nAnimationHeight )
|
||||
{
|
||||
piVideoFrame->get_Width( &m_nAnimationWidth );
|
||||
piVideoFrame->get_Height( &m_nAnimationHeight );
|
||||
}
|
||||
|
||||
//ColorSpace - CSP_BGR - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//CSP_BGRA - <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20> gif <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if( IMAGEFORMAT_PNG == Format || true == m_bAnimationGifWithAlpha )
|
||||
piVideoFormat->put_ColorSpace( CSP_BGRA );
|
||||
else
|
||||
piVideoFormat->put_ColorSpace( CSP_BGR );
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> width, height
|
||||
piVideoFormat->put_Width( m_nAnimationWidth );
|
||||
piVideoFormat->put_Height( m_nAnimationHeight );
|
||||
piVideoFormat->put_AspectRatioX( m_nAnimationWidth );
|
||||
piVideoFormat->put_AspectRatioY( m_nAnimationHeight );
|
||||
|
||||
m_pImageVideoFile->put_videoFormat( piVideoFormat );
|
||||
}
|
||||
RELEASEINTERFACE( piVideoFrame );
|
||||
RELEASEINTERFACE( piVideoFormat );
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
HRESULT hRes = m_pImageVideoFile->CreateVideoFile( Path );
|
||||
if( SUCCEEDED( hRes ) )
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
hRes = m_pImageVideoFile->WriteVideo((IUnknown*) *Image);
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
||||
if ( VARIANT_FALSE == m_TiffMultipaged )
|
||||
{
|
||||
if( SUCCEEDED( hRes ) )
|
||||
hRes = m_pImageVideoFile->CloseFile();
|
||||
else
|
||||
m_pImageVideoFile->CloseFile();//<2F><><EFBFBD><EFBFBD><EFBFBD> CloseFile <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> hRes
|
||||
RELEASEINTERFACE( m_pImageVideoFile );
|
||||
m_nAnimationWidth = -1;
|
||||
m_nAnimationHeight = -1;
|
||||
}
|
||||
}
|
||||
if( SUCCEEDED( hRes ) )
|
||||
return VARIANT_TRUE;
|
||||
else
|
||||
return VARIANT_FALSE;
|
||||
return S_OK;
|
||||
|
||||
}
|
||||
VARIANT_BOOL SaveImageAsFrame(void** Image, VARIANT_BOOL LastFrame, BOOL bArrayOrInterface = TRUE)
|
||||
{
|
||||
@ -1880,37 +1816,8 @@ protected:
|
||||
// all ok
|
||||
return Success;
|
||||
}
|
||||
else if ( 1 == m_nMultipagedFormat )
|
||||
{
|
||||
if ( !m_pImageVideoFile )
|
||||
return VARIANT_FALSE;
|
||||
|
||||
MediaCore::IAVSUncompressedVideoFrame* piVideoFrame = NULL;
|
||||
((IUnknown*)*Image)->QueryInterface( __uuidof(MediaCore::IAVSUncompressedVideoFrame), (void**)&piVideoFrame );
|
||||
if( NULL != piVideoFrame )
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> duration
|
||||
piVideoFrame->put_Duration( m_dAnimationDuration );
|
||||
RELEASEINTERFACE( piVideoFrame );
|
||||
}
|
||||
|
||||
HRESULT hRes = m_pImageVideoFile->WriteVideo((IUnknown*) *Image);
|
||||
if ( VARIANT_FALSE != LastFrame )
|
||||
{
|
||||
if( SUCCEEDED( hRes ) )
|
||||
hRes = m_pImageVideoFile->CloseFile();
|
||||
else
|
||||
m_pImageVideoFile->CloseFile();//<2F><><EFBFBD><EFBFBD><EFBFBD> CloseFile <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> hRes
|
||||
RELEASEINTERFACE( m_pImageVideoFile );
|
||||
m_nAnimationWidth = -1;
|
||||
m_nAnimationHeight = -1;
|
||||
}
|
||||
if( SUCCEEDED(hRes) )
|
||||
return VARIANT_TRUE;
|
||||
else
|
||||
return VARIANT_FALSE;
|
||||
}
|
||||
return VARIANT_FALSE;
|
||||
return S_OK;
|
||||
|
||||
}
|
||||
VARIANT_BOOL SaveImageAsPicture(void** Image, IPictureDisp** Picture, BOOL bArrayOrInterface = TRUE)
|
||||
{
|
||||
|
||||
@ -47,12 +47,20 @@
|
||||
|
||||
using namespace ATL;
|
||||
|
||||
#include "../../AVSVideoStudio3/Common/VideoFileInterface.h"
|
||||
#define NO_RAW_CHECKER
|
||||
#define NO_SWF_CHECKER
|
||||
|
||||
#include "../../Common/VideoFileInterface.h"
|
||||
|
||||
#import "../../Redist/ASCMediaCore3.dll" named_guids rename_namespace("MediaCore"), exclude("tagRECT")
|
||||
#import "../../Redist/ASCMediaFormatSettings3.dll" named_guids rename_namespace("MediaFormat"), exclude("tagRECT")
|
||||
#import "../../Redist/ASCGraphics.dll" named_guids rename_namespace("AVSGraphics")
|
||||
#ifndef NO_SWF_CHECKER
|
||||
#import "../../Redist/ASCSWFFile3.dll" named_guids rename_namespace("SWF")
|
||||
#endif
|
||||
|
||||
#ifndef NO_RAW_CHECKER
|
||||
#import "../../Redist/ASCImageRaw3.dll" named_guids rename_namespace("ImageRaw")
|
||||
#endif
|
||||
#import "../../Redist/ASCImageJpeg2000.dll" named_guids rename_namespace("Jpeg2000")
|
||||
|
||||
#import "../../../../AVS/Redist/AVSMediaCore3.dll" named_guids rename_namespace("MediaCore"), exclude("tagRECT")
|
||||
#import "../../../../AVS/Redist/AVSMediaFormatSettings3.dll" named_guids rename_namespace("MediaFormat"), exclude("tagRECT")
|
||||
#import "../../../../AVS/Redist/AVSImageRaw3.dll" named_guids rename_namespace("ImageRaw")
|
||||
#import "../../../../AVS/Redist/AVSImageJpeg2000.dll" named_guids rename_namespace("Jpeg2000")
|
||||
#import "../../../../AVS/Redist/AVSImageVideoFile3.dll" named_guids rename_namespace("ImageVideoFile"), raw_interfaces_only exclude("IAVSVideoFileTemplate")
|
||||
#import "../../../../AVS/Redist/AVSGraphics.dll" named_guids rename_namespace("AVSGraphics")
|
||||
#import "../../../../AVS/Redist/AVSSWFFile3.dll" named_guids rename_namespace("SWF")
|
||||
|
||||
Reference in New Issue
Block a user