Fix GCC 4 build. Implemented constructors/destructors and standard operators.

Hopefully, I am not stepping on your toes, David! Please check these changes,
I've added some TODOs where problems may be lurking.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29312 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-02-24 12:15:40 +00:00
parent 8ee9217eec
commit 50d6da5a0e
2 changed files with 132 additions and 81 deletions
@@ -42,6 +42,67 @@
#endif #endif
OpenDMLStream::OpenDMLStream()
:
is_audio(false),
is_video(false),
is_subtitle(false),
stream_header_valid(false),
audio_format_valid(false),
audio_format(NULL),
audio_format_size(0),
video_format_valid(false),
odml_index_start(0),
odml_index_size(0),
duration(0),
frame_count(0),
frames_per_sec_rate(1),
frames_per_sec_scale(1)
{
}
OpenDMLStream::OpenDMLStream(const OpenDMLStream& other)
{
*this = other;
}
OpenDMLStream::~OpenDMLStream()
{
}
OpenDMLStream&
OpenDMLStream::operator=(const OpenDMLStream& other)
{
// TODO: implement for real
if (&other != this)
memcpy(this, &other, sizeof(OpenDMLStream));
return *this;
}
bool
OpenDMLStream::operator==(const OpenDMLStream& other) const
{
// TODO: should probably check "valid" flags
if (this == &other)
return true;
return memcmp(this, &other, sizeof(OpenDMLStream)) == 0;
}
bool
OpenDMLStream::operator!=(const OpenDMLStream& other) const
{
return !(*this == other);
}
// #pragma mark -
OpenDMLParser::OpenDMLParser(BPositionIO *source) OpenDMLParser::OpenDMLParser(BPositionIO *source)
: fSource(source), : fSource(source),
fSize(source->Seek(0, SEEK_END)), fSize(source->Seek(0, SEEK_END)),
@@ -111,22 +172,9 @@ void
OpenDMLParser::CreateNewStreamInfo() OpenDMLParser::CreateNewStreamInfo()
{ {
OpenDMLStream info; OpenDMLStream info;
info.is_audio = false;
info.is_video = false;
info.stream_header_valid = false;
info.audio_format = 0;
info.video_format_valid = false;
info.odml_index_start = 0;
info.odml_index_size = 0;
info.duration = 0;
info.frame_count = 0;
info.frames_per_sec_rate = 1;
info.frames_per_sec_scale = 1;
fStreams.push_back(info); fStreams.push_back(info);
fCurrentStream = fStreams.last(); fCurrentStream = &fStreams[fStreams.size() - 1];// fStreams.last();
} }
status_t status_t
@@ -30,11 +30,15 @@
#include "avi.h" #include "avi.h"
class OpenDMLStream class OpenDMLStream {
{
public: public:
OpenDMLStream(); OpenDMLStream();
~OpenDMLStream(); OpenDMLStream(const OpenDMLStream& other);
virtual ~OpenDMLStream();
OpenDMLStream& operator=(const OpenDMLStream& other);
bool operator==(const OpenDMLStream& other) const;
bool operator!=(const OpenDMLStream& other) const;
bool is_audio; bool is_audio;
bool is_video; bool is_video;
@@ -44,7 +48,7 @@ public:
avi_stream_header stream_header; avi_stream_header stream_header;
bool audio_format_valid; bool audio_format_valid;
wave_format_ex *audio_format; wave_format_ex* audio_format;
size_t audio_format_size; size_t audio_format_size;
bool video_format_valid; bool video_format_valid;
@@ -59,17 +63,16 @@ public:
uint32 frames_per_sec_scale; uint32 frames_per_sec_scale;
}; };
class OpenDMLParser class OpenDMLParser {
{
public: public:
OpenDMLParser(BPositionIO *source); OpenDMLParser(BPositionIO *source);
~OpenDMLParser(); virtual ~OpenDMLParser();
status_t Init(); status_t Init();
int StreamCount(); int StreamCount();
const OpenDMLStream * StreamInfo(int index); const OpenDMLStream* StreamInfo(int index);
int64 StandardIndexStart(); int64 StandardIndexStart();
uint32 StandardIndexSize(); uint32 StandardIndexSize();
@@ -77,12 +80,13 @@ public:
int64 MovieListStart(); int64 MovieListStart();
uint32 MovieListSize() {return fMovieListSize;}; uint32 MovieListSize() {return fMovieListSize;};
const avi_main_header * AviMainHeader(); const avi_main_header* AviMainHeader();
const odml_extended_header * OdmlExtendedHeader(); const odml_extended_header* OdmlExtendedHeader();
private: private:
status_t Parse(); status_t Parse();
status_t ParseChunk_AVI(int number, uint64 start, uint32 size); status_t ParseChunk_AVI(int number, uint64 start,
uint32 size);
status_t ParseChunk_LIST(uint64 start, uint32 size); status_t ParseChunk_LIST(uint64 start, uint32 size);
status_t ParseChunk_idx1(uint64 start, uint32 size); status_t ParseChunk_idx1(uint64 start, uint32 size);
status_t ParseChunk_indx(uint64 start, uint32 size); status_t ParseChunk_indx(uint64 start, uint32 size);
@@ -102,8 +106,7 @@ private:
void SetupVideoStreamLength(OpenDMLStream *stream); void SetupVideoStreamLength(OpenDMLStream *stream);
private: private:
BPositionIO* fSource;
BPositionIO * fSource;
int64 fSize; int64 fSize;
// TODO can be multiple Movi Lists // TODO can be multiple Movi Lists
@@ -122,7 +125,7 @@ private:
odml_extended_header fOdmlExtendedHeader; odml_extended_header fOdmlExtendedHeader;
bool fOdmlExtendedHeaderValid; bool fOdmlExtendedHeaderValid;
vector<OpenDMLStream> fStreams; std::vector<OpenDMLStream> fStreams;
OpenDMLStream * fCurrentStream; OpenDMLStream * fCurrentStream;
}; };