* Fixed warnings when compiled with GCC 4.

* Minor cleanup on the way.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18488 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-08-11 19:42:49 +00:00
parent 6e0e4ca6b2
commit db942edbe1
5 changed files with 48 additions and 32 deletions
@@ -25,10 +25,11 @@
#ifndef _CHUNK_INDEX_H #ifndef _CHUNK_INDEX_H
#define _CHUNK_INDEX_H #define _CHUNK_INDEX_H
#include <SupportDefs.h> #include <SupportDefs.h>
// Std Headers #include <map>
#include <map.h>
struct ChunkIndex { struct ChunkIndex {
uint32 stream; uint32 stream;
@@ -25,15 +25,15 @@
#ifndef _MOV_ATOM_H #ifndef _MOV_ATOM_H
#define _MOV_ATOM_H #define _MOV_ATOM_H
#include "QTStructs.h"
#include <File.h> #include <File.h>
#include <MediaDefs.h> #include <MediaDefs.h>
#include <MediaFormats.h> #include <MediaFormats.h>
#include <SupportDefs.h> #include <SupportDefs.h>
// Std Headers #include <map>
#include <map.h>
#include "QTStructs.h"
/* /*
AtomBase AtomBase
@@ -22,16 +22,20 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <iostream.h>
#include <DataIO.h>
#include <SupportKit.h>
#include "MOVParser.h" #include "MOVParser.h"
#include "MOVFileReader.h" #include "MOVFileReader.h"
#include <DataIO.h>
#include <SupportKit.h>
#include <iostream>
extern AtomBase *getAtom(BPositionIO *pStream); extern AtomBase *getAtom(BPositionIO *pStream);
MOVFileReader::MOVFileReader(BPositionIO *pStream) MOVFileReader::MOVFileReader(BPositionIO *pStream)
{ {
theStream = pStream; theStream = pStream;
@@ -549,36 +553,36 @@ const mov_stream_header *MOVFileReader::StreamFormat(uint32 stream_index)
return &theStreamHeader; return &theStreamHeader;
} }
uint32 MOVFileReader::getChunkSize(uint32 stream_index, uint32 pFrameNo)
uint32
MOVFileReader::getChunkSize(uint32 streamIndex, uint32 frameNumber)
{ {
AtomBase *aAtomBase = GetChildAtom(uint32('trak'),stream_index); AtomBase *aAtomBase = GetChildAtom(uint32('trak'), streamIndex);
if (aAtomBase) { if (aAtomBase == NULL)
TRAKAtom *aTrakAtom = dynamic_cast<TRAKAtom *>(aAtomBase); return 0;
if (IsAudio(stream_index)) { TRAKAtom *aTrakAtom = dynamic_cast<TRAKAtom *>(aAtomBase);
// We read audio in chunk by chunk so chunk size is chunk size if (IsAudio(streamIndex)) {
uint32 ChunkNo = pFrameNo; // We read audio in chunk by chunk so chunk size is chunk size
off_t Chunk_Start = aTrakAtom->getOffsetForChunk(ChunkNo); off_t chunkStart = aTrakAtom->getOffsetForChunk(frameNumber);
uint32 ChunkSize = ChunkSize = theChunkSuperIndex.getChunkSize(stream_index,ChunkNo,Chunk_Start); return theChunkSuperIndex.getChunkSize(streamIndex, frameNumber, chunkStart);
}
return ChunkSize; 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; 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); AtomBase *aAtomBase = GetChildAtom(uint32('trak'),stream_index);
if (aAtomBase) { if (aAtomBase) {
@@ -25,15 +25,16 @@
#ifndef _MOV_PARSER_H #ifndef _MOV_PARSER_H
#define _MOV_PARSER_H #define _MOV_PARSER_H
#include "MOVAtom.h"
#include <File.h> #include <File.h>
#include <MediaDefs.h> #include <MediaDefs.h>
#include <MediaFormats.h> #include <MediaFormats.h>
#include <SupportDefs.h> #include <SupportDefs.h>
// Std Headers #include <map>
#include <map.h>
#include "MOVAtom.h"
typedef SoundDescriptionV1* SoundDescPtr; typedef SoundDescriptionV1* SoundDescPtr;
typedef std::map<uint32, SoundDescPtr, std::less<uint32> > SoundDescArray; typedef std::map<uint32, SoundDescPtr, std::less<uint32> > SoundDescArray;
@@ -22,6 +22,13 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef QT_STRUCTS_H
#define QT_STRUCTS_H
#include <SupportDefs.h>
struct xxxx { struct xxxx {
uint8 Version; uint8 Version;
uint8 Flags1; uint8 Flags1;
@@ -340,3 +347,6 @@ struct VideoDescriptionV0 {
uint8 *theVOL; uint8 *theVOL;
size_t VOLSize; size_t VOLSize;
}; };
#endif // QT_STRUCTS_H