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

Side by Side Diff: chromecast/media/cma/base/decoder_config_adapter.cc

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 #include "chromecast/media/cma/base/decoder_config_adapter.h"
6
7 #include "chromecast/media/cma/public/audio_config.h"
8 #include "chromecast/media/cma/public/video_config.h"
9 #include "media/base/audio_decoder_config.h"
10 #include "media/base/channel_layout.h"
11 #include "media/base/video_decoder_config.h"
12
13 namespace chromecast {
14 namespace media {
15
16 AudioConfig DecoderConfigAdapter::ToAudioConfig(
17 const ::media::AudioDecoderConfig& config) {
18 if (!config.IsValidConfig()) {
19 return AudioConfig();
20 }
21
22 return AudioConfig(
23 static_cast<AudioConfig::Codec>(config.codec()),
lcwu1 2015/04/13 23:55:42 It's actually dangerous doing this. I am not sure
erickung1 2015/04/15 22:13:18 Done. Create util function to do the conversion us
24 static_cast<AudioConfig::ChannelLayout>(config.channel_layout()),
25 ::media::ChannelLayoutToChannelCount(config.channel_layout()),
26 config.bytes_per_channel(),
27 config.samples_per_second(),
28 config.extra_data(),
29 config.extra_data_size(),
30 config.is_encrypted());
31 }
32
33 VideoConfig DecoderConfigAdapter::ToVideoConfig(
34 const ::media::VideoDecoderConfig& config) {
35 if (!config.IsValidConfig()) {
36 return VideoConfig();
37 }
38
39 return VideoConfig(
40 static_cast<VideoConfig::Codec>(config.codec()),
41 static_cast<VideoConfig::CodecProfile>(config.profile()),
42 config.extra_data(),
43 config.extra_data_size(),
44 config.is_encrypted());
45 }
46
47 } // namespace media
48 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698