mkvmuxer: Use WriteID for all element IDs.
Fixes reliability issue with IMkvWriter::ElementStartNotify: the cluster and segment IDs were being written with SerializeInt instead of WriteID. Also: - Remove completed TODO. - Fix method declaration order in MkvWriter. Change-Id: Ie37e141169af6e0ca7d931cc39f001722e7b9078
This commit is contained in:
parent
7a9a72f984
commit
8da8206fa0
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011 The WebM project authors. All Rights Reserved.
|
||||
// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the LICENSE file in the root of the source
|
||||
@ -1080,7 +1080,7 @@ bool Cluster::WriteClusterHeader() {
|
||||
if (finalized_)
|
||||
return false;
|
||||
|
||||
if (SerializeInt(writer_, kMkvCluster, 4))
|
||||
if (WriteID(writer_, kMkvCluster))
|
||||
return false;
|
||||
|
||||
// Save for later.
|
||||
@ -1680,9 +1680,6 @@ bool Segment::AddFrame(const uint8* frame,
|
||||
timecode = audio_timecode;
|
||||
}
|
||||
|
||||
// TODO(fgalligan): Add checks here to make sure the timestamps passed in
|
||||
// are valid.
|
||||
|
||||
cluster_list_[cluster_list_size_] =
|
||||
new (std::nothrow) Cluster(timecode, MaxOffset());
|
||||
|
||||
@ -1837,7 +1834,7 @@ bool Segment::WriteSegmentHeader() {
|
||||
|
||||
// Write "unknown" (-1) as segment size value. If mode is kFile, Segment
|
||||
// will write over duration when the file is finalized.
|
||||
if (SerializeInt(writer_header_, kMkvSegment, 4))
|
||||
if (WriteID(writer_header_, kMkvSegment))
|
||||
return false;
|
||||
|
||||
// Save for later.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011 The WebM project authors. All Rights Reserved.
|
||||
// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the LICENSE file in the root of the source
|
||||
@ -44,6 +44,10 @@ int32 WriteUIntSize(IMkvWriter* writer, uint64 value, int32 size);
|
||||
// Output an Mkv master element. Returns true if the element was written.
|
||||
bool WriteEbmlMasterElement(IMkvWriter* writer, uint64 value, uint64 size);
|
||||
|
||||
// Outputs an Mkv ID, calls |IMkvWriter::ElementStartNotify|, and passes the
|
||||
// ID to |SerializeInt|. Returns 0 on success.
|
||||
int32 WriteID(IMkvWriter* writer, uint64 type);
|
||||
|
||||
// Output an Mkv non-master element. Returns true if the element was written.
|
||||
bool WriteEbmlElement(IMkvWriter* writer, uint64 type, uint64 value);
|
||||
bool WriteEbmlElement(IMkvWriter* writer, uint64 type, float value);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011 The WebM project authors. All Rights Reserved.
|
||||
// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the LICENSE file in the root of the source
|
||||
@ -26,8 +26,8 @@ class MkvWriter : public IMkvWriter {
|
||||
virtual int64 Position() const;
|
||||
virtual int32 Position(int64 position);
|
||||
virtual bool Seekable() const;
|
||||
virtual void ElementStartNotify(uint64 element_id, int64 position);
|
||||
virtual int32 Write(const void* buffer, uint32 length);
|
||||
virtual void ElementStartNotify(uint64 element_id, int64 position);
|
||||
|
||||
// Creates and opens a file for writing. |filename| is the name of the file
|
||||
// to open. This function will overwrite the contents of |filename|. Returns
|
||||
|
Loading…
x
Reference in New Issue
Block a user