diff options
author | Matthew Hoops | 2011-12-11 12:38:06 -0500 |
---|---|---|
committer | Matthew Hoops | 2011-12-12 12:28:48 -0500 |
commit | b367772b5f6966ef99ea0914b8e10644b18652ea (patch) | |
tree | a17272af1db610d4924d191ca630108afcbf4b8b /common | |
parent | 35a0fb089a12991be52a14e02977202263a7dbee (diff) | |
download | scummvm-rg350-b367772b5f6966ef99ea0914b8e10644b18652ea.tar.gz scummvm-rg350-b367772b5f6966ef99ea0914b8e10644b18652ea.tar.bz2 scummvm-rg350-b367772b5f6966ef99ea0914b8e10644b18652ea.zip |
VIDEO: Add support for QuickTime video track edit lists
Diffstat (limited to 'common')
-rw-r--r-- | common/quicktime.cpp | 19 | ||||
-rw-r--r-- | common/quicktime.h | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/common/quicktime.cpp b/common/quicktime.cpp index 9ea8c229ea..e16d3f2652 100644 --- a/common/quicktime.cpp +++ b/common/quicktime.cpp @@ -386,8 +386,7 @@ int QuickTimeParser::readTKHD(Atom atom) { /* track->id = */_fd->readUint32BE(); // track id (NOT 0 !) _fd->readUint32BE(); // reserved - //track->startTime = 0; // check - (version == 1) ? (_fd->readUint32BE(), _fd->readUint32BE()) : _fd->readUint32BE(); // highlevel (considering edits) duration in movie timebase + track->duration = (version == 1) ? (_fd->readUint32BE(), _fd->readUint32BE()) : _fd->readUint32BE(); // highlevel (considering edits) duration in movie timebase _fd->readUint32BE(); // reserved _fd->readUint32BE(); // reserved @@ -410,8 +409,8 @@ int QuickTimeParser::readTKHD(Atom atom) { track->scaleFactorY.debugPrint(1, "readTKHD(): scaleFactorY ="); // these are fixed-point, 16:16 - // uint32 tkWidth = _fd->readUint32BE() >> 16; // track width - // uint32 tkHeight = _fd->readUint32BE() >> 16; // track height + //_fd->readUint32BE() >> 16; // track width + //_fd->readUint32BE() >> 16; // track height return 0; } @@ -428,17 +427,18 @@ int QuickTimeParser::readELST(Atom atom) { debug(2, "Track %d edit list count: %d", _tracks.size() - 1, track->editCount); + uint32 offset = 0; + for (uint32 i = 0; i < track->editCount; i++){ track->editList[i].trackDuration = _fd->readUint32BE(); track->editList[i].mediaTime = _fd->readSint32BE(); track->editList[i].mediaRate = Rational(_fd->readUint32BE(), 0x10000); - debugN(3, "\tDuration = %d, Media Time = %d, ", track->editList[i].trackDuration, track->editList[i].mediaTime); + track->editList[i].timeOffset = offset; + debugN(3, "\tDuration = %d (Offset = %d), Media Time = %d, ", track->editList[i].trackDuration, offset, track->editList[i].mediaTime); track->editList[i].mediaRate.debugPrint(3, "Media Rate ="); + offset += track->editList[i].trackDuration; } - if (track->editCount != 1) - warning("Multiple edit list entries. Things may go awry"); - return 0; } @@ -500,7 +500,7 @@ int QuickTimeParser::readMDHD(Atom atom) { } track->timeScale = _fd->readUint32BE(); - track->duration = (version == 1) ? (_fd->readUint32BE(), _fd->readUint32BE()) : _fd->readUint32BE(); // duration + track->mediaDuration = (version == 1) ? (_fd->readUint32BE(), _fd->readUint32BE()) : _fd->readUint32BE(); // duration _fd->readUint16BE(); // language _fd->readUint16BE(); // quality @@ -793,6 +793,7 @@ QuickTimeParser::Track::Track() { duration = 0; startTime = 0; objectTypeMP4 = 0; + mediaDuration = 0; } QuickTimeParser::Track::~Track() { diff --git a/common/quicktime.h b/common/quicktime.h index e4c821e209..d7e2691c2b 100644 --- a/common/quicktime.h +++ b/common/quicktime.h @@ -109,6 +109,7 @@ protected: struct EditListEntry { uint32 trackDuration; + uint32 timeOffset; int32 mediaTime; Rational mediaRate; }; @@ -163,6 +164,7 @@ protected: uint32 frameCount; uint32 duration; + uint32 mediaDuration; uint32 startTime; Rational scaleFactorX; Rational scaleFactorY; |