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:
@@ -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,100 +30,103 @@
|
|||||||
|
|
||||||
#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;
|
||||||
bool is_subtitle;
|
bool is_subtitle;
|
||||||
|
|
||||||
bool stream_header_valid;
|
bool stream_header_valid;
|
||||||
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;
|
||||||
bitmap_info_header video_format;
|
bitmap_info_header video_format;
|
||||||
|
|
||||||
int64 odml_index_start;
|
int64 odml_index_start;
|
||||||
uint32 odml_index_size;
|
uint32 odml_index_size;
|
||||||
|
|
||||||
bigtime_t duration;
|
bigtime_t duration;
|
||||||
int64 frame_count;
|
int64 frame_count;
|
||||||
uint32 frames_per_sec_rate;
|
uint32 frames_per_sec_rate;
|
||||||
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();
|
||||||
|
|
||||||
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,
|
||||||
status_t ParseChunk_LIST(uint64 start, uint32 size);
|
uint32 size);
|
||||||
status_t ParseChunk_idx1(uint64 start, uint32 size);
|
status_t ParseChunk_LIST(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_indx(uint64 start, uint32 size);
|
status_t ParseChunk_idx1(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_avih(uint64 start, uint32 size);
|
status_t ParseChunk_indx(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_strh(uint64 start, uint32 size);
|
status_t ParseChunk_avih(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_strf(uint64 start, uint32 size);
|
status_t ParseChunk_strh(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_strn(uint64 start, uint32 size);
|
status_t ParseChunk_strf(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_dmlh(uint64 start, uint32 size);
|
status_t ParseChunk_strn(uint64 start, uint32 size);
|
||||||
status_t ParseList_movi(uint64 start, uint32 size);
|
status_t ParseChunk_dmlh(uint64 start, uint32 size);
|
||||||
status_t ParseList_generic(uint64 start, uint32 size);
|
status_t ParseList_movi(uint64 start, uint32 size);
|
||||||
status_t ParseList_INFO(uint64 start, uint32 size);
|
status_t ParseList_generic(uint64 start, uint32 size);
|
||||||
status_t ParseList_strl(uint64 start, uint32 size);
|
status_t ParseList_INFO(uint64 start, uint32 size);
|
||||||
|
status_t ParseList_strl(uint64 start, uint32 size);
|
||||||
|
|
||||||
void CreateNewStreamInfo();
|
void CreateNewStreamInfo();
|
||||||
void SetupStreamLength(OpenDMLStream *stream);
|
void SetupStreamLength(OpenDMLStream *stream);
|
||||||
void SetupAudioStreamLength(OpenDMLStream *stream);
|
void SetupAudioStreamLength(OpenDMLStream *stream);
|
||||||
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
|
||||||
int64 fMovieListStart;
|
int64 fMovieListStart;
|
||||||
uint32 fMovieListSize;
|
uint32 fMovieListSize;
|
||||||
|
|
||||||
int64 fStandardIndexStart;
|
int64 fStandardIndexStart;
|
||||||
uint32 fStandardIndexSize;
|
uint32 fStandardIndexSize;
|
||||||
|
|
||||||
int fStreamCount;
|
int fStreamCount;
|
||||||
int fMovieChunkCount;
|
int fMovieChunkCount;
|
||||||
|
|
||||||
avi_main_header fAviMainHeader;
|
avi_main_header fAviMainHeader;
|
||||||
bool fAviMainHeaderValid;
|
bool fAviMainHeaderValid;
|
||||||
|
|
||||||
odml_extended_header fOdmlExtendedHeader;
|
odml_extended_header fOdmlExtendedHeader;
|
||||||
bool fOdmlExtendedHeaderValid;
|
bool fOdmlExtendedHeaderValid;
|
||||||
|
|
||||||
vector<OpenDMLStream> fStreams;
|
std::vector<OpenDMLStream> fStreams;
|
||||||
OpenDMLStream * fCurrentStream;
|
OpenDMLStream * fCurrentStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user