DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerator
vp_codec_configuration.h
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef MEDIA_FILTERS_VP_CODEC_CONFIGURATION_H_
8 #define MEDIA_FILTERS_VP_CODEC_CONFIGURATION_H_
9 
10 #include <stdint.h>
11 #include <string>
12 #include <vector>
13 
14 #include "packager/base/macros.h"
15 #include "packager/media/base/video_stream_info.h"
16 
17 namespace edash_packager {
18 namespace media {
19 
22  public:
23  enum ColorSpace {
24  COLOR_SPACE_UNSPECIFIED = 0,
25  COLOR_SPACE_BT_601 = 1,
26  COLOR_SPACE_BT_709 = 2,
27  COLOR_SPACE_BT_2020_NON_CONSTANT_LUMINANCE = 3,
28  COLOR_SPACE_BT_2020_CONSTANT_LUMINANCE = 4,
29  COLOR_SPACE_SRGB = 5,
30  };
31 
32  enum ChromaSubsampling {
33  CHROMA_420_VERTICAL = 0,
34  CHROMA_420_COLLOCATED_WITH_LUMA = 1,
35  CHROMA_422 = 2,
36  CHROMA_444 = 3,
37  CHROMA_440 = 4,
38  };
39 
41  VPCodecConfiguration(uint8_t profile,
42  uint8_t level,
43  uint8_t bit_depth,
44  uint8_t color_space,
45  uint8_t chroma_subsampling,
46  uint8_t transfer_function,
47  bool video_full_range_flag,
48  const std::vector<uint8_t>& codec_initialization_data);
50 
53  bool Parse(const std::vector<uint8_t>& data);
54 
57  void Write(std::vector<uint8_t>* data) const;
58 
60  std::string GetCodecString(VideoCodec codec) const;
61 
62  void set_profile(uint8_t profile) { profile_ = profile; }
63  void set_level(uint8_t level) { level_ = level; }
64  void set_bit_depth(uint8_t bit_depth) { bit_depth_ = bit_depth; }
65  void set_color_space(uint8_t color_space) { color_space_ = color_space; }
66  void set_chroma_subsampling(uint8_t chroma_subsampling) {
67  chroma_subsampling_ = chroma_subsampling;
68  }
69  void set_transfer_function(uint8_t transfer_function) {
70  transfer_function_ = transfer_function;
71  }
72  void set_video_full_range_flag(bool video_full_range_flag) {
73  video_full_range_flag_ = video_full_range_flag;
74  }
75 
76  uint8_t profile() const { return profile_; }
77  uint8_t level() const { return level_; }
78  uint8_t bit_depth() const { return bit_depth_; }
79  uint8_t color_space() const { return color_space_; }
80  uint8_t chroma_subsampling() const { return chroma_subsampling_; }
81  uint8_t transfer_function() const { return transfer_function_; }
82  bool video_full_range_flag() const { return video_full_range_flag_; }
83 
84  private:
85  uint8_t profile_;
86  uint8_t level_;
87  uint8_t bit_depth_;
88  uint8_t color_space_;
89  uint8_t chroma_subsampling_;
90  uint8_t transfer_function_;
91  bool video_full_range_flag_;
92  std::vector<uint8_t> codec_initialization_data_;
93 
94  DISALLOW_COPY_AND_ASSIGN(VPCodecConfiguration);
95 };
96 
97 } // namespace media
98 } // namespace edash_packager
99 
100 #endif // MEDIA_FILTERS_VP_CODEC_CONFIGURATION_H_
void Write(std::vector< uint8_t > *data) const
std::string GetCodecString(VideoCodec codec) const
bool Parse(const std::vector< uint8_t > &data)
Class for parsing or writing VP codec configuration data.