Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: chromecast/media/cma/public/video_config.h

Issue 1074383002: Introduce VideoConfig/AudioConfig class for CMA backend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromecast/media/cma/public/video_config.h
diff --git a/chromecast/media/cma/public/video_config.h b/chromecast/media/cma/public/video_config.h
new file mode 100644
index 0000000000000000000000000000000000000000..619cc6b68d3485beb49e39cd03bfa7eec006d95d
--- /dev/null
+++ b/chromecast/media/cma/public/video_config.h
@@ -0,0 +1,108 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_MEDIA_CMA_PUBLIC_VIDEO_CONFIG_H_
+#define CHROMECAST_MEDIA_CMA_PUBLIC_VIDEO_CONFIG_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+
+namespace chromecast {
+namespace media {
+
+class VideoConfig {
+ public:
+ // It maps to ::media::VideoCodec in src/media/base/video_decoder_config.h
+ enum Codec {
+ kUnknownVideoCodec = 0,
+ kCodecH264,
+ kCodecVC1,
+ kCodecMPEG2,
+ kCodecMPEG4,
+ kCodecTheora,
+ kCodecVP8,
+ kCodecVP9,
+ kVideoCodecMax = kCodecVP9,
+ };
+
+ // It maps to ::media::VideoCodecProfile in
+ // src/media/base/video_decoder_config.h
+ enum CodecProfile {
+ VIDEO_CODEC_PROFILE_UNKNOWN = -1,
+ VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN,
+ H264PROFILE_MIN = 0,
+ H264PROFILE_BASELINE = H264PROFILE_MIN,
+ H264PROFILE_MAIN = 1,
+ H264PROFILE_EXTENDED = 2,
+ H264PROFILE_HIGH = 3,
+ H264PROFILE_HIGH10PROFILE = 4,
+ H264PROFILE_HIGH422PROFILE = 5,
+ H264PROFILE_HIGH444PREDICTIVEPROFILE = 6,
+ H264PROFILE_SCALABLEBASELINE = 7,
+ H264PROFILE_SCALABLEHIGH = 8,
+ H264PROFILE_STEREOHIGH = 9,
+ H264PROFILE_MULTIVIEWHIGH = 10,
+ H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH,
+ VP8PROFILE_MIN = 11,
+ VP8PROFILE_ANY = VP8PROFILE_MIN,
+ VP8PROFILE_MAX = VP8PROFILE_ANY,
+ VP9PROFILE_MIN = 12,
+ VP9PROFILE_ANY = VP9PROFILE_MIN,
+ VP9PROFILE_MAX = VP9PROFILE_ANY,
+ VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_MAX,
+ };
+
+ public:
+ VideoConfig();
+ VideoConfig(Codec codec,
+ CodecProfile profile,
+ const uint8* extra_data, size_t extra_data_size,
+ bool is_encrypted);
+ ~VideoConfig();
+
+ void Initialize(Codec codec,
+ CodecProfile profile,
+ const uint8* extra_data, size_t extra_data_size,
+ bool is_encrypted);
+
+ // Returns true if this object has appropriate configuration values, false
+ // otherwise.
+ bool IsValidConfig() const;
+
+ // Returns true if all fields in |config| match this config.
+ // Note: The contents of |extra_data_| are compared not the raw pointers.
+ bool Matches(const VideoConfig& config) const;
+
+ // Returns a human-readable string describing |*this|. For debugging & test
+ // output only.
+ std::string AsHumanReadableString() const;
+ std::string GetHumanReadableCodecName() const;
+
+ Codec codec() const { return codec_; }
+ CodecProfile profile() const { return profile_; }
+
+ // Optional byte data required to initialize video decoders.
+ const uint8* extra_data() const {
+ return extra_data_.empty() ? NULL : &extra_data_[0]; }
+ size_t extra_data_size() const { return extra_data_.size(); }
+
+ bool is_encrypted() const { return is_encrypted_; }
+
+ private:
+ Codec codec_;
+ CodecProfile profile_;
+ std::vector<uint8> extra_data_;
+ bool is_encrypted_;
+
+ // 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
+} // namespace chromecast
+
+#endif // CHROMECAST_MEDIA_CMA_PUBLIC_VIDEO_CONFIG_H_

Powered by Google App Engine
This is Rietveld 408576698