1 // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 #ifndef LIBWEBM_COMMON_HDR_UTIL_H_
9 #define LIBWEBM_COMMON_HDR_UTIL_H_
15 #include "mkvmuxer/mkvmuxer.h"
19 struct MasteringMetadata;
20 struct PrimaryChromaticity;
21 } // namespace mkvparser
24 // Utility types and functions for working with the Colour element and its
25 // children. Copiers return true upon success. Presence functions return true
26 // when the specified element is present.
28 // TODO(tomfinegan): These should be moved to libwebm_utils once c++11 is
29 // required by libwebm.
31 // Features of the VP9 codec that may be set in the CodecPrivate of a VP9 video
32 // stream. A value of kValueNotPresent represents that the value was not set in
34 struct Vp9CodecFeatures {
35 static const int kValueNotPresent;
38 : profile(kValueNotPresent),
39 level(kValueNotPresent),
40 bit_depth(kValueNotPresent),
41 chroma_subsampling(kValueNotPresent) {}
42 ~Vp9CodecFeatures() {}
47 int chroma_subsampling;
50 typedef std::unique_ptr<mkvmuxer::PrimaryChromaticity> PrimaryChromaticityPtr;
52 bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc,
53 PrimaryChromaticityPtr* muxer_pc);
55 bool MasteringMetadataValuePresent(double value);
57 bool CopyMasteringMetadata(const mkvparser::MasteringMetadata& parser_mm,
58 mkvmuxer::MasteringMetadata* muxer_mm);
60 bool ColourValuePresent(long long value);
62 bool CopyColour(const mkvparser::Colour& parser_colour,
63 mkvmuxer::Colour* muxer_colour);
65 // Returns true if |features| is set to one or more valid values.
66 bool ParseVpxCodecPrivate(const uint8_t* private_data, int32_t length,
67 Vp9CodecFeatures* features);
69 } // namespace libwebm
71 #endif // LIBWEBM_COMMON_HDR_UTIL_H_