Loading include/ndk/NdkMediaCodec.h +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ int AMediaCodec_delete(AMediaCodec*); /** * Configure the codec. For decoding you would typically get the format from an extractor. */ int AMediaCodec_configure(AMediaCodec*, AMediaFormat *format, ANativeWindow* surface); // TODO: other args int AMediaCodec_configure(AMediaCodec*, const AMediaFormat* format, ANativeWindow* surface); // TODO: other args /** * Start the codec. A codec must be configured before it can be started, and must be started Loading include/ndk/NdkMediaMuxer.h 0 → 100644 +75 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 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. */ /* * This file defines an NDK API. * Do not remove methods. * Do not change method signatures. * Do not change the value of constants. * Do not change the size of any of the classes defined in here. * Do not reference types that are not part of the NDK. * Do not #include files that aren't part of the NDK. */ #ifndef _NDK_MEDIA_MUXER_H #define _NDK_MEDIA_MUXER_H #include <sys/types.h> #include "NdkMediaFormat.h" #include "NdkMediaCodec.h" #ifdef __cplusplus extern "C" { #endif struct AMediaMuxer; typedef struct AMediaMuxer AMediaMuxer; typedef enum { AMEDIAMUXER_OUTPUT_FORMAT_MPEG_4 = 0, AMEDIAMUXER_OUTPUT_FORMAT_WEBM = 1, } OutputFormat; /** * Create new media muxer */ AMediaMuxer* AMediaMuxer_new(int fd, OutputFormat format); /** * Delete a previously created media muxer */ int AMediaMuxer_delete(AMediaMuxer*); int AMediaMuxer_setLocation(AMediaMuxer*, float latitude, float longtitude); int AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees); ssize_t AMediaMuxer_addTrack(AMediaMuxer*, const AMediaFormat* format); int AMediaMuxer_start(AMediaMuxer*); int AMediaMuxer_stop(AMediaMuxer*); int AMediaMuxer_writeSampleData(AMediaMuxer *muxer, size_t trackIdx, const uint8_t *data, const AMediaCodecBufferInfo &info); #ifdef __cplusplus } // extern "C" #endif #endif // _NDK_MEDIA_MUXER_H media/ndk/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ LOCAL_SRC_FILES:= \ NdkMediaCodec.cpp \ NdkMediaExtractor.cpp \ NdkMediaFormat.cpp \ NdkMediaMuxer.cpp \ LOCAL_MODULE:= libmediandk Loading media/ndk/NdkMediaCodec.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ int AMediaCodec_delete(AMediaCodec *mData) { return OK; } int AMediaCodec_configure(AMediaCodec *mData, AMediaFormat *format, ANativeWindow* window) { int AMediaCodec_configure(AMediaCodec *mData, const AMediaFormat* format, ANativeWindow* window) { sp<AMessage> nativeFormat; AMediaFormat_getFormat(format, &nativeFormat); ALOGV("configure with format: %s", nativeFormat->debugString(0).c_str()); Loading media/ndk/NdkMediaFormat.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -41,14 +41,14 @@ struct AMediaFormat { extern "C" { // private functions for conversion to/from AMessage AMediaFormat* AMediaFormat_fromMsg(void* data) { AMediaFormat* AMediaFormat_fromMsg(const void* data) { ALOGV("private ctor"); AMediaFormat* mData = new AMediaFormat(); mData->mFormat = *((sp<AMessage>*)data); return mData; } void AMediaFormat_getFormat(AMediaFormat* mData, void* dest) { void AMediaFormat_getFormat(const AMediaFormat* mData, void* dest) { *((sp<AMessage>*)dest) = mData->mFormat; } Loading Loading
include/ndk/NdkMediaCodec.h +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ int AMediaCodec_delete(AMediaCodec*); /** * Configure the codec. For decoding you would typically get the format from an extractor. */ int AMediaCodec_configure(AMediaCodec*, AMediaFormat *format, ANativeWindow* surface); // TODO: other args int AMediaCodec_configure(AMediaCodec*, const AMediaFormat* format, ANativeWindow* surface); // TODO: other args /** * Start the codec. A codec must be configured before it can be started, and must be started Loading
include/ndk/NdkMediaMuxer.h 0 → 100644 +75 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 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. */ /* * This file defines an NDK API. * Do not remove methods. * Do not change method signatures. * Do not change the value of constants. * Do not change the size of any of the classes defined in here. * Do not reference types that are not part of the NDK. * Do not #include files that aren't part of the NDK. */ #ifndef _NDK_MEDIA_MUXER_H #define _NDK_MEDIA_MUXER_H #include <sys/types.h> #include "NdkMediaFormat.h" #include "NdkMediaCodec.h" #ifdef __cplusplus extern "C" { #endif struct AMediaMuxer; typedef struct AMediaMuxer AMediaMuxer; typedef enum { AMEDIAMUXER_OUTPUT_FORMAT_MPEG_4 = 0, AMEDIAMUXER_OUTPUT_FORMAT_WEBM = 1, } OutputFormat; /** * Create new media muxer */ AMediaMuxer* AMediaMuxer_new(int fd, OutputFormat format); /** * Delete a previously created media muxer */ int AMediaMuxer_delete(AMediaMuxer*); int AMediaMuxer_setLocation(AMediaMuxer*, float latitude, float longtitude); int AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees); ssize_t AMediaMuxer_addTrack(AMediaMuxer*, const AMediaFormat* format); int AMediaMuxer_start(AMediaMuxer*); int AMediaMuxer_stop(AMediaMuxer*); int AMediaMuxer_writeSampleData(AMediaMuxer *muxer, size_t trackIdx, const uint8_t *data, const AMediaCodecBufferInfo &info); #ifdef __cplusplus } // extern "C" #endif #endif // _NDK_MEDIA_MUXER_H
media/ndk/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ LOCAL_SRC_FILES:= \ NdkMediaCodec.cpp \ NdkMediaExtractor.cpp \ NdkMediaFormat.cpp \ NdkMediaMuxer.cpp \ LOCAL_MODULE:= libmediandk Loading
media/ndk/NdkMediaCodec.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ int AMediaCodec_delete(AMediaCodec *mData) { return OK; } int AMediaCodec_configure(AMediaCodec *mData, AMediaFormat *format, ANativeWindow* window) { int AMediaCodec_configure(AMediaCodec *mData, const AMediaFormat* format, ANativeWindow* window) { sp<AMessage> nativeFormat; AMediaFormat_getFormat(format, &nativeFormat); ALOGV("configure with format: %s", nativeFormat->debugString(0).c_str()); Loading
media/ndk/NdkMediaFormat.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -41,14 +41,14 @@ struct AMediaFormat { extern "C" { // private functions for conversion to/from AMessage AMediaFormat* AMediaFormat_fromMsg(void* data) { AMediaFormat* AMediaFormat_fromMsg(const void* data) { ALOGV("private ctor"); AMediaFormat* mData = new AMediaFormat(); mData->mFormat = *((sp<AMessage>*)data); return mData; } void AMediaFormat_getFormat(AMediaFormat* mData, void* dest) { void AMediaFormat_getFormat(const AMediaFormat* mData, void* dest) { *((sp<AMessage>*)dest) = mData->mFormat; } Loading