DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
video_stream_info.h
1 // Copyright 2014 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_BASE_VIDEO_STREAM_INFO_H_
8 #define MEDIA_BASE_VIDEO_STREAM_INFO_H_
9 
10 #include "packager/media/base/stream_info.h"
11 
12 namespace shaka {
13 namespace media {
14 
16 class VideoStreamInfo : public StreamInfo {
17  public:
21  VideoStreamInfo(int track_id, uint32_t time_scale, uint64_t duration,
22  Codec codec, const std::string& codec_string,
23  const uint8_t* codec_config, size_t codec_config_size,
24  uint16_t width, uint16_t height, uint32_t pixel_width,
25  uint32_t pixel_height, int16_t trick_play_rate,
26  uint8_t nalu_length_size, const std::string& language,
27  bool is_encrypted);
28 
31  bool IsValidConfig() const override;
32  std::string ToString() const override;
34 
35  uint16_t width() const { return width_; }
36  uint16_t height() const { return height_; }
39  uint32_t pixel_width() const { return pixel_width_; }
42  uint32_t pixel_height() const { return pixel_height_; }
43  uint8_t nalu_length_size() const { return nalu_length_size_; }
44  int16_t trick_play_rate() const { return trick_play_rate_; }
45  const std::vector<uint8_t>& eme_init_data() const { return eme_init_data_; }
46 
47  void set_width(uint32_t width) { width_ = width; }
48  void set_height(uint32_t height) { height_ = height; }
49  void set_pixel_width(uint32_t pixel_width) { pixel_width_ = pixel_width; }
50  void set_pixel_height(uint32_t pixel_height) { pixel_height_ = pixel_height; }
51  void set_eme_init_data(const uint8_t* eme_init_data,
52  size_t eme_init_data_size) {
53  eme_init_data_.assign(eme_init_data, eme_init_data + eme_init_data_size);
54  }
55 
56  private:
57  ~VideoStreamInfo() override;
58 
59  uint16_t width_;
60  uint16_t height_;
61 
62  // pixel_width_:pixel_height_ is the sample aspect ratio.
63  // 0 means unknown.
64  uint32_t pixel_width_;
65  uint32_t pixel_height_;
66  int16_t trick_play_rate_; // Non-zero for trick-play streams.
67 
68  // Specifies the normalized size of the NAL unit length field. Can be 1, 2 or
69  // 4 bytes, or 0 if the size if unknown or the stream is not a AVC stream
70  // (H.264).
71  uint8_t nalu_length_size_;
72 
73  // Container-specific data used by CDM to generate a license request:
74  // https://w3c.github.io/encrypted-media/#initialization-data.
75  std::vector<uint8_t> eme_init_data_;
76 
77  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
78  // generated copy constructor and assignment operator. Since the extra data is
79  // typically small, the performance impact is minimal.
80 };
81 
82 } // namespace media
83 } // namespace shaka
84 
85 #endif // MEDIA_BASE_VIDEO_STREAM_INFO_H_
Abstract class holds stream information.
Definition: stream_info.h:53
bool IsValidConfig() const override
Holds video stream information.
std::string ToString() const override
VideoStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, Codec codec, const std::string &codec_string, const uint8_t *codec_config, size_t codec_config_size, uint16_t width, uint16_t height, uint32_t pixel_width, uint32_t pixel_height, int16_t trick_play_rate, uint8_t nalu_length_size, const std::string &language, bool is_encrypted)