summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-03-26 11:43:06 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-26 11:43:06 -0700
commitb3e2e24f789d41d6c38b8ad4c252cf9f6e2122d8 (patch)
tree3db78e2b9860b33fc0a75cdd9e3ddba2f97410db /media/jni
parent61bf87428c0f3366d0c4ec203ff96331b7ec3546 (diff)
parent9b8e496f4d143280deff137c5f30ca8907bc28db (diff)
downloadframeworks_base-b3e2e24f789d41d6c38b8ad4c252cf9f6e2122d8.zip
frameworks_base-b3e2e24f789d41d6c38b8ad4c252cf9f6e2122d8.tar.gz
frameworks_base-b3e2e24f789d41d6c38b8ad4c252cf9f6e2122d8.tar.bz2
Merge "Provisional support for secure decryption of media streams."
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_MediaExtractor.cpp29
-rw-r--r--media/jni/android_media_MediaExtractor.h1
-rw-r--r--media/jni/android_media_Utils.cpp2
3 files changed, 31 insertions, 1 deletions
diff --git a/media/jni/android_media_MediaExtractor.cpp b/media/jni/android_media_MediaExtractor.cpp
index 0c86fc2..8c661b7 100644
--- a/media/jni/android_media_MediaExtractor.cpp
+++ b/media/jni/android_media_MediaExtractor.cpp
@@ -160,6 +160,10 @@ status_t JMediaExtractor::getSampleTime(int64_t *sampleTimeUs) {
return mImpl->getSampleTime(sampleTimeUs);
}
+status_t JMediaExtractor::getSampleFlags(uint32_t *sampleFlags) {
+ return mImpl->getSampleFlags(sampleFlags);
+}
+
} // namespace android
////////////////////////////////////////////////////////////////////////////////
@@ -343,6 +347,28 @@ static jlong android_media_MediaExtractor_getSampleTime(
return sampleTimeUs;
}
+static jint android_media_MediaExtractor_getSampleFlags(
+ JNIEnv *env, jobject thiz) {
+ sp<JMediaExtractor> extractor = getMediaExtractor(env, thiz);
+
+ if (extractor == NULL) {
+ jniThrowException(env, "java/lang/IllegalStateException", NULL);
+ return -1ll;
+ }
+
+ uint32_t sampleFlags;
+ status_t err = extractor->getSampleFlags(&sampleFlags);
+
+ if (err == ERROR_END_OF_STREAM) {
+ return -1ll;
+ } else if (err != OK) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+ return false;
+ }
+
+ return sampleFlags;
+}
+
static void android_media_MediaExtractor_native_init(JNIEnv *env) {
jclass clazz = env->FindClass("android/media/MediaExtractor");
CHECK(clazz != NULL);
@@ -412,6 +438,9 @@ static JNINativeMethod gMethods[] = {
{ "getSampleTime", "()J",
(void *)android_media_MediaExtractor_getSampleTime },
+ { "getSampleFlags", "()I",
+ (void *)android_media_MediaExtractor_getSampleFlags },
+
{ "native_init", "()V", (void *)android_media_MediaExtractor_native_init },
{ "native_setup", "(Ljava/lang/String;)V",
diff --git a/media/jni/android_media_MediaExtractor.h b/media/jni/android_media_MediaExtractor.h
index 70e58c6..49a64d6 100644
--- a/media/jni/android_media_MediaExtractor.h
+++ b/media/jni/android_media_MediaExtractor.h
@@ -43,6 +43,7 @@ struct JMediaExtractor : public RefBase {
status_t readSampleData(jobject byteBuf, size_t offset, size_t *sampleSize);
status_t getSampleTrackIndex(size_t *trackIndex);
status_t getSampleTime(int64_t *sampleTimeUs);
+ status_t getSampleFlags(uint32_t *sampleFlags);
protected:
virtual ~JMediaExtractor();
diff --git a/media/jni/android_media_Utils.cpp b/media/jni/android_media_Utils.cpp
index 8b2321c..1190448 100644
--- a/media/jni/android_media_Utils.cpp
+++ b/media/jni/android_media_Utils.cpp
@@ -324,7 +324,7 @@ status_t ConvertKeyValueArraysToMessage(
env->DeleteLocalRef(byteArray); byteArray = NULL;
}
- msg->setObject(key.c_str(), buffer);
+ msg->setBuffer(key.c_str(), buffer);
}
}