Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| OLD | NEW |