From b367772b5f6966ef99ea0914b8e10644b18652ea Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 11 Dec 2011 12:38:06 -0500 Subject: VIDEO: Add support for QuickTime video track edit lists --- common/quicktime.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'common/quicktime.cpp') 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() { -- cgit v1.2.3 From 7ac5bcd6f180129c4dc79b24403ef14753f2fd8a Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 15 Dec 2011 12:59:19 -0500 Subject: COMMON: QuickTime mdat atoms should be leaves --- common/quicktime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/quicktime.cpp') diff --git a/common/quicktime.cpp b/common/quicktime.cpp index e16d3f2652..dbec7f7b90 100644 --- a/common/quicktime.cpp +++ b/common/quicktime.cpp @@ -135,7 +135,7 @@ void QuickTimeParser::initParseTable() { { &QuickTimeParser::readDefault, MKTAG('e', 'd', 't', 's') }, { &QuickTimeParser::readELST, MKTAG('e', 'l', 's', 't') }, { &QuickTimeParser::readHDLR, MKTAG('h', 'd', 'l', 'r') }, - { &QuickTimeParser::readDefault, MKTAG('m', 'd', 'a', 't') }, + { &QuickTimeParser::readLeaf, MKTAG('m', 'd', 'a', 't') }, { &QuickTimeParser::readMDHD, MKTAG('m', 'd', 'h', 'd') }, { &QuickTimeParser::readDefault, MKTAG('m', 'd', 'i', 'a') }, { &QuickTimeParser::readDefault, MKTAG('m', 'i', 'n', 'f') }, -- cgit v1.2.3 From f17b1bf4f09c14d18a7bd2c5b0eeb2ac2f4490f7 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 27 Feb 2012 18:31:20 -0500 Subject: COMMON: Fix opening QuickTime files from MacBinary files --- common/quicktime.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'common/quicktime.cpp') diff --git a/common/quicktime.cpp b/common/quicktime.cpp index dbec7f7b90..248d8b2b3a 100644 --- a/common/quicktime.cpp +++ b/common/quicktime.cpp @@ -66,7 +66,7 @@ bool QuickTimeParser::parseFile(const String &filename) { _foundMOOV = false; _disposeFileHandle = DisposeAfterUse::YES; - Atom atom = { 0, 0, 0xffffffff }; + Atom atom = { 0, 0, 0 }; if (_resFork->hasResFork()) { // Search for a 'moov' resource @@ -80,14 +80,12 @@ bool QuickTimeParser::parseFile(const String &filename) { if (readDefault(atom) < 0 || !_foundMOOV) return false; } - delete _fd; - atom.type = 0; - atom.offset = 0; - atom.size = 0xffffffff; + delete _fd; } _fd = _resFork->getDataFork(); + atom.size = _fd->size(); if (readDefault(atom) < 0 || !_foundMOOV) return false; -- cgit v1.2.3