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  kNumVideoCodec
25 };
26 
28 class VideoStreamInfo : public StreamInfo {
29  public:
33  VideoStreamInfo(int track_id,
34  uint32_t time_scale,
35  uint64_t duration,
36  VideoCodec codec,
37  const std::string& codec_string,
38  const std::string& language,
39  uint16_t width,
40  uint16_t height,
41  uint32_t pixel_width,
42  uint32_t pixel_height,
43  int16_t trick_play_rate,
44  uint8_t nalu_length_size,
45  const uint8_t* extra_data,
46  size_t extra_data_size,
47  bool is_encrypted);
48 
51  bool IsValidConfig() const override;
52  std::string ToString() const override;
54 
55  VideoCodec codec() const { return codec_; }
56  uint16_t width() const { return width_; }
57  uint16_t height() const { return height_; }
60  uint32_t pixel_width() const { return pixel_width_; }
63  uint32_t pixel_height() const { return pixel_height_; }
64  uint8_t nalu_length_size() const { return nalu_length_size_; }
65  int16_t trick_play_rate() const { return trick_play_rate_; }
66 
67  void set_width(uint32_t width) { width_ = width; }
68  void set_height(uint32_t height) { height_ = height; }
69  void set_pixel_width(uint32_t pixel_width) { pixel_width_ = pixel_width; }
70  void set_pixel_height(uint32_t pixel_height) { pixel_height_ = pixel_height; }
71 
72  private:
73  ~VideoStreamInfo() override;
74 
75  VideoCodec codec_;
76  uint16_t width_;
77  uint16_t height_;
78 
79  // pixel_width_:pixel_height_ is the sample aspect ratio.
80  // 0 means unknown.
81  uint32_t pixel_width_;
82  uint32_t pixel_height_;
83  int16_t trick_play_rate_; // Non-zero for trick-play streams.
84 
85  // Specifies the normalized size of the NAL unit length field. Can be 1, 2 or
86  // 4 bytes, or 0 if the size if unknown or the stream is not a AVC stream
87  // (H.264).
88  uint8_t nalu_length_size_;
89 
90  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
91  // generated copy constructor and assignment operator. Since the extra data is
92  // typically small, the performance impact is minimal.
93 };
94 
95 } // namespace media
96 } // namespace edash_packager
97 
98 #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)