[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-cvs
Subject: [Datatype-cvs] common/util riff.cpp,1.12.16.2.16.1,1.12.16.2.16.2
From: sgarg () helixcommunity ! org
Date: 2010-01-29 5:12:59
Message-ID: 201001290514.o0T5EEn7031355 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/datatype/common/util
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv29110
Modified Files:
Tag: hxclient_3_4_7_atlas
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.12.16.2.16.1
retrieving revision 1.12.16.2.16.2
diff -u -d -r1.12.16.2.16.1 -r1.12.16.2.16.2
--- riff.cpp 14 Jan 2010 04:07:52 -0000 1.12.16.2.16.1
+++ riff.cpp 29 Jan 2010 05:12:56 -0000 1.12.16.2.16.2
@@ -214,18 +214,30 @@
HX_RELEASE(m_pFileStatObj);
if ( !m_pFileObject )
- return HXR_UNEXPECTED;
+ {
+ return HXR_UNEXPECTED;
+ }
- HX_RESULT retVal = m_pFileObject->QueryInterface(IID_IHXFileStat, (void **) \
&m_pFileStatObj);
- if(SUCCEEDED(retVal) && (m_pFileStatObj->Stat((IHXFileStatResponse *) this) == \
HXR_OK))
- {
- return status;
+ // QI for IHXFileStat
+ HX_RESULT retVal = m_pFileObject->QueryInterface(IID_IHXFileStat, (void **) \
&m_pFileStatObj); + if(SUCCEEDED(retVal))
+ {
+ // 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;
}
/////////////////////////////////////////////////////////////////////////
@@ -239,6 +251,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);
@@ -248,8 +265,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()
@@ -731,6 +752,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