blob: 3c84d6a455043c3491454c8e509111d927f010c3 [file] [log] [blame]
Marco Nelissen98603d82018-07-17 11:06:55 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//#define LOG_NDEBUG 0
18#define LOG_TAG "NdkMediaFormat"
19
20#include <inttypes.h>
21
22//#include <ndk/include/media/NdkMediaFormat.h>
23
24#include <utils/Log.h>
25#include <utils/StrongPointer.h>
26#include <media/NdkMediaFormatPriv.h>
27#include <media/stagefright/foundation/ABuffer.h>
28#include <media/stagefright/foundation/AMessage.h>
29//#include <android_runtime/AndroidRuntime.h>
30//#include <android_util_Binder.h>
31
32#include <jni.h>
33
34using namespace android;
35
36extern "C" {
37
38// private functions for conversion to/from AMessage
39AMediaFormat* AMediaFormat_fromMsg(const void* data) {
40 ALOGV("private ctor");
41 AMediaFormat* mData = new AMediaFormat();
42 mData->mFormat = *((sp<AMessage>*)data);
43 if (mData->mFormat == NULL) {
44 ALOGW("got NULL format");
45 mData->mFormat = new AMessage;
46 }
47 return mData;
48}
49
50void AMediaFormat_getFormat(const AMediaFormat* mData, void* dest) {
51 *((sp<AMessage>*)dest) = mData->mFormat;
52}
53
54} // extern "C"
55
56