summaryrefslogtreecommitdiff
path: root/third_party/libwebm/common
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebm/common')
-rw-r--r--third_party/libwebm/common/file_util.cc67
-rw-r--r--third_party/libwebm/common/file_util.h41
-rw-r--r--third_party/libwebm/common/hdr_util.cc182
-rw-r--r--third_party/libwebm/common/hdr_util.h51
-rw-r--r--third_party/libwebm/common/webmids.h184
5 files changed, 0 insertions, 525 deletions
diff --git a/third_party/libwebm/common/file_util.cc b/third_party/libwebm/common/file_util.cc
deleted file mode 100644
index 4f91318f3..000000000
--- a/third_party/libwebm/common/file_util.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2016 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.
-#include "common/file_util.h"
-
-#include <sys/stat.h>
-#ifndef _MSC_VER
-#include <unistd.h> // close()
-#endif
-
-#include <cstdio>
-#include <cstdlib>
-#include <fstream>
-#include <ios>
-
-namespace libwebm {
-
-std::string GetTempFileName() {
-#if !defined _MSC_VER && !defined __MINGW32__
- char temp_file_name_template[] = "libwebm_temp.XXXXXX";
- int fd = mkstemp(temp_file_name_template);
- if (fd != -1) {
- close(fd);
- return std::string(temp_file_name_template);
- }
- return std::string();
-#else
- char tmp_file_name[_MAX_PATH];
- errno_t err = tmpnam_s(tmp_file_name);
- if (err == 0) {
- return std::string(tmp_file_name);
- }
- return std::string();
-#endif
-}
-
-uint64_t GetFileSize(const std::string& file_name) {
- uint64_t file_size = 0;
-#ifndef _MSC_VER
- struct stat st;
- st.st_size = 0;
- if (stat(file_name.c_str(), &st) == 0) {
-#else
- struct _stat st;
- st.st_size = 0;
- if (_stat(file_name.c_str(), &st) == 0) {
-#endif
- file_size = st.st_size;
- }
- return file_size;
-}
-
-TempFileDeleter::TempFileDeleter() { file_name_ = GetTempFileName(); }
-
-TempFileDeleter::~TempFileDeleter() {
- std::ifstream file(file_name_.c_str());
- if (file.good()) {
- file.close();
- std::remove(file_name_.c_str());
- }
-}
-
-} // namespace libwebm
diff --git a/third_party/libwebm/common/file_util.h b/third_party/libwebm/common/file_util.h
deleted file mode 100644
index 0e71eac11..000000000
--- a/third_party/libwebm/common/file_util.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2016 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 LIBWEBM_COMMON_FILE_UTIL_H_
-#define LIBWEBM_COMMON_FILE_UTIL_H_
-
-#include <stdint.h>
-
-#include <string>
-
-#include "mkvmuxer/mkvmuxertypes.h" // LIBWEBM_DISALLOW_COPY_AND_ASSIGN()
-
-namespace libwebm {
-
-// Returns a temporary file name.
-std::string GetTempFileName();
-
-// Returns size of file specified by |file_name|, or 0 upon failure.
-uint64_t GetFileSize(const std::string& file_name);
-
-// Manages life of temporary file specified at time of construction. Deletes
-// file upon destruction.
-class TempFileDeleter {
- public:
- TempFileDeleter();
- explicit TempFileDeleter(std::string file_name) : file_name_(file_name) {}
- ~TempFileDeleter();
- const std::string& name() const { return file_name_; }
-
- private:
- std::string file_name_;
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(TempFileDeleter);
-};
-
-} // namespace libwebm
-
-#endif // LIBWEBM_COMMON_FILE_UTIL_H_ \ No newline at end of file
diff --git a/third_party/libwebm/common/hdr_util.cc b/third_party/libwebm/common/hdr_util.cc
deleted file mode 100644
index e1a9842fb..000000000
--- a/third_party/libwebm/common/hdr_util.cc
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright (c) 2016 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.
-#include "hdr_util.h"
-
-#include <cstddef>
-#include <new>
-
-#include "mkvparser/mkvparser.h"
-
-namespace libwebm {
-bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc,
- PrimaryChromaticityPtr* muxer_pc) {
- muxer_pc->reset(new (std::nothrow)
- mkvmuxer::PrimaryChromaticity(parser_pc.x, parser_pc.y));
- if (!muxer_pc->get())
- return false;
- return true;
-}
-
-bool MasteringMetadataValuePresent(double value) {
- return value != mkvparser::MasteringMetadata::kValueNotPresent;
-}
-
-bool CopyMasteringMetadata(const mkvparser::MasteringMetadata& parser_mm,
- mkvmuxer::MasteringMetadata* muxer_mm) {
- if (MasteringMetadataValuePresent(parser_mm.luminance_max))
- muxer_mm->luminance_max = parser_mm.luminance_max;
- if (MasteringMetadataValuePresent(parser_mm.luminance_min))
- muxer_mm->luminance_min = parser_mm.luminance_min;
-
- PrimaryChromaticityPtr r_ptr(NULL);
- PrimaryChromaticityPtr g_ptr(NULL);
- PrimaryChromaticityPtr b_ptr(NULL);
- PrimaryChromaticityPtr wp_ptr(NULL);
-
- if (parser_mm.r) {
- if (!CopyPrimaryChromaticity(*parser_mm.r, &r_ptr))
- return false;
- }
- if (parser_mm.g) {
- if (!CopyPrimaryChromaticity(*parser_mm.g, &g_ptr))
- return false;
- }
- if (parser_mm.b) {
- if (!CopyPrimaryChromaticity(*parser_mm.b, &b_ptr))
- return false;
- }
- if (parser_mm.white_point) {
- if (!CopyPrimaryChromaticity(*parser_mm.white_point, &wp_ptr))
- return false;
- }
-
- if (!muxer_mm->SetChromaticity(r_ptr.get(), g_ptr.get(), b_ptr.get(),
- wp_ptr.get())) {
- return false;
- }
-
- return true;
-}
-
-bool ColourValuePresent(long long value) {
- return value != mkvparser::Colour::kValueNotPresent;
-}
-
-bool CopyColour(const mkvparser::Colour& parser_colour,
- mkvmuxer::Colour* muxer_colour) {
- if (!muxer_colour)
- return false;
-
- if (ColourValuePresent(parser_colour.matrix_coefficients))
- muxer_colour->matrix_coefficients = parser_colour.matrix_coefficients;
- if (ColourValuePresent(parser_colour.bits_per_channel))
- muxer_colour->bits_per_channel = parser_colour.bits_per_channel;
- if (ColourValuePresent(parser_colour.chroma_subsampling_horz))
- muxer_colour->chroma_subsampling_horz =
- parser_colour.chroma_subsampling_horz;
- if (ColourValuePresent(parser_colour.chroma_subsampling_vert))
- muxer_colour->chroma_subsampling_vert =
- parser_colour.chroma_subsampling_vert;
- if (ColourValuePresent(parser_colour.cb_subsampling_horz))
- muxer_colour->cb_subsampling_horz = parser_colour.cb_subsampling_horz;
- if (ColourValuePresent(parser_colour.cb_subsampling_vert))
- muxer_colour->cb_subsampling_vert = parser_colour.cb_subsampling_vert;
- if (ColourValuePresent(parser_colour.chroma_siting_horz))
- muxer_colour->chroma_siting_horz = parser_colour.chroma_siting_horz;
- if (ColourValuePresent(parser_colour.chroma_siting_vert))
- muxer_colour->chroma_siting_vert = parser_colour.chroma_siting_vert;
- if (ColourValuePresent(parser_colour.range))
- muxer_colour->range = parser_colour.range;
- if (ColourValuePresent(parser_colour.transfer_characteristics))
- muxer_colour->transfer_characteristics =
- parser_colour.transfer_characteristics;
- if (ColourValuePresent(parser_colour.primaries))
- muxer_colour->primaries = parser_colour.primaries;
- if (ColourValuePresent(parser_colour.max_cll))
- muxer_colour->max_cll = parser_colour.max_cll;
- if (ColourValuePresent(parser_colour.max_fall))
- muxer_colour->max_fall = parser_colour.max_fall;
-
- if (parser_colour.mastering_metadata) {
- mkvmuxer::MasteringMetadata muxer_mm;
- if (!CopyMasteringMetadata(*parser_colour.mastering_metadata, &muxer_mm))
- return false;
- if (!muxer_colour->SetMasteringMetadata(muxer_mm))
- return false;
- }
- return true;
-}
-
-// Format of VPx private data:
-//
-// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// | ID Byte | Length | |
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
-// | |
-// : Bytes 1..Length of Codec Feature :
-// | |
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-//
-// ID Byte Format
-// ID byte is an unsigned byte.
-// 0 1 2 3 4 5 6 7
-// +-+-+-+-+-+-+-+-+
-// |X| ID |
-// +-+-+-+-+-+-+-+-+
-//
-// The X bit is reserved.
-//
-// Currently only profile level is supported. ID byte must be set to 1, and
-// length must be 1. Supported values are:
-//
-// 10: Level 1
-// 11: Level 1.1
-// 20: Level 2
-// 21: Level 2.1
-// 30: Level 3
-// 31: Level 3.1
-// 40: Level 4
-// 41: Level 4.1
-// 50: Level 5
-// 51: Level 5.1
-// 52: Level 5.2
-// 60: Level 6
-// 61: Level 6.1
-// 62: Level 6.2
-//
-// See the following link for more information:
-// http://www.webmproject.org/vp9/profiles/
-int ParseVpxCodecPrivate(const uint8_t* private_data, int32_t length) {
- const int kVpxCodecPrivateLength = 3;
- if (!private_data || length != kVpxCodecPrivateLength)
- return 0;
-
- const uint8_t id_byte = *private_data;
- if (id_byte != 1)
- return 0;
-
- const int kVpxProfileLength = 1;
- const uint8_t length_byte = private_data[1];
- if (length_byte != kVpxProfileLength)
- return 0;
-
- const int level = static_cast<int>(private_data[2]);
-
- const int kNumLevels = 14;
- const int levels[kNumLevels] = {10, 11, 20, 21, 30, 31, 40,
- 41, 50, 51, 52, 60, 61, 62};
-
- for (int i = 0; i < kNumLevels; ++i) {
- if (level == levels[i])
- return level;
- }
-
- return 0;
-}
-} // namespace libwebm
diff --git a/third_party/libwebm/common/hdr_util.h b/third_party/libwebm/common/hdr_util.h
deleted file mode 100644
index d30c2b9f2..000000000
--- a/third_party/libwebm/common/hdr_util.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2016 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 LIBWEBM_COMMON_HDR_UTIL_H_
-#define LIBWEBM_COMMON_HDR_UTIL_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "mkvmuxer/mkvmuxer.h"
-
-namespace mkvparser {
-struct Colour;
-struct MasteringMetadata;
-struct PrimaryChromaticity;
-} // namespace mkvparser
-
-namespace libwebm {
-// Utility types and functions for working with the Colour element and its
-// children. Copiers return true upon success. Presence functions return true
-// when the specified element is present.
-
-// TODO(tomfinegan): These should be moved to libwebm_utils once c++11 is
-// required by libwebm.
-
-typedef std::auto_ptr<mkvmuxer::PrimaryChromaticity> PrimaryChromaticityPtr;
-
-bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc,
- PrimaryChromaticityPtr* muxer_pc);
-
-bool MasteringMetadataValuePresent(double value);
-
-bool CopyMasteringMetadata(const mkvparser::MasteringMetadata& parser_mm,
- mkvmuxer::MasteringMetadata* muxer_mm);
-
-bool ColourValuePresent(long long value);
-
-bool CopyColour(const mkvparser::Colour& parser_colour,
- mkvmuxer::Colour* muxer_colour);
-
-// Returns VP9 profile upon success or 0 upon failure.
-int ParseVpxCodecPrivate(const uint8_t* private_data, int32_t length);
-
-} // namespace libwebm
-
-#endif // LIBWEBM_COMMON_HDR_UTIL_H_
diff --git a/third_party/libwebm/common/webmids.h b/third_party/libwebm/common/webmids.h
deleted file mode 100644
index 32a0c5fb9..000000000
--- a/third_party/libwebm/common/webmids.h
+++ /dev/null
@@ -1,184 +0,0 @@
-// 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 COMMON_WEBMIDS_H_
-#define COMMON_WEBMIDS_H_
-
-namespace libwebm {
-
-enum MkvId {
- kMkvEBML = 0x1A45DFA3,
- kMkvEBMLVersion = 0x4286,
- kMkvEBMLReadVersion = 0x42F7,
- kMkvEBMLMaxIDLength = 0x42F2,
- kMkvEBMLMaxSizeLength = 0x42F3,
- kMkvDocType = 0x4282,
- kMkvDocTypeVersion = 0x4287,
- kMkvDocTypeReadVersion = 0x4285,
- kMkvVoid = 0xEC,
- kMkvSignatureSlot = 0x1B538667,
- kMkvSignatureAlgo = 0x7E8A,
- kMkvSignatureHash = 0x7E9A,
- kMkvSignaturePublicKey = 0x7EA5,
- kMkvSignature = 0x7EB5,
- kMkvSignatureElements = 0x7E5B,
- kMkvSignatureElementList = 0x7E7B,
- kMkvSignedElement = 0x6532,
- // segment
- kMkvSegment = 0x18538067,
- // Meta Seek Information
- kMkvSeekHead = 0x114D9B74,
- kMkvSeek = 0x4DBB,
- kMkvSeekID = 0x53AB,
- kMkvSeekPosition = 0x53AC,
- // Segment Information
- kMkvInfo = 0x1549A966,
- kMkvTimecodeScale = 0x2AD7B1,
- kMkvDuration = 0x4489,
- kMkvDateUTC = 0x4461,
- kMkvTitle = 0x7BA9,
- kMkvMuxingApp = 0x4D80,
- kMkvWritingApp = 0x5741,
- // Cluster
- kMkvCluster = 0x1F43B675,
- kMkvTimecode = 0xE7,
- kMkvPrevSize = 0xAB,
- kMkvBlockGroup = 0xA0,
- kMkvBlock = 0xA1,
- kMkvBlockDuration = 0x9B,
- kMkvReferenceBlock = 0xFB,
- kMkvLaceNumber = 0xCC,
- kMkvSimpleBlock = 0xA3,
- kMkvBlockAdditions = 0x75A1,
- kMkvBlockMore = 0xA6,
- kMkvBlockAddID = 0xEE,
- kMkvBlockAdditional = 0xA5,
- kMkvDiscardPadding = 0x75A2,
- // Track
- kMkvTracks = 0x1654AE6B,
- kMkvTrackEntry = 0xAE,
- kMkvTrackNumber = 0xD7,
- kMkvTrackUID = 0x73C5,
- kMkvTrackType = 0x83,
- kMkvFlagEnabled = 0xB9,
- kMkvFlagDefault = 0x88,
- kMkvFlagForced = 0x55AA,
- kMkvFlagLacing = 0x9C,
- kMkvDefaultDuration = 0x23E383,
- kMkvMaxBlockAdditionID = 0x55EE,
- kMkvName = 0x536E,
- kMkvLanguage = 0x22B59C,
- kMkvCodecID = 0x86,
- kMkvCodecPrivate = 0x63A2,
- kMkvCodecName = 0x258688,
- kMkvCodecDelay = 0x56AA,
- kMkvSeekPreRoll = 0x56BB,
- // video
- kMkvVideo = 0xE0,
- kMkvFlagInterlaced = 0x9A,
- kMkvStereoMode = 0x53B8,
- kMkvAlphaMode = 0x53C0,
- kMkvPixelWidth = 0xB0,
- kMkvPixelHeight = 0xBA,
- kMkvPixelCropBottom = 0x54AA,
- kMkvPixelCropTop = 0x54BB,
- kMkvPixelCropLeft = 0x54CC,
- kMkvPixelCropRight = 0x54DD,
- kMkvDisplayWidth = 0x54B0,
- kMkvDisplayHeight = 0x54BA,
- kMkvDisplayUnit = 0x54B2,
- kMkvAspectRatioType = 0x54B3,
- kMkvFrameRate = 0x2383E3,
- // end video
- // colour
- kMkvColour = 0x55B0,
- kMkvMatrixCoefficients = 0x55B1,
- kMkvBitsPerChannel = 0x55B2,
- kMkvChromaSubsamplingHorz = 0x55B3,
- kMkvChromaSubsamplingVert = 0x55B4,
- kMkvCbSubsamplingHorz = 0x55B5,
- kMkvCbSubsamplingVert = 0x55B6,
- kMkvChromaSitingHorz = 0x55B7,
- kMkvChromaSitingVert = 0x55B8,
- kMkvRange = 0x55B9,
- kMkvTransferCharacteristics = 0x55BA,
- kMkvPrimaries = 0x55BB,
- kMkvMaxCLL = 0x55BC,
- kMkvMaxFALL = 0x55BD,
- // mastering metadata
- kMkvMasteringMetadata = 0x55D0,
- kMkvPrimaryRChromaticityX = 0x55D1,
- kMkvPrimaryRChromaticityY = 0x55D2,
- kMkvPrimaryGChromaticityX = 0x55D3,
- kMkvPrimaryGChromaticityY = 0x55D4,
- kMkvPrimaryBChromaticityX = 0x55D5,
- kMkvPrimaryBChromaticityY = 0x55D6,
- kMkvWhitePointChromaticityX = 0x55D7,
- kMkvWhitePointChromaticityY = 0x55D8,
- kMkvLuminanceMax = 0x55D9,
- kMkvLuminanceMin = 0x55DA,
- // end mastering metadata
- // end colour
- // audio
- kMkvAudio = 0xE1,
- kMkvSamplingFrequency = 0xB5,
- kMkvOutputSamplingFrequency = 0x78B5,
- kMkvChannels = 0x9F,
- kMkvBitDepth = 0x6264,
- // end audio
- // ContentEncodings
- kMkvContentEncodings = 0x6D80,
- kMkvContentEncoding = 0x6240,
- kMkvContentEncodingOrder = 0x5031,
- kMkvContentEncodingScope = 0x5032,
- kMkvContentEncodingType = 0x5033,
- kMkvContentCompression = 0x5034,
- kMkvContentCompAlgo = 0x4254,
- kMkvContentCompSettings = 0x4255,
- kMkvContentEncryption = 0x5035,
- kMkvContentEncAlgo = 0x47E1,
- kMkvContentEncKeyID = 0x47E2,
- kMkvContentSignature = 0x47E3,
- kMkvContentSigKeyID = 0x47E4,
- kMkvContentSigAlgo = 0x47E5,
- kMkvContentSigHashAlgo = 0x47E6,
- kMkvContentEncAESSettings = 0x47E7,
- kMkvAESSettingsCipherMode = 0x47E8,
- kMkvAESSettingsCipherInitData = 0x47E9,
- // end ContentEncodings
- // Cueing Data
- kMkvCues = 0x1C53BB6B,
- kMkvCuePoint = 0xBB,
- kMkvCueTime = 0xB3,
- kMkvCueTrackPositions = 0xB7,
- kMkvCueTrack = 0xF7,
- kMkvCueClusterPosition = 0xF1,
- kMkvCueBlockNumber = 0x5378,
- // Chapters
- kMkvChapters = 0x1043A770,
- kMkvEditionEntry = 0x45B9,
- kMkvChapterAtom = 0xB6,
- kMkvChapterUID = 0x73C4,
- kMkvChapterStringUID = 0x5654,
- kMkvChapterTimeStart = 0x91,
- kMkvChapterTimeEnd = 0x92,
- kMkvChapterDisplay = 0x80,
- kMkvChapString = 0x85,
- kMkvChapLanguage = 0x437C,
- kMkvChapCountry = 0x437E,
- // Tags
- kMkvTags = 0x1254C367,
- kMkvTag = 0x7373,
- kMkvSimpleTag = 0x67C8,
- kMkvTagName = 0x45A3,
- kMkvTagString = 0x4487
-};
-
-} // namespace libwebm
-
-#endif // COMMON_WEBMIDS_H_