diff options
author | Elliott Hughes <enh@google.com> | 2014-06-10 16:53:31 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-06-11 14:43:57 -0700 |
commit | 95d3f86fed2cab71a446f2b9ab38458ee91e3b65 (patch) | |
tree | f401d5075c59ee94ab8bb7caba0bef164054973c /media/jni/android_media_MediaMetadataRetriever.cpp | |
parent | 2a1ed46decbc8e21a39367a4b7770111392167c3 (diff) | |
download | frameworks_base-95d3f86fed2cab71a446f2b9ab38458ee91e3b65.zip frameworks_base-95d3f86fed2cab71a446f2b9ab38458ee91e3b65.tar.gz frameworks_base-95d3f86fed2cab71a446f2b9ab38458ee91e3b65.tar.bz2 |
Switch to a type-safe album art interface.
(Requires a matching change in frameworks/av.)
Bug: 15514223
Change-Id: I4e494cc5d7a2eb82cd2b7ae3b829fc663136267a
Diffstat (limited to 'media/jni/android_media_MediaMetadataRetriever.cpp')
-rw-r--r-- | media/jni/android_media_MediaMetadataRetriever.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp index c2694f1..0e34789 100644 --- a/media/jni/android_media_MediaMetadataRetriever.cpp +++ b/media/jni/android_media_MediaMetadataRetriever.cpp @@ -23,6 +23,7 @@ #include <utils/threads.h> #include <core/SkBitmap.h> #include <media/mediametadataretriever.h> +#include <media/mediascanner.h> #include <private/media/VideoFrame.h> #include "jni.h" @@ -326,17 +327,13 @@ static jbyteArray android_media_MediaMetadataRetriever_getEmbeddedPicture( return NULL; } - unsigned int len = mediaAlbumArt->mSize; - char* data = (char*) mediaAlbumArt + sizeof(MediaAlbumArt); - jbyteArray array = env->NewByteArray(len); + jbyteArray array = env->NewByteArray(mediaAlbumArt->size()); if (!array) { // OutOfMemoryError exception has already been thrown. ALOGE("getEmbeddedPicture: OutOfMemoryError is thrown."); } else { - jbyte* bytes = env->GetByteArrayElements(array, NULL); - if (bytes != NULL) { - memcpy(bytes, data, len); - env->ReleaseByteArrayElements(array, bytes, 0); - } + const jbyte* data = + reinterpret_cast<const jbyte*>(mediaAlbumArt->data()); + env->SetByteArrayRegion(array, 0, mediaAlbumArt->size(), data); } // No need to delete mediaAlbumArt here |