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

Side by Side Diff: chromecast/public/media/decoder_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, 7 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_PUBLIC_MEDIA_DECODER_CONFIG_H_
6 #define CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_
7
8 #include <stdint.h>
9 #include <vector>
10
11 namespace chromecast {
12 namespace media {
13
14 namespace {
15
16 // Maximum audio bytes per sample.
17 static const int kMaxBytesPerSample = 4;
18
19 // Maximum audio sampling rate.
20 static const int kMaxSampleRate = 192000;
21
22 } // namespace
23
24 enum AudioCodec {
25 kAudioCodecUnknown = -1,
26
27 kAudioCodecMin = 0,
28 kCodecAAC = kAudioCodecMin,
29 kCodecMP3,
30 kCodecPCM,
31 kCodecPCM_S16BE,
32 kCodecVorbis,
33 kCodecOpus,
34 kCodecEAC3,
35 kCodecAC3,
36 kCodecDTS,
37 kAudioCodecMax = kCodecDTS,
38 };
39
40 enum VideoCodec {
41 kVideoCodecUnknown = -1,
42
43 kVideoCodecMin = 0,
44 kCodecH264 = kVideoCodecMin,
45 kCodecVC1,
46 kCodecMPEG2,
47 kCodecMPEG4,
48 kCodecTheora,
49 kCodecVP8,
50 kCodecVP9,
51 kCodecHEVC,
52 kVideoCodecMax = kCodecHEVC,
53 };
54
55 // Profile for Video codec.
56 enum VideoProfile {
57 kVideoProfileUnknown = -1,
58
59 kVideoProfileMin = 0,
60 kH264Baseline = kVideoProfileMin,
61 kH264Main,
62 kH264Extended,
63 kH264High,
64 kH264High10,
65 kH264High422,
66 kH264High444Predictive,
67 kH264ScalableBaseline,
68 kH264ScalableHigh,
69 kH264Stereohigh,
70 kH264MultiviewHigh,
71 kVP8ProfileAny,
72 kVP9ProfileAny,
73 kVideoProfileMax = kVP9ProfileAny,
74 };
75
76 struct AudioConfig {
77 AudioConfig()
78 : codec(kAudioCodecUnknown),
79 bytes_per_channel(0),
80 channel_number(0),
81 samples_per_second(0),
82 extra_data(nullptr),
83 extra_data_size(0),
84 is_encrypted(false) {}
85
86 // Audio codec.
87 AudioCodec codec;
88 // Number of bytes in each channel.
89 int bytes_per_channel;
90 // Number of channels in this audio stream.
91 int channel_number;
92 // Number of audio samples per second.
93 int samples_per_second;
94 // Pointer to extra data buffer for certain codec initialization. Note the
95 // structure only passes the pointer of data buffer and does not own memory
96 // responsibility.
97 const uint8_t* extra_data;
98 // Size of extra data in bytes.
99 int extra_data_size;
100 // content is encrypted or not.
101 bool is_encrypted;
102 };
103
104 struct VideoConfig {
105 VideoConfig()
106 : codec(kVideoCodecUnknown),
107 profile(kVideoProfileUnknown),
108 additional_config(nullptr),
109 extra_data(nullptr),
110 extra_data_size(0),
111 is_encrypted(false) {}
112
113 // Video codec.
114 VideoCodec codec;
115 // Video codec profile.
116 VideoProfile profile;
117 // Additional video config for the video stream if available.
118 VideoConfig* additional_config;
119 // Pointer to extra data buffer for certain codec initialization. Note the
120 // structure only passes the pointer of data buffer and does not own memory
121 // responsibility.
lcwu1 2015/05/05 23:46:22 This comment should also be applied to the data me
erickung1 2015/05/06 01:17:11 Done.
122 const uint8_t* extra_data;
123 // Size of extra data in bytes.
124 int extra_data_size;
125 // content is encrypted or not.
126 bool is_encrypted;
127 };
128
129 // TODO(erickung): Remove following two inline IsValidConfig() functions. These
130 // are to keep existing CMA backend implementation consistent until the clean up
131 // is done. These SHOULD NOT be used in New CMA backend implementation.
132 inline bool IsValidConfig(const AudioConfig& config) {
133 return config.codec >= kAudioCodecMin &&
134 config.codec <= kAudioCodecMax &&
135 config.channel_number > 0 &&
136 config.bytes_per_channel > 0 &&
137 config.bytes_per_channel <= kMaxBytesPerSample &&
138 config.samples_per_second > 0 &&
139 config.samples_per_second <= kMaxSampleRate;
140 }
141
142 inline bool IsValidConfig(const VideoConfig& config) {
143 return config.codec >= kVideoCodecMin && config.codec <= kVideoCodecMax;
144 }
145
146 } // namespace media
147 } // namespace chromecast
148
149 #endif // CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_
OLDNEW
« chromecast/media/cma/base/decoder_config_adapter.h ('K') | « chromecast/media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698