2014-02-14 23:21:05 +00:00
|
|
|
// Copyright 2014 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
2013-09-24 04:17:12 +00:00
|
|
|
|
|
|
|
#ifndef MEDIA_BASE_VIDEO_STREAM_INFO_H_
|
|
|
|
#define MEDIA_BASE_VIDEO_STREAM_INFO_H_
|
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/base/stream_info.h"
|
2013-09-24 04:17:12 +00:00
|
|
|
|
2014-09-19 20:41:13 +00:00
|
|
|
namespace edash_packager {
|
2013-09-24 04:17:12 +00:00
|
|
|
namespace media {
|
|
|
|
|
|
|
|
enum VideoCodec {
|
|
|
|
kUnknownVideoCodec = 0,
|
|
|
|
kCodecH264,
|
|
|
|
kCodecVC1,
|
|
|
|
kCodecMPEG2,
|
|
|
|
kCodecMPEG4,
|
|
|
|
kCodecTheora,
|
|
|
|
kCodecVP8,
|
|
|
|
kCodecVP9,
|
|
|
|
kNumVideoCodec
|
|
|
|
};
|
|
|
|
|
2014-01-24 18:46:46 +00:00
|
|
|
/// Holds video stream information.
|
2013-09-24 04:17:12 +00:00
|
|
|
class VideoStreamInfo : public StreamInfo {
|
|
|
|
public:
|
2014-01-24 18:46:46 +00:00
|
|
|
/// Construct an initialized video stream info object.
|
2013-09-24 04:17:12 +00:00
|
|
|
VideoStreamInfo(int track_id,
|
2014-09-30 21:52:21 +00:00
|
|
|
uint32_t time_scale,
|
|
|
|
uint64_t duration,
|
2013-09-24 04:17:12 +00:00
|
|
|
VideoCodec codec,
|
2013-10-14 20:55:48 +00:00
|
|
|
const std::string& codec_string,
|
|
|
|
const std::string& language,
|
2014-09-30 21:52:21 +00:00
|
|
|
uint16_t width,
|
|
|
|
uint16_t height,
|
2015-06-02 21:41:49 +00:00
|
|
|
int16_t trick_play_rate,
|
2014-09-30 21:52:21 +00:00
|
|
|
uint8_t nalu_length_size,
|
|
|
|
const uint8_t* extra_data,
|
2013-09-24 04:17:12 +00:00
|
|
|
size_t extra_data_size,
|
|
|
|
bool is_encrypted);
|
|
|
|
|
2014-01-24 18:46:46 +00:00
|
|
|
/// @name StreamInfo implementation overrides.
|
|
|
|
/// @{
|
2013-10-14 20:55:48 +00:00
|
|
|
virtual bool IsValidConfig() const OVERRIDE;
|
|
|
|
virtual std::string ToString() const OVERRIDE;
|
2014-01-24 18:46:46 +00:00
|
|
|
/// @}
|
2013-09-24 04:17:12 +00:00
|
|
|
|
|
|
|
VideoCodec codec() const { return codec_; }
|
2014-09-30 21:52:21 +00:00
|
|
|
uint16_t width() const { return width_; }
|
|
|
|
uint16_t height() const { return height_; }
|
|
|
|
uint8_t nalu_length_size() const { return nalu_length_size_; }
|
2015-06-03 16:53:48 +00:00
|
|
|
int16_t trick_play_rate() const { return trick_play_rate_; }
|
2013-10-14 20:55:48 +00:00
|
|
|
|
2014-01-24 18:46:46 +00:00
|
|
|
/// @param profile,compatible_profiles,level are only used by H.264 codec.
|
|
|
|
/// @return The codec string.
|
2013-11-12 20:32:44 +00:00
|
|
|
static std::string GetCodecString(VideoCodec codec,
|
2014-09-30 21:52:21 +00:00
|
|
|
uint8_t profile,
|
|
|
|
uint8_t compatible_profiles,
|
|
|
|
uint8_t level);
|
2013-09-24 04:17:12 +00:00
|
|
|
|
|
|
|
private:
|
2014-01-16 00:52:07 +00:00
|
|
|
virtual ~VideoStreamInfo();
|
|
|
|
|
2013-09-24 04:17:12 +00:00
|
|
|
VideoCodec codec_;
|
2014-09-30 21:52:21 +00:00
|
|
|
uint16_t width_;
|
|
|
|
uint16_t height_;
|
2015-06-02 21:41:49 +00:00
|
|
|
int16_t trick_play_rate_; // Non-zero for trick-play streams.
|
2013-09-24 04:17:12 +00:00
|
|
|
|
2013-11-12 20:32:44 +00:00
|
|
|
// Specifies the normalized size of the NAL unit length field. Can be 1, 2 or
|
|
|
|
// 4 bytes, or 0 if the size if unknown or the stream is not a AVC stream
|
|
|
|
// (H.264).
|
2014-09-30 21:52:21 +00:00
|
|
|
uint8_t nalu_length_size_;
|
2013-11-12 20:32:44 +00:00
|
|
|
|
2013-09-24 04:17:12 +00:00
|
|
|
// Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
|
|
|
|
// generated copy constructor and assignment operator. Since the extra data is
|
|
|
|
// typically small, the performance impact is minimal.
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace media
|
2014-09-19 20:41:13 +00:00
|
|
|
} // namespace edash_packager
|
2013-09-24 04:17:12 +00:00
|
|
|
|
|
|
|
#endif // MEDIA_BASE_VIDEO_STREAM_INFO_H_
|