| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/sdk_media_codec_bridge.h" | 5 #include "media/base/android/sdk_media_codec_bridge.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 Java_MediaCodecBridge_create(env, j_mime.obj(), is_secure, direction)); | 90 Java_MediaCodecBridge_create(env, j_mime.obj(), is_secure, direction)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 SdkMediaCodecBridge::~SdkMediaCodecBridge() { | 93 SdkMediaCodecBridge::~SdkMediaCodecBridge() { |
| 94 JNIEnv* env = AttachCurrentThread(); | 94 JNIEnv* env = AttachCurrentThread(); |
| 95 CHECK(env); | 95 CHECK(env); |
| 96 if (j_media_codec_.obj()) | 96 if (j_media_codec_.obj()) |
| 97 Java_MediaCodecBridge_release(env, j_media_codec_.obj()); | 97 Java_MediaCodecBridge_release(env, j_media_codec_.obj()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 MediaCodecStatus SdkMediaCodecBridge::Reset() { | |
| 101 JNIEnv* env = AttachCurrentThread(); | |
| 102 return static_cast<MediaCodecStatus>( | |
| 103 Java_MediaCodecBridge_flush(env, j_media_codec_.obj())); | |
| 104 } | |
| 105 | |
| 106 bool SdkMediaCodecBridge::Start() { | 100 bool SdkMediaCodecBridge::Start() { |
| 107 JNIEnv* env = AttachCurrentThread(); | 101 JNIEnv* env = AttachCurrentThread(); |
| 108 return Java_MediaCodecBridge_start(env, j_media_codec_.obj()); | 102 return Java_MediaCodecBridge_start(env, j_media_codec_.obj()); |
| 109 } | 103 } |
| 110 | 104 |
| 111 void SdkMediaCodecBridge::Stop() { | 105 void SdkMediaCodecBridge::Stop() { |
| 112 JNIEnv* env = AttachCurrentThread(); | 106 JNIEnv* env = AttachCurrentThread(); |
| 113 Java_MediaCodecBridge_stop(env, j_media_codec_.obj()); | 107 Java_MediaCodecBridge_stop(env, j_media_codec_.obj()); |
| 114 } | 108 } |
| 115 | 109 |
| 110 MediaCodecStatus SdkMediaCodecBridge::Flush() { |
| 111 JNIEnv* env = AttachCurrentThread(); |
| 112 return static_cast<MediaCodecStatus>( |
| 113 Java_MediaCodecBridge_flush(env, j_media_codec_.obj())); |
| 114 } |
| 115 |
| 116 MediaCodecStatus SdkMediaCodecBridge::GetOutputSize(gfx::Size* size) { | 116 MediaCodecStatus SdkMediaCodecBridge::GetOutputSize(gfx::Size* size) { |
| 117 JNIEnv* env = AttachCurrentThread(); | 117 JNIEnv* env = AttachCurrentThread(); |
| 118 ScopedJavaLocalRef<jobject> result = | 118 ScopedJavaLocalRef<jobject> result = |
| 119 Java_MediaCodecBridge_getOutputFormat(env, j_media_codec_.obj()); | 119 Java_MediaCodecBridge_getOutputFormat(env, j_media_codec_.obj()); |
| 120 MediaCodecStatus status = static_cast<MediaCodecStatus>( | 120 MediaCodecStatus status = static_cast<MediaCodecStatus>( |
| 121 Java_GetOutputFormatResult_status(env, result.obj())); | 121 Java_GetOutputFormatResult_status(env, result.obj())); |
| 122 if (status == MEDIA_CODEC_OK) { | 122 if (status == MEDIA_CODEC_OK) { |
| 123 size->SetSize(Java_GetOutputFormatResult_width(env, result.obj()), | 123 size->SetSize(Java_GetOutputFormatResult_width(env, result.obj()), |
| 124 Java_GetOutputFormatResult_height(env, result.obj())); | 124 Java_GetOutputFormatResult_height(env, result.obj())); |
| 125 } | 125 } |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 if (adaptive_playback_supported_for_testing_ == 0) | 698 if (adaptive_playback_supported_for_testing_ == 0) |
| 699 return false; | 699 return false; |
| 700 else if (adaptive_playback_supported_for_testing_ > 0) | 700 else if (adaptive_playback_supported_for_testing_ > 0) |
| 701 return true; | 701 return true; |
| 702 JNIEnv* env = AttachCurrentThread(); | 702 JNIEnv* env = AttachCurrentThread(); |
| 703 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 703 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
| 704 width, height); | 704 width, height); |
| 705 } | 705 } |
| 706 | 706 |
| 707 } // namespace media | 707 } // namespace media |
| OLD | NEW |