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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROMECAST_MEDIA_CMA_PUBLIC_VIDEO_CONFIG_H_
6 #define CHROMECAST_MEDIA_CMA_PUBLIC_VIDEO_CONFIG_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12
13 namespace chromecast {
14 namespace media {
15
16 class VideoConfig {
17 public:
18 // It maps to ::media::VideoCodec in src/media/base/video_decoder_config.h
19 enum Codec {
20 kUnknownVideoCodec = 0,
21 kCodecH264,
22 kCodecVC1,
23 kCodecMPEG2,
24 kCodecMPEG4,
25 kCodecTheora,
26 kCodecVP8,
27 kCodecVP9,
28 kVideoCodecMax = kCodecVP9,
29 };
30
31 // It maps to ::media::VideoCodecProfile in
32 // src/media/base/video_decoder_config.h
33 enum CodecProfile {
34 VIDEO_CODEC_PROFILE_UNKNOWN = -1,
35 VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN,
36 H264PROFILE_MIN = 0,
37 H264PROFILE_BASELINE = H264PROFILE_MIN,
38 H264PROFILE_MAIN = 1,
39 H264PROFILE_EXTENDED = 2,
40 H264PROFILE_HIGH = 3,
41 H264PROFILE_HIGH10PROFILE = 4,
42 H264PROFILE_HIGH422PROFILE = 5,
43 H264PROFILE_HIGH444PREDICTIVEPROFILE = 6,
44 H264PROFILE_SCALABLEBASELINE = 7,
45 H264PROFILE_SCALABLEHIGH = 8,
46 H264PROFILE_STEREOHIGH = 9,
47 H264PROFILE_MULTIVIEWHIGH = 10,
48 H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH,
49 VP8PROFILE_MIN = 11,
50 VP8PROFILE_ANY = VP8PROFILE_MIN,
51 VP8PROFILE_MAX = VP8PROFILE_ANY,
52 VP9PROFILE_MIN = 12,
53 VP9PROFILE_ANY = VP9PROFILE_MIN,
54 VP9PROFILE_MAX = VP9PROFILE_ANY,
55 VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_MAX,
56 };
57
58 public:
59 VideoConfig();
60 VideoConfig(Codec codec,
61 CodecProfile profile,
62 const uint8* extra_data, size_t extra_data_size,
63 bool is_encrypted);
64 ~VideoConfig();
65
66 void Initialize(Codec codec,
67 CodecProfile profile,
68 const uint8* extra_data, size_t extra_data_size,
69 bool is_encrypted);
70
71 // Returns true if this object has appropriate configuration values, false
72 // otherwise.
73 bool IsValidConfig() const;
74
75 // Returns true if all fields in |config| match this config.
76 // Note: The contents of |extra_data_| are compared not the raw pointers.
77 bool Matches(const VideoConfig& config) const;
78
79 // Returns a human-readable string describing |*this|. For debugging & test
80 // output only.
81 std::string AsHumanReadableString() const;
82 std::string GetHumanReadableCodecName() const;
83
84 Codec codec() const { return codec_; }
85 CodecProfile profile() const { return profile_; }
86
87 // Optional byte data required to initialize video decoders.
88 const uint8* extra_data() const {
89 return extra_data_.empty() ? NULL : &extra_data_[0]; }
90 size_t extra_data_size() const { return extra_data_.size(); }
91
92 bool is_encrypted() const { return is_encrypted_; }
93
94 private:
95 Codec codec_;
96 CodecProfile profile_;
97 std::vector<uint8> extra_data_;
98 bool is_encrypted_;
99
100 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
101 // generated copy constructor and assignment operator. Since the extra data is
102 // typically small, the performance impact is minimal.
103 };
104
105 } // namespace media
106 } // namespace chromecast
107
108 #endif // CHROMECAST_MEDIA_CMA_PUBLIC_VIDEO_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698