c3378771b3
Pulling libwebm from upstream
Changes from upstream:
249629d make Mkv(Reader|Writer)(FILE*) explicit
7f3cda4 mkvparser: fix a bunch of windows warnings
5c06178 Merge "clang-format on mkvparser.[ch]pp"
4df111e clang-format on mkvparser.[ch]pp
7b24501 clang-format re-run.
c6767b9 Change AlignTrailingComments to false in .clang-format
9097a06 Merge "muxer: Reject file if TrackType is never specified"
eddf974 Merge "clang-format on mkvmuxertypes.hpp and webmids.hpp"
def325c muxer: Reject file if TrackType is never specified
41f869c Merge "clang-format on webvttparser.(cc|h)"
fd0be37 clang-format on webvttparser.(cc|h)
207d8a1 Merge "clang-format on mkvmuxerutil.[ch]pp"
02429eb Merge "clang-format on mkvwriter.[ch]pp"
0cf7b1b Merge "clang-format on mkvreader.[ch]pp"
2e80fed Merge "clang-format on sample.cpp"
3402e12 Merge "clang-format on sample_muxer.cpp"
1a685db Merge "clang-format on sample_muxer_metadata.(cc|h)"
6634c7f Merge "clang-format on vttreader.cc"
7566004
Merge "clang-format on vttdemux.cc"
9915b84 clang-format on mkvreader.[ch]pp
7437254 clang-format on mkvmuxertypes.hpp and webmids.hpp
0d5a98c clang-format on sample_muxer.cpp
e3485c9 clang-format on vttdemux.cc
46cc823 clang-format on dumpvtt.cc
5218bd2 clang-format on vttreader.cc
1a0130d clang-format on sample_muxer_metadata.(cc|h)
867f189 clang-format on sample.cpp
4c7bec5 clang-format on mkvwriter.[ch]pp
9ead078 clang-format on mkvmuxerutil.[ch]pp
fb6b6e6 clang-format on mkvmuxer.[ch]pp
ce77592 Update .clang-format to allow short functions in one line
0a24fe4 Merge "Add support for DateUTC and DefaultDuration in MKV Muxer."
11d5b66 Merge "Add .clang-format"
a1a3b14 Add .clang-format
0fcec38 Add support for DateUTC and DefaultDuration in MKV Muxer.
Change-Id: Ia0ed161ffc3d63c2eba8ed145707ffe543617976
138 lines
6.3 KiB
C++
138 lines
6.3 KiB
C++
// 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
|
|
// tree. An additional intellectual property rights grant can be found
|
|
// in the file PATENTS. All contributing project authors may
|
|
// be found in the AUTHORS file in the root of the source tree.
|
|
|
|
#ifndef MKVMUXERUTIL_HPP
|
|
#define MKVMUXERUTIL_HPP
|
|
|
|
#include "mkvmuxertypes.hpp"
|
|
|
|
namespace mkvmuxer {
|
|
|
|
class IMkvWriter;
|
|
|
|
const uint64 kEbmlUnknownValue = 0x01FFFFFFFFFFFFFFULL;
|
|
const int64 kMaxBlockTimecode = 0x07FFFLL;
|
|
|
|
// Writes out |value| in Big Endian order. Returns 0 on success.
|
|
int32 SerializeInt(IMkvWriter* writer, int64 value, int32 size);
|
|
|
|
// Returns the size in bytes of the element.
|
|
int32 GetUIntSize(uint64 value);
|
|
int32 GetCodedUIntSize(uint64 value);
|
|
uint64 EbmlMasterElementSize(uint64 type, uint64 value);
|
|
uint64 EbmlElementSize(uint64 type, int64 value);
|
|
uint64 EbmlElementSize(uint64 type, uint64 value);
|
|
uint64 EbmlElementSize(uint64 type, float value);
|
|
uint64 EbmlElementSize(uint64 type, const char* value);
|
|
uint64 EbmlElementSize(uint64 type, const uint8* value, uint64 size);
|
|
uint64 EbmlDateElementSize(uint64 type, int64 value);
|
|
|
|
// Creates an EBML coded number from |value| and writes it out. The size of
|
|
// the coded number is determined by the value of |value|. |value| must not
|
|
// be in a coded form. Returns 0 on success.
|
|
int32 WriteUInt(IMkvWriter* writer, uint64 value);
|
|
|
|
// Creates an EBML coded number from |value| and writes it out. The size of
|
|
// the coded number is determined by the value of |size|. |value| must not
|
|
// be in a coded form. Returns 0 on success.
|
|
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);
|
|
bool WriteEbmlElement(IMkvWriter* writer, uint64 type, const char* value);
|
|
bool WriteEbmlElement(IMkvWriter* writer, uint64 type, const uint8* value,
|
|
uint64 size);
|
|
bool WriteEbmlDateElement(IMkvWriter* writer, uint64 type, int64 value);
|
|
|
|
// Output an Mkv Simple Block.
|
|
// Inputs:
|
|
// data: Pointer to the data.
|
|
// length: Length of the data.
|
|
// track_number: Track to add the data to. Value returned by Add track
|
|
// functions. Only values in the range [1, 126] are
|
|
// permitted.
|
|
// timecode: Relative timecode of the Block. Only values in the
|
|
// range [0, 2^15) are permitted.
|
|
// is_key: Non-zero value specifies that frame is a key frame.
|
|
uint64 WriteSimpleBlock(IMkvWriter* writer, const uint8* data, uint64 length,
|
|
uint64 track_number, int64 timecode, uint64 is_key);
|
|
|
|
// Output a metadata keyframe, using a Block Group element.
|
|
// Inputs:
|
|
// data: Pointer to the (meta)data.
|
|
// length: Length of the (meta)data.
|
|
// track_number: Track to add the data to. Value returned by Add track
|
|
// functions. Only values in the range [1, 126] are
|
|
// permitted.
|
|
// timecode Timecode of frame, relative to cluster timecode. Only
|
|
// values in the range [0, 2^15) are permitted.
|
|
// duration_timecode Duration of frame, using timecode units.
|
|
uint64 WriteMetadataBlock(IMkvWriter* writer, const uint8* data, uint64 length,
|
|
uint64 track_number, int64 timecode,
|
|
uint64 duration_timecode);
|
|
|
|
// Output an Mkv Block with BlockAdditional data.
|
|
// Inputs:
|
|
// data: Pointer to the data.
|
|
// length: Length of the data.
|
|
// additional: Pointer to the additional data
|
|
// additional_length: Length of the additional data.
|
|
// add_id: Value of BlockAddID element.
|
|
// track_number: Track to add the data to. Value returned by Add track
|
|
// functions. Only values in the range [1, 126] are
|
|
// permitted.
|
|
// timecode: Relative timecode of the Block. Only values in the
|
|
// range [0, 2^15) are permitted.
|
|
// is_key: Non-zero value specifies that frame is a key frame.
|
|
uint64 WriteBlockWithAdditional(IMkvWriter* writer, const uint8* data,
|
|
uint64 length, const uint8* additional,
|
|
uint64 additional_length, uint64 add_id,
|
|
uint64 track_number, int64 timecode,
|
|
uint64 is_key);
|
|
|
|
// Output an Mkv Block with a DiscardPadding element.
|
|
// Inputs:
|
|
// data: Pointer to the data.
|
|
// length: Length of the data.
|
|
// discard_padding: DiscardPadding value.
|
|
// track_number: Track to add the data to. Value returned by Add track
|
|
// functions. Only values in the range [1, 126] are
|
|
// permitted.
|
|
// timecode: Relative timecode of the Block. Only values in the
|
|
// range [0, 2^15) are permitted.
|
|
// is_key: Non-zero value specifies that frame is a key frame.
|
|
uint64 WriteBlockWithDiscardPadding(IMkvWriter* writer, const uint8* data,
|
|
uint64 length, int64 discard_padding,
|
|
uint64 track_number, int64 timecode,
|
|
uint64 is_key);
|
|
|
|
// Output a void element. |size| must be the entire size in bytes that will be
|
|
// void. The function will calculate the size of the void header and subtract
|
|
// it from |size|.
|
|
uint64 WriteVoidElement(IMkvWriter* writer, uint64 size);
|
|
|
|
// Returns the version number of the muxer in |major|, |minor|, |build|,
|
|
// and |revision|.
|
|
void GetVersion(int32* major, int32* minor, int32* build, int32* revision);
|
|
|
|
// Returns a random number to be used for UID, using |seed| to seed
|
|
// the random-number generator (see POSIX rand_r() for semantics).
|
|
uint64 MakeUID(unsigned int* seed);
|
|
|
|
} // end namespace mkvmuxer
|
|
|
|
#endif // MKVMUXERUTIL_HPP
|