DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs 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 edash_packager {
13 namespace media {
14 
15 enum VideoCodec {
16  kUnknownVideoCodec = 0,
17  kCodecH264,
18  kCodecVC1,
19  kCodecMPEG2,
20  kCodecMPEG4,
21  kCodecTheora,
22  kCodecVP8,
23  kCodecVP9,
24  kCodecVP10,
25  kNumVideoCodec
26 };
27 
29 class VideoStreamInfo : public StreamInfo {
30  public:
34  VideoStreamInfo(int track_id,
35  uint32_t time_scale,
36  uint64_t duration,
37  VideoCodec codec,
38  const std::string& codec_string,
39  const std::string& language,
40  uint16_t width,
41  uint16_t height,
42  uint32_t pixel_width,
43  uint32_t pixel_height,
44  int16_t trick_play_rate,
45  uint8_t nalu_length_size,
46  const uint8_t* extra_data,
47  size_t extra_data_size,
48  bool is_encrypted);
49 
52  bool IsValidConfig() const override;
53  std::string ToString() const override;
55 
56  VideoCodec codec() const { return codec_; }
57  uint16_t width() const { return width_; }
58  uint16_t height() const { return height_; }
61  uint32_t pixel_width() const { return pixel_width_; }
64  uint32_t pixel_height() const { return pixel_height_; }
65  uint8_t nalu_length_size() const { return nalu_length_size_; }
66  int16_t trick_play_rate() const { return trick_play_rate_; }
67 
68  void set_width(uint32_t width) { width_ = width; }
69  void set_height(uint32_t height) { height_ = height; }
70  void set_pixel_width(uint32_t pixel_width) { pixel_width_ = pixel_width; }
71  void set_pixel_height(uint32_t pixel_height) { pixel_height_ = pixel_height; }
72 
73  private:
74  ~VideoStreamInfo() override;
75 
76  VideoCodec codec_;
77  uint16_t width_;
78  uint16_t height_;
79 
80  // pixel_width_:pixel_height_ is the sample aspect ratio.
81  // 0 means unknown.
82  uint32_t pixel_width_;
83  uint32_t pixel_height_;
84  int16_t trick_play_rate_; // Non-zero for trick-play streams.
85 
86  // Specifies the normalized size of the NAL unit length field. Can be 1, 2 or
87  // 4 bytes, or 0 if the size if unknown or the stream is not a AVC stream
88  // (H.264).
89  uint8_t nalu_length_size_;
90 
91  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
92  // generated copy constructor and assignment operator. Since the extra data is
93  // typically small, the performance impact is minimal.
94 };
95 
96 } // namespace media
97 } // namespace edash_packager
98 
99 #endif // MEDIA_BASE_VIDEO_STREAM_INFO_H_
std::string ToString() const override
Abstract class holds stream information.
Definition: stream_info.h:26
Holds video stream information.
VideoStreamInfo(int track_id, uint32_t time_scale, uint64_t duration, VideoCodec codec, const std::string &codec_string, const std::string &language, 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 uint8_t *extra_data, size_t extra_data_size, bool is_encrypted)