4.53 beta

This commit is contained in:
Igor Pavlov
2007-08-27 00:00:00 +00:00
committed by Kornel Lesiński
parent 33ccab7e72
commit 051769bbc5
360 changed files with 4658 additions and 5167 deletions

View File

@@ -167,6 +167,14 @@ HRESULT CCoderMixer2MT::Init(ISequentialInStream **inStreams, ISequentialOutStre
return S_OK;
}
HRESULT CCoderMixer2MT::ReturnIfError(HRESULT code)
{
for (int i = 0; i < _coders.Size(); i++)
if (_coders[i].Result == code)
return code;
return S_OK;
}
STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
const UInt64 ** /* inSizes */,
UInt32 numInStreams,
@@ -198,18 +206,10 @@ STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
if (i != _progressCoderIndex)
_coders[i].WaitFinish();
for (i = 0; i < _coders.Size(); i++)
{
HRESULT result = _coders[i].Result;
if (result == E_ABORT)
return result;
}
for (i = 0; i < _coders.Size(); i++)
{
HRESULT result = _coders[i].Result;
if (result == S_FALSE)
return result;
}
RINOK(ReturnIfError(E_ABORT));
RINOK(ReturnIfError(E_OUTOFMEMORY));
RINOK(ReturnIfError(S_FALSE));
for (i = 0; i < _coders.Size(); i++)
{
HRESULT result = _coders[i].Result;

View File

@@ -51,6 +51,7 @@ class CCoderMixer2MT:
void AddCoderCommon();
HRESULT Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams);
HRESULT ReturnIfError(HRESULT code);
public:
CObjectVector<CCoder2> _coders;
MY_UNKNOWN_IMP

View File

@@ -30,6 +30,14 @@ void CCoderMixerMT::ReInit()
_coders[i].ReInit();
}
HRESULT CCoderMixerMT::ReturnIfError(HRESULT code)
{
for (int i = 0; i < _coders.Size(); i++)
if (_coders[i].Result == code)
return code;
return S_OK;
}
STDMETHODIMP CCoderMixerMT::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream,
const UInt64 * /* inSize */, const UInt64 * /* outSize */,
@@ -67,18 +75,10 @@ STDMETHODIMP CCoderMixerMT::Code(ISequentialInStream *inStream,
if (i != _progressCoderIndex)
_coders[i].WaitFinish();
for (i = 0; i < _coders.Size(); i++)
{
HRESULT result = _coders[i].Result;
if (result == E_ABORT)
return result;
}
for (i = 0; i < _coders.Size(); i++)
{
HRESULT result = _coders[i].Result;
if (result == S_FALSE)
return result;
}
RINOK(ReturnIfError(E_ABORT));
RINOK(ReturnIfError(E_OUTOFMEMORY));
RINOK(ReturnIfError(S_FALSE));
for (i = 0; i < _coders.Size(); i++)
{
HRESULT result = _coders[i].Result;

View File

@@ -42,6 +42,7 @@ class CCoderMixerMT:
CObjectVector<CStreamBinder> _streamBinders;
int _progressCoderIndex;
HRESULT ReturnIfError(HRESULT code);
public:
CObjectVector<CCoder> _coders;
MY_UNKNOWN_IMP

View File

@@ -4,17 +4,19 @@
#include "DummyOutStream.h"
void CDummyOutStream::Init(ISequentialOutStream *outStream)
STDMETHODIMP CDummyOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
m_Stream = outStream;
}
STDMETHODIMP CDummyOutStream::Write(const void *data,
UInt32 size, UInt32 *processedSize)
{
if(m_Stream)
return m_Stream->Write(data, size, processedSize);
UInt32 realProcessedSize;
HRESULT result;
if(!_stream)
{
realProcessedSize = size;
result = S_OK;
}
else
result = _stream->Write(data, size, &realProcessedSize);
_size += realProcessedSize;
if(processedSize != NULL)
*processedSize = size;
return S_OK;
*processedSize = realProcessedSize;
return result;
}

View File

@@ -10,14 +10,14 @@ class CDummyOutStream:
public ISequentialOutStream,
public CMyUnknownImp
{
CMyComPtr<ISequentialOutStream> _stream;
UInt64 _size;
public:
void SetStream(ISequentialOutStream *outStream) { _stream = outStream; }
void Init() { _size = 0; }
MY_UNKNOWN_IMP
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
private:
CMyComPtr<ISequentialOutStream> m_Stream;
public:
void Init(ISequentialOutStream *outStream);
UInt64 GetSize() const { return _size; }
};
#endif