Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d97cec0 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Add AMediaFormat functions to clear and copy"

parents 6aecd355 98603d87
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -27,13 +27,23 @@
#ifndef _NDK_MEDIA_FORMAT_PRIV_H
#define _NDK_MEDIA_FORMAT_PRIV_H

#include <media/NdkMediaFormat.h>
#include <utils/String8.h>
#include <utils/StrongPointer.h>
#include <media/stagefright/foundation/AMessage.h>

#ifdef __cplusplus
extern "C" {
#endif

AMediaFormat* AMediaFormat_fromMsg(void*);
using namespace android;

struct AMediaFormat {
    sp<AMessage> mFormat;
    String8 mDebug;
    KeyedVector<String8, String8> mStringCache;
};

AMediaFormat* AMediaFormat_fromMsg(const void*);
void AMediaFormat_getFormat(const AMediaFormat* mData, void* dest);

#ifdef __cplusplus
+1 −0
Original line number Diff line number Diff line
@@ -191,6 +191,7 @@ cc_library {
        "MediaResourcePolicy.cpp",
        "Visualizer.cpp",
        "StringArray.cpp",
        "NdkMediaFormatPriv.cpp",
    ],

    aidl: {
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//#define LOG_NDEBUG 0
#define LOG_TAG "NdkMediaFormat"

#include <inttypes.h>

//#include <ndk/include/media/NdkMediaFormat.h>

#include <utils/Log.h>
#include <utils/StrongPointer.h>
#include <media/NdkMediaFormatPriv.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/AMessage.h>
//#include <android_runtime/AndroidRuntime.h>
//#include <android_util_Binder.h>

#include <jni.h>

using namespace android;

extern "C" {

// private functions for conversion to/from AMessage
AMediaFormat* AMediaFormat_fromMsg(const void* data) {
    ALOGV("private ctor");
    AMediaFormat* mData = new AMediaFormat();
    mData->mFormat = *((sp<AMessage>*)data);
    if (mData->mFormat == NULL) {
        ALOGW("got NULL format");
        mData->mFormat = new AMessage;
    }
    return mData;
}

void AMediaFormat_getFormat(const AMediaFormat* mData, void* dest) {
    *((sp<AMessage>*)dest) = mData->mFormat;
}

} // extern "C"

+1 −1
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@

#include <media/NdkMediaCodec.h>
#include <media/NdkMediaError.h>
#include <media/NdkMediaFormatPriv.h>
#include "NdkMediaCryptoPriv.h"
#include "NdkMediaFormatPriv.h"

#include <utils/Log.h>
#include <utils/StrongPointer.h>
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include <media/NdkMediaCrypto.h>
#include <media/NdkMediaCodec.h>
#include "NdkMediaFormatPriv.h"
#include <media/NdkMediaFormatPriv.h>


#include <cutils/properties.h>
Loading