Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/android/ndk_media_codec_bridge.h" | 5 #include "media/base/android/ndk_media_codec_bridge.h" |
| 6 | 6 |
| 7 #include <media/NdkMediaError.h> | 7 #include <media/NdkMediaError.h> |
| 8 #include <media/NdkMediaFormat.h> | 8 #include <media/NdkMediaFormat.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/native_library.h" | 14 #include "base/native_library.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "media/base/android/media_codec_util.h" | |
| 16 #include "media/base/decrypt_config.h" | 17 #include "media/base/decrypt_config.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 const char kMediaFormatKeyCropLeft[] = "crop-left"; | 20 const char kMediaFormatKeyCropLeft[] = "crop-left"; |
| 20 const char kMediaFormatKeyCropRight[] = "crop-right"; | 21 const char kMediaFormatKeyCropRight[] = "crop-right"; |
| 21 const char kMediaFormatKeyCropBottom[] = "crop-bottom"; | 22 const char kMediaFormatKeyCropBottom[] = "crop-bottom"; |
| 22 const char kMediaFormatKeyCropTop[] = "crop-top"; | 23 const char kMediaFormatKeyCropTop[] = "crop-top"; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace media { | 26 namespace media { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 void* dst, | 231 void* dst, |
| 231 size_t num) { | 232 size_t num) { |
| 232 size_t capacity; | 233 size_t capacity; |
| 233 const uint8_t* src_data = | 234 const uint8_t* src_data = |
| 234 AMediaCodec_getOutputBuffer(media_codec_.get(), index, &capacity); | 235 AMediaCodec_getOutputBuffer(media_codec_.get(), index, &capacity); |
| 235 CHECK_GE(capacity, offset + num); | 236 CHECK_GE(capacity, offset + num); |
| 236 memcpy(dst, src_data + offset, num); | 237 memcpy(dst, src_data + offset, num); |
| 237 return MEDIA_CODEC_OK; | 238 return MEDIA_CODEC_OK; |
| 238 } | 239 } |
| 239 | 240 |
| 241 std::string NdkMediaCodecBridge::GetName() { | |
| 242 // The NDK doesn't expose a name getter, so use the default name as a proxy. | |
|
DaleCurtis
2016/04/23 19:06:21
I'm wary of this, there is already some worry that
| |
| 243 if (base::android::BuildInfo::GetInstance()->sdk_int() < 18) | |
| 244 return ""; | |
| 245 return MediaCodecUtil::GetDefaultCodecName(mime_, direction_); | |
| 246 } | |
| 247 | |
| 240 } // namespace media | 248 } // namespace media |
| OLD | NEW |