diff --git a/src/add-ons/media/plugins/mov_reader/libMOV/ChunkSuperIndex.h b/src/add-ons/media/plugins/mov_reader/libMOV/ChunkSuperIndex.h index bf5ba955b0..ca4c2b5d3e 100644 --- a/src/add-ons/media/plugins/mov_reader/libMOV/ChunkSuperIndex.h +++ b/src/add-ons/media/plugins/mov_reader/libMOV/ChunkSuperIndex.h @@ -25,10 +25,11 @@ #ifndef _CHUNK_INDEX_H #define _CHUNK_INDEX_H + #include -// Std Headers -#include +#include + struct ChunkIndex { uint32 stream; diff --git a/src/add-ons/media/plugins/mov_reader/libMOV/MOVAtom.h b/src/add-ons/media/plugins/mov_reader/libMOV/MOVAtom.h index 4faecb4abe..7ed170a8db 100644 --- a/src/add-ons/media/plugins/mov_reader/libMOV/MOVAtom.h +++ b/src/add-ons/media/plugins/mov_reader/libMOV/MOVAtom.h @@ -25,15 +25,15 @@ #ifndef _MOV_ATOM_H #define _MOV_ATOM_H +#include "QTStructs.h" + #include #include #include #include -// Std Headers -#include +#include -#include "QTStructs.h" /* AtomBase diff --git a/src/add-ons/media/plugins/mov_reader/libMOV/MOVFileReader.cpp b/src/add-ons/media/plugins/mov_reader/libMOV/MOVFileReader.cpp index a5516cbb83..a62a368113 100644 --- a/src/add-ons/media/plugins/mov_reader/libMOV/MOVFileReader.cpp +++ b/src/add-ons/media/plugins/mov_reader/libMOV/MOVFileReader.cpp @@ -22,16 +22,20 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include #include "MOVParser.h" #include "MOVFileReader.h" +#include +#include + +#include + + extern AtomBase *getAtom(BPositionIO *pStream); + MOVFileReader::MOVFileReader(BPositionIO *pStream) { theStream = pStream; @@ -549,36 +553,36 @@ const mov_stream_header *MOVFileReader::StreamFormat(uint32 stream_index) return &theStreamHeader; } -uint32 MOVFileReader::getChunkSize(uint32 stream_index, uint32 pFrameNo) + +uint32 +MOVFileReader::getChunkSize(uint32 streamIndex, uint32 frameNumber) { - AtomBase *aAtomBase = GetChildAtom(uint32('trak'),stream_index); - if (aAtomBase) { - TRAKAtom *aTrakAtom = dynamic_cast(aAtomBase); + AtomBase *aAtomBase = GetChildAtom(uint32('trak'), streamIndex); + if (aAtomBase == NULL) + return 0; - if (IsAudio(stream_index)) { + TRAKAtom *aTrakAtom = dynamic_cast(aAtomBase); - // We read audio in chunk by chunk so chunk size is chunk size - uint32 ChunkNo = pFrameNo; - off_t Chunk_Start = aTrakAtom->getOffsetForChunk(ChunkNo); - uint32 ChunkSize = ChunkSize = theChunkSuperIndex.getChunkSize(stream_index,ChunkNo,Chunk_Start); - - return ChunkSize; + if (IsAudio(streamIndex)) { + // We read audio in chunk by chunk so chunk size is chunk size + off_t chunkStart = aTrakAtom->getOffsetForChunk(frameNumber); + return theChunkSuperIndex.getChunkSize(streamIndex, frameNumber, chunkStart); + } + + if (IsVideo(streamIndex)) { + if (frameNumber < aTrakAtom->FrameCount()) { + // We read video in Sample by Sample so chunk size is Sample Size + uint32 sampleNumber = aTrakAtom->getSampleForFrame(frameNumber); + return aTrakAtom->getSizeForSample(sampleNumber); } - - if (IsVideo(stream_index)) { - if (pFrameNo < aTrakAtom->FrameCount()) { - // We read video in Sample by Sample so chunk size is Sample Size - uint32 SampleNo = aTrakAtom->getSampleForFrame(pFrameNo); - return aTrakAtom->getSizeForSample(SampleNo); - } - } - } return 0; } -bool MOVFileReader::IsKeyFrame(uint32 stream_index, uint32 pFrameNo) + +bool +MOVFileReader::IsKeyFrame(uint32 stream_index, uint32 pFrameNo) { AtomBase *aAtomBase = GetChildAtom(uint32('trak'),stream_index); if (aAtomBase) { diff --git a/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h b/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h index c29162446c..82fd9eac08 100644 --- a/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h +++ b/src/add-ons/media/plugins/mov_reader/libMOV/MOVParser.h @@ -25,15 +25,16 @@ #ifndef _MOV_PARSER_H #define _MOV_PARSER_H + +#include "MOVAtom.h" + #include #include #include #include -// Std Headers -#include +#include -#include "MOVAtom.h" typedef SoundDescriptionV1* SoundDescPtr; typedef std::map > SoundDescArray; diff --git a/src/add-ons/media/plugins/mov_reader/libMOV/QTStructs.h b/src/add-ons/media/plugins/mov_reader/libMOV/QTStructs.h index 4298d48b1e..589e3b9915 100644 --- a/src/add-ons/media/plugins/mov_reader/libMOV/QTStructs.h +++ b/src/add-ons/media/plugins/mov_reader/libMOV/QTStructs.h @@ -22,6 +22,13 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef QT_STRUCTS_H +#define QT_STRUCTS_H + + +#include + + struct xxxx { uint8 Version; uint8 Flags1; @@ -340,3 +347,6 @@ struct VideoDescriptionV0 { uint8 *theVOL; size_t VOLSize; }; + +#endif // QT_STRUCTS_H +