179f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong/*
279f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * Copyright 2011, The Android Open Source Project
379f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong *
479f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * Licensed under the Apache License, Version 2.0 (the "License");
579f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * you may not use this file except in compliance with the License.
679f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * You may obtain a copy of the License at
779f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong *
879f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong *     http://www.apache.org/licenses/LICENSE-2.0
979f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong *
1079f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * Unless required by applicable law or agreed to in writing, software
1179f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * distributed under the License is distributed on an "AS IS" BASIS,
1279f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1379f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * See the License for the specific language governing permissions and
1479f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * limitations under the License.
1579f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong */
1679f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong
1779f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#ifndef _ANDROID_MEDIA_UTILS_H_
1879f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#define _ANDROID_MEDIA_UTILS_H_
1979f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong
2079f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#include "jni.h"
2179f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#include "JNIHelp.h"
2279f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#include "android_runtime/AndroidRuntime.h"
2379f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong
2479f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#include <utils/KeyedVector.h>
2579f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#include <utils/String8.h>
2679f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong
2779f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dongnamespace android {
2879f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong
2979f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong/**
3079f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong * Returns true if the conversion is successful; otherwise, false.
3179f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong */
3279f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dongbool ConvertKeyValueArraysToKeyedVector(
3379f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong    JNIEnv *env, jobjectArray keys, jobjectArray values,
3479f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong    KeyedVector<String8, String8>* vector);
3579f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong
3688572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huberstruct AMessage;
3788572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huberstatus_t ConvertMessageToMap(
3888572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huber        JNIEnv *env, const sp<AMessage> &msg, jobject *map);
3988572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huber
4088572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huberstatus_t ConvertKeyValueArraysToMessage(
4188572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huber        JNIEnv *env, jobjectArray keys, jobjectArray values,
4288572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huber        sp<AMessage> *msg);
4388572f7a3e9d7ef85c26865a0150f3c2041561c2Andreas Huber
4479f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong};  // namespace android
4579f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong
4679f407cc6c5ae34fc6f04d52fd034b49d1f002c4James Dong#endif //  _ANDROID_MEDIA_UTILS_H_
47