本文整理汇总了C++中CMyComPtr::SetDecoderProperties2方法的典型用法代码示例。如果您正苦于以下问题:C++ CMyComPtr::SetDecoderProperties2方法的具体用法?C++ CMyComPtr::SetDecoderProperties2怎么用?C++ CMyComPtr::SetDecoderProperties2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMyComPtr
的用法示例。
在下文中一共展示了CMyComPtr::SetDecoderProperties2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Code
HRESULT CDecoder::Code(const CHeader &header, ISequentialOutStream *outStream,
ICompressProgressInfo *progress)
{
if (header.FilterID > 1)
return E_NOTIMPL;
{
CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
_lzmaDecoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
if (!setDecoderProperties)
return E_NOTIMPL;
RINOK(setDecoderProperties->SetDecoderProperties2(header.LzmaProps, 5));
}
CMyComPtr<ICompressSetOutStream> setOutStream;
bool filteredMode = (header.FilterID == 1);
if (filteredMode)
{
_bcjStream.QueryInterface(IID_ICompressSetOutStream, &setOutStream);
if (!setOutStream)
return E_NOTIMPL;
RINOK(setOutStream->SetOutStream(outStream));
outStream = _bcjStream;
}
const UInt64 *Size = header.HasSize() ? &header.Size : NULL;
HRESULT res = _lzmaDecoderSpec->CodeResume(outStream, Size, progress);
if (filteredMode)
{
CMyComPtr<IOutStreamFlush> flush;
_bcjStream.QueryInterface(IID_IOutStreamFlush, &flush);
if (flush)
{
HRESULT res2 = flush->Flush();
if (res == S_OK)
res = res2;
}
HRESULT res2 = setOutStream->ReleaseOutStream();
if (res == S_OK)
res = res2;
}
RINOK(res);
if (header.HasSize())
if (_lzmaDecoderSpec->GetOutputProcessedSize() != header.Size)
return S_FALSE;
return S_OK;
}
示例2: Decode
//.........这里部分代码省略.........
if (_multiThread)
_mixerCoderMTSpec->AddCoder2(decoder2);
#ifdef _ST_MODE
else
_mixerCoderSTSpec->AddCoder2(decoder2, false);
#endif
}
_decoders.Add(decoderUnknown);
#ifdef EXTERNAL_CODECS
CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
decoderUnknown.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
if (setCompressCodecsInfo)
{
RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecsInfo));
}
#endif
}
_bindInfoExPrev = bindInfo;
_bindInfoExPrevIsDefined = true;
}
int i;
_mixerCoderCommon->ReInit();
UInt32 packStreamIndex = 0, unpackStreamIndex = 0;
UInt32 coderIndex = 0;
// UInt32 coder2Index = 0;
for (i = 0; i < numCoders; i++)
{
const CCoderInfo &coderInfo = folderInfo.Coders[i];
CMyComPtr<IUnknown> &decoder = _decoders[coderIndex];
{
CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
if (setDecoderProperties)
{
const CByteBuffer &props = coderInfo.Props;
size_t size = props.GetCapacity();
if (size > 0xFFFFFFFF)
return E_NOTIMPL;
if (size > 0)
{
RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)props, (UInt32)size));
}
}
}
#ifdef COMPRESS_MT
if (mtMode)
{
CMyComPtr<ICompressSetCoderMt> setCoderMt;
decoder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
if (setCoderMt)
{
RINOK(setCoderMt->SetNumberOfThreads(numThreads));
}
}
#endif
#ifndef _NO_CRYPTO
{
CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
decoder.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword);
if (cryptoSetPassword)
{
示例3: Decode
HRESULT CZipDecoder::Decode(
DECL_EXTERNAL_CODECS_LOC_VARS
CInArchive &archive, const CItemEx &item,
ISequentialOutStream *realOutStream,
IArchiveExtractCallback *extractCallback,
ICompressProgressInfo *compressProgress,
UInt32 numThreads, Int32 &res)
{
res = NArchive::NExtract::NOperationResult::kDataError;
CInStreamReleaser inStreamReleaser;
bool needCRC = true;
bool wzAesMode = false;
bool pkAesMode = false;
UInt16 methodId = item.CompressionMethod;
if (item.IsEncrypted())
{
if (item.IsStrongEncrypted())
{
CStrongCryptoField f;
if (item.CentralExtra.GetStrongCryptoField(f))
{
pkAesMode = true;
}
if (!pkAesMode)
{
res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
return S_OK;
}
}
if (methodId == NFileHeader::NCompressionMethod::kWzAES)
{
CWzAesExtraField aesField;
if (item.CentralExtra.GetWzAesField(aesField))
{
wzAesMode = true;
needCRC = aesField.NeedCrc();
}
}
}
COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC;
CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
outStreamSpec->SetStream(realOutStream);
outStreamSpec->Init(needCRC);
UInt64 authenticationPos;
CMyComPtr<ISequentialInStream> inStream;
{
UInt64 packSize = item.PackSize;
if (wzAesMode)
{
if (packSize < NCrypto::NWzAes::kMacSize)
return S_OK;
packSize -= NCrypto::NWzAes::kMacSize;
}
UInt64 dataPos = item.GetDataPosition();
inStream.Attach(archive.CreateLimitedStream(dataPos, packSize));
authenticationPos = dataPos + packSize;
}
CMyComPtr<ICompressFilter> cryptoFilter;
if (item.IsEncrypted())
{
if (wzAesMode)
{
CWzAesExtraField aesField;
if (!item.CentralExtra.GetWzAesField(aesField))
return S_OK;
methodId = aesField.Method;
if (!_wzAesDecoder)
{
_wzAesDecoderSpec = new NCrypto::NWzAes::CDecoder;
_wzAesDecoder = _wzAesDecoderSpec;
}
cryptoFilter = _wzAesDecoder;
Byte properties = aesField.Strength;
RINOK(_wzAesDecoderSpec->SetDecoderProperties2(&properties, 1));
}
else if (pkAesMode)
{
if (!_pkAesDecoder)
{
_pkAesDecoderSpec = new NCrypto::NZipStrong::CDecoder;
_pkAesDecoder = _pkAesDecoderSpec;
}
cryptoFilter = _pkAesDecoder;
}
else
{
if (!_zipCryptoDecoder)
{
_zipCryptoDecoderSpec = new NCrypto::NZip::CDecoder;
_zipCryptoDecoder = _zipCryptoDecoderSpec;
}
cryptoFilter = _zipCryptoDecoder;
}
CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
RINOK(cryptoFilter.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword));
//.........这里部分代码省略.........
示例4: Init
//.........这里部分代码省略.........
break;
case NMethodType::kBZip2:
coder = new NCompress::NBZip2::CDecoder();
break;
case NMethodType::kLZMA:
new NCompress::NLZMA::CDecoder();
break;
default:
return E_NOTIMPL;
}
#endif
coder.QueryInterface(IID_ISequentialInStream, &_codecInStream);
if (!_codecInStream)
return E_NOTIMPL;
}
if (thereIsFilterFlag)
{
UInt32 processedSize;
BYTE flag;
RINOK(inStream->Read(&flag, 1, &processedSize));
if (processedSize != 1)
return E_FAIL;
if (flag > 1)
return E_NOTIMPL;
useFilter = (flag != 0);
}
if (useFilter)
{
if (!_filterInStream)
{
#ifndef EXCLUDE_COM
N7z::CMethodInfo methodInfo;
if (!N7z::GetMethodInfo(k_BCJ_X86, methodInfo))
return E_NOTIMPL;
CMyComPtr<ICompressCoder> coder;
RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath, methodInfo.Decoder, &coder));
coder.QueryInterface(IID_ISequentialInStream, &_filterInStream);
if (!_filterInStream)
return E_NOTIMPL;
#else
return E_NOTIMPL;
#endif
}
CMyComPtr<ICompressSetInStream> setInStream;
_filterInStream.QueryInterface(IID_ICompressSetInStream, &setInStream);
if (!setInStream)
return E_NOTIMPL;
RINOK(setInStream->SetInStream(_codecInStream));
_decoderInStream = _filterInStream;
}
else
_decoderInStream = _codecInStream;
if (method == NMethodType::kLZMA)
{
CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
_codecInStream.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
if (setDecoderProperties)
{
static const UInt32 kPropertiesSize = 5;
BYTE properties[kPropertiesSize];
UInt32 processedSize;
RINOK(inStream->Read(properties, kPropertiesSize, &processedSize));
if (processedSize != kPropertiesSize)
return E_FAIL;
RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)properties, kPropertiesSize));
}
}
{
CMyComPtr<ICompressSetInStream> setInStream;
_codecInStream.QueryInterface(IID_ICompressSetInStream, &setInStream);
if (!setInStream)
return E_NOTIMPL;
RINOK(setInStream->SetInStream(inStream));
}
{
CMyComPtr<ICompressSetOutStreamSize> setOutStreamSize;
_codecInStream.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize);
if (!setOutStreamSize)
return E_NOTIMPL;
RINOK(setOutStreamSize->SetOutStreamSize(NULL));
}
if (useFilter)
{
/*
CMyComPtr<ICompressSetOutStreamSize> setOutStreamSize;
_filterInStream.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize);
if (!setOutStreamSize)
return E_NOTIMPL;
RINOK(setOutStreamSize->SetOutStreamSize(NULL));
*/
}
return S_OK;
}