Fix bug in WebM SeekHead.
The positions in the SeekHead element should be relative to the Segment payload, not the start of the file. Also added entries for Tracks and SegmentInfo. Change-Id: Id692da25fffc27d78e9f1a06d061431aeb6f1e7c
This commit is contained in:
parent
fe6775a509
commit
40e1cc87d1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -40,26 +40,36 @@ const uint8_t kBasicSupportData[] = {
|
|||
0x42, 0x85, 0x81, 0x02,
|
||||
// ID: Segment, Payload Size: 411
|
||||
0x18, 0x53, 0x80, 0x67, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x9b,
|
||||
// ID: SeekHead, Payload Size: 30
|
||||
0x11, 0x4d, 0x9b, 0x74, 0x9e,
|
||||
// ID: SeekHead, Payload Size: 58
|
||||
0x11, 0x4d, 0x9b, 0x74, 0xba,
|
||||
// ID: Seek, Payload Size: 11
|
||||
0x4d, 0xbb, 0x8b,
|
||||
// SeekID: binary(4) (Info)
|
||||
0x53, 0xab, 0x84, 0x15, 0x49, 0xa9, 0x66,
|
||||
// SeekPosition: 89
|
||||
0x53, 0xac, 0x81, 0x59,
|
||||
// ID: Seek, Payload Size: 11
|
||||
0x4d, 0xbb, 0x8b,
|
||||
// SeekID: binary(4) (Tracks)
|
||||
0x53, 0xab, 0x84, 0x16, 0x54, 0xae, 0x6b,
|
||||
// SeekPosition: 182
|
||||
0x53, 0xac, 0x81, 0xb6,
|
||||
// ID: Seek, Payload Size: 12
|
||||
0x4d, 0xbb, 0x8c,
|
||||
// SeekID: binary(4) (Cluster)
|
||||
0x53, 0xab, 0x84, 0x1f, 0x43, 0xb6, 0x75,
|
||||
// SeekPosition: 322
|
||||
0x53, 0xac, 0x82, 0x01, 0x47,
|
||||
// SeekPosition: 279
|
||||
0x53, 0xac, 0x82, 0x01, 0x17,
|
||||
// ID: Seek, Payload Size: 12
|
||||
0x4d, 0xbb, 0x8c,
|
||||
// SeekID: binary(4) (Cues)
|
||||
0x53, 0xab, 0x84, 0x1c, 0x53, 0xbb, 0x6b,
|
||||
// SeekPosition: 429
|
||||
0x53, 0xac, 0x82, 0x01, 0xb8,
|
||||
// ID: Void, Payload Size: 52
|
||||
0xec, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// SeekPosition: 392
|
||||
0x53, 0xac, 0x82, 0x01, 0x88,
|
||||
// ID: Void, Payload Size: 24
|
||||
0xec, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
// ID: Info, Payload Size: 88
|
||||
0x15, 0x49, 0xa9, 0x66, 0xd8,
|
||||
// TimecodeScale: 1000000
|
||||
|
|
|
@ -14,9 +14,10 @@
|
|||
namespace edash_packager {
|
||||
namespace media {
|
||||
namespace {
|
||||
const mkvmuxer::uint64 kElementIds[] = {mkvmuxer::kMkvCluster,
|
||||
mkvmuxer::kMkvCues, mkvmuxer::kMkvInfo,
|
||||
mkvmuxer::kMkvTracks};
|
||||
const mkvmuxer::uint64 kElementIds[] = {
|
||||
mkvmuxer::kMkvInfo, mkvmuxer::kMkvTracks, mkvmuxer::kMkvCluster,
|
||||
mkvmuxer::kMkvCues,
|
||||
};
|
||||
const int kElementIdCount = arraysize(kElementIds);
|
||||
|
||||
uint64_t MaxSeekEntrySize() {
|
||||
|
@ -55,7 +56,7 @@ bool SeekHead::Write(mkvmuxer::IMkvWriter* writer) {
|
|||
if (!WriteEbmlMasterElement(writer, mkvmuxer::kMkvSeekHead, payload_size))
|
||||
return false;
|
||||
|
||||
const int64_t positions[] = {cluster_pos_, cues_pos_, info_pos_, tracks_pos_};
|
||||
const int64_t positions[] = {info_pos_, tracks_pos_, cluster_pos_, cues_pos_};
|
||||
for (int i = 0; i < kElementIdCount; ++i) {
|
||||
if (element_sizes[i] == 0)
|
||||
continue;
|
||||
|
@ -99,7 +100,7 @@ bool SeekHead::WriteVoid(mkvmuxer::IMkvWriter* writer) {
|
|||
}
|
||||
|
||||
uint64_t SeekHead::GetPayloadSize(std::vector<uint64_t>* data) {
|
||||
const int64_t positions[] = {cluster_pos_, cues_pos_, info_pos_, tracks_pos_};
|
||||
const int64_t positions[] = {info_pos_, tracks_pos_, cluster_pos_, cues_pos_};
|
||||
uint64_t total_payload_size = 0;
|
||||
data->resize(kElementIdCount);
|
||||
for (int i = 0; i < kElementIdCount; ++i) {
|
||||
|
|
|
@ -224,9 +224,11 @@ Status Segmenter::WriteSegmentHeader(uint64_t file_size, MkvWriter* writer) {
|
|||
return error_status;
|
||||
}
|
||||
|
||||
seek_head_.set_info_pos(writer->Position() - segment_payload_pos_);
|
||||
if (!segment_info_.Write(writer))
|
||||
return error_status;
|
||||
|
||||
seek_head_.set_tracks_pos(writer->Position() - segment_payload_pos_);
|
||||
if (!tracks_.Write(writer))
|
||||
return error_status;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Status SingleSegmentSegmenter::DoInitialize(scoped_ptr<MkvWriter> writer) {
|
|||
writer_ = writer.Pass();
|
||||
Status ret = WriteSegmentHeader(0, writer_.get());
|
||||
init_end_ = writer_->Position() - 1;
|
||||
seek_head()->set_cluster_pos(init_end_ + 1);
|
||||
seek_head()->set_cluster_pos(init_end_ + 1 - segment_payload_pos());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ Status SingleSegmentSegmenter::DoFinalize() {
|
|||
|
||||
// Write the Cues to the end of the file.
|
||||
index_start_ = writer_->Position();
|
||||
seek_head()->set_cues_pos(index_start_);
|
||||
seek_head()->set_cues_pos(index_start_ - segment_payload_pos());
|
||||
if (!cues()->Write(writer_.get()))
|
||||
return Status(error::FILE_FAILURE, "Error writing Cues data.");
|
||||
|
||||
|
|
|
@ -35,26 +35,36 @@ const uint8_t kBasicSupportData[] = {
|
|||
0x42, 0x85, 0x81, 0x02,
|
||||
// ID: Segment, Payload Size: 343
|
||||
0x18, 0x53, 0x80, 0x67, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x57,
|
||||
// ID: SeekHead, Payload Size: 30
|
||||
0x11, 0x4d, 0x9b, 0x74, 0x9e,
|
||||
// ID: Seek, Payload Size: 12
|
||||
0x4d, 0xbb, 0x8c,
|
||||
// ID: SeekHead, Payload Size: 57
|
||||
0x11, 0x4d, 0x9b, 0x74, 0xb9,
|
||||
// ID: Seek, Payload Size: 11
|
||||
0x4d, 0xbb, 0x8b,
|
||||
// SeekID: binary(4) (Info)
|
||||
0x53, 0xab, 0x84, 0x15, 0x49, 0xa9, 0x66,
|
||||
// SeekPosition: 89
|
||||
0x53, 0xac, 0x81, 0x59,
|
||||
// ID: Seek, Payload Size: 11
|
||||
0x4d, 0xbb, 0x8b,
|
||||
// SeekID: binary(4) (Tracks)
|
||||
0x53, 0xab, 0x84, 0x16, 0x54, 0xae, 0x6b,
|
||||
// SeekPosition: 182
|
||||
0x53, 0xac, 0x81, 0xb6,
|
||||
// ID: Seek, Payload Size: 11
|
||||
0x4d, 0xbb, 0x8b,
|
||||
// SeekID: binary(4) (Cluster)
|
||||
0x53, 0xab, 0x84, 0x1f, 0x43, 0xb6, 0x75,
|
||||
// SeekPosition: 276
|
||||
0x53, 0xac, 0x82, 0x01, 0x14,
|
||||
// SeekPosition: 228
|
||||
0x53, 0xac, 0x81, 0xe4,
|
||||
// ID: Seek, Payload Size: 12
|
||||
0x4d, 0xbb, 0x8c,
|
||||
// SeekID: binary(4) (Cues)
|
||||
0x53, 0xab, 0x84, 0x1c, 0x53, 0xbb, 0x6b,
|
||||
// SeekPosition: 367
|
||||
0x53, 0xac, 0x82, 0x01, 0x75,
|
||||
// ID: Void, Payload Size: 52
|
||||
0xec, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// SeekPosition: 325
|
||||
0x53, 0xac, 0x82, 0x01, 0x45,
|
||||
// ID: Void, Payload Size: 25
|
||||
0xec, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00,
|
||||
// ID: Info, Payload Size: 88
|
||||
0x15, 0x49, 0xa9, 0x66, 0xd8,
|
||||
// TimecodeScale: 1000000
|
||||
|
|
|
@ -95,7 +95,7 @@ Status TwoPassSingleSegmentSegmenter::DoFinalize() {
|
|||
// Write the Cues to the end of the temp file.
|
||||
uint64_t cues_pos = writer()->Position();
|
||||
set_index_start(cues_pos);
|
||||
seek_head()->set_cues_pos(cues_pos);
|
||||
seek_head()->set_cues_pos(cues_pos - segment_payload_pos());
|
||||
if (!cues()->Write(writer()))
|
||||
return Status(error::FILE_FAILURE, "Error writing Cues data.");
|
||||
|
||||
|
|
Loading…
Reference in New Issue