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_
|
|
|
|
|
|
|
|
#include "media/base/stream_info.h"
|
|
|
|
|
|
|
|
namespace media {
|
|
|
|
|
|
|
|
enum VideoCodec {
|
|
|
|
kUnknownVideoCodec = 0,
|
|
|
|
kCodecH264,
|
|
|
|
kCodecVC1,
|
|
|
|
kCodecMPEG2,
|
|
|
|
kCodecMPEG4,
|
|
|
|
kCodecTheora,
|
|
|
|
kCodecVP8,
|
|
|
|
kCodecVP9,
|
|
|
|
kNumVideoCodec
|
|
|
|
};
|
|
|
|
|
|
|
|
class VideoStreamInfo : public StreamInfo {
|
|
|
|
public:
|
|
|
|
// Constructs an initialized object. It is acceptable to pass in NULL for
|
|
|
|
// |extra_data|, otherwise the memory is copied.
|
|
|
|
VideoStreamInfo(int track_id,
|
2013-10-14 20:55:48 +00:00
|
|
|
uint32 time_scale,
|
|
|
|
uint64 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,
|
|
|
|
uint16 width,
|
|
|
|
uint16 height,
|
2013-11-12 20:32:44 +00:00
|
|
|
uint8 nalu_length_size,
|
2013-09-24 04:17:12 +00:00
|
|
|
const uint8* extra_data,
|
|
|
|
size_t extra_data_size,
|
|
|
|
bool is_encrypted);
|
|
|
|
|
|
|
|
// Returns true if this object has appropriate configuration values, false
|
|
|
|
// otherwise.
|
2013-10-14 20:55:48 +00:00
|
|
|
virtual bool IsValidConfig() const OVERRIDE;
|
2013-09-24 04:17:12 +00:00
|
|
|
|
|
|
|
// Returns a human-readable string describing |*this|.
|
2013-10-14 20:55:48 +00:00
|
|
|
virtual std::string ToString() const OVERRIDE;
|
2013-09-24 04:17:12 +00:00
|
|
|
|
|
|
|
VideoCodec codec() const { return codec_; }
|
2013-10-14 20:55:48 +00:00
|
|
|
uint16 width() const { return width_; }
|
|
|
|
uint16 height() const { return height_; }
|
2013-11-12 20:32:44 +00:00
|
|
|
uint8 nalu_length_size() const { return nalu_length_size_; }
|
2013-10-14 20:55:48 +00:00
|
|
|
|
|
|
|
// Returns the codec string. The parameters beyond codec are only used by
|
|
|
|
// H.264 codec.
|
2013-11-12 20:32:44 +00:00
|
|
|
static std::string GetCodecString(VideoCodec codec,
|
|
|
|
uint8 profile,
|
|
|
|
uint8 compatible_profiles,
|
|
|
|
uint8 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_;
|
2013-10-14 20:55:48 +00:00
|
|
|
uint16 width_;
|
|
|
|
uint16 height_;
|
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).
|
|
|
|
uint8 nalu_length_size_;
|
|
|
|
|
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
|
|
|
|
|
|
|
|
#endif // MEDIA_BASE_VIDEO_STREAM_INFO_H_
|