[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-cvs
Subject: [Datatype-cvs] common/util riff.cpp,1.16.12.2,1.16.12.3
From: sgarg () helixcommunity ! org
Date: 2010-01-29 5:35:38
Message-ID: 201001290536.o0T5ansJ032756 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/datatype/common/util
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv30078
Modified Files:
Tag: hxclient_4_0_1_brizo
riff.cpp
Log Message:
Fix broken RealMedia file format due to RIFFReader
Index: riff.cpp
===================================================================
RCS file: /cvsroot/datatype/common/util/riff.cpp,v
retrieving revision 1.16.12.2
retrieving revision 1.16.12.3
diff -u -d -r1.16.12.2 -r1.16.12.3
--- riff.cpp 15 Jan 2010 04:23:43 -0000 1.16.12.2
+++ riff.cpp 29 Jan 2010 05:35:35 -0000 1.16.12.3
@@ -64,6 +64,7 @@
{ GET_IIDHANDLE(IID_IUnknown), this},
{ GET_IIDHANDLE(IID_IHXFileResponse), (IHXFileResponse*)this},
{ GET_IIDHANDLE(IID_IHXFileStatResponse), (IHXFileStatResponse*)this},
+ { GET_IIDHANDLE(IID_IHXThreadSafeMethods), (IHXThreadSafeMethods*)this},
};
HX_RESULT retVal = ::QIFind(qiList, QILISTSIZE(qiList), riid, ppvObj);
@@ -218,18 +219,30 @@
HX_RELEASE(m_pFileStatObj);
if ( !m_pFileObject )
- return HXR_UNEXPECTED;
+ {
+ return HXR_UNEXPECTED;
+ }
+ // QI for IHXFileStat
HX_RESULT retVal = m_pFileObject->QueryInterface(IID_IHXFileStat, (void **) &m_pFileStatObj);
- if(SUCCEEDED(retVal) && (m_pFileStatObj->Stat((IHXFileStatResponse *) this) == HXR_OK))
+ if(SUCCEEDED(retVal))
{
- return status;
+ // QI for IHXFileStat succeeded, so set the state
+ m_state = RS_StatDonePending;
+ // Do the Stat
+ retVal = m_pFileStatObj->Stat((IHXFileStatResponse *) this);
}
else
{
- m_state = RS_GetFileTypePending;
- return m_pFileObject->Read(sizeof(UINT32) * 2);
+ // QI for IHXFileStat failed, so skip the Stat and seek to
+ // the beginning of the file. Set the state.
+ m_state = RS_InitialSeekDonePending;
+ // Set the desired seek offset
+ m_ulSeekOffset = 0;
+ // Seek the file to the beginning
+ retVal = m_pFileObject->Seek(m_ulSeekOffset, FALSE);
}
+ return retVal;
}
/////////////////////////////////////////////////////////////////////////
@@ -243,6 +256,11 @@
UINT32 ulModificationTime,
UINT32 ulMode)
{
+ // Check the state
+ if (m_state != RS_StatDonePending)
+ {
+ return HXR_UNEXPECTED;
+ }
// We're finished with the IHXFileStat interface, so we'll release it:
HX_RELEASE(m_pFileStatObj);
@@ -252,8 +270,12 @@
// actual duration for all streams using it.
m_ulTotalFileSizeInBytes = ulSize;
}
- m_state = RS_GetFileTypePending;
- return m_pFileObject->Read(sizeof(UINT32) * 2);
+ // Now we need to seek the file to the beginning, so set the state
+ m_state = RS_InitialSeekDonePending;
+ // Set the desired seek offset
+ m_ulSeekOffset = 0;
+ // Seek the file to the beginning
+ return m_pFileObject->Seek(m_ulSeekOffset, FALSE);
}
UINT32 CRIFFReader::GetTotalFileSize()
@@ -736,6 +758,15 @@
switch ( m_state )
{
+ case RS_InitialSeekDonePending:
+ // We have seeked the file object back to the beginning,
+ // so now we can read the first chunk header.
+ //
+ // Set the state
+ m_state = RS_GetFileTypePending;
+ // Read the first two UINT32's in the file
+ result = m_pFileObject->Read(sizeof(UINT32) * 2);
+ return (HXR_OK == status ? result : status);
case RS_ChunkBodySeekPending:
m_state = RS_ChunkHeaderReadPending;
result = m_pFileObject->Read(sizeof(UINT32) + sizeof(UINT32));
_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic