├── AndroidManifest.xml ├── LICENSE ├── README.md ├── gen ├── android │ └── support │ │ └── v7 │ │ └── appcompat │ │ └── R.java └── com │ └── openamedia │ └── recorder │ ├── BuildConfig.java │ └── R.java ├── ic_launcher-web.png ├── jni ├── Android.mk ├── Application.mk ├── Common.cpp ├── Common.h ├── FFMPEGer.cpp ├── FFMPEGer.h ├── FFmpegAudioEncoder.cpp ├── FFmpegAudioEncoder.h ├── LMRSource.cpp ├── LMRSource.h ├── LocalMediaRecorder.cpp ├── LocalMediaRecorder.h ├── MediaInfo.cpp ├── MediaRecorder.h ├── MessageQueue.cpp ├── MessageQueue.h ├── MuxEngine.cpp ├── MuxEngine.h ├── Prefetcher.cpp ├── Prefetcher.h ├── android │ ├── ADebug.h │ ├── AString.cpp │ ├── AString.h │ ├── ColorConverter.cpp │ ├── ColorConverter.h │ ├── Condition.h │ ├── Errors.h │ ├── List.h │ ├── Log.h │ ├── MediaBuffer.cpp │ ├── MediaBuffer.h │ ├── MediaBufferGroup.cpp │ ├── MediaBufferGroup.h │ ├── MetaData.cpp │ ├── MetaData.h │ ├── Mutex.h │ ├── TimedEventQueue.cpp │ └── TimedEventQueue.h ├── com_openamedia_recorder_ARecorder.cpp ├── com_openamedia_recorder_ARecorder.h ├── ffmpeg │ ├── include │ │ ├── libavcodec │ │ │ ├── avcodec.h │ │ │ ├── avfft.h │ │ │ ├── dxva2.h │ │ │ ├── old_codec_ids.h │ │ │ ├── vaapi.h │ │ │ ├── vda.h │ │ │ ├── vdpau.h │ │ │ ├── version.h │ │ │ └── xvmc.h │ │ ├── libavdevice │ │ │ ├── avdevice.h │ │ │ └── version.h │ │ ├── libavfilter │ │ │ ├── asrc_abuffer.h │ │ │ ├── avcodec.h │ │ │ ├── avfilter.h │ │ │ ├── avfiltergraph.h │ │ │ ├── buffersink.h │ │ │ ├── buffersrc.h │ │ │ └── version.h │ │ ├── libavformat │ │ │ ├── avformat.h │ │ │ ├── avio.h │ │ │ └── version.h │ │ ├── libavutil │ │ │ ├── adler32.h │ │ │ ├── aes.h │ │ │ ├── attributes.h │ │ │ ├── audio_fifo.h │ │ │ ├── audioconvert.h │ │ │ ├── avassert.h │ │ │ ├── avconfig.h │ │ │ ├── avstring.h │ │ │ ├── avutil.h │ │ │ ├── base64.h │ │ │ ├── blowfish.h │ │ │ ├── bprint.h │ │ │ ├── bswap.h │ │ │ ├── buffer.h │ │ │ ├── channel_layout.h │ │ │ ├── common.h │ │ │ ├── cpu.h │ │ │ ├── crc.h │ │ │ ├── dict.h │ │ │ ├── downmix_info.h │ │ │ ├── error.h │ │ │ ├── eval.h │ │ │ ├── ffversion.h │ │ │ ├── fifo.h │ │ │ ├── file.h │ │ │ ├── frame.h │ │ │ ├── hmac.h │ │ │ ├── imgutils.h │ │ │ ├── intfloat.h │ │ │ ├── intfloat_readwrite.h │ │ │ ├── intreadwrite.h │ │ │ ├── lfg.h │ │ │ ├── log.h │ │ │ ├── lzo.h │ │ │ ├── macros.h │ │ │ ├── mathematics.h │ │ │ ├── md5.h │ │ │ ├── mem.h │ │ │ ├── murmur3.h │ │ │ ├── old_pix_fmts.h │ │ │ ├── opt.h │ │ │ ├── parseutils.h │ │ │ ├── pixdesc.h │ │ │ ├── pixfmt.h │ │ │ ├── random_seed.h │ │ │ ├── rational.h │ │ │ ├── ripemd.h │ │ │ ├── samplefmt.h │ │ │ ├── sha.h │ │ │ ├── sha512.h │ │ │ ├── stereo3d.h │ │ │ ├── time.h │ │ │ ├── timecode.h │ │ │ ├── timestamp.h │ │ │ ├── version.h │ │ │ └── xtea.h │ │ ├── libswresample │ │ │ ├── swresample.h │ │ │ └── version.h │ │ └── libswscale │ │ │ ├── swscale.h │ │ │ └── version.h │ └── lib │ │ ├── libavcodec.a │ │ ├── libavformat.a │ │ ├── libavutil.a │ │ ├── libfaac.a │ │ ├── libswresample.a │ │ ├── libswscale.a │ │ └── libx264.a ├── io │ ├── ANativeWindowRenderer.cpp │ ├── ANativeWindowRenderer.h │ ├── OpenSLRecorder.cpp │ └── OpenSLRecorder.h └── openmax │ ├── OMX_Audio.h │ ├── OMX_Component.h │ ├── OMX_ContentPipe.h │ ├── OMX_Core.h │ ├── OMX_IVCommon.h │ ├── OMX_Image.h │ ├── OMX_Index.h │ ├── OMX_IndexExt.h │ ├── OMX_Other.h │ ├── OMX_Types.h │ ├── OMX_Video.h │ └── OMX_VideoExt.h ├── libs └── android-support-v4.jar ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ ├── controller_record.png │ ├── controller_stop.png │ └── ic_launcher.png ├── drawable-mdpi │ ├── controller_record.png │ ├── controller_stop.png │ └── ic_launcher.png ├── drawable-xhdpi │ ├── controller_record.png │ ├── controller_stop.png │ └── ic_launcher.png ├── drawable-xxhdpi │ ├── controller_record.png │ ├── controller_stop.png │ └── ic_launcher.png ├── layout │ └── activity_main.xml ├── menu │ └── main.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml ├── values-w820dp │ └── dimens.xml └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── src └── com └── openamedia ├── activity └── RecorderActivity.java └── recorder └── ARecorder.java /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | recorder 2 | ======== 3 | 4 | openamedia recorder is a android app recording audio/video to a target file. 5 | -------------------------------------------------------------------------------- /gen/com/openamedia/recorder/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.openamedia.recorder; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/ic_launcher-web.png -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := static-avutil 5 | LOCAL_SRC_FILES := ffmpeg/lib/libavutil.a 6 | include $(PREBUILT_STATIC_LIBRARY) 7 | 8 | include $(CLEAR_VARS) 9 | LOCAL_MODULE := static-avformat 10 | LOCAL_SRC_FILES := ffmpeg/lib/libavformat.a 11 | include $(PREBUILT_STATIC_LIBRARY) 12 | 13 | include $(CLEAR_VARS) 14 | LOCAL_MODULE := static-avcodec 15 | LOCAL_SRC_FILES := ffmpeg/lib/libavcodec.a 16 | include $(PREBUILT_STATIC_LIBRARY) 17 | 18 | include $(CLEAR_VARS) 19 | LOCAL_MODULE := static-faac 20 | LOCAL_SRC_FILES := ffmpeg/lib/libfaac.a 21 | include $(PREBUILT_STATIC_LIBRARY) 22 | 23 | include $(CLEAR_VARS) 24 | LOCAL_MODULE := static-swresample 25 | LOCAL_SRC_FILES := ffmpeg/lib/libswresample.a 26 | include $(PREBUILT_STATIC_LIBRARY) 27 | 28 | include $(CLEAR_VARS) 29 | LOCAL_MODULE := static-swscale 30 | LOCAL_SRC_FILES := ffmpeg/lib/libswscale.a 31 | include $(PREBUILT_STATIC_LIBRARY) 32 | 33 | include $(CLEAR_VARS) 34 | LOCAL_MODULE := static-x264 35 | LOCAL_SRC_FILES := ffmpeg/lib/libx264.a 36 | include $(PREBUILT_STATIC_LIBRARY) 37 | 38 | 39 | include $(CLEAR_VARS) 40 | 41 | LOCAL_MODULE := arecorder-jni 42 | 43 | LOCAL_SRC_FILES := com_openamedia_recorder_ARecorder.cpp \ 44 | android/AString.cpp \ 45 | android/MetaData.cpp \ 46 | android/TimedEventQueue.cpp \ 47 | android/ColorConverter.cpp \ 48 | android/MediaBuffer.cpp \ 49 | android/MediaBufferGroup.cpp \ 50 | io/ANativeWindowRenderer.cpp \ 51 | io/OpenSLRecorder.cpp \ 52 | Common.cpp \ 53 | MessageQueue.cpp \ 54 | LMRSource.cpp \ 55 | Prefetcher.cpp \ 56 | FFMPEGer.cpp \ 57 | FFmpegAudioEncoder.cpp \ 58 | MuxEngine.cpp \ 59 | LocalMediaRecorder.cpp 60 | 61 | LOCAL_STATIC_LIBRARIES := static-avformat \ 62 | static-avcodec \ 63 | static-x264 \ 64 | static-faac \ 65 | static-swresample \ 66 | static-swscale \ 67 | static-avutil 68 | 69 | 70 | LOCAL_C_INCLUDES := ffmpeg/include \ 71 | openmax \ 72 | 73 | LOCAL_LDLIBS += -llog \ 74 | -landroid \ 75 | -lOpenSLES \ 76 | -lz \ 77 | 78 | LOCAL_CFLAGS += -Wno-multichar \ 79 | -D__cplusplus \ 80 | -D__STDC_CONSTANT_MACROS \ 81 | -D__STDC_FORMAT_MACROS \ 82 | -DFF_API_SWS_GETCONTEXT 83 | 84 | 85 | include $(BUILD_SHARED_LIBRARY) -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi 2 | APP_STL := stlport_shared -------------------------------------------------------------------------------- /jni/Common.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | 22 | #include "Common.h" 23 | 24 | #include 25 | 26 | namespace openamedia { 27 | 28 | int64_t getCurrentTimeUS(){ 29 | struct timeval tv; 30 | gettimeofday(&tv,NULL); 31 | return tv.tv_sec * 1000000 + tv.tv_usec; 32 | } 33 | 34 | }//namespace 35 | -------------------------------------------------------------------------------- /jni/Common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef OPENAMEDIA_COMMON_H 22 | #define OPENAMEDIA_COMMON_H 23 | 24 | #include 25 | 26 | namespace openamedia { 27 | 28 | #define MAX_STRING_PATH_LEN 512 29 | 30 | enum MediaType { 31 | MEDIA_TYPE_UNKNOWN = 0, 32 | MEDIA_TYPE_AUDIO, 33 | MEDIA_TYPE_VIDEO, 34 | }; 35 | 36 | enum CodecType { 37 | CODEC_TYPE_MP3, 38 | CODEC_TYPE_AAC, 39 | CODEC_TYPE_H264, 40 | }; 41 | 42 | int64_t getCurrentTimeUS(); 43 | 44 | }//namespace 45 | 46 | #endif//OPENAMEDIA_COMMON_H 47 | -------------------------------------------------------------------------------- /jni/FFMPEGer.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENAMEDIA_FFMPEGER_H 2 | #define OPENAMEDIA_FFMPEGER_H 3 | 4 | #include "android/MetaData.h" 5 | #include "android/Errors.h" 6 | #include "android/MediaBuffer.h" 7 | 8 | #include "openmax/OMX_IVCommon.h" 9 | 10 | #include "Common.h" 11 | 12 | extern "C"{ 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | } 22 | 23 | namespace openamedia { 24 | 25 | class FFMPEGer { 26 | public: 27 | FFMPEGer(); 28 | ~FFMPEGer(); 29 | 30 | void setOutputFile(const char* path); 31 | void setVideoSize(int width, int height); 32 | void setVideoColorFormat(OMX_COLOR_FORMATTYPE fmt); 33 | 34 | bool init(MetaData* meta); 35 | 36 | int getAudioEncodeBufferSize(); 37 | 38 | status_t encodeAudio(MediaBuffer* src, MediaBuffer* dst); 39 | status_t encodeVideo(MediaBuffer* src, MediaBuffer* dst); 40 | 41 | status_t finish(); 42 | 43 | void mux(); 44 | 45 | MetaData* getMetaData(); 46 | 47 | private: 48 | bool mInited; 49 | AVOutputFormat *fmt; 50 | AVFormatContext *fmt_ctx; 51 | AVCodec *audio_codec; 52 | AVCodec *video_codec; 53 | bool have_video; 54 | bool have_audio; 55 | MetaData* mMetaData; 56 | 57 | struct OutputStream { 58 | AVStream *st; 59 | /* pts of the next frame that will be generated */ 60 | int64_t next_pts; 61 | int samples_count; 62 | AVFrame *frame; 63 | AVFrame *tmp_frame; 64 | SwsContext *sws_ctx; 65 | SwrContext *swr_ctx; 66 | }; 67 | 68 | OutputStream video_st; 69 | OutputStream audio_st; 70 | 71 | char mOutputFile[MAX_STRING_PATH_LEN]; 72 | 73 | int mWidth; 74 | int mHeight; 75 | OMX_COLOR_FORMATTYPE mColor; 76 | AVPixelFormat mPixFmt; 77 | 78 | bool deInit(); 79 | void reset(); 80 | 81 | bool add_stream(OutputStream *ost, AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id); 82 | bool open_audio(AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg); 83 | AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt, uint64_t channel_layout, int sample_rate, int nb_samples); 84 | bool open_video(AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg); 85 | AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height); 86 | void close_stream(AVFormatContext *oc, OutputStream *ost); 87 | int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt); 88 | 89 | FFMPEGer(const FFMPEGer&); 90 | FFMPEGer& operator=(const FFMPEGer&); 91 | }; 92 | 93 | }//namespace 94 | 95 | #endif//OPENAMEDIA_FFMPEGER_H 96 | -------------------------------------------------------------------------------- /jni/FFmpegAudioEncoder.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENAMEDIA_FFMPEG_AUDIO_ENCODER_H 2 | #define OPENAMEDIA_FFMPEG_AUDIO_ENCODER_H 3 | 4 | #include "Common.h" 5 | 6 | extern "C"{ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | } 15 | 16 | namespace openamedia { 17 | 18 | #define DEFAULT_AUDIO_ENCODER_OUT_CAPACITY 1*1024*1024 19 | 20 | class FFmpegAudioEncoder { 21 | public: 22 | FFmpegAudioEncoder(); 23 | ~FFmpegAudioEncoder(); 24 | 25 | bool setBitRate(int bitRate); 26 | bool setSampleRate(int sampleRate); 27 | bool setChannels(int channels); 28 | bool setEncoder(CodecType codec); 29 | 30 | bool getEncoderBufferSize(int* size); 31 | 32 | bool init(); 33 | 34 | bool encode(void* in, int inSize, void** out, int* outSize); 35 | 36 | private: 37 | bool mInited; 38 | int mBitRate; 39 | int mSampleRate; 40 | int mChannels; 41 | AVCodecID mCodecID; 42 | 43 | AVCodec *codec; 44 | AVCodecContext *c; 45 | AVFrame *frame; 46 | AVPacket pkt; 47 | int buffer_size; 48 | 49 | void* mOut; 50 | int mOutCapacity; 51 | int mOutSize; 52 | 53 | bool deInit(); 54 | void reset(); 55 | 56 | bool select_sample_fmt(AVSampleFormat sample_fmt); 57 | bool select_sample_rate(int sampleRate); 58 | bool select_channels(int channels); 59 | 60 | FFmpegAudioEncoder(const FFmpegAudioEncoder&); 61 | FFmpegAudioEncoder& operator=(const FFmpegAudioEncoder&); 62 | }; 63 | 64 | }//namespace 65 | 66 | #endif//OPENAMEDIA_FFMPEG_AUDIO_ENCODER_H 67 | -------------------------------------------------------------------------------- /jni/LMRSource.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENAMEDIA_LMRSOURCE_H 2 | #define OPENAMEDIA_LMRSOURCE_H 3 | 4 | #include "Prefetcher.h" 5 | #include "io/OpenSLRecorder.h" 6 | #include "android/MetaData.h" 7 | #include "openmax/OMX_IVCommon.h" 8 | 9 | namespace openamedia { 10 | 11 | #define LMR_AUDIO_RECORD_BUFFERS_NUM 5 12 | #define LMR_AUDIO_RECORD_BUFFER_SIZE 1024 13 | 14 | class LMRAudioSource { 15 | public: 16 | LMRAudioSource(); 17 | ~LMRAudioSource(); 18 | 19 | void setSampleRate(int sampleRate); 20 | void setChannels(int channels); 21 | void setBufSize(int bufSize); 22 | 23 | bool init(); 24 | 25 | bool start(); 26 | bool stop(); 27 | status_t read(MediaBuffer** buffer); 28 | 29 | private: 30 | Mutex mLock; 31 | Condition mCond; 32 | bool mInited; 33 | bool mStarted; 34 | bool mDone; 35 | OpenSLRecorder* mSLRecorder; 36 | MetaData* mMetaData; 37 | 38 | MediaBufferGroup* mGroup; 39 | List mBusyList; 40 | MediaBuffer* mSLBuffer; 41 | 42 | int mSampleRate; 43 | int mChannels; 44 | int mBufSize; 45 | 46 | bool deInit(); 47 | void reset(); 48 | 49 | static bool AcquireBuffer(void** data, int* dataSize, void* context); 50 | bool acquireBuffer(void** data, int* dataSize); 51 | 52 | LMRAudioSource(const LMRAudioSource&); 53 | LMRAudioSource& operator=(const LMRAudioSource&); 54 | }; 55 | 56 | class LMRVideoSource { 57 | public: 58 | LMRVideoSource(); 59 | ~LMRVideoSource(); 60 | 61 | void setRect(int width, int height); 62 | void setColorFormat(OMX_COLOR_FORMATTYPE color); 63 | 64 | bool init(); 65 | 66 | bool start(); 67 | bool stop(); 68 | status_t read(MediaBuffer** buffer); 69 | 70 | status_t write(void* data, int dataSize); 71 | 72 | private: 73 | Mutex mLock; 74 | Condition mCond; 75 | bool mInited; 76 | bool mStarted; 77 | bool mDone; 78 | MetaData* mMetaData; 79 | 80 | int mWidth; 81 | int mHeight; 82 | OMX_COLOR_FORMATTYPE mColor; 83 | 84 | MediaBufferGroup* mGroup; 85 | List mBusyList; 86 | 87 | bool deInit(); 88 | void reset(); 89 | 90 | LMRVideoSource(const LMRVideoSource&); 91 | LMRVideoSource& operator=(const LMRVideoSource&); 92 | }; 93 | 94 | class LMRSource : public Prefetcher::Source { 95 | public: 96 | LMRSource(); 97 | virtual ~LMRSource(); 98 | 99 | bool init(MetaData* meta); 100 | virtual bool start(); 101 | virtual bool stop(); 102 | virtual status_t read(MediaBuffer** buffer); 103 | virtual bool seek(int64_t timeMS); 104 | 105 | status_t writeVideo(void* data, int dataSize); 106 | 107 | MetaData* getMetaData(); 108 | 109 | private: 110 | bool mInited; 111 | bool mStarted; 112 | MetaData* mMetaData; 113 | LMRAudioSource* mAudioSource; 114 | LMRVideoSource* mVideoSource; 115 | 116 | bool mNextReadAudio; 117 | 118 | bool deInit(); 119 | void reset(); 120 | 121 | LMRSource(const LMRSource&); 122 | LMRSource& operator=(const LMRSource&); 123 | }; 124 | 125 | }//namespace 126 | 127 | #endif//OPENAMEDIA_LMRSOURCE_H 128 | -------------------------------------------------------------------------------- /jni/LocalMediaRecorder.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENAMEDIA_LOCAL_MEDIA_RECORDER_H 2 | #define OPENAMEDIA_LOCAL_MEDIA_RECORDER_H 3 | 4 | #include "android/MetaData.h" 5 | 6 | #include "MediaRecorder.h" 7 | #include "MessageQueue.h" 8 | #include "LMRSource.h" 9 | #include "Prefetcher.h" 10 | #include "MuxEngine.h" 11 | 12 | namespace openamedia { 13 | 14 | class LocalMediaRecorder : public MediaRecorder { 15 | public: 16 | LocalMediaRecorder(); 17 | 18 | enum MsgType { 19 | MSG_SET_OUTPUT_FILE, 20 | MSG_SET_LISTENER, 21 | MSG_SET_PARAMETER, 22 | MSG_SET_PREVIEW, 23 | MSG_SET_CHANNELS, 24 | MSG_SET_SAMPLE_RATE, 25 | MSG_SET_VIDEO_SIZE, 26 | MSG_SET_COLOR_FORMAT, 27 | MSG_START, 28 | MSG_STOP, 29 | }; 30 | 31 | virtual void setOutputFile(const char* path); 32 | virtual void setListener(MediaRecorderListener* listener); 33 | virtual void setParameter(const char* param); 34 | virtual void setPreview(ANativeWindow* window); 35 | virtual void setChannels(int channels); 36 | virtual void setSampleRate(int sampleRate); 37 | virtual void setVideoSize(int width, int height); 38 | virtual void setColorFormat(OMX_COLOR_FORMATTYPE fmt); 39 | 40 | virtual void start(); 41 | virtual void stop(); 42 | virtual void writeVideo(void* data, int dataSize); 43 | 44 | protected: 45 | virtual ~LocalMediaRecorder(); 46 | 47 | private: 48 | char mOutputFile[MAX_STRING_PATH_LEN]; 49 | 50 | MediaRecorderListener* mListener; 51 | MessageQueue* mMsgQueue; 52 | 53 | LMRSource* mLMRSource; 54 | Prefetcher* mPrefetcher; 55 | MuxEngine* mMuxEngine; 56 | 57 | MetaData* mMetaData; 58 | 59 | int mChannels; 60 | int mSampleRate; 61 | int mWidth; 62 | int mHeight; 63 | OMX_COLOR_FORMATTYPE mColorFormat; 64 | 65 | static void HandleMessage(Message* msg, void* context); 66 | void handleMessage(Message* msg); 67 | 68 | static void HandleThreadExit(void* context); 69 | void handleThreadExit(); 70 | 71 | void onSetParameter(const char*); 72 | void onStart(); 73 | 74 | LocalMediaRecorder(const LocalMediaRecorder&); 75 | LocalMediaRecorder& operator=(const LocalMediaRecorder&); 76 | }; 77 | }//namespace 78 | 79 | #endif//OPENAMEDIA_LOCAL_MEDIA_RECORDER_H 80 | -------------------------------------------------------------------------------- /jni/MediaInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "MediaInfo.h" 22 | 23 | namespace openamedia { 24 | VideoInfo::VideoInfo() 25 | :width(0), 26 | height(0), 27 | frameRate(0), 28 | colorFmt(OMX_COLOR_FormatUnused), 29 | streamDuration(0), 30 | bitRate(0){ 31 | } 32 | 33 | VideoInfo::~VideoInfo(){ 34 | } 35 | 36 | AudioInfo::AudioInfo() 37 | :sampleRate(0), 38 | channels(0), 39 | bitsPerSample(0), 40 | streamDuration(0), 41 | bitRate(0){ 42 | } 43 | 44 | AudioInfo::~AudioInfo(){ 45 | } 46 | 47 | MediaBuffer::MediaBuffer() 48 | :type(MEDIA_TYPE_UNKNOWN), 49 | ptsMS(0), 50 | data(NULL), 51 | size(0), 52 | decompressed(false){ 53 | } 54 | 55 | MediaBuffer::~MediaBuffer(){ 56 | } 57 | 58 | }//namespace 59 | -------------------------------------------------------------------------------- /jni/MediaRecorder.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENAMEDIA_MEDIA_RECORDER_H 2 | #define OPENAMEDIA_MEDIA_RECORDER_H 3 | 4 | #include 5 | #include 6 | #include "openmax/OMX_IVCommon.h" 7 | 8 | namespace openamedia { 9 | 10 | class Engine { 11 | public: 12 | virtual ~Engine(); 13 | 14 | virtual bool start() = 0; 15 | virtual bool stop() = 0; 16 | 17 | protected: 18 | Engine(); 19 | 20 | private: 21 | Engine(const Engine&); 22 | Engine& operator=(const Engine&); 23 | }; 24 | 25 | class MediaRecorderListener { 26 | public: 27 | virtual ~MediaRecorderListener(){} 28 | 29 | static const int NATIVE_MSG_SET_OUTPUT_FILE_DONE = 0; 30 | static const int NATIVE_MSG_SET_LISTENER_DONE = 1; 31 | static const int NATIVE_MSG_SET_PARAMETER_DONE = 2; 32 | static const int NATIVE_MSG_SET_PREVIEW_DONE = 3; 33 | static const int NATIVE_MSG_START_DONE = 4; 34 | static const int NATIVE_MSG_ERROR = 5; 35 | static const int NATIVE_MSG_NOTIFY_LOG_INFO = 6; 36 | 37 | virtual void notify(int msg, int ext1 = 0, int ext2 = 0, const void* data = NULL, int dataSize = 0) = 0; 38 | virtual void notifyLog(const char* log) = 0; 39 | 40 | virtual void registerCurThread() = 0; 41 | virtual void unRegisterCurThread() = 0; 42 | 43 | protected: 44 | MediaRecorderListener(){} 45 | 46 | private: 47 | MediaRecorderListener(const MediaRecorderListener&); 48 | MediaRecorderListener& operator=(const MediaRecorderListener&); 49 | }; 50 | 51 | class MediaRecorder { 52 | public: 53 | virtual ~MediaRecorder(){} 54 | 55 | virtual void setOutputFile(const char* path) = 0; 56 | virtual void setListener(MediaRecorderListener* listener) = 0; 57 | virtual void setParameter(const char* param) = 0; 58 | virtual void setPreview(ANativeWindow* window) = 0; 59 | virtual void setChannels(int channels) = 0; 60 | virtual void setSampleRate(int sampleRate) = 0; 61 | virtual void setVideoSize(int width, int height) = 0; 62 | virtual void setColorFormat(OMX_COLOR_FORMATTYPE fmt) = 0; 63 | virtual void start() = 0; 64 | virtual void stop() = 0; 65 | virtual void writeVideo(void* data, int dataSize) = 0; 66 | 67 | protected: 68 | MediaRecorder(){} 69 | 70 | private: 71 | MediaRecorder(const MediaRecorder&); 72 | MediaRecorder& operator=(const MediaRecorder&); 73 | }; 74 | 75 | }//namespace 76 | 77 | #endif//OPENAMEDIA_MEDIA_RECORDER_H 78 | -------------------------------------------------------------------------------- /jni/MessageQueue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "MessageQueue.h" 22 | 23 | #define LOG_TAG "MessageQueue" 24 | #include "android/Log.h" 25 | 26 | namespace openamedia { 27 | 28 | MessageQueue::MessageQueue(void (*handleMessage)(Message* msg, void* context), void (*handleThreadExit)(void* context), void* context) 29 | :mDone(false), 30 | mThreadExited(false), 31 | mStarted(false), 32 | mHandleMessage(handleMessage), 33 | mHandleThreadExitFnc(handleThreadExit), 34 | mContext(context){ 35 | start(); 36 | } 37 | 38 | MessageQueue::~MessageQueue(){ 39 | stop(); 40 | 41 | List::iterator it = mFreeList.begin(); 42 | while(it != mFreeList.end()){ 43 | Message* tmp = *it; 44 | free(tmp); 45 | it = mFreeList.erase(it); 46 | } 47 | 48 | it = mObtainList.begin(); 49 | while(it != mObtainList.end()){ 50 | Message* tmp = *it; 51 | free(tmp); 52 | it = mObtainList.erase(it); 53 | } 54 | 55 | it = mRunList.begin(); 56 | while(it != mRunList.end()){ 57 | Message* tmp = *it; 58 | free(tmp); 59 | it = mRunList.erase(it); 60 | } 61 | } 62 | 63 | Message* MessageQueue::obtainMessage(){ 64 | Mutex::Autolock ao(mLock); 65 | 66 | int tryTimes = 3; 67 | while(!mDone && mFreeList.empty() && tryTimes-- > 0){ 68 | mCond.waitRelative(mLock, 100000000); 69 | } 70 | 71 | if(mDone) 72 | return NULL; 73 | 74 | Message* msg = NULL; 75 | 76 | if(!mFreeList.empty()){ 77 | msg = *mFreeList.begin(); 78 | mFreeList.erase(mFreeList.begin()); 79 | mObtainList.push_back(msg); 80 | }else{ 81 | msg = (Message*)calloc(sizeof(Message), 1); 82 | mObtainList.push_back(msg); 83 | } 84 | 85 | memset(msg, 0, sizeof(Message)); 86 | 87 | return msg; 88 | } 89 | 90 | void MessageQueue::sendMessage(Message* msg){ 91 | Mutex::Autolock ao(mLock); 92 | 93 | if(mDone) 94 | return; 95 | 96 | for(List::iterator it = mObtainList.begin(); it != mObtainList.end(); ++it){ 97 | Message* tmp = *it; 98 | if(tmp == msg){ 99 | mObtainList.erase(it); 100 | mRunList.push_back(tmp); 101 | mCond.signal(); 102 | break; 103 | } 104 | } 105 | } 106 | 107 | void* MessageQueue::ThreadWrapper(void* me){ 108 | MessageQueue* mq = (MessageQueue*)me; 109 | mq->threadEntry(); 110 | 111 | return NULL; 112 | } 113 | 114 | void MessageQueue::threadEntry(){ 115 | for(;;){ 116 | Message* msg = NULL; 117 | 118 | { 119 | Mutex::Autolock ao(mLock); 120 | 121 | while(!mDone && mRunList.empty()){ 122 | mCond.waitRelative(mLock, 200000000); 123 | } 124 | 125 | if(mDone){ 126 | break; 127 | } 128 | 129 | msg = *mRunList.begin(); 130 | } 131 | 132 | if(msg == NULL) 133 | continue; 134 | 135 | mHandleMessage(msg, mContext); 136 | 137 | { 138 | Mutex::Autolock ao(mLock); 139 | mRunList.erase(mRunList.begin()); 140 | mFreeList.push_back(msg); 141 | mCond.signal(); 142 | } 143 | } 144 | 145 | mHandleThreadExitFnc(mContext); 146 | 147 | { 148 | Mutex::Autolock ao(mLock); 149 | mThreadExited = true; 150 | mCond.signal(); 151 | } 152 | 153 | return; 154 | } 155 | 156 | void MessageQueue::start(){ 157 | Mutex::Autolock ao(mLock); 158 | 159 | if(mStarted) 160 | return; 161 | 162 | pthread_attr_t attr; 163 | pthread_attr_init(&attr); 164 | pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); 165 | pthread_create(&mThread, &attr, ThreadWrapper, this); 166 | pthread_attr_destroy(&attr); 167 | 168 | mStarted = true; 169 | } 170 | 171 | void MessageQueue::stop(){ 172 | Mutex::Autolock ao(mLock); 173 | 174 | if(!mStarted) 175 | return; 176 | 177 | mDone = true; 178 | while(!mThreadExited){ 179 | mCond.waitRelative(mLock, 40000000); 180 | } 181 | } 182 | 183 | }//namespace 184 | -------------------------------------------------------------------------------- /jni/MessageQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef OPENAMEDIA_MESSAGE_QUEUE_H 22 | #define OPENAMEDIA_MESSAGE_QUEUE_H 23 | 24 | #include 25 | #include "android/Mutex.h" 26 | #include "android/Condition.h" 27 | #include "android/List.h" 28 | 29 | namespace openamedia { 30 | 31 | struct Message { 32 | int what; 33 | int arg1; 34 | int arg2; 35 | int64_t arg3; 36 | void* obj; 37 | int objSize; 38 | }; 39 | 40 | class MessageQueue { 41 | public: 42 | MessageQueue(void (*handleMessage)(Message* msg, void* context), void (*handleThreadExit)(void* context), void* context); 43 | ~MessageQueue(); 44 | 45 | Message* obtainMessage(); 46 | void sendMessage(Message* msg); 47 | 48 | private: 49 | Mutex mLock; 50 | Condition mCond; 51 | pthread_t mThread; 52 | bool mDone; 53 | bool mThreadExited; 54 | bool mStarted; 55 | 56 | List mFreeList; 57 | List mObtainList; 58 | List mRunList; 59 | 60 | static void* ThreadWrapper(void* me); 61 | void threadEntry(); 62 | 63 | void start(); 64 | void stop(); 65 | 66 | void (*mHandleMessage)(Message* msg, void* context); 67 | void (*mHandleThreadExitFnc)(void* context); 68 | void* mContext; 69 | 70 | MessageQueue(const MessageQueue&); 71 | MessageQueue& operator=(const MessageQueue&); 72 | }; 73 | 74 | }//namespace 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /jni/MuxEngine.cpp: -------------------------------------------------------------------------------- 1 | #include "MuxEngine.h" 2 | 3 | #define LOG_TAG "MuxEngine" 4 | #include "android/Log.h" 5 | 6 | namespace openamedia { 7 | 8 | MuxEngine::MuxEngine() 9 | :mInited(false), 10 | mStarted(false), 11 | mDone(false), 12 | mThreadExited(false), 13 | mAudioSrc(NULL), 14 | mVideoSrc(NULL), 15 | mFFMPEG(NULL), 16 | mNextReadAudio(true){ 17 | } 18 | 19 | MuxEngine::~MuxEngine(){ 20 | deInit(); 21 | } 22 | 23 | void MuxEngine::setOutputFile(const char* path){ 24 | strncpy(mOutputFile, path, sizeof(mOutputFile)); 25 | } 26 | 27 | void MuxEngine::setAudioSource(Prefetcher::SubSource* src) { 28 | mAudioSrc = src; 29 | } 30 | 31 | void MuxEngine::setVideoSource(Prefetcher::SubSource* src) { 32 | mVideoSrc = src; 33 | } 34 | 35 | bool MuxEngine::init(){ 36 | if(mInited) 37 | return true; 38 | 39 | do{ 40 | mFFMPEG = new FFMPEGer; 41 | mFFMPEG->setOutputFile(mOutputFile); 42 | mFFMPEG->setVideoSize(320, 240); 43 | mFFMPEG->setVideoColorFormat(OMX_COLOR_FormatYUV420SemiPlanar); 44 | bool res = mFFMPEG->init(NULL); 45 | if(!res) 46 | break; 47 | 48 | mInited = true; 49 | }while(0); 50 | 51 | if(!mInited) 52 | reset(); 53 | 54 | return mInited; 55 | } 56 | 57 | bool MuxEngine::deInit(){ 58 | if(!mInited) 59 | return true; 60 | 61 | reset(); 62 | 63 | mInited = false; 64 | 65 | return true; 66 | } 67 | 68 | void MuxEngine::reset(){ 69 | if(mFFMPEG != NULL){ 70 | delete mFFMPEG; 71 | mFFMPEG = NULL; 72 | } 73 | } 74 | 75 | bool MuxEngine::start(){ 76 | if(mStarted) 77 | return true; 78 | 79 | pthread_attr_t attr; 80 | pthread_attr_init(&attr); 81 | pthread_create(&mThreadID, &attr, ThreadWrapper, this); 82 | pthread_attr_destroy(&attr); 83 | 84 | mStarted = true; 85 | 86 | return true; 87 | } 88 | 89 | bool MuxEngine::stop(){ 90 | Mutex::Autolock ao(mLock); 91 | if(!mStarted) 92 | return true; 93 | 94 | mDone = true; 95 | while(!mThreadExited){ 96 | mCond.waitRelative(mLock, 40000000); 97 | } 98 | 99 | mFFMPEG->finish(); 100 | 101 | mStarted = false; 102 | 103 | return true; 104 | } 105 | 106 | bool MuxEngine::getAudioEncodeBufferSize(int* bufSize){ 107 | if(!mInited) 108 | return false; 109 | 110 | *bufSize = mFFMPEG->getAudioEncodeBufferSize(); 111 | return true; 112 | } 113 | 114 | void* MuxEngine::ThreadWrapper(void* context){ 115 | MuxEngine* me = (MuxEngine*)context; 116 | me->threadEntry(); 117 | 118 | return NULL; 119 | } 120 | 121 | void MuxEngine::threadEntry(){ 122 | for(;;){ 123 | Mutex::Autolock ao(mLock); 124 | 125 | if(mDone){ 126 | break; 127 | } 128 | 129 | MediaBuffer* buffer = NULL; 130 | MediaBuffer* out;//TODO: mean nothing. 131 | bool res; 132 | 133 | if(mNextReadAudio && mAudioSrc != NULL){ 134 | res = mAudioSrc->read(&buffer); 135 | if(!res) 136 | break; 137 | 138 | mFFMPEG->encodeAudio(buffer, out); 139 | 140 | if(mVideoSrc != NULL) 141 | mNextReadAudio = false; 142 | }else if(!mNextReadAudio && mVideoSrc != NULL){ 143 | res = mVideoSrc->read(&buffer); 144 | if(!res) 145 | break; 146 | 147 | mFFMPEG->encodeVideo(buffer, out); 148 | 149 | if(mAudioSrc != NULL) 150 | mNextReadAudio = true; 151 | } 152 | 153 | buffer->release(); 154 | } 155 | 156 | { 157 | ALOGW("MuxEngine thread exited!!"); 158 | Mutex::Autolock ao(mLock); 159 | mThreadExited = true; 160 | mCond.signal(); 161 | } 162 | } 163 | 164 | } 165 | -------------------------------------------------------------------------------- /jni/MuxEngine.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENAMEDIA_MUX_ENGINE_H 2 | #define OPENAMEDIA_MUX_ENGINE_H 3 | 4 | #include 5 | 6 | #include "android/Mutex.h" 7 | #include "android/Condition.h" 8 | #include "Prefetcher.h" 9 | #include "FFMPEGer.h" 10 | #include "FFmpegAudioEncoder.h" 11 | 12 | namespace openamedia { 13 | 14 | class MuxEngine { 15 | public: 16 | MuxEngine(); 17 | virtual ~MuxEngine(); 18 | 19 | void setOutputFile(const char* path); 20 | 21 | void setAudioSource(Prefetcher::SubSource* src); 22 | void setVideoSource(Prefetcher::SubSource* src); 23 | 24 | bool init(); 25 | 26 | bool start(); 27 | bool stop(); 28 | 29 | bool getAudioEncodeBufferSize(int* bufSize); 30 | 31 | private: 32 | Mutex mLock; 33 | Condition mCond; 34 | pthread_t mThreadID; 35 | bool mInited; 36 | bool mStarted; 37 | bool mDone; 38 | bool mThreadExited; 39 | 40 | Prefetcher::SubSource* mAudioSrc; 41 | Prefetcher::SubSource* mVideoSrc; 42 | 43 | FFMPEGer* mFFMPEG; 44 | FFmpegAudioEncoder* mAudioEncoder; 45 | 46 | bool mNextReadAudio; 47 | 48 | char mOutputFile[MAX_STRING_PATH_LEN]; 49 | 50 | bool deInit(); 51 | void reset(); 52 | 53 | static void* ThreadWrapper(void* context); 54 | void threadEntry(); 55 | 56 | MuxEngine(const MuxEngine&); 57 | MuxEngine& operator=(const MuxEngine&); 58 | }; 59 | 60 | }//namespace 61 | 62 | #endif//OPENAMEDIA_MUX_ENGINE_H 63 | -------------------------------------------------------------------------------- /jni/Prefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef OPENAMEDIA_PREFETCHER_H 22 | #define OPENAMEDIA_PREFETCHER_H 23 | 24 | #include 25 | #include "android/List.h" 26 | #include "android/Mutex.h" 27 | #include "android/Condition.h" 28 | #include "android/Errors.h" 29 | #include "android/MediaBuffer.h" 30 | #include "android/MediaBufferGroup.h" 31 | 32 | #include "Common.h" 33 | 34 | namespace openamedia { 35 | 36 | #define MAX_SUB_SOURCE_BUFFER_SIZE (1920*1080*3/2) 37 | #define DEFAULT_VIDEO_SUB_SOURCE_CAPACITY 40//decided by the max num of continual video packets from av_read_frame, especially after seeking. 38 | #define DEFAULT_AUDIO_SUB_SOURCE_CAPACITY 20//normally, the num of audio packets(not samples) from av_read_frame is less than video ones. 39 | 40 | class Prefetcher { 41 | public: 42 | class Source { 43 | public: 44 | virtual ~Source(){} 45 | 46 | virtual bool start() = 0; 47 | virtual bool stop() = 0; 48 | virtual status_t read(MediaBuffer** buffer) = 0; 49 | virtual bool seek(int64_t timeMS) = 0; 50 | 51 | protected: 52 | Source(){} 53 | 54 | private: 55 | Source(const Source&); 56 | Source& operator=(const Source&); 57 | }; 58 | 59 | Prefetcher(Prefetcher::Source* src); 60 | ~Prefetcher(); 61 | 62 | bool start(); 63 | bool stop(); 64 | bool seek(int64_t timeMS); 65 | 66 | class SubSource { 67 | public: 68 | SubSource(int capacity); 69 | ~SubSource(); 70 | 71 | bool read(MediaBuffer** buffer); 72 | 73 | private: 74 | friend class Prefetcher; 75 | 76 | Mutex mLock; 77 | Condition mCond; 78 | bool mDone; 79 | 80 | bool write(MediaBuffer* buffer); 81 | void stop(); 82 | void clear(); 83 | void clear_l(); 84 | 85 | List mBusyList; 86 | MediaBufferGroup mGroup; 87 | 88 | SubSource(const SubSource&); 89 | SubSource& operator=(const SubSource&); 90 | }; 91 | 92 | /* 93 | TODO: Prefetcher would better be a general one, without any binding to video/audio type. 94 | :( unlike the Prefetcher in old android stagefright, here 1 source refers to more than 2 subsources. seems no good way to distinguish them without specifying mime type. 95 | */ 96 | SubSource* getSource(MediaType type); 97 | 98 | private: 99 | Mutex mLock; 100 | Condition mCond; 101 | 102 | bool mStarted; 103 | Source* mSource; 104 | 105 | bool mSeeking; 106 | int64_t mSeekTime; 107 | 108 | SubSource* mVideoSource; 109 | SubSource* mAudioSource; 110 | 111 | pthread_t mThread; 112 | bool mDone; 113 | bool mThreadExited; 114 | 115 | static void* ThreadWrapper(void* me); 116 | void threadEntry(); 117 | 118 | Prefetcher(const Prefetcher&); 119 | Prefetcher& operator=(const Prefetcher&); 120 | }; 121 | } 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /jni/android/ADebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 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 | #ifndef OPENAMEDIA_A_DEBUG_H 18 | #define OPENAMEDIA_A_DEBUG_H 19 | 20 | #include 21 | 22 | #include "AString.h" 23 | #include "Log.h" 24 | 25 | namespace openamedia { 26 | 27 | #define LITERAL_TO_STRING_INTERNAL(x) #x 28 | #define LITERAL_TO_STRING(x) LITERAL_TO_STRING_INTERNAL(x) 29 | 30 | #define CHECK(condition) \ 31 | LOG_ALWAYS_FATAL_IF( \ 32 | !(condition), \ 33 | "%s", \ 34 | __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ 35 | " CHECK(" #condition ") failed.") 36 | 37 | #define MAKE_COMPARATOR(suffix,op) \ 38 | template \ 39 | AString Compare_##suffix(const A &a, const B &b) { \ 40 | AString res; \ 41 | if (!(a op b)) { \ 42 | res.append(a); \ 43 | res.append(" vs. "); \ 44 | res.append(b); \ 45 | } \ 46 | return res; \ 47 | } 48 | 49 | MAKE_COMPARATOR(EQ,==) 50 | MAKE_COMPARATOR(NE,!=) 51 | MAKE_COMPARATOR(LE,<=) 52 | MAKE_COMPARATOR(GE,>=) 53 | MAKE_COMPARATOR(LT,<) 54 | MAKE_COMPARATOR(GT,>) 55 | 56 | #define CHECK_OP(x,y,suffix,op) \ 57 | do { \ 58 | AString ___res = Compare_##suffix(x, y); \ 59 | if (!___res.empty()) { \ 60 | AString ___full = \ 61 | __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ 62 | " CHECK_" #suffix "( " #x "," #y ") failed: "; \ 63 | ___full.append(___res); \ 64 | \ 65 | LOG_ALWAYS_FATAL("%s", ___full.c_str()); \ 66 | } \ 67 | } while (false) 68 | 69 | #define CHECK_EQ(x,y) CHECK_OP(x,y,EQ,==) 70 | #define CHECK_NE(x,y) CHECK_OP(x,y,NE,!=) 71 | #define CHECK_LE(x,y) CHECK_OP(x,y,LE,<=) 72 | #define CHECK_LT(x,y) CHECK_OP(x,y,LT,<) 73 | #define CHECK_GE(x,y) CHECK_OP(x,y,GE,>=) 74 | #define CHECK_GT(x,y) CHECK_OP(x,y,GT,>) 75 | 76 | #define TRESPASS() \ 77 | LOG_ALWAYS_FATAL( \ 78 | __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ 79 | " Should not be here."); 80 | 81 | } // namespace android 82 | 83 | #endif // A_DEBUG_H_ 84 | 85 | -------------------------------------------------------------------------------- /jni/android/AString.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 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 | #ifndef OPENAMEDIA_A_STRING_H 18 | #define OPENAMEDIA_A_STRING_H 19 | 20 | #include 21 | 22 | namespace openamedia { 23 | 24 | struct AString { 25 | AString(); 26 | AString(const char *s); 27 | AString(const char *s, size_t size); 28 | AString(const AString &from); 29 | AString(const AString &from, size_t offset, size_t n); 30 | ~AString(); 31 | 32 | AString &operator=(const AString &from); 33 | void setTo(const char *s); 34 | void setTo(const char *s, size_t size); 35 | void setTo(const AString &from, size_t offset, size_t n); 36 | 37 | size_t size() const; 38 | const char *c_str() const; 39 | 40 | bool empty() const; 41 | 42 | void clear(); 43 | void trim(); 44 | void erase(size_t start, size_t n); 45 | 46 | void append(char c) { append(&c, 1); } 47 | void append(const char *s); 48 | void append(const char *s, size_t size); 49 | void append(const AString &from); 50 | void append(const AString &from, size_t offset, size_t n); 51 | void append(int x); 52 | void append(unsigned x); 53 | void append(long x); 54 | void append(unsigned long x); 55 | void append(long long x); 56 | void append(unsigned long long x); 57 | void append(float x); 58 | void append(double x); 59 | void append(void *x); 60 | 61 | void insert(const AString &from, size_t insertionPos); 62 | void insert(const char *from, size_t size, size_t insertionPos); 63 | 64 | ssize_t find(const char *substring, size_t start = 0) const; 65 | 66 | size_t hash() const; 67 | 68 | bool operator==(const AString &other) const; 69 | bool operator<(const AString &other) const; 70 | bool operator>(const AString &other) const; 71 | 72 | int compare(const AString &other) const; 73 | 74 | bool startsWith(const char *prefix) const; 75 | bool endsWith(const char *suffix) const; 76 | 77 | void tolower(); 78 | 79 | private: 80 | static const char *kEmptyString; 81 | 82 | char *mData; 83 | size_t mSize; 84 | size_t mAllocSize; 85 | 86 | void makeMutable(); 87 | }; 88 | 89 | AString StringPrintf(const char *format, ...); 90 | 91 | } // namespace android 92 | 93 | #endif // A_STRING_H_ 94 | 95 | -------------------------------------------------------------------------------- /jni/android/ColorConverter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef OPENAMEDIA_COLOR_CONVERTER_H 18 | #define OPENAMEDIA_COLOR_CONVERTER_H 19 | 20 | #include 21 | 22 | #include 23 | 24 | #include "Errors.h" 25 | #include "openmax/OMX_Video.h" 26 | 27 | namespace openamedia { 28 | 29 | struct ColorConverter { 30 | ColorConverter(OMX_COLOR_FORMATTYPE from, OMX_COLOR_FORMATTYPE to); 31 | ~ColorConverter(); 32 | 33 | bool isValid() const; 34 | 35 | status_t convert( 36 | const void *srcBits, 37 | size_t srcWidth, size_t srcHeight, 38 | size_t srcCropLeft, size_t srcCropTop, 39 | size_t srcCropRight, size_t srcCropBottom, 40 | void *dstBits, 41 | size_t dstWidth, size_t dstHeight, 42 | size_t dstCropLeft, size_t dstCropTop, 43 | size_t dstCropRight, size_t dstCropBottom); 44 | 45 | private: 46 | struct BitmapParams { 47 | BitmapParams( 48 | void *bits, 49 | size_t width, size_t height, 50 | size_t cropLeft, size_t cropTop, 51 | size_t cropRight, size_t cropBottom); 52 | 53 | size_t cropWidth() const; 54 | size_t cropHeight() const; 55 | 56 | void *mBits; 57 | size_t mWidth, mHeight; 58 | size_t mCropLeft, mCropTop, mCropRight, mCropBottom; 59 | }; 60 | 61 | OMX_COLOR_FORMATTYPE mSrcFormat, mDstFormat; 62 | uint8_t *mClip; 63 | 64 | uint8_t *initClip(); 65 | 66 | status_t convertCbYCrY( 67 | const BitmapParams &src, const BitmapParams &dst); 68 | 69 | status_t convertYUV420Planar( 70 | const BitmapParams &src, const BitmapParams &dst); 71 | 72 | status_t convertQCOMYUV420SemiPlanar( 73 | const BitmapParams &src, const BitmapParams &dst); 74 | 75 | status_t convertYUV420SemiPlanar( 76 | const BitmapParams &src, const BitmapParams &dst); 77 | 78 | status_t convertTIYUV420PackedSemiPlanar( 79 | const BitmapParams &src, const BitmapParams &dst); 80 | 81 | ColorConverter(const ColorConverter &); 82 | ColorConverter &operator=(const ColorConverter &); 83 | }; 84 | 85 | } // namespace android 86 | 87 | #endif // COLOR_CONVERTER_H_ 88 | -------------------------------------------------------------------------------- /jni/android/Condition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef OPENAMEDIA_CONDITION_H 18 | #define OPENAMEDIA_CONDITION_H 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #include "Mutex.h" 26 | 27 | namespace openamedia { 28 | /* 29 | * Condition variable class. The implementation is system-dependent. 30 | * 31 | * Condition variables are paired up with mutexes. Lock the mutex, 32 | * call wait(), then either re-wait() if things aren't quite what you want, 33 | * or unlock the mutex and continue. All threads calling wait() must 34 | * use the same mutex for a given Condition. 35 | */ 36 | class Condition { 37 | public: 38 | enum { 39 | PRIVATE = 0, 40 | SHARED = 1 41 | }; 42 | 43 | enum WakeUpType { 44 | WAKE_UP_ONE = 0, 45 | WAKE_UP_ALL = 1 46 | }; 47 | 48 | Condition(); 49 | Condition(int type); 50 | ~Condition(); 51 | // Wait on the condition variable. Lock the mutex before calling. 52 | int wait(Mutex& mutex); 53 | // same with relative timeout 54 | int waitRelative(Mutex& mutex, int64_t reltimeNS); 55 | // Signal the condition variable, allowing one thread to continue. 56 | void signal(); 57 | // Signal the condition variable, allowing one or all threads to continue. 58 | void signal(WakeUpType type) { 59 | if (type == WAKE_UP_ONE) { 60 | signal(); 61 | } else { 62 | broadcast(); 63 | } 64 | } 65 | // Signal the condition variable, allowing all threads to continue. 66 | void broadcast(); 67 | 68 | private: 69 | pthread_cond_t mCond; 70 | }; 71 | 72 | // --------------------------------------------------------------------------- 73 | inline Condition::Condition() { 74 | pthread_cond_init(&mCond, NULL); 75 | } 76 | 77 | inline Condition::Condition(int type) { 78 | if (type == SHARED) { 79 | pthread_condattr_t attr; 80 | pthread_condattr_init(&attr); 81 | pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); 82 | pthread_cond_init(&mCond, &attr); 83 | pthread_condattr_destroy(&attr); 84 | } else { 85 | pthread_cond_init(&mCond, NULL); 86 | } 87 | } 88 | 89 | inline Condition::~Condition() { 90 | pthread_cond_destroy(&mCond); 91 | } 92 | 93 | inline int Condition::wait(Mutex& mutex) { 94 | return -pthread_cond_wait(&mCond, &mutex.mMutex); 95 | } 96 | 97 | inline int Condition::waitRelative(Mutex& mutex, int64_t reltimeNS) { 98 | struct timespec ts; 99 | struct timeval t; 100 | gettimeofday(&t, NULL); 101 | ts.tv_sec = t.tv_sec; 102 | ts.tv_nsec= t.tv_usec*1000; 103 | 104 | ts.tv_sec += reltimeNS/1000000000; 105 | ts.tv_nsec+= reltimeNS%1000000000; 106 | if (ts.tv_nsec >= 1000000000) { 107 | ts.tv_nsec -= 1000000000; 108 | ts.tv_sec += 1; 109 | } 110 | return -pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts); 111 | } 112 | 113 | inline void Condition::signal() { 114 | pthread_cond_signal(&mCond); 115 | } 116 | 117 | inline void Condition::broadcast() { 118 | pthread_cond_broadcast(&mCond); 119 | } 120 | 121 | 122 | // --------------------------------------------------------------------------- 123 | } // namespace 124 | 125 | #endif // CONDITON_H 126 | -------------------------------------------------------------------------------- /jni/android/Errors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef OPENAMEDIA_ERRORS_H 18 | #define OPENAMEDIA_ERRORS_H 19 | 20 | #include 21 | #include 22 | 23 | namespace openamedia { 24 | 25 | typedef int32_t status_t; 26 | 27 | enum Error { 28 | OK = 0, // Everything's swell. 29 | NO_ERROR = 0, // No errors. 30 | 31 | UNKNOWN_ERROR = 0x80000000, 32 | 33 | NO_MEMORY = -ENOMEM, 34 | INVALID_OPERATION = -ENOSYS, 35 | BAD_VALUE = -EINVAL, 36 | BAD_TYPE = 0x80000001, 37 | NAME_NOT_FOUND = -ENOENT, 38 | PERMISSION_DENIED = -EPERM, 39 | NO_INIT = -ENODEV, 40 | ALREADY_EXISTS = -EEXIST, 41 | DEAD_OBJECT = -EPIPE, 42 | FAILED_TRANSACTION = 0x80000002, 43 | JPARKS_BROKE_IT = -EPIPE, 44 | BAD_INDEX = -EOVERFLOW, 45 | NOT_ENOUGH_DATA = -ENODATA, 46 | WOULD_BLOCK = -EWOULDBLOCK, 47 | TIMED_OUT = -ETIMEDOUT, 48 | UNKNOWN_TRANSACTION = -EBADMSG, 49 | FDS_NOT_ALLOWED = 0x80000007, 50 | }; 51 | 52 | enum MediaError { 53 | MEDIA_ERROR_BASE = -1000, 54 | 55 | ERROR_ALREADY_CONNECTED = MEDIA_ERROR_BASE, 56 | ERROR_NOT_CONNECTED = MEDIA_ERROR_BASE - 1, 57 | ERROR_UNKNOWN_HOST = MEDIA_ERROR_BASE - 2, 58 | ERROR_CANNOT_CONNECT = MEDIA_ERROR_BASE - 3, 59 | ERROR_IO = MEDIA_ERROR_BASE - 4, 60 | ERROR_CONNECTION_LOST = MEDIA_ERROR_BASE - 5, 61 | ERROR_MALFORMED = MEDIA_ERROR_BASE - 7, 62 | ERROR_OUT_OF_RANGE = MEDIA_ERROR_BASE - 8, 63 | ERROR_BUFFER_TOO_SMALL = MEDIA_ERROR_BASE - 9, 64 | ERROR_UNSUPPORTED = MEDIA_ERROR_BASE - 10, 65 | ERROR_END_OF_STREAM = MEDIA_ERROR_BASE - 11, 66 | 67 | // Not technically an error. 68 | INFO_FORMAT_CHANGED = MEDIA_ERROR_BASE - 12, 69 | INFO_DISCONTINUITY = MEDIA_ERROR_BASE - 13, 70 | INFO_OUTPUT_BUFFERS_CHANGED = MEDIA_ERROR_BASE - 14, 71 | 72 | // 73 | ERROR_DECODE_FAILED = MEDIA_ERROR_BASE - 15, 74 | ERROR_AUDIO_RESAMPLE_FAILED = MEDIA_ERROR_BASE - 16, 75 | 76 | // The following constant values should be in sync with 77 | // drm/drm_framework_common.h 78 | DRM_ERROR_BASE = -2000, 79 | 80 | ERROR_DRM_UNKNOWN = DRM_ERROR_BASE, 81 | ERROR_DRM_NO_LICENSE = DRM_ERROR_BASE - 1, 82 | ERROR_DRM_LICENSE_EXPIRED = DRM_ERROR_BASE - 2, 83 | ERROR_DRM_SESSION_NOT_OPENED = DRM_ERROR_BASE - 3, 84 | ERROR_DRM_DECRYPT_UNIT_NOT_INITIALIZED = DRM_ERROR_BASE - 4, 85 | ERROR_DRM_DECRYPT = DRM_ERROR_BASE - 5, 86 | ERROR_DRM_CANNOT_HANDLE = DRM_ERROR_BASE - 6, 87 | ERROR_DRM_TAMPER_DETECTED = DRM_ERROR_BASE - 7, 88 | ERROR_DRM_NOT_PROVISIONED = DRM_ERROR_BASE - 8, 89 | ERROR_DRM_DEVICE_REVOKED = DRM_ERROR_BASE - 9, 90 | 91 | ERROR_DRM_VENDOR_MAX = DRM_ERROR_BASE - 500, 92 | ERROR_DRM_VENDOR_MIN = DRM_ERROR_BASE - 999, 93 | 94 | // Deprecated 95 | ERROR_DRM_WV_VENDOR_MAX = ERROR_DRM_VENDOR_MAX, 96 | ERROR_DRM_WV_VENDOR_MIN = ERROR_DRM_VENDOR_MIN, 97 | 98 | // Heartbeat Error Codes 99 | HEARTBEAT_ERROR_BASE = -3000, 100 | ERROR_HEARTBEAT_TERMINATE_REQUESTED = HEARTBEAT_ERROR_BASE, 101 | }; 102 | 103 | };// namespace 104 | 105 | #endif // ERRORS_H 106 | -------------------------------------------------------------------------------- /jni/android/MediaBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 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_TAG "MediaBuffer" 18 | #include "Log.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "ADebug.h" 25 | #include "MediaBuffer.h" 26 | 27 | #include 28 | 29 | namespace openamedia { 30 | 31 | MediaBuffer::MediaBuffer(void *data, size_t size) 32 | : mObserver(NULL), 33 | mNextBuffer(NULL), 34 | mRefCount(0), 35 | mData(data), 36 | mSize(size), 37 | mRangeOffset(0), 38 | mRangeLength(size), 39 | mMetaData(new MetaData), 40 | mOwnsData(false), 41 | mOriginal(NULL) { 42 | } 43 | 44 | MediaBuffer::MediaBuffer(size_t size) 45 | : mObserver(NULL), 46 | mNextBuffer(NULL), 47 | mRefCount(0), 48 | mData(malloc(size)), 49 | mSize(size), 50 | mRangeOffset(0), 51 | mRangeLength(size), 52 | mMetaData(new MetaData), 53 | mOwnsData(true), 54 | mOriginal(NULL) { 55 | } 56 | 57 | void MediaBuffer::release() { 58 | if (mObserver == NULL) { 59 | CHECK_EQ(mRefCount, 0); 60 | delete this; 61 | return; 62 | } 63 | 64 | int prevCount = __atomic_dec(&mRefCount); 65 | if (prevCount == 1) { 66 | if (mObserver == NULL) { 67 | delete this; 68 | return; 69 | } 70 | 71 | mObserver->signalBufferReturned(this); 72 | } 73 | CHECK(prevCount > 0); 74 | } 75 | 76 | void MediaBuffer::add_ref() { 77 | (void) __atomic_inc(&mRefCount); 78 | } 79 | 80 | void *MediaBuffer::data() const { 81 | return mData; 82 | } 83 | 84 | size_t MediaBuffer::size() const { 85 | return mSize; 86 | } 87 | 88 | size_t MediaBuffer::range_offset() const { 89 | return mRangeOffset; 90 | } 91 | 92 | size_t MediaBuffer::range_length() const { 93 | return mRangeLength; 94 | } 95 | 96 | void MediaBuffer::set_range(size_t offset, size_t length) { 97 | if (offset + length > mSize) { 98 | ALOGE("offset = %d, length = %d, mSize = %d", offset, length, mSize); 99 | } 100 | CHECK(offset + length <= mSize); 101 | 102 | mRangeOffset = offset; 103 | mRangeLength = length; 104 | } 105 | 106 | MetaData* MediaBuffer::meta_data() { 107 | return mMetaData; 108 | } 109 | 110 | void MediaBuffer::reset() { 111 | mMetaData->clear(); 112 | set_range(0, mSize); 113 | } 114 | 115 | MediaBuffer::~MediaBuffer() { 116 | CHECK(mObserver == NULL); 117 | 118 | if (mOwnsData && mData != NULL) { 119 | free(mData); 120 | mData = NULL; 121 | } 122 | 123 | if (mOriginal != NULL) { 124 | mOriginal->release(); 125 | mOriginal = NULL; 126 | } 127 | } 128 | 129 | void MediaBuffer::setObserver(MediaBufferObserver *observer) { 130 | CHECK(observer == NULL || mObserver == NULL); 131 | mObserver = observer; 132 | } 133 | 134 | void MediaBuffer::setNextBuffer(MediaBuffer *buffer) { 135 | mNextBuffer = buffer; 136 | } 137 | 138 | MediaBuffer *MediaBuffer::nextBuffer() { 139 | return mNextBuffer; 140 | } 141 | 142 | int MediaBuffer::refcount() const { 143 | return mRefCount; 144 | } 145 | 146 | MediaBuffer *MediaBuffer::clone() { 147 | MediaBuffer *buffer = new MediaBuffer(mData, mSize); 148 | buffer->set_range(mRangeOffset, mRangeLength); 149 | buffer->mMetaData = new MetaData(*mMetaData); 150 | 151 | add_ref(); 152 | buffer->mOriginal = this; 153 | 154 | return buffer; 155 | } 156 | 157 | void MediaBuffer::copyDataFrom(MediaBuffer* buffer) { 158 | if(buffer->size() > mSize){ 159 | free(mData); 160 | mData = malloc(buffer->size()); 161 | mSize = buffer->size(); 162 | } 163 | 164 | memcpy(mData, buffer->data(), buffer->size()); 165 | mRangeOffset = buffer->range_offset(); 166 | mRangeLength = buffer->range_length(); 167 | 168 | delete mMetaData; 169 | mMetaData = new MetaData(*buffer->meta_data()); 170 | } 171 | 172 | } // namespace android 173 | -------------------------------------------------------------------------------- /jni/android/MediaBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 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 | #ifndef OPENAMEDIA_MEDIA_BUFFER_H 18 | #define OPENAMEDIA_MEDIA_BUFFER_H 19 | 20 | #include 21 | 22 | #include "Errors.h" 23 | #include "MetaData.h" 24 | 25 | namespace openamedia { 26 | 27 | class MediaBuffer; 28 | class MediaBufferObserver; 29 | 30 | class MediaBufferObserver { 31 | public: 32 | MediaBufferObserver() {} 33 | virtual ~MediaBufferObserver() {} 34 | 35 | virtual void signalBufferReturned(MediaBuffer *buffer) = 0; 36 | 37 | private: 38 | MediaBufferObserver(const MediaBufferObserver &); 39 | MediaBufferObserver &operator=(const MediaBufferObserver &); 40 | }; 41 | 42 | class MediaBuffer { 43 | public: 44 | // The underlying data remains the responsibility of the caller! 45 | MediaBuffer(void *data, size_t size); 46 | 47 | MediaBuffer(size_t size); 48 | 49 | // Decrements the reference count and returns the buffer to its 50 | // associated MediaBufferGroup if the reference count drops to 0. 51 | void release(); 52 | 53 | // Increments the reference count. 54 | void add_ref(); 55 | 56 | void *data() const; 57 | size_t size() const; 58 | 59 | size_t range_offset() const; 60 | size_t range_length() const; 61 | 62 | void set_range(size_t offset, size_t length); 63 | 64 | MetaData* meta_data(); 65 | // Clears meta data and resets the range to the full extent. 66 | void reset(); 67 | 68 | void setObserver(MediaBufferObserver *group); 69 | 70 | // Returns a clone of this MediaBuffer increasing its reference count. 71 | // The clone references the same data but has its own range and 72 | // MetaData. 73 | MediaBuffer *clone(); 74 | 75 | //every member data includes data and size could change after this call. 76 | void copyDataFrom(MediaBuffer* buffer); 77 | 78 | int refcount() const; 79 | 80 | protected: 81 | virtual ~MediaBuffer(); 82 | 83 | private: 84 | friend class MediaBufferGroup; 85 | 86 | MediaBufferObserver *mObserver; 87 | MediaBuffer *mNextBuffer; 88 | int mRefCount; 89 | 90 | void *mData; 91 | size_t mSize, mRangeOffset, mRangeLength; 92 | 93 | MetaData* mMetaData; 94 | bool mOwnsData; 95 | 96 | MediaBuffer *mOriginal; 97 | 98 | void setNextBuffer(MediaBuffer *buffer); 99 | MediaBuffer *nextBuffer(); 100 | 101 | MediaBuffer(const MediaBuffer &); 102 | MediaBuffer &operator=(const MediaBuffer &); 103 | }; 104 | 105 | } // namespace 106 | 107 | #endif // OPENAMEDIA_MEDIA_BUFFER_H 108 | -------------------------------------------------------------------------------- /jni/android/MediaBufferGroup.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 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_TAG "MediaBufferGroup" 18 | #include "Log.h" 19 | 20 | #include "ADebug.h" 21 | #include "MediaBuffer.h" 22 | #include "MediaBufferGroup.h" 23 | 24 | namespace openamedia { 25 | 26 | MediaBufferGroup::MediaBufferGroup() 27 | : mFirstBuffer(NULL), 28 | mLastBuffer(NULL), 29 | mDone(false){ 30 | } 31 | 32 | MediaBufferGroup::~MediaBufferGroup() { 33 | MediaBuffer *next; 34 | for (MediaBuffer *buffer = mFirstBuffer; buffer != NULL; 35 | buffer = next) { 36 | next = buffer->nextBuffer(); 37 | 38 | CHECK_EQ(buffer->refcount(), 0); 39 | 40 | buffer->setObserver(NULL); 41 | buffer->release(); 42 | } 43 | } 44 | 45 | void MediaBufferGroup::add_buffer(MediaBuffer *buffer) { 46 | Mutex::Autolock autoLock(mLock); 47 | 48 | buffer->setObserver(this); 49 | 50 | if (mLastBuffer) { 51 | mLastBuffer->setNextBuffer(buffer); 52 | } else { 53 | mFirstBuffer = buffer; 54 | } 55 | 56 | mLastBuffer = buffer; 57 | } 58 | 59 | status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) { 60 | Mutex::Autolock autoLock(mLock); 61 | 62 | for (;;) { 63 | if(mDone) 64 | return UNKNOWN_ERROR; 65 | 66 | for (MediaBuffer *buffer = mFirstBuffer; 67 | buffer != NULL; buffer = buffer->nextBuffer()) { 68 | if (buffer->refcount() == 0) { 69 | buffer->add_ref(); 70 | buffer->reset(); 71 | 72 | *out = buffer; 73 | goto exit; 74 | } 75 | } 76 | 77 | // All buffers are in use. Block until one of them is returned to us. 78 | mCondition.wait(mLock); 79 | } 80 | 81 | exit: 82 | return OK; 83 | } 84 | 85 | status_t MediaBufferGroup::acquire_buffer_with_timeout(MediaBuffer **out, int ms) { 86 | Mutex::Autolock autoLock(mLock); 87 | 88 | bool waited = false; 89 | for (;;) { 90 | if(mDone) 91 | return UNKNOWN_ERROR; 92 | 93 | for (MediaBuffer *buffer = mFirstBuffer; 94 | buffer != NULL; buffer = buffer->nextBuffer()) { 95 | if (buffer->refcount() == 0) { 96 | buffer->add_ref(); 97 | buffer->reset(); 98 | 99 | *out = buffer; 100 | goto exit; 101 | } 102 | } 103 | 104 | if(waited) 105 | return TIMED_OUT; 106 | 107 | // All buffers are in use. Block until one of them is returned to us. 108 | mCondition.waitRelative(mLock, ms * 1000000); 109 | waited = true; 110 | } 111 | 112 | exit: 113 | return OK; 114 | } 115 | 116 | void MediaBufferGroup::stop_acquire(){ 117 | Mutex::Autolock autoLock(mLock); 118 | mDone = true; 119 | mCondition.signal(); 120 | } 121 | 122 | void MediaBufferGroup::signalBufferReturned(MediaBuffer *) { 123 | Mutex::Autolock autoLock(mLock); 124 | mCondition.signal(); 125 | } 126 | 127 | } // namespace android 128 | -------------------------------------------------------------------------------- /jni/android/MediaBufferGroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 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 | #ifndef OPENAMEDIA_MEDIA_BUFFER_GROUP_H 18 | #define OPENAMEDIA_MEDIA_BUFFER_GROUP_H 19 | 20 | #include "MediaBuffer.h" 21 | #include "Errors.h" 22 | #include "Mutex.h" 23 | #include "Condition.h" 24 | 25 | namespace openamedia { 26 | 27 | class MediaBuffer; 28 | class MetaData; 29 | 30 | class MediaBufferGroup : public MediaBufferObserver { 31 | public: 32 | MediaBufferGroup(); 33 | ~MediaBufferGroup(); 34 | 35 | void add_buffer(MediaBuffer *buffer); 36 | 37 | // Blocks until a buffer is available and returns it to the caller, 38 | // the returned buffer will have a reference count of 1. 39 | status_t acquire_buffer(MediaBuffer **buffer); 40 | 41 | status_t acquire_buffer_with_timeout(MediaBuffer **out, int ms); 42 | 43 | void stop_acquire(); 44 | 45 | protected: 46 | virtual void signalBufferReturned(MediaBuffer *buffer); 47 | 48 | private: 49 | friend class MediaBuffer; 50 | 51 | Mutex mLock; 52 | Condition mCondition; 53 | 54 | MediaBuffer *mFirstBuffer, *mLastBuffer; 55 | 56 | bool mDone; 57 | 58 | MediaBufferGroup(const MediaBufferGroup &); 59 | MediaBufferGroup &operator=(const MediaBufferGroup &); 60 | }; 61 | 62 | } // namespace android 63 | 64 | #endif // MEDIA_BUFFER_GROUP_H_ 65 | -------------------------------------------------------------------------------- /jni/android/Mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef OPENAMEDIA_MUTEX_H 18 | #define OPENAMEDIA_MUTEX_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace openamedia { 25 | 26 | class Condition; 27 | 28 | /* 29 | * Simple mutex class. The implementation is system-dependent. 30 | * 31 | * The mutex must be unlocked by the thread that locked it. They are not 32 | * recursive, i.e. the same thread can't lock it multiple times. 33 | */ 34 | class Mutex { 35 | public: 36 | enum { 37 | PRIVATE = 0, 38 | SHARED = 1 39 | }; 40 | 41 | Mutex(); 42 | Mutex(const char* name); 43 | Mutex(int type, const char* name = NULL); 44 | ~Mutex(); 45 | 46 | // lock or unlock the mutex 47 | int lock(); 48 | void unlock(); 49 | 50 | // lock if possible; returns 0 on success, error otherwise 51 | int tryLock(); 52 | 53 | // Manages the mutex automatically. It'll be locked when Autolock is 54 | // constructed and released when Autolock goes out of scope. 55 | class Autolock { 56 | public: 57 | inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); } 58 | inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); } 59 | inline ~Autolock() { mLock.unlock(); } 60 | private: 61 | Mutex& mLock; 62 | }; 63 | 64 | private: 65 | friend class Condition; 66 | 67 | // A mutex cannot be copied 68 | Mutex(const Mutex&); 69 | Mutex& operator = (const Mutex&); 70 | 71 | pthread_mutex_t mMutex; 72 | }; 73 | 74 | inline Mutex::Mutex() { 75 | pthread_mutex_init(&mMutex, NULL); 76 | } 77 | 78 | inline Mutex::Mutex(const char* name) { 79 | pthread_mutex_init(&mMutex, NULL); 80 | } 81 | 82 | inline Mutex::Mutex(int type, const char* name) { 83 | if (type == SHARED) { 84 | pthread_mutexattr_t attr; 85 | pthread_mutexattr_init(&attr); 86 | pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); 87 | pthread_mutex_init(&mMutex, &attr); 88 | pthread_mutexattr_destroy(&attr); 89 | } else { 90 | pthread_mutex_init(&mMutex, NULL); 91 | } 92 | } 93 | 94 | inline Mutex::~Mutex() { 95 | pthread_mutex_destroy(&mMutex); 96 | } 97 | 98 | inline int Mutex::lock() { 99 | return -pthread_mutex_lock(&mMutex); 100 | } 101 | 102 | inline void Mutex::unlock() { 103 | pthread_mutex_unlock(&mMutex); 104 | } 105 | 106 | inline int Mutex::tryLock() { 107 | return -pthread_mutex_trylock(&mMutex); 108 | } 109 | 110 | }//namespace 111 | 112 | 113 | #endif//MUTEX_H 114 | -------------------------------------------------------------------------------- /jni/android/TimedEventQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 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 | #ifndef OPENAMEDIA_TIMED_EVENT_QUEUE_H 18 | #define OPENAMEDIA_TIMED_EVENT_QUEUE_H 19 | 20 | #include 21 | 22 | #include "List.h" 23 | #include "Mutex.h" 24 | #include "Condition.h" 25 | 26 | namespace openamedia { 27 | 28 | struct TimedEventQueue { 29 | 30 | typedef int32_t event_id; 31 | 32 | struct Event { 33 | Event() 34 | : mEventID(0) { 35 | } 36 | 37 | virtual ~Event() {} 38 | 39 | event_id eventID() { 40 | return mEventID; 41 | } 42 | 43 | protected: 44 | virtual void fire(TimedEventQueue *queue, int64_t now_us) = 0; 45 | 46 | private: 47 | friend class TimedEventQueue; 48 | 49 | event_id mEventID; 50 | 51 | void setEventID(event_id id) { 52 | mEventID = id; 53 | } 54 | 55 | Event(const Event &); 56 | Event &operator=(const Event &); 57 | }; 58 | 59 | TimedEventQueue(); 60 | ~TimedEventQueue(); 61 | 62 | // Start executing the event loop. 63 | void start(); 64 | 65 | // Stop executing the event loop, if flush is false, any pending 66 | // events are discarded, otherwise the queue will stop (and this call 67 | // return) once all pending events have been handled. 68 | void stop(bool flush = false); 69 | 70 | // Posts an event to the front of the queue (after all events that 71 | // have previously been posted to the front but before timed events). 72 | event_id postEvent(Event* event); 73 | 74 | event_id postEventToBack(Event* event); 75 | 76 | // It is an error to post an event with a negative delay. 77 | event_id postEventWithDelay(Event* event, int64_t delay_us); 78 | 79 | // If the event is to be posted at a time that has already passed, 80 | // it will fire as soon as possible. 81 | event_id postTimedEvent(Event* event, int64_t realtime_us); 82 | 83 | // Returns true iff event is currently in the queue and has been 84 | // successfully cancelled. In this case the event will have been 85 | // removed from the queue and won't fire. 86 | bool cancelEvent(event_id id); 87 | 88 | // Cancel any pending event that satisfies the predicate. 89 | // If stopAfterFirstMatch is true, only cancels the first event 90 | // satisfying the predicate (if any). 91 | void cancelEvents( 92 | bool (*predicate)(void *cookie, Event* event), 93 | void *cookie, 94 | bool stopAfterFirstMatch = false); 95 | 96 | static int64_t getRealTimeUs(); 97 | 98 | private: 99 | struct QueueItem { 100 | Event* event; 101 | int64_t realtime_us; 102 | }; 103 | 104 | struct StopEvent : public TimedEventQueue::Event { 105 | virtual void fire(TimedEventQueue *queue, int64_t now_us) { 106 | queue->mStopped = true; 107 | } 108 | }; 109 | 110 | pthread_t mThread; 111 | List mQueue; 112 | Mutex mLock; 113 | Condition mQueueNotEmptyCondition; 114 | Condition mQueueHeadChangedCondition; 115 | event_id mNextEventID; 116 | 117 | bool mRunning; 118 | bool mStopped; 119 | 120 | static void *ThreadWrapper(void *me); 121 | void threadEntry(); 122 | 123 | Event* removeEventFromQueue_l(event_id id); 124 | 125 | TimedEventQueue(const TimedEventQueue &); 126 | TimedEventQueue &operator=(const TimedEventQueue &); 127 | }; 128 | 129 | } // namespace android 130 | 131 | #endif // TIMED_EVENT_QUEUE_H_ 132 | -------------------------------------------------------------------------------- /jni/com_openamedia_recorder_ARecorder.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_openamedia_recorder_ARecorder */ 4 | 5 | #ifndef _Included_com_openamedia_recorder_ARecorder 6 | #define _Included_com_openamedia_recorder_ARecorder 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_openamedia_recorder_ARecorder 12 | * Method: setParameter 13 | * Signature: (Ljava/lang/String;)V 14 | */ 15 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeSetOutputFile 16 | (JNIEnv *, jobject, jstring); 17 | 18 | /* 19 | * Class: com_openamedia_recorder_ARecorder 20 | * Method: nativeSetPrevew 21 | * Signature: (Landroid/view/Surface;)V 22 | */ 23 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeSetPreview 24 | (JNIEnv *, jobject, jobject); 25 | 26 | /* 27 | * Class: com_openamedia_recorder_ARecorder 28 | * Method: nativeSetChannels 29 | * Signature: (Landroid/view/Surface;)V 30 | */ 31 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeSetChannels 32 | (JNIEnv *, jobject, jint); 33 | 34 | /* 35 | * Class: com_openamedia_recorder_ARecorder 36 | * Method: nativeSetSampleRate 37 | * Signature: (Landroid/view/Surface;)V 38 | */ 39 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeSetSampleRate 40 | (JNIEnv *, jobject, jint); 41 | 42 | /* 43 | * Class: com_openamedia_recorder_ARecorder 44 | * Method: nativeSetVideoSize 45 | * Signature: (Landroid/view/Surface;)V 46 | */ 47 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeSetVideoSize 48 | (JNIEnv *, jobject, jint, jint); 49 | 50 | /* 51 | * Class: com_openamedia_recorder_ARecorder 52 | * Method: nativeSetColorFormat 53 | * Signature: (Landroid/view/Surface;)V 54 | */ 55 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeSetColorFormat 56 | (JNIEnv *, jobject, jstring); 57 | 58 | /* 59 | * Class: com_openamedia_recorder_ARecorder 60 | * Method: nativeStart 61 | * Signature: ()V 62 | */ 63 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeStart 64 | (JNIEnv *, jobject); 65 | 66 | /* 67 | * Class: com_openamedia_recorder_ARecorder 68 | * Method: nativeStop 69 | * Signature: ()V 70 | */ 71 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeStop 72 | (JNIEnv *, jobject); 73 | 74 | /* 75 | * Class: com_openamedia_recorder_ARecorder 76 | * Method: nativeRelease 77 | * Signature: ()V 78 | */ 79 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeRelease 80 | (JNIEnv *, jobject); 81 | 82 | /* 83 | * Class: com_openamedia_recorder_ARecorder 84 | * Method: nativeWriteVideo 85 | * Signature: ()V 86 | */ 87 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeWriteVideo 88 | (JNIEnv *, jobject, jbyteArray, jint); 89 | 90 | 91 | /* 92 | * Class: com_openamedia_recorder_ARecorder 93 | * Method: setParameter 94 | * Signature: (Ljava/lang/String;)V 95 | */ 96 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_setParameter 97 | (JNIEnv *, jobject, jstring); 98 | 99 | /* 100 | * Class: com_openamedia_recorder_ARecorder 101 | * Method: nativeSetup 102 | * Signature: (Ljava/lang/Object;)V 103 | */ 104 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeSetup 105 | (JNIEnv *, jobject, jobject); 106 | 107 | /* 108 | * Class: com_openamedia_recorder_ARecorder 109 | * Method: nativeInit 110 | * Signature: ()V 111 | */ 112 | JNIEXPORT void JNICALL Java_com_openamedia_recorder_ARecorder_nativeInit 113 | (JNIEnv *, jclass); 114 | 115 | #ifdef __cplusplus 116 | } 117 | #endif 118 | #endif 119 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavcodec/avfft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_AVFFT_H 20 | #define AVCODEC_AVFFT_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavc_fft 25 | * FFT functions 26 | */ 27 | 28 | /** 29 | * @defgroup lavc_fft FFT functions 30 | * @ingroup lavc_misc 31 | * 32 | * @{ 33 | */ 34 | 35 | typedef float FFTSample; 36 | 37 | typedef struct FFTComplex { 38 | FFTSample re, im; 39 | } FFTComplex; 40 | 41 | typedef struct FFTContext FFTContext; 42 | 43 | /** 44 | * Set up a complex FFT. 45 | * @param nbits log2 of the length of the input array 46 | * @param inverse if 0 perform the forward transform, if 1 perform the inverse 47 | */ 48 | FFTContext *av_fft_init(int nbits, int inverse); 49 | 50 | /** 51 | * Do the permutation needed BEFORE calling ff_fft_calc(). 52 | */ 53 | void av_fft_permute(FFTContext *s, FFTComplex *z); 54 | 55 | /** 56 | * Do a complex FFT with the parameters defined in av_fft_init(). The 57 | * input data must be permuted before. No 1.0/sqrt(n) normalization is done. 58 | */ 59 | void av_fft_calc(FFTContext *s, FFTComplex *z); 60 | 61 | void av_fft_end(FFTContext *s); 62 | 63 | FFTContext *av_mdct_init(int nbits, int inverse, double scale); 64 | void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 65 | void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); 66 | void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 67 | void av_mdct_end(FFTContext *s); 68 | 69 | /* Real Discrete Fourier Transform */ 70 | 71 | enum RDFTransformType { 72 | DFT_R2C, 73 | IDFT_C2R, 74 | IDFT_R2C, 75 | DFT_C2R, 76 | }; 77 | 78 | typedef struct RDFTContext RDFTContext; 79 | 80 | /** 81 | * Set up a real FFT. 82 | * @param nbits log2 of the length of the input array 83 | * @param trans the type of transform 84 | */ 85 | RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); 86 | void av_rdft_calc(RDFTContext *s, FFTSample *data); 87 | void av_rdft_end(RDFTContext *s); 88 | 89 | /* Discrete Cosine Transform */ 90 | 91 | typedef struct DCTContext DCTContext; 92 | 93 | enum DCTTransformType { 94 | DCT_II = 0, 95 | DCT_III, 96 | DCT_I, 97 | DST_I, 98 | }; 99 | 100 | /** 101 | * Set up DCT. 102 | * 103 | * @param nbits size of the input array: 104 | * (1 << nbits) for DCT-II, DCT-III and DST-I 105 | * (1 << nbits) + 1 for DCT-I 106 | * @param type the type of transform 107 | * 108 | * @note the first element of the input of DST-I is ignored 109 | */ 110 | DCTContext *av_dct_init(int nbits, enum DCTTransformType type); 111 | void av_dct_calc(DCTContext *s, FFTSample *data); 112 | void av_dct_end (DCTContext *s); 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | #endif /* AVCODEC_AVFFT_H */ 119 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavcodec/dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DXVA2 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_DXVA_H 24 | #define AVCODEC_DXVA_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_dxva2 29 | * Public libavcodec DXVA2 header. 30 | */ 31 | 32 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 33 | #undef _WIN32_WINNT 34 | #endif 35 | 36 | #if !defined(_WIN32_WINNT) 37 | #define _WIN32_WINNT 0x0600 38 | #endif 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | /** 45 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 46 | * @ingroup lavc_codec_hwaccel 47 | * 48 | * @{ 49 | */ 50 | 51 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards 52 | 53 | /** 54 | * This structure is used to provides the necessary configurations and data 55 | * to the DXVA2 FFmpeg HWAccel implementation. 56 | * 57 | * The application must make it available as AVCodecContext.hwaccel_context. 58 | */ 59 | struct dxva_context { 60 | /** 61 | * DXVA2 decoder object 62 | */ 63 | IDirectXVideoDecoder *decoder; 64 | 65 | /** 66 | * DXVA2 configuration used to create the decoder 67 | */ 68 | const DXVA2_ConfigPictureDecode *cfg; 69 | 70 | /** 71 | * The number of surface in the surface array 72 | */ 73 | unsigned surface_count; 74 | 75 | /** 76 | * The array of Direct3D surfaces used to create the decoder 77 | */ 78 | LPDIRECT3DSURFACE9 *surface; 79 | 80 | /** 81 | * A bit field configuring the workarounds needed for using the decoder 82 | */ 83 | uint64_t workaround; 84 | 85 | /** 86 | * Private to the FFmpeg AVHWAccel implementation 87 | */ 88 | unsigned report_id; 89 | }; 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | #endif /* AVCODEC_DXVA_H */ 96 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavcodec/vaapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Video Acceleration API (shared data between FFmpeg and the video player) 3 | * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 4 | * 5 | * Copyright (C) 2008-2009 Splitted-Desktop Systems 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVCODEC_VAAPI_H 25 | #define AVCODEC_VAAPI_H 26 | 27 | /** 28 | * @file 29 | * @ingroup lavc_codec_hwaccel_vaapi 30 | * Public libavcodec VA API header. 31 | */ 32 | 33 | #include 34 | 35 | /** 36 | * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding 37 | * @ingroup lavc_codec_hwaccel 38 | * @{ 39 | */ 40 | 41 | /** 42 | * This structure is used to share data between the FFmpeg library and 43 | * the client video application. 44 | * This shall be zero-allocated and available as 45 | * AVCodecContext.hwaccel_context. All user members can be set once 46 | * during initialization or through each AVCodecContext.get_buffer() 47 | * function call. In any case, they must be valid prior to calling 48 | * decoding functions. 49 | */ 50 | struct vaapi_context { 51 | /** 52 | * Window system dependent data 53 | * 54 | * - encoding: unused 55 | * - decoding: Set by user 56 | */ 57 | void *display; 58 | 59 | /** 60 | * Configuration ID 61 | * 62 | * - encoding: unused 63 | * - decoding: Set by user 64 | */ 65 | uint32_t config_id; 66 | 67 | /** 68 | * Context ID (video decode pipeline) 69 | * 70 | * - encoding: unused 71 | * - decoding: Set by user 72 | */ 73 | uint32_t context_id; 74 | 75 | /** 76 | * VAPictureParameterBuffer ID 77 | * 78 | * - encoding: unused 79 | * - decoding: Set by libavcodec 80 | */ 81 | uint32_t pic_param_buf_id; 82 | 83 | /** 84 | * VAIQMatrixBuffer ID 85 | * 86 | * - encoding: unused 87 | * - decoding: Set by libavcodec 88 | */ 89 | uint32_t iq_matrix_buf_id; 90 | 91 | /** 92 | * VABitPlaneBuffer ID (for VC-1 decoding) 93 | * 94 | * - encoding: unused 95 | * - decoding: Set by libavcodec 96 | */ 97 | uint32_t bitplane_buf_id; 98 | 99 | /** 100 | * Slice parameter/data buffer IDs 101 | * 102 | * - encoding: unused 103 | * - decoding: Set by libavcodec 104 | */ 105 | uint32_t *slice_buf_ids; 106 | 107 | /** 108 | * Number of effective slice buffer IDs to send to the HW 109 | * 110 | * - encoding: unused 111 | * - decoding: Set by libavcodec 112 | */ 113 | unsigned int n_slice_buf_ids; 114 | 115 | /** 116 | * Size of pre-allocated slice_buf_ids 117 | * 118 | * - encoding: unused 119 | * - decoding: Set by libavcodec 120 | */ 121 | unsigned int slice_buf_ids_alloc; 122 | 123 | /** 124 | * Pointer to VASliceParameterBuffers 125 | * 126 | * - encoding: unused 127 | * - decoding: Set by libavcodec 128 | */ 129 | void *slice_params; 130 | 131 | /** 132 | * Size of a VASliceParameterBuffer element 133 | * 134 | * - encoding: unused 135 | * - decoding: Set by libavcodec 136 | */ 137 | unsigned int slice_param_size; 138 | 139 | /** 140 | * Size of pre-allocated slice_params 141 | * 142 | * - encoding: unused 143 | * - decoding: Set by libavcodec 144 | */ 145 | unsigned int slice_params_alloc; 146 | 147 | /** 148 | * Number of slices currently filled in 149 | * 150 | * - encoding: unused 151 | * - decoding: Set by libavcodec 152 | */ 153 | unsigned int slice_count; 154 | 155 | /** 156 | * Pointer to slice data buffer base 157 | * - encoding: unused 158 | * - decoding: Set by libavcodec 159 | */ 160 | const uint8_t *slice_data; 161 | 162 | /** 163 | * Current size of slice data 164 | * 165 | * - encoding: unused 166 | * - decoding: Set by libavcodec 167 | */ 168 | uint32_t slice_data_size; 169 | }; 170 | 171 | /* @} */ 172 | 173 | #endif /* AVCODEC_VAAPI_H */ 174 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavcodec/vda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * VDA HW acceleration 3 | * 4 | * copyright (c) 2011 Sebastien Zwickert 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_VDA_H 24 | #define AVCODEC_VDA_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_vda 29 | * Public libavcodec VDA header. 30 | */ 31 | 32 | #include 33 | 34 | // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes 35 | // http://openradar.appspot.com/8026390 36 | #undef __GNUC_STDC_INLINE__ 37 | 38 | #define Picture QuickdrawPicture 39 | #include 40 | #undef Picture 41 | 42 | #include "libavcodec/version.h" 43 | 44 | // extra flags not defined in VDADecoder.h 45 | enum { 46 | kVDADecodeInfo_Asynchronous = 1UL << 0, 47 | kVDADecodeInfo_FrameDropped = 1UL << 1 48 | }; 49 | 50 | /** 51 | * @defgroup lavc_codec_hwaccel_vda VDA 52 | * @ingroup lavc_codec_hwaccel 53 | * 54 | * @{ 55 | */ 56 | 57 | /** 58 | * This structure is used to provide the necessary configurations and data 59 | * to the VDA FFmpeg HWAccel implementation. 60 | * 61 | * The application must make it available as AVCodecContext.hwaccel_context. 62 | */ 63 | struct vda_context { 64 | /** 65 | * VDA decoder object. 66 | * 67 | * - encoding: unused 68 | * - decoding: Set/Unset by libavcodec. 69 | */ 70 | VDADecoder decoder; 71 | 72 | /** 73 | * The Core Video pixel buffer that contains the current image data. 74 | * 75 | * encoding: unused 76 | * decoding: Set by libavcodec. Unset by user. 77 | */ 78 | CVPixelBufferRef cv_buffer; 79 | 80 | /** 81 | * Use the hardware decoder in synchronous mode. 82 | * 83 | * encoding: unused 84 | * decoding: Set by user. 85 | */ 86 | int use_sync_decoding; 87 | 88 | /** 89 | * The frame width. 90 | * 91 | * - encoding: unused 92 | * - decoding: Set/Unset by user. 93 | */ 94 | int width; 95 | 96 | /** 97 | * The frame height. 98 | * 99 | * - encoding: unused 100 | * - decoding: Set/Unset by user. 101 | */ 102 | int height; 103 | 104 | /** 105 | * The frame format. 106 | * 107 | * - encoding: unused 108 | * - decoding: Set/Unset by user. 109 | */ 110 | int format; 111 | 112 | /** 113 | * The pixel format for output image buffers. 114 | * 115 | * - encoding: unused 116 | * - decoding: Set/Unset by user. 117 | */ 118 | OSType cv_pix_fmt_type; 119 | 120 | /** 121 | * The current bitstream buffer. 122 | * 123 | * - encoding: unused 124 | * - decoding: Set/Unset by libavcodec. 125 | */ 126 | uint8_t *priv_bitstream; 127 | 128 | /** 129 | * The current size of the bitstream. 130 | * 131 | * - encoding: unused 132 | * - decoding: Set/Unset by libavcodec. 133 | */ 134 | int priv_bitstream_size; 135 | 136 | /** 137 | * The reference size used for fast reallocation. 138 | * 139 | * - encoding: unused 140 | * - decoding: Set/Unset by libavcodec. 141 | */ 142 | int priv_allocated_size; 143 | 144 | /** 145 | * Use av_buffer to manage buffer. 146 | * When the flag is set, the CVPixelBuffers returned by the decoder will 147 | * be released automatically, so you have to retain them if necessary. 148 | * Not setting this flag may cause memory leak. 149 | * 150 | * encoding: unused 151 | * decoding: Set by user. 152 | */ 153 | int use_ref_buffer; 154 | }; 155 | 156 | /** Create the video decoder. */ 157 | int ff_vda_create_decoder(struct vda_context *vda_ctx, 158 | uint8_t *extradata, 159 | int extradata_size); 160 | 161 | /** Destroy the video decoder. */ 162 | int ff_vda_destroy_decoder(struct vda_context *vda_ctx); 163 | 164 | /** 165 | * @} 166 | */ 167 | 168 | #endif /* AVCODEC_VDA_H */ 169 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavdevice/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVDEVICE_VERSION_H 20 | #define AVDEVICE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavd 25 | * Libavdevice version macros 26 | */ 27 | 28 | #include "libavutil/version.h" 29 | 30 | #define LIBAVDEVICE_VERSION_MAJOR 55 31 | #define LIBAVDEVICE_VERSION_MINOR 10 32 | #define LIBAVDEVICE_VERSION_MICRO 100 33 | 34 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ 35 | LIBAVDEVICE_VERSION_MINOR, \ 36 | LIBAVDEVICE_VERSION_MICRO) 37 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ 38 | LIBAVDEVICE_VERSION_MINOR, \ 39 | LIBAVDEVICE_VERSION_MICRO) 40 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT 41 | 42 | #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION) 43 | 44 | /** 45 | * FF_API_* defines may be placed below to indicate public API that will be 46 | * dropped at a future version bump. The defines themselves are not part of 47 | * the public API and may change, break or disappear at any time. 48 | */ 49 | 50 | #endif /* AVDEVICE_VERSION_H */ 51 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavfilter/asrc_abuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVFILTER_ASRC_ABUFFER_H 20 | #define AVFILTER_ASRC_ABUFFER_H 21 | 22 | #include "avfilter.h" 23 | 24 | /** 25 | * @file 26 | * memory buffer source for audio 27 | * 28 | * @deprecated use buffersrc.h instead. 29 | */ 30 | 31 | /** 32 | * Queue an audio buffer to the audio buffer source. 33 | * 34 | * @param abuffersrc audio source buffer context 35 | * @param data pointers to the samples planes 36 | * @param linesize linesizes of each audio buffer plane 37 | * @param nb_samples number of samples per channel 38 | * @param sample_fmt sample format of the audio data 39 | * @param ch_layout channel layout of the audio data 40 | * @param planar flag to indicate if audio data is planar or packed 41 | * @param pts presentation timestamp of the audio buffer 42 | * @param flags unused 43 | * 44 | * @deprecated use av_buffersrc_add_ref() instead. 45 | */ 46 | attribute_deprecated 47 | int av_asrc_buffer_add_samples(AVFilterContext *abuffersrc, 48 | uint8_t *data[8], int linesize[8], 49 | int nb_samples, int sample_rate, 50 | int sample_fmt, int64_t ch_layout, int planar, 51 | int64_t pts, int av_unused flags); 52 | 53 | /** 54 | * Queue an audio buffer to the audio buffer source. 55 | * 56 | * This is similar to av_asrc_buffer_add_samples(), but the samples 57 | * are stored in a buffer with known size. 58 | * 59 | * @param abuffersrc audio source buffer context 60 | * @param buf pointer to the samples data, packed is assumed 61 | * @param size the size in bytes of the buffer, it must contain an 62 | * integer number of samples 63 | * @param sample_fmt sample format of the audio data 64 | * @param ch_layout channel layout of the audio data 65 | * @param pts presentation timestamp of the audio buffer 66 | * @param flags unused 67 | * 68 | * @deprecated use av_buffersrc_add_ref() instead. 69 | */ 70 | attribute_deprecated 71 | int av_asrc_buffer_add_buffer(AVFilterContext *abuffersrc, 72 | uint8_t *buf, int buf_size, 73 | int sample_rate, 74 | int sample_fmt, int64_t ch_layout, int planar, 75 | int64_t pts, int av_unused flags); 76 | 77 | /** 78 | * Queue an audio buffer to the audio buffer source. 79 | * 80 | * @param abuffersrc audio source buffer context 81 | * @param samplesref buffer ref to queue 82 | * @param flags unused 83 | * 84 | * @deprecated use av_buffersrc_add_ref() instead. 85 | */ 86 | attribute_deprecated 87 | int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *abuffersrc, 88 | AVFilterBufferRef *samplesref, 89 | int av_unused flags); 90 | 91 | #endif /* AVFILTER_ASRC_ABUFFER_H */ 92 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavfilter/avcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVFILTER_AVCODEC_H 20 | #define AVFILTER_AVCODEC_H 21 | 22 | /** 23 | * @file 24 | * libavcodec/libavfilter gluing utilities 25 | * 26 | * This should be included in an application ONLY if the installed 27 | * libavfilter has been compiled with libavcodec support, otherwise 28 | * symbols defined below will not be available. 29 | */ 30 | 31 | #include "avfilter.h" 32 | 33 | #if FF_API_AVFILTERBUFFER 34 | /** 35 | * Create and return a picref reference from the data and properties 36 | * contained in frame. 37 | * 38 | * @param perms permissions to assign to the new buffer reference 39 | * @deprecated avfilter APIs work natively with AVFrame instead. 40 | */ 41 | attribute_deprecated 42 | AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms); 43 | 44 | 45 | /** 46 | * Create and return a picref reference from the data and properties 47 | * contained in frame. 48 | * 49 | * @param perms permissions to assign to the new buffer reference 50 | * @deprecated avfilter APIs work natively with AVFrame instead. 51 | */ 52 | attribute_deprecated 53 | AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame, 54 | int perms); 55 | 56 | /** 57 | * Create and return a buffer reference from the data and properties 58 | * contained in frame. 59 | * 60 | * @param perms permissions to assign to the new buffer reference 61 | * @deprecated avfilter APIs work natively with AVFrame instead. 62 | */ 63 | attribute_deprecated 64 | AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(enum AVMediaType type, 65 | const AVFrame *frame, 66 | int perms); 67 | #endif 68 | 69 | #if FF_API_FILL_FRAME 70 | /** 71 | * Fill an AVFrame with the information stored in samplesref. 72 | * 73 | * @param frame an already allocated AVFrame 74 | * @param samplesref an audio buffer reference 75 | * @return >= 0 in case of success, a negative AVERROR code in case of 76 | * failure 77 | * @deprecated Use avfilter_copy_buf_props() instead. 78 | */ 79 | attribute_deprecated 80 | int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame, 81 | const AVFilterBufferRef *samplesref); 82 | 83 | /** 84 | * Fill an AVFrame with the information stored in picref. 85 | * 86 | * @param frame an already allocated AVFrame 87 | * @param picref a video buffer reference 88 | * @return >= 0 in case of success, a negative AVERROR code in case of 89 | * failure 90 | * @deprecated Use avfilter_copy_buf_props() instead. 91 | */ 92 | attribute_deprecated 93 | int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame, 94 | const AVFilterBufferRef *picref); 95 | 96 | /** 97 | * Fill an AVFrame with information stored in ref. 98 | * 99 | * @param frame an already allocated AVFrame 100 | * @param ref a video or audio buffer reference 101 | * @return >= 0 in case of success, a negative AVERROR code in case of 102 | * failure 103 | * @deprecated Use avfilter_copy_buf_props() instead. 104 | */ 105 | attribute_deprecated 106 | int avfilter_fill_frame_from_buffer_ref(AVFrame *frame, 107 | const AVFilterBufferRef *ref); 108 | #endif 109 | 110 | #endif /* AVFILTER_AVCODEC_H */ 111 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavfilter/avfiltergraph.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Filter graphs 3 | * copyright (c) 2007 Bobby Bingham 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVFILTER_AVFILTERGRAPH_H 23 | #define AVFILTER_AVFILTERGRAPH_H 24 | 25 | #include "avfilter.h" 26 | #include "libavutil/log.h" 27 | 28 | #endif /* AVFILTER_AVFILTERGRAPH_H */ 29 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavfilter/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFILTER_VERSION_H 22 | #define AVFILTER_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup lavfi 27 | * Libavfilter version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #define LIBAVFILTER_VERSION_MAJOR 4 33 | #define LIBAVFILTER_VERSION_MINOR 2 34 | #define LIBAVFILTER_VERSION_MICRO 100 35 | 36 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ 37 | LIBAVFILTER_VERSION_MINOR, \ 38 | LIBAVFILTER_VERSION_MICRO) 39 | #define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ 40 | LIBAVFILTER_VERSION_MINOR, \ 41 | LIBAVFILTER_VERSION_MICRO) 42 | #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT 43 | 44 | #define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) 45 | 46 | /** 47 | * FF_API_* defines may be placed below to indicate public API that will be 48 | * dropped at a future version bump. The defines themselves are not part of 49 | * the public API and may change, break or disappear at any time. 50 | */ 51 | 52 | #ifndef FF_API_AVFILTERPAD_PUBLIC 53 | #define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 5) 54 | #endif 55 | #ifndef FF_API_FOO_COUNT 56 | #define FF_API_FOO_COUNT (LIBAVFILTER_VERSION_MAJOR < 5) 57 | #endif 58 | #ifndef FF_API_FILL_FRAME 59 | #define FF_API_FILL_FRAME (LIBAVFILTER_VERSION_MAJOR < 5) 60 | #endif 61 | #ifndef FF_API_BUFFERSRC_BUFFER 62 | #define FF_API_BUFFERSRC_BUFFER (LIBAVFILTER_VERSION_MAJOR < 5) 63 | #endif 64 | #ifndef FF_API_AVFILTERBUFFER 65 | #define FF_API_AVFILTERBUFFER (LIBAVFILTER_VERSION_MAJOR < 5) 66 | #endif 67 | #ifndef FF_API_OLD_FILTER_OPTS 68 | #define FF_API_OLD_FILTER_OPTS (LIBAVFILTER_VERSION_MAJOR < 5) 69 | #endif 70 | #ifndef FF_API_ACONVERT_FILTER 71 | #define FF_API_ACONVERT_FILTER (LIBAVFILTER_VERSION_MAJOR < 5) 72 | #endif 73 | #ifndef FF_API_AVFILTER_OPEN 74 | #define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 5) 75 | #endif 76 | #ifndef FF_API_AVFILTER_INIT_FILTER 77 | #define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 5) 78 | #endif 79 | #ifndef FF_API_OLD_FILTER_REGISTER 80 | #define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 5) 81 | #endif 82 | #ifndef FF_API_OLD_GRAPH_PARSE 83 | #define FF_API_OLD_GRAPH_PARSE (LIBAVFILTER_VERSION_MAJOR < 5) 84 | #endif 85 | #ifndef FF_API_DRAWTEXT_OLD_TIMELINE 86 | #define FF_API_DRAWTEXT_OLD_TIMELINE (LIBAVFILTER_VERSION_MAJOR < 5) 87 | #endif 88 | #ifndef FF_API_NOCONST_GET_NAME 89 | #define FF_API_NOCONST_GET_NAME (LIBAVFILTER_VERSION_MAJOR < 5) 90 | #endif 91 | #ifndef FF_API_INTERLACE_LOWPASS_SET 92 | #define FF_API_INTERLACE_LOWPASS_SET (LIBAVFILTER_VERSION_MAJOR < 5) 93 | #endif 94 | 95 | #endif /* AVFILTER_VERSION_H */ 96 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavformat/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFORMAT_VERSION_H 22 | #define AVFORMAT_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup libavf 27 | * Libavformat version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #define LIBAVFORMAT_VERSION_MAJOR 55 33 | #define LIBAVFORMAT_VERSION_MINOR 33 34 | #define LIBAVFORMAT_VERSION_MICRO 100 35 | 36 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ 37 | LIBAVFORMAT_VERSION_MINOR, \ 38 | LIBAVFORMAT_VERSION_MICRO) 39 | #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ 40 | LIBAVFORMAT_VERSION_MINOR, \ 41 | LIBAVFORMAT_VERSION_MICRO) 42 | #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT 43 | 44 | #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) 45 | 46 | /** 47 | * FF_API_* defines may be placed below to indicate public API that will be 48 | * dropped at a future version bump. The defines themselves are not part of 49 | * the public API and may change, break or disappear at any time. 50 | */ 51 | #ifndef FF_API_REFERENCE_DTS 52 | #define FF_API_REFERENCE_DTS (LIBAVFORMAT_VERSION_MAJOR < 56) 53 | #endif 54 | 55 | #ifndef FF_API_ALLOC_OUTPUT_CONTEXT 56 | #define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 56) 57 | #endif 58 | #ifndef FF_API_FORMAT_PARAMETERS 59 | #define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 56) 60 | #endif 61 | #ifndef FF_API_NEW_STREAM 62 | #define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 56) 63 | #endif 64 | #ifndef FF_API_SET_PTS_INFO 65 | #define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 56) 66 | #endif 67 | #ifndef FF_API_CLOSE_INPUT_FILE 68 | #define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 56) 69 | #endif 70 | #ifndef FF_API_READ_PACKET 71 | #define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 56) 72 | #endif 73 | #ifndef FF_API_ASS_SSA 74 | #define FF_API_ASS_SSA (LIBAVFORMAT_VERSION_MAJOR < 56) 75 | #endif 76 | #ifndef FF_API_R_FRAME_RATE 77 | #define FF_API_R_FRAME_RATE 1 78 | #endif 79 | #endif /* AVFORMAT_VERSION_H */ 80 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_ADLER32_H 22 | #define AVUTIL_ADLER32_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | /** 28 | * @file 29 | * Public header for libavutil Adler32 hasher 30 | * 31 | * @defgroup lavu_adler32 Adler32 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | /** 37 | * Calculate the Adler32 checksum of a buffer. 38 | * 39 | * Passing the return value to a subsequent av_adler32_update() call 40 | * allows the checksum of multiple buffers to be calculated as though 41 | * they were concatenated. 42 | * 43 | * @param adler initial checksum value 44 | * @param buf pointer to input buffer 45 | * @param len size of input buffer 46 | * @return updated checksum 47 | */ 48 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 49 | unsigned int len) av_pure; 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | #endif /* AVUTIL_ADLER32_H */ 56 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AES_H 22 | #define AVUTIL_AES_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_aes AES 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_aes_size; 36 | 37 | struct AVAES; 38 | 39 | /** 40 | * Allocate an AVAES context. 41 | */ 42 | struct AVAES *av_aes_alloc(void); 43 | 44 | /** 45 | * Initialize an AVAES context. 46 | * @param key_bits 128, 192 or 256 47 | * @param decrypt 0 for encryption, 1 for decryption 48 | */ 49 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * Encrypt or decrypt a buffer using a previously initialized context. 53 | * @param count number of 16 byte blocks 54 | * @param dst destination array, can be equal to src 55 | * @param src source array, can be equal to dst 56 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 57 | * @param decrypt 0 for encryption, 1 for decryption 58 | */ 59 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | #endif /* AVUTIL_AES_H */ 66 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/attributes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * Macro definitions for various function/variable attributes 24 | */ 25 | 26 | #ifndef AVUTIL_ATTRIBUTES_H 27 | #define AVUTIL_ATTRIBUTES_H 28 | 29 | #ifdef __GNUC__ 30 | # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) 31 | #else 32 | # define AV_GCC_VERSION_AT_LEAST(x,y) 0 33 | #endif 34 | 35 | #ifndef av_always_inline 36 | #if AV_GCC_VERSION_AT_LEAST(3,1) 37 | # define av_always_inline __attribute__((always_inline)) inline 38 | #elif defined(_MSC_VER) 39 | # define av_always_inline __forceinline 40 | #else 41 | # define av_always_inline inline 42 | #endif 43 | #endif 44 | 45 | #ifndef av_extern_inline 46 | #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) 47 | # define av_extern_inline extern inline 48 | #else 49 | # define av_extern_inline inline 50 | #endif 51 | #endif 52 | 53 | #if AV_GCC_VERSION_AT_LEAST(3,1) 54 | # define av_noinline __attribute__((noinline)) 55 | #elif defined(_MSC_VER) 56 | # define av_noinline __declspec(noinline) 57 | #else 58 | # define av_noinline 59 | #endif 60 | 61 | #if AV_GCC_VERSION_AT_LEAST(3,1) 62 | # define av_pure __attribute__((pure)) 63 | #else 64 | # define av_pure 65 | #endif 66 | 67 | #if AV_GCC_VERSION_AT_LEAST(2,6) 68 | # define av_const __attribute__((const)) 69 | #else 70 | # define av_const 71 | #endif 72 | 73 | #if AV_GCC_VERSION_AT_LEAST(4,3) 74 | # define av_cold __attribute__((cold)) 75 | #else 76 | # define av_cold 77 | #endif 78 | 79 | #if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) 80 | # define av_flatten __attribute__((flatten)) 81 | #else 82 | # define av_flatten 83 | #endif 84 | 85 | #if AV_GCC_VERSION_AT_LEAST(3,1) 86 | # define attribute_deprecated __attribute__((deprecated)) 87 | #elif defined(_MSC_VER) 88 | # define attribute_deprecated __declspec(deprecated) 89 | #else 90 | # define attribute_deprecated 91 | #endif 92 | 93 | /** 94 | * Disable warnings about deprecated features 95 | * This is useful for sections of code kept for backward compatibility and 96 | * scheduled for removal. 97 | */ 98 | #ifndef AV_NOWARN_DEPRECATED 99 | #if AV_GCC_VERSION_AT_LEAST(4,6) 100 | # define AV_NOWARN_DEPRECATED(code) \ 101 | _Pragma("GCC diagnostic push") \ 102 | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ 103 | code \ 104 | _Pragma("GCC diagnostic pop") 105 | #elif defined(_MSC_VER) 106 | # define AV_NOWARN_DEPRECATED(code) \ 107 | __pragma(warning(push)) \ 108 | __pragma(warning(disable : 4996)) \ 109 | code; \ 110 | __pragma(warning(pop)) 111 | #else 112 | # define AV_NOWARN_DEPRECATED(code) code 113 | #endif 114 | #endif 115 | 116 | 117 | #if defined(__GNUC__) 118 | # define av_unused __attribute__((unused)) 119 | #else 120 | # define av_unused 121 | #endif 122 | 123 | /** 124 | * Mark a variable as used and prevent the compiler from optimizing it 125 | * away. This is useful for variables accessed only from inline 126 | * assembler without the compiler being aware. 127 | */ 128 | #if AV_GCC_VERSION_AT_LEAST(3,1) 129 | # define av_used __attribute__((used)) 130 | #else 131 | # define av_used 132 | #endif 133 | 134 | #if AV_GCC_VERSION_AT_LEAST(3,3) 135 | # define av_alias __attribute__((may_alias)) 136 | #else 137 | # define av_alias 138 | #endif 139 | 140 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) 141 | # define av_uninit(x) x=x 142 | #else 143 | # define av_uninit(x) x 144 | #endif 145 | 146 | #ifdef __GNUC__ 147 | # define av_builtin_constant_p __builtin_constant_p 148 | # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) 149 | #else 150 | # define av_builtin_constant_p(x) 0 151 | # define av_printf_format(fmtpos, attrpos) 152 | #endif 153 | 154 | #if AV_GCC_VERSION_AT_LEAST(2,5) 155 | # define av_noreturn __attribute__((noreturn)) 156 | #else 157 | # define av_noreturn 158 | #endif 159 | 160 | #endif /* AVUTIL_ATTRIBUTES_H */ 161 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/audio_fifo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Audio FIFO 3 | * Copyright (c) 2012 Justin Ruggles 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * Audio FIFO Buffer 25 | */ 26 | 27 | #ifndef AVUTIL_AUDIO_FIFO_H 28 | #define AVUTIL_AUDIO_FIFO_H 29 | 30 | #include "avutil.h" 31 | #include "fifo.h" 32 | #include "samplefmt.h" 33 | 34 | /** 35 | * @addtogroup lavu_audio 36 | * @{ 37 | */ 38 | 39 | /** 40 | * Context for an Audio FIFO Buffer. 41 | * 42 | * - Operates at the sample level rather than the byte level. 43 | * - Supports multiple channels with either planar or packed sample format. 44 | * - Automatic reallocation when writing to a full buffer. 45 | */ 46 | typedef struct AVAudioFifo AVAudioFifo; 47 | 48 | /** 49 | * Free an AVAudioFifo. 50 | * 51 | * @param af AVAudioFifo to free 52 | */ 53 | void av_audio_fifo_free(AVAudioFifo *af); 54 | 55 | /** 56 | * Allocate an AVAudioFifo. 57 | * 58 | * @param sample_fmt sample format 59 | * @param channels number of channels 60 | * @param nb_samples initial allocation size, in samples 61 | * @return newly allocated AVAudioFifo, or NULL on error 62 | */ 63 | AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, 64 | int nb_samples); 65 | 66 | /** 67 | * Reallocate an AVAudioFifo. 68 | * 69 | * @param af AVAudioFifo to reallocate 70 | * @param nb_samples new allocation size, in samples 71 | * @return 0 if OK, or negative AVERROR code on failure 72 | */ 73 | int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); 74 | 75 | /** 76 | * Write data to an AVAudioFifo. 77 | * 78 | * The AVAudioFifo will be reallocated automatically if the available space 79 | * is less than nb_samples. 80 | * 81 | * @see enum AVSampleFormat 82 | * The documentation for AVSampleFormat describes the data layout. 83 | * 84 | * @param af AVAudioFifo to write to 85 | * @param data audio data plane pointers 86 | * @param nb_samples number of samples to write 87 | * @return number of samples actually written, or negative AVERROR 88 | * code on failure. If successful, the number of samples 89 | * actually written will always be nb_samples. 90 | */ 91 | int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); 92 | 93 | /** 94 | * Read data from an AVAudioFifo. 95 | * 96 | * @see enum AVSampleFormat 97 | * The documentation for AVSampleFormat describes the data layout. 98 | * 99 | * @param af AVAudioFifo to read from 100 | * @param data audio data plane pointers 101 | * @param nb_samples number of samples to read 102 | * @return number of samples actually read, or negative AVERROR code 103 | * on failure. The number of samples actually read will not 104 | * be greater than nb_samples, and will only be less than 105 | * nb_samples if av_audio_fifo_size is less than nb_samples. 106 | */ 107 | int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); 108 | 109 | /** 110 | * Drain data from an AVAudioFifo. 111 | * 112 | * Removes the data without reading it. 113 | * 114 | * @param af AVAudioFifo to drain 115 | * @param nb_samples number of samples to drain 116 | * @return 0 if OK, or negative AVERROR code on failure 117 | */ 118 | int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); 119 | 120 | /** 121 | * Reset the AVAudioFifo buffer. 122 | * 123 | * This empties all data in the buffer. 124 | * 125 | * @param af AVAudioFifo to reset 126 | */ 127 | void av_audio_fifo_reset(AVAudioFifo *af); 128 | 129 | /** 130 | * Get the current number of samples in the AVAudioFifo available for reading. 131 | * 132 | * @param af the AVAudioFifo to query 133 | * @return number of samples available for reading 134 | */ 135 | int av_audio_fifo_size(AVAudioFifo *af); 136 | 137 | /** 138 | * Get the current number of samples in the AVAudioFifo available for writing. 139 | * 140 | * @param af the AVAudioFifo to query 141 | * @return number of samples available for writing 142 | */ 143 | int av_audio_fifo_space(AVAudioFifo *af); 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | #endif /* AVUTIL_AUDIO_FIFO_H */ 150 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/audioconvert.h: -------------------------------------------------------------------------------- 1 | 2 | #include "version.h" 3 | 4 | #if FF_API_AUDIOCONVERT 5 | #include "channel_layout.h" 6 | #endif 7 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/avassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple assert() macros that are a bit more flexible than ISO C assert(). 24 | * @author Michael Niedermayer 25 | */ 26 | 27 | #ifndef AVUTIL_AVASSERT_H 28 | #define AVUTIL_AVASSERT_H 29 | 30 | #include 31 | #include "avutil.h" 32 | #include "log.h" 33 | 34 | /** 35 | * assert() equivalent, that is always enabled. 36 | */ 37 | #define av_assert0(cond) do { \ 38 | if (!(cond)) { \ 39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ 40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \ 41 | abort(); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /** 47 | * assert() equivalent, that does not lie in speed critical code. 48 | * These asserts() thus can be enabled without fearing speedloss. 49 | */ 50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 51 | #define av_assert1(cond) av_assert0(cond) 52 | #else 53 | #define av_assert1(cond) ((void)0) 54 | #endif 55 | 56 | 57 | /** 58 | * assert() equivalent, that does lie in speed critical code. 59 | */ 60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 61 | #define av_assert2(cond) av_assert0(cond) 62 | #else 63 | #define av_assert2(cond) ((void)0) 64 | #endif 65 | 66 | #endif /* AVUTIL_AVASSERT_H */ 67 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffconf */ 2 | #ifndef AVUTIL_AVCONFIG_H 3 | #define AVUTIL_AVCONFIG_H 4 | #define AV_HAVE_BIGENDIAN 0 5 | #define AV_HAVE_FAST_UNALIGNED 0 6 | #define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0 7 | #define AV_HAVE_INCOMPATIBLE_FORK_ABI 0 8 | #endif /* AVUTIL_AVCONFIG_H */ 9 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | 33 | /** 34 | * Decode a base64-encoded string. 35 | * 36 | * @param out buffer for decoded data 37 | * @param in null-terminated input string 38 | * @param out_size size in bytes of the out buffer, must be at 39 | * least 3/4 of the length of in 40 | * @return number of bytes written, or a negative value in case of 41 | * invalid input 42 | */ 43 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 44 | 45 | /** 46 | * Encode data to base64 and null-terminate. 47 | * 48 | * @param out buffer for encoded data 49 | * @param out_size size in bytes of the out buffer (including the 50 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 51 | * @param in input buffer containing the data to encode 52 | * @param in_size size in bytes of the in buffer 53 | * @return out or NULL in case of error 54 | */ 55 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 56 | 57 | /** 58 | * Calculate the output size needed to base64-encode x bytes to a 59 | * null-terminated string. 60 | */ 61 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | #endif /* AVUTIL_BASE64_H */ 68 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Blowfish algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_BLOWFISH_H 23 | #define AVUTIL_BLOWFISH_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_blowfish Blowfish 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | #define AV_BF_ROUNDS 16 34 | 35 | typedef struct AVBlowfish { 36 | uint32_t p[AV_BF_ROUNDS + 2]; 37 | uint32_t s[4][256]; 38 | } AVBlowfish; 39 | 40 | /** 41 | * Initialize an AVBlowfish context. 42 | * 43 | * @param ctx an AVBlowfish context 44 | * @param key a key 45 | * @param key_len length of the key 46 | */ 47 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); 48 | 49 | /** 50 | * Encrypt or decrypt a buffer using a previously initialized context. 51 | * 52 | * @param ctx an AVBlowfish context 53 | * @param xl left four bytes halves of input to be encrypted 54 | * @param xr right four bytes halves of input to be encrypted 55 | * @param decrypt 0 for encryption, 1 for decryption 56 | */ 57 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, 58 | int decrypt); 59 | 60 | /** 61 | * Encrypt or decrypt a buffer using a previously initialized context. 62 | * 63 | * @param ctx an AVBlowfish context 64 | * @param dst destination array, can be equal to src 65 | * @param src source array, can be equal to dst 66 | * @param count number of 8 byte blocks 67 | * @param iv initialization vector for CBC mode, if NULL ECB will be used 68 | * @param decrypt 0 for encryption, 1 for decryption 69 | */ 70 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, 71 | int count, uint8_t *iv, int decrypt); 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* AVUTIL_BLOWFISH_H */ 78 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/bswap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * byte swapping routines 24 | */ 25 | 26 | #ifndef AVUTIL_BSWAP_H 27 | #define AVUTIL_BSWAP_H 28 | 29 | #include 30 | #include "libavutil/avconfig.h" 31 | #include "attributes.h" 32 | 33 | #ifdef HAVE_AV_CONFIG_H 34 | 35 | #include "config.h" 36 | 37 | #if ARCH_AARCH64 38 | # include "aarch64/bswap.h" 39 | #elif ARCH_ARM 40 | # include "arm/bswap.h" 41 | #elif ARCH_AVR32 42 | # include "avr32/bswap.h" 43 | #elif ARCH_BFIN 44 | # include "bfin/bswap.h" 45 | #elif ARCH_SH4 46 | # include "sh4/bswap.h" 47 | #elif ARCH_X86 48 | # include "x86/bswap.h" 49 | #endif 50 | 51 | #endif /* HAVE_AV_CONFIG_H */ 52 | 53 | #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) 54 | #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) 55 | #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) 56 | 57 | #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) 58 | 59 | #ifndef av_bswap16 60 | static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 61 | { 62 | x= (x>>8) | (x<<8); 63 | return x; 64 | } 65 | #endif 66 | 67 | #ifndef av_bswap32 68 | static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 69 | { 70 | return AV_BSWAP32C(x); 71 | } 72 | #endif 73 | 74 | #ifndef av_bswap64 75 | static inline uint64_t av_const av_bswap64(uint64_t x) 76 | { 77 | return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); 78 | } 79 | #endif 80 | 81 | // be2ne ... big-endian to native-endian 82 | // le2ne ... little-endian to native-endian 83 | 84 | #if AV_HAVE_BIGENDIAN 85 | #define av_be2ne16(x) (x) 86 | #define av_be2ne32(x) (x) 87 | #define av_be2ne64(x) (x) 88 | #define av_le2ne16(x) av_bswap16(x) 89 | #define av_le2ne32(x) av_bswap32(x) 90 | #define av_le2ne64(x) av_bswap64(x) 91 | #define AV_BE2NEC(s, x) (x) 92 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x) 93 | #else 94 | #define av_be2ne16(x) av_bswap16(x) 95 | #define av_be2ne32(x) av_bswap32(x) 96 | #define av_be2ne64(x) av_bswap64(x) 97 | #define av_le2ne16(x) (x) 98 | #define av_le2ne32(x) (x) 99 | #define av_le2ne64(x) (x) 100 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x) 101 | #define AV_LE2NEC(s, x) (x) 102 | #endif 103 | 104 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x) 105 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x) 106 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x) 107 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x) 108 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x) 109 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x) 110 | 111 | #endif /* AVUTIL_BSWAP_H */ 112 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_CRC_H 22 | #define AVUTIL_CRC_H 23 | 24 | #include 25 | #include 26 | #include "attributes.h" 27 | 28 | /** 29 | * @defgroup lavu_crc32 CRC32 30 | * @ingroup lavu_crypto 31 | * @{ 32 | */ 33 | 34 | typedef uint32_t AVCRC; 35 | 36 | typedef enum { 37 | AV_CRC_8_ATM, 38 | AV_CRC_16_ANSI, 39 | AV_CRC_16_CCITT, 40 | AV_CRC_32_IEEE, 41 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ 42 | AV_CRC_24_IEEE = 12, 43 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ 44 | }AVCRCId; 45 | 46 | /** 47 | * Initialize a CRC table. 48 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 49 | * @param le If 1, the lowest bit represents the coefficient for the highest 50 | * exponent of the corresponding polynomial (both for poly and 51 | * actual CRC). 52 | * If 0, you must swap the CRC parameter and the result of av_crc 53 | * if you need the standard representation (can be simplified in 54 | * most cases to e.g. bswap16): 55 | * av_bswap32(crc << (32-bits)) 56 | * @param bits number of bits for the CRC 57 | * @param poly generator polynomial without the x**bits coefficient, in the 58 | * representation as specified by le 59 | * @param ctx_size size of ctx in bytes 60 | * @return <0 on failure 61 | */ 62 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); 63 | 64 | /** 65 | * Get an initialized standard CRC table. 66 | * @param crc_id ID of a standard CRC 67 | * @return a pointer to the CRC table or NULL on failure 68 | */ 69 | const AVCRC *av_crc_get_table(AVCRCId crc_id); 70 | 71 | /** 72 | * Calculate the CRC of a block. 73 | * @param crc CRC of previous blocks if any or initial value for CRC 74 | * @return CRC updated with the data from the given block 75 | * 76 | * @see av_crc_init() "le" parameter 77 | */ 78 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc, 79 | const uint8_t *buffer, size_t length) av_pure; 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | #endif /* AVUTIL_CRC_H */ 86 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/downmix_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Tim Walker 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_DOWNMIX_INFO_H 22 | #define AVUTIL_DOWNMIX_INFO_H 23 | 24 | #include "frame.h" 25 | 26 | /** 27 | * @file 28 | * audio downmix medatata 29 | */ 30 | 31 | /** 32 | * @addtogroup lavu_audio 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @defgroup downmix_info Audio downmix metadata 38 | * @{ 39 | */ 40 | 41 | /** 42 | * Possible downmix types. 43 | */ 44 | enum AVDownmixType { 45 | AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ 46 | AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ 47 | AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ 48 | AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ 49 | AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ 50 | }; 51 | 52 | /** 53 | * This structure describes optional metadata relevant to a downmix procedure. 54 | * 55 | * All fields are set by the decoder to the value indicated in the audio 56 | * bitstream (if present), or to a "sane" default otherwise. 57 | */ 58 | typedef struct AVDownmixInfo { 59 | /** 60 | * Type of downmix preferred by the mastering engineer. 61 | */ 62 | enum AVDownmixType preferred_downmix_type; 63 | 64 | /** 65 | * Absolute scale factor representing the nominal level of the center 66 | * channel during a regular downmix. 67 | */ 68 | double center_mix_level; 69 | 70 | /** 71 | * Absolute scale factor representing the nominal level of the center 72 | * channel during an Lt/Rt compatible downmix. 73 | */ 74 | double center_mix_level_ltrt; 75 | 76 | /** 77 | * Absolute scale factor representing the nominal level of the surround 78 | * channels during a regular downmix. 79 | */ 80 | double surround_mix_level; 81 | 82 | /** 83 | * Absolute scale factor representing the nominal level of the surround 84 | * channels during an Lt/Rt compatible downmix. 85 | */ 86 | double surround_mix_level_ltrt; 87 | 88 | /** 89 | * Absolute scale factor representing the level at which the LFE data is 90 | * mixed into L/R channels during downmixing. 91 | */ 92 | double lfe_mix_level; 93 | } AVDownmixInfo; 94 | 95 | /** 96 | * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. 97 | * 98 | * The side data is created and added to the frame if it's absent. 99 | * 100 | * @param frame the frame for which the side data is to be obtained. 101 | * 102 | * @return the AVDownmixInfo structure to be edited by the caller. 103 | */ 104 | AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | #endif /* AVUTIL_DOWNMIX_INFO_H */ 115 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | #ifndef AVUTIL_FFVERSION_H 2 | #define AVUTIL_FFVERSION_H 3 | #define FFMPEG_VERSION "2.2.5" 4 | #endif /* AVUTIL_FFVERSION_H */ 5 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_FILE_H 20 | #define AVUTIL_FILE_H 21 | 22 | #include 23 | 24 | #include "avutil.h" 25 | 26 | /** 27 | * @file 28 | * Misc file utilities. 29 | */ 30 | 31 | /** 32 | * Read the file with name filename, and put its content in a newly 33 | * allocated buffer or map it with mmap() when available. 34 | * In case of success set *bufptr to the read or mmapped buffer, and 35 | * *size to the size in bytes of the buffer in *bufptr. 36 | * The returned buffer must be released with av_file_unmap(). 37 | * 38 | * @param log_offset loglevel offset used for logging 39 | * @param log_ctx context used for logging 40 | * @return a non negative number in case of success, a negative value 41 | * corresponding to an AVERROR error code in case of failure 42 | */ 43 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 44 | int log_offset, void *log_ctx); 45 | 46 | /** 47 | * Unmap or free the buffer bufptr created by av_file_map(). 48 | * 49 | * @param size size in bytes of bufptr, must be the same as returned 50 | * by av_file_map() 51 | */ 52 | void av_file_unmap(uint8_t *bufptr, size_t size); 53 | 54 | /** 55 | * Wrapper to work around the lack of mkstemp() on mingw. 56 | * Also, tries to create file in /tmp first, if possible. 57 | * *prefix can be a character constant; *filename will be allocated internally. 58 | * @return file descriptor of opened file (or -1 on error) 59 | * and opened file name in **filename. 60 | * @note On very old libcs it is necessary to set a secure umask before 61 | * calling this, av_tempfile() can't call umask itself as it is used in 62 | * libraries and could interfere with the calling application. 63 | */ 64 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); 65 | 66 | #endif /* AVUTIL_FILE_H */ 67 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Martin Storsjo 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_HMAC_H 22 | #define AVUTIL_HMAC_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_hmac HMAC 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | enum AVHMACType { 33 | AV_HMAC_MD5, 34 | AV_HMAC_SHA1, 35 | AV_HMAC_SHA224 = 10, 36 | AV_HMAC_SHA256, 37 | AV_HMAC_SHA384, 38 | AV_HMAC_SHA512, 39 | }; 40 | 41 | typedef struct AVHMAC AVHMAC; 42 | 43 | /** 44 | * Allocate an AVHMAC context. 45 | * @param type The hash function used for the HMAC. 46 | */ 47 | AVHMAC *av_hmac_alloc(enum AVHMACType type); 48 | 49 | /** 50 | * Free an AVHMAC context. 51 | * @param ctx The context to free, may be NULL 52 | */ 53 | void av_hmac_free(AVHMAC *ctx); 54 | 55 | /** 56 | * Initialize an AVHMAC context with an authentication key. 57 | * @param ctx The HMAC context 58 | * @param key The authentication key 59 | * @param keylen The length of the key, in bytes 60 | */ 61 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); 62 | 63 | /** 64 | * Hash data with the HMAC. 65 | * @param ctx The HMAC context 66 | * @param data The data to hash 67 | * @param len The length of the data, in bytes 68 | */ 69 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); 70 | 71 | /** 72 | * Finish hashing and output the HMAC digest. 73 | * @param ctx The HMAC context 74 | * @param out The output buffer to write the digest into 75 | * @param outlen The length of the out buffer, in bytes 76 | * @return The number of bytes written to out, or a negative error code. 77 | */ 78 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); 79 | 80 | /** 81 | * Hash an array of data with a key. 82 | * @param ctx The HMAC context 83 | * @param data The data to hash 84 | * @param len The length of the data, in bytes 85 | * @param key The authentication key 86 | * @param keylen The length of the key, in bytes 87 | * @param out The output buffer to write the digest into 88 | * @param outlen The length of the out buffer, in bytes 89 | * @return The number of bytes written to out, or a negative error code. 90 | */ 91 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, 92 | const uint8_t *key, unsigned int keylen, 93 | uint8_t *out, unsigned int outlen); 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | #endif /* AVUTIL_HMAC_H */ 100 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/intfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_H 22 | #define AVUTIL_INTFLOAT_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | union av_intfloat32 { 28 | uint32_t i; 29 | float f; 30 | }; 31 | 32 | union av_intfloat64 { 33 | uint64_t i; 34 | double f; 35 | }; 36 | 37 | /** 38 | * Reinterpret a 32-bit integer as a float. 39 | */ 40 | static av_always_inline float av_int2float(uint32_t i) 41 | { 42 | union av_intfloat32 v; 43 | v.i = i; 44 | return v.f; 45 | } 46 | 47 | /** 48 | * Reinterpret a float as a 32-bit integer. 49 | */ 50 | static av_always_inline uint32_t av_float2int(float f) 51 | { 52 | union av_intfloat32 v; 53 | v.f = f; 54 | return v.i; 55 | } 56 | 57 | /** 58 | * Reinterpret a 64-bit integer as a double. 59 | */ 60 | static av_always_inline double av_int2double(uint64_t i) 61 | { 62 | union av_intfloat64 v; 63 | v.i = i; 64 | return v.f; 65 | } 66 | 67 | /** 68 | * Reinterpret a double as a 64-bit integer. 69 | */ 70 | static av_always_inline uint64_t av_double2int(double f) 71 | { 72 | union av_intfloat64 v; 73 | v.f = f; 74 | return v.i; 75 | } 76 | 77 | #endif /* AVUTIL_INTFLOAT_H */ 78 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/intfloat_readwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2005 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_READWRITE_H 22 | #define AVUTIL_INTFLOAT_READWRITE_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | #if FF_API_INTFLOAT 30 | /* IEEE 80 bits extended float */ 31 | typedef struct AVExtFloat { 32 | uint8_t exponent[2]; 33 | uint8_t mantissa[8]; 34 | } AVExtFloat; 35 | 36 | attribute_deprecated double av_int2dbl(int64_t v) av_const; 37 | attribute_deprecated float av_int2flt(int32_t v) av_const; 38 | attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const; 39 | attribute_deprecated int64_t av_dbl2int(double d) av_const; 40 | attribute_deprecated int32_t av_flt2int(float d) av_const; 41 | attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const; 42 | #endif /* FF_API_INTFLOAT */ 43 | 44 | #endif /* AVUTIL_INTFLOAT_READWRITE_H */ 45 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/lfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lagged Fibonacci PRNG 3 | * Copyright (c) 2008 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LFG_H 23 | #define AVUTIL_LFG_H 24 | 25 | typedef struct AVLFG { 26 | unsigned int state[64]; 27 | int index; 28 | } AVLFG; 29 | 30 | void av_lfg_init(AVLFG *c, unsigned int seed); 31 | 32 | /** 33 | * Get the next random unsigned 32-bit number using an ALFG. 34 | * 35 | * Please also consider a simple LCG like state= state*1664525+1013904223, 36 | * it may be good enough and faster for your specific use case. 37 | */ 38 | static inline unsigned int av_lfg_get(AVLFG *c){ 39 | c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 40 | return c->state[c->index++ & 63]; 41 | } 42 | 43 | /** 44 | * Get the next random unsigned 32-bit number using a MLFG. 45 | * 46 | * Please also consider av_lfg_get() above, it is faster. 47 | */ 48 | static inline unsigned int av_mlfg_get(AVLFG *c){ 49 | unsigned int a= c->state[(c->index-55) & 63]; 50 | unsigned int b= c->state[(c->index-24) & 63]; 51 | return c->state[c->index++ & 63] = 2*a*b+a+b; 52 | } 53 | 54 | /** 55 | * Get the next two numbers generated by a Box-Muller Gaussian 56 | * generator using the random numbers issued by lfg. 57 | * 58 | * @param out array where the two generated numbers are placed 59 | */ 60 | void av_bmg_get(AVLFG *lfg, double out[2]); 61 | 62 | #endif /* AVUTIL_LFG_H */ 63 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/lzo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LZO 1x decompression 3 | * copyright (c) 2006 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LZO_H 23 | #define AVUTIL_LZO_H 24 | 25 | /** 26 | * @defgroup lavu_lzo LZO 27 | * @ingroup lavu_crypto 28 | * 29 | * @{ 30 | */ 31 | 32 | #include 33 | 34 | /** @name Error flags returned by av_lzo1x_decode 35 | * @{ */ 36 | /// end of the input buffer reached before decoding finished 37 | #define AV_LZO_INPUT_DEPLETED 1 38 | /// decoded data did not fit into output buffer 39 | #define AV_LZO_OUTPUT_FULL 2 40 | /// a reference to previously decoded data was wrong 41 | #define AV_LZO_INVALID_BACKPTR 4 42 | /// a non-specific error in the compressed bitstream 43 | #define AV_LZO_ERROR 8 44 | /** @} */ 45 | 46 | #define AV_LZO_INPUT_PADDING 8 47 | #define AV_LZO_OUTPUT_PADDING 12 48 | 49 | /** 50 | * @brief Decodes LZO 1x compressed data. 51 | * @param out output buffer 52 | * @param outlen size of output buffer, number of bytes left are returned here 53 | * @param in input buffer 54 | * @param inlen size of input buffer, number of bytes left are returned here 55 | * @return 0 on success, otherwise a combination of the error flags above 56 | * 57 | * Make sure all buffers are appropriately padded, in must provide 58 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. 59 | */ 60 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_LZO_H */ 67 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * @ingroup lavu 22 | * Utility Preprocessor macros 23 | */ 24 | 25 | #ifndef AVUTIL_MACROS_H 26 | #define AVUTIL_MACROS_H 27 | 28 | /** 29 | * @addtogroup preproc_misc Preprocessor String Macros 30 | * 31 | * String manipulation macros 32 | * 33 | * @{ 34 | */ 35 | 36 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 37 | #define AV_TOSTRING(s) #s 38 | 39 | #define AV_GLUE(a, b) a ## b 40 | #define AV_JOIN(a, b) AV_GLUE(a, b) 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | #define AV_PRAGMA(s) _Pragma(#s) 47 | 48 | #endif /* AVUTIL_MACROS_H */ 49 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MD5_H 22 | #define AVUTIL_MD5_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_md5 MD5 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_md5_size; 36 | 37 | struct AVMD5; 38 | 39 | /** 40 | * Allocate an AVMD5 context. 41 | */ 42 | struct AVMD5 *av_md5_alloc(void); 43 | 44 | /** 45 | * Initialize MD5 hashing. 46 | * 47 | * @param ctx pointer to the function context (of size av_md5_size) 48 | */ 49 | void av_md5_init(struct AVMD5 *ctx); 50 | 51 | /** 52 | * Update hash value. 53 | * 54 | * @param ctx hash function context 55 | * @param src input data to update hash with 56 | * @param len input data length 57 | */ 58 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); 59 | 60 | /** 61 | * Finish hashing and output digest value. 62 | * 63 | * @param ctx hash function context 64 | * @param dst buffer where output digest value is stored 65 | */ 66 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 67 | 68 | /** 69 | * Hash an array of data. 70 | * 71 | * @param dst The output buffer to write the digest into 72 | * @param src The data to hash 73 | * @param len The length of the data, in bytes 74 | */ 75 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | #endif /* AVUTIL_MD5_H */ 82 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/murmur3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Reimar Döffinger 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MURMUR3_H 22 | #define AVUTIL_MURMUR3_H 23 | 24 | #include 25 | 26 | struct AVMurMur3 *av_murmur3_alloc(void); 27 | void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); 28 | void av_murmur3_init(struct AVMurMur3 *c); 29 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); 30 | void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); 31 | 32 | #endif /* AVUTIL_MURMUR3_H */ 33 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/random_seed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Baptiste Coudurier 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get a seed to use in conjunction with random functions. 32 | * This function tries to provide a good seed at a best effort bases. 33 | * Its possible to call this function multiple times if more bits are needed. 34 | * It can be quite slow, which is why it should only be used as seed for a faster 35 | * PRNG. The quality of the seed depends on the platform. 36 | */ 37 | uint32_t av_get_random_seed(void); 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | #endif /* AVUTIL_RANDOM_SEED_H */ 44 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/rational.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rational numbers 3 | * Copyright (c) 2003 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * rational numbers 25 | * @author Michael Niedermayer 26 | */ 27 | 28 | #ifndef AVUTIL_RATIONAL_H 29 | #define AVUTIL_RATIONAL_H 30 | 31 | #include 32 | #include 33 | #include "attributes.h" 34 | 35 | /** 36 | * @addtogroup lavu_math 37 | * @{ 38 | */ 39 | 40 | /** 41 | * rational number numerator/denominator 42 | */ 43 | typedef struct AVRational{ 44 | int num; ///< numerator 45 | int den; ///< denominator 46 | } AVRational; 47 | 48 | /** 49 | * Create a rational. 50 | * Useful for compilers that do not support compound literals. 51 | * @note The return value is not reduced. 52 | */ 53 | static inline AVRational av_make_q(int num, int den) 54 | { 55 | AVRational r = { num, den }; 56 | return r; 57 | } 58 | 59 | /** 60 | * Compare two rationals. 61 | * @param a first rational 62 | * @param b second rational 63 | * @return 0 if a==b, 1 if a>b, -1 if a>63)|1; 70 | else if(b.den && a.den) return 0; 71 | else if(a.num && b.num) return (a.num>>31) - (b.num>>31); 72 | else return INT_MIN; 73 | } 74 | 75 | /** 76 | * Convert rational to double. 77 | * @param a rational to convert 78 | * @return (double) a 79 | */ 80 | static inline double av_q2d(AVRational a){ 81 | return a.num / (double) a.den; 82 | } 83 | 84 | /** 85 | * Reduce a fraction. 86 | * This is useful for framerate calculations. 87 | * @param dst_num destination numerator 88 | * @param dst_den destination denominator 89 | * @param num source numerator 90 | * @param den source denominator 91 | * @param max the maximum allowed for dst_num & dst_den 92 | * @return 1 if exact, 0 otherwise 93 | */ 94 | int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); 95 | 96 | /** 97 | * Multiply two rationals. 98 | * @param b first rational 99 | * @param c second rational 100 | * @return b*c 101 | */ 102 | AVRational av_mul_q(AVRational b, AVRational c) av_const; 103 | 104 | /** 105 | * Divide one rational by another. 106 | * @param b first rational 107 | * @param c second rational 108 | * @return b/c 109 | */ 110 | AVRational av_div_q(AVRational b, AVRational c) av_const; 111 | 112 | /** 113 | * Add two rationals. 114 | * @param b first rational 115 | * @param c second rational 116 | * @return b+c 117 | */ 118 | AVRational av_add_q(AVRational b, AVRational c) av_const; 119 | 120 | /** 121 | * Subtract one rational from another. 122 | * @param b first rational 123 | * @param c second rational 124 | * @return b-c 125 | */ 126 | AVRational av_sub_q(AVRational b, AVRational c) av_const; 127 | 128 | /** 129 | * Invert a rational. 130 | * @param q value 131 | * @return 1 / q 132 | */ 133 | static av_always_inline AVRational av_inv_q(AVRational q) 134 | { 135 | AVRational r = { q.den, q.num }; 136 | return r; 137 | } 138 | 139 | /** 140 | * Convert a double precision floating point number to a rational. 141 | * inf is expressed as {1,0} or {-1,0} depending on the sign. 142 | * 143 | * @param d double to convert 144 | * @param max the maximum allowed numerator and denominator 145 | * @return (AVRational) d 146 | */ 147 | AVRational av_d2q(double d, int max) av_const; 148 | 149 | /** 150 | * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer 151 | * than q1, 0 if they have the same distance. 152 | */ 153 | int av_nearer_q(AVRational q, AVRational q1, AVRational q2); 154 | 155 | /** 156 | * Find the nearest value in q_list to q. 157 | * @param q_list an array of rationals terminated by {0, 0} 158 | * @return the index of the nearest value found in the array 159 | */ 160 | int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | #endif /* AVUTIL_RATIONAL_H */ 167 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_RIPEMD_H 23 | #define AVUTIL_RIPEMD_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | /** 31 | * @defgroup lavu_ripemd RIPEMD 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_ripemd_size; 37 | 38 | struct AVRIPEMD; 39 | 40 | /** 41 | * Allocate an AVRIPEMD context. 42 | */ 43 | struct AVRIPEMD *av_ripemd_alloc(void); 44 | 45 | /** 46 | * Initialize RIPEMD hashing. 47 | * 48 | * @param context pointer to the function context (of size av_ripemd_size) 49 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 50 | * @return zero if initialization succeeded, -1 otherwise 51 | */ 52 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 53 | 54 | /** 55 | * Update hash value. 56 | * 57 | * @param context hash function context 58 | * @param data input data to update hash with 59 | * @param len input data length 60 | */ 61 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); 62 | 63 | /** 64 | * Finish hashing and output digest value. 65 | * 66 | * @param context hash function context 67 | * @param digest buffer where output digest value is stored 68 | */ 69 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /* AVUTIL_RIPEMD_H */ 76 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_SHA_H 22 | #define AVUTIL_SHA_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_sha SHA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_sha_size; 36 | 37 | struct AVSHA; 38 | 39 | /** 40 | * Allocate an AVSHA context. 41 | */ 42 | struct AVSHA *av_sha_alloc(void); 43 | 44 | /** 45 | * Initialize SHA-1 or SHA-2 hashing. 46 | * 47 | * @param context pointer to the function context (of size av_sha_size) 48 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) 49 | * @return zero if initialization succeeded, -1 otherwise 50 | */ 51 | int av_sha_init(struct AVSHA* context, int bits); 52 | 53 | /** 54 | * Update hash value. 55 | * 56 | * @param context hash function context 57 | * @param data input data to update hash with 58 | * @param len input data length 59 | */ 60 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); 61 | 62 | /** 63 | * Finish hashing and output digest value. 64 | * 65 | * @param context hash function context 66 | * @param digest buffer where output digest value is stored 67 | */ 68 | void av_sha_final(struct AVSHA* context, uint8_t *digest); 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | #endif /* AVUTIL_SHA_H */ 75 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/sha512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_SHA512_H 23 | #define AVUTIL_SHA512_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | /** 31 | * @defgroup lavu_sha512 SHA512 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_sha512_size; 37 | 38 | struct AVSHA512; 39 | 40 | /** 41 | * Allocate an AVSHA512 context. 42 | */ 43 | struct AVSHA512 *av_sha512_alloc(void); 44 | 45 | /** 46 | * Initialize SHA-2 512 hashing. 47 | * 48 | * @param context pointer to the function context (of size av_sha512_size) 49 | * @param bits number of bits in digest (224, 256, 384 or 512 bits) 50 | * @return zero if initialization succeeded, -1 otherwise 51 | */ 52 | int av_sha512_init(struct AVSHA512* context, int bits); 53 | 54 | /** 55 | * Update hash value. 56 | * 57 | * @param context hash function context 58 | * @param data input data to update hash with 59 | * @param len input data length 60 | */ 61 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); 62 | 63 | /** 64 | * Finish hashing and output digest value. 65 | * 66 | * @param context hash function context 67 | * @param digest buffer where output digest value is stored 68 | */ 69 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest); 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /* AVUTIL_SHA512_H */ 76 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/stereo3d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Vittorio Giovara 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | 23 | #include "frame.h" 24 | 25 | /** 26 | * List of possible 3D Types 27 | */ 28 | enum AVStereo3DType { 29 | /** 30 | * Video is not stereoscopic (and metadata has to be there). 31 | */ 32 | AV_STEREO3D_2D, 33 | 34 | /** 35 | * Views are next to each other. 36 | * 37 | * LLLLRRRR 38 | * LLLLRRRR 39 | * LLLLRRRR 40 | * ... 41 | */ 42 | AV_STEREO3D_SIDEBYSIDE, 43 | 44 | /** 45 | * Views are on top of each other. 46 | * 47 | * LLLLLLLL 48 | * LLLLLLLL 49 | * RRRRRRRR 50 | * RRRRRRRR 51 | */ 52 | AV_STEREO3D_TOPBOTTOM, 53 | 54 | /** 55 | * Views are alternated temporally. 56 | * 57 | * frame0 frame1 frame2 ... 58 | * LLLLLLLL RRRRRRRR LLLLLLLL 59 | * LLLLLLLL RRRRRRRR LLLLLLLL 60 | * LLLLLLLL RRRRRRRR LLLLLLLL 61 | * ... ... ... 62 | */ 63 | AV_STEREO3D_FRAMESEQUENCE, 64 | 65 | /** 66 | * Views are packed in a checkerboard-like structure per pixel. 67 | * 68 | * LRLRLRLR 69 | * RLRLRLRL 70 | * LRLRLRLR 71 | * ... 72 | */ 73 | AV_STEREO3D_CHECKERBOARD, 74 | 75 | /** 76 | * Views are next to each other, but when upscaling 77 | * apply a checkerboard pattern. 78 | * 79 | * LLLLRRRR L L L L R R R R 80 | * LLLLRRRR => L L L L R R R R 81 | * LLLLRRRR L L L L R R R R 82 | * LLLLRRRR L L L L R R R R 83 | */ 84 | AV_STEREO3D_SIDEBYSIDE_QUINCUNX, 85 | 86 | /** 87 | * Views are packed per line, as if interlaced. 88 | * 89 | * LLLLLLLL 90 | * RRRRRRRR 91 | * LLLLLLLL 92 | * ... 93 | */ 94 | AV_STEREO3D_LINES, 95 | 96 | /** 97 | * Views are packed per column. 98 | * 99 | * LRLRLRLR 100 | * LRLRLRLR 101 | * LRLRLRLR 102 | * ... 103 | */ 104 | AV_STEREO3D_COLUMNS, 105 | }; 106 | 107 | 108 | /** 109 | * Inverted views, Right/Bottom represents the left view. 110 | */ 111 | #define AV_STEREO3D_FLAG_INVERT (1 << 0) 112 | 113 | /** 114 | * Stereo 3D type: this structure describes how two videos are packed 115 | * within a single video surface, with additional information as needed. 116 | * 117 | * @note The struct must be allocated with av_stereo3d_alloc() and 118 | * its size is not a part of the public ABI. 119 | */ 120 | typedef struct AVStereo3D { 121 | /** 122 | * How views are packed within the video. 123 | */ 124 | enum AVStereo3DType type; 125 | 126 | /** 127 | * Additional information about the frame packing. 128 | */ 129 | int flags; 130 | } AVStereo3D; 131 | 132 | /** 133 | * Allocate an AVStereo3D structure and set its fields to default values. 134 | * The resulting struct can be freed using av_freep(). 135 | * 136 | * @return An AVStereo3D filled with default values or NULL on failure. 137 | */ 138 | AVStereo3D *av_stereo3d_alloc(void); 139 | 140 | /** 141 | * Allocate a complete AVFrameSideData and add it to the frame. 142 | * 143 | * @param frame The frame which side data is added to. 144 | * 145 | * @return The AVStereo3D structure to be filled by caller. 146 | */ 147 | AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); 148 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_TIME_H 22 | #define AVUTIL_TIME_H 23 | 24 | #include 25 | 26 | /** 27 | * Get the current time in microseconds. 28 | */ 29 | int64_t av_gettime(void); 30 | 31 | /** 32 | * Sleep for a period of time. Although the duration is expressed in 33 | * microseconds, the actual delay may be rounded to the precision of the 34 | * system timer. 35 | * 36 | * @param usec Number of microseconds to sleep. 37 | * @return zero on success or (negative) error code. 38 | */ 39 | int av_usleep(unsigned usec); 40 | 41 | #endif /* AVUTIL_TIME_H */ 42 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/timestamp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * timestamp utils, mostly useful for debugging/logging purposes 22 | */ 23 | 24 | #ifndef AVUTIL_TIMESTAMP_H 25 | #define AVUTIL_TIMESTAMP_H 26 | 27 | #include "common.h" 28 | 29 | #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) 30 | #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS 31 | #endif 32 | 33 | #define AV_TS_MAX_STRING_SIZE 32 34 | 35 | /** 36 | * Fill the provided buffer with a string containing a timestamp 37 | * representation. 38 | * 39 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 40 | * @param ts the timestamp to represent 41 | * @return the buffer in input 42 | */ 43 | static inline char *av_ts_make_string(char *buf, int64_t ts) 44 | { 45 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 46 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64, ts); 47 | return buf; 48 | } 49 | 50 | /** 51 | * Convenience macro, the return value should be used only directly in 52 | * function arguments but never stand-alone. 53 | */ 54 | #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) 55 | 56 | /** 57 | * Fill the provided buffer with a string containing a timestamp time 58 | * representation. 59 | * 60 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 61 | * @param ts the timestamp to represent 62 | * @param tb the timebase of the timestamp 63 | * @return the buffer in input 64 | */ 65 | static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) 66 | { 67 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 68 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); 69 | return buf; 70 | } 71 | 72 | /** 73 | * Convenience macro, the return value should be used only directly in 74 | * function arguments but never stand-alone. 75 | */ 76 | #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) 77 | 78 | #endif /* AVUTIL_TIMESTAMP_H */ 79 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libavutil/xtea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the XTEA algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_XTEA_H 23 | #define AVUTIL_XTEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil XTEA algorithm 30 | * @defgroup lavu_xtea XTEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | typedef struct AVXTEA { 36 | uint32_t key[16]; 37 | } AVXTEA; 38 | 39 | /** 40 | * Initialize an AVXTEA context. 41 | * 42 | * @param ctx an AVXTEA context 43 | * @param key a key of 16 bytes used for encryption/decryption 44 | */ 45 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); 46 | 47 | /** 48 | * Encrypt or decrypt a buffer using a previously initialized context. 49 | * 50 | * @param ctx an AVXTEA context 51 | * @param dst destination array, can be equal to src 52 | * @param src source array, can be equal to dst 53 | * @param count number of 8 byte blocks 54 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 55 | * @param decrypt 0 for encryption, 1 for decryption 56 | */ 57 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 58 | int count, uint8_t *iv, int decrypt); 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | #endif /* AVUTIL_XTEA_H */ 65 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libswresample/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of libswresample 5 | * 6 | * libswresample is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * libswresample is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with libswresample; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SWR_VERSION_H 22 | #define SWR_VERSION_H 23 | 24 | /** 25 | * @file 26 | * Libswresample version macros 27 | */ 28 | 29 | #include "libavutil/avutil.h" 30 | 31 | #define LIBSWRESAMPLE_VERSION_MAJOR 0 32 | #define LIBSWRESAMPLE_VERSION_MINOR 18 33 | #define LIBSWRESAMPLE_VERSION_MICRO 100 34 | 35 | #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ 36 | LIBSWRESAMPLE_VERSION_MINOR, \ 37 | LIBSWRESAMPLE_VERSION_MICRO) 38 | #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ 39 | LIBSWRESAMPLE_VERSION_MINOR, \ 40 | LIBSWRESAMPLE_VERSION_MICRO) 41 | #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT 42 | 43 | #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) 44 | 45 | #endif /* SWR_VERSION_H */ 46 | -------------------------------------------------------------------------------- /jni/ffmpeg/include/libswscale/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SWSCALE_VERSION_H 20 | #define SWSCALE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * swscale version macros 25 | */ 26 | 27 | #include "libavutil/version.h" 28 | 29 | #define LIBSWSCALE_VERSION_MAJOR 2 30 | #define LIBSWSCALE_VERSION_MINOR 5 31 | #define LIBSWSCALE_VERSION_MICRO 102 32 | 33 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ 34 | LIBSWSCALE_VERSION_MINOR, \ 35 | LIBSWSCALE_VERSION_MICRO) 36 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ 37 | LIBSWSCALE_VERSION_MINOR, \ 38 | LIBSWSCALE_VERSION_MICRO) 39 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT 40 | 41 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) 42 | 43 | /** 44 | * FF_API_* defines may be placed below to indicate public API that will be 45 | * dropped at a future version bump. The defines themselves are not part of 46 | * the public API and may change, break or disappear at any time. 47 | */ 48 | 49 | #ifndef FF_API_SWS_GETCONTEXT 50 | #define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3) 51 | #endif 52 | #ifndef FF_API_SWS_CPU_CAPS 53 | #define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3) 54 | #endif 55 | #ifndef FF_API_SWS_FORMAT_NAME 56 | #define FF_API_SWS_FORMAT_NAME (LIBSWSCALE_VERSION_MAJOR < 3) 57 | #endif 58 | 59 | #endif /* SWSCALE_VERSION_H */ 60 | -------------------------------------------------------------------------------- /jni/ffmpeg/lib/libavcodec.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/ffmpeg/lib/libavcodec.a -------------------------------------------------------------------------------- /jni/ffmpeg/lib/libavformat.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/ffmpeg/lib/libavformat.a -------------------------------------------------------------------------------- /jni/ffmpeg/lib/libavutil.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/ffmpeg/lib/libavutil.a -------------------------------------------------------------------------------- /jni/ffmpeg/lib/libfaac.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/ffmpeg/lib/libfaac.a -------------------------------------------------------------------------------- /jni/ffmpeg/lib/libswresample.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/ffmpeg/lib/libswresample.a -------------------------------------------------------------------------------- /jni/ffmpeg/lib/libswscale.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/ffmpeg/lib/libswscale.a -------------------------------------------------------------------------------- /jni/ffmpeg/lib/libx264.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/ffmpeg/lib/libx264.a -------------------------------------------------------------------------------- /jni/io/ANativeWindowRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef OPENAMEDIA_ANATIVE_WINDOW_RENDERER_H 22 | #define OPENAMEDIA_ANATIVE_WINDOW_RENDERER_H 23 | 24 | #include 25 | #include "android/ColorConverter.h" 26 | 27 | #include "Common.h" 28 | #include "android/MetaData.h" 29 | #include "android/MediaBuffer.h" 30 | 31 | namespace openamedia { 32 | 33 | class ANativeWindowRenderer { 34 | public: 35 | ANativeWindowRenderer(ANativeWindow* window, MetaData* meta); 36 | ~ANativeWindowRenderer(); 37 | 38 | bool init(); 39 | bool deInit(); 40 | 41 | void render(MediaBuffer* buffer); 42 | 43 | private: 44 | ANativeWindow* mNativeWindow; 45 | ColorConverter* mConverter; 46 | 47 | MetaData* mMetaData; 48 | bool mInited; 49 | 50 | int mWidth; 51 | int mHeight; 52 | 53 | int mCropTop; 54 | int mCropLeft; 55 | int mCropRight; 56 | int mCropBottom; 57 | int mCropWidth; 58 | int mCropHeight; 59 | 60 | ARect mRect; 61 | 62 | void reset(); 63 | 64 | ANativeWindowRenderer(const ANativeWindowRenderer&); 65 | ANativeWindowRenderer& operator=(const ANativeWindowRenderer&); 66 | }; 67 | 68 | }//namespace 69 | 70 | #endif//ANATIVE_WINDOW_RENDERER_H 71 | -------------------------------------------------------------------------------- /jni/io/OpenSLRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jim Qian 3 | * 4 | * This file is part of OpenaMedia-C(client). 5 | * 6 | * OpenaMedia-C is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with OpenaMedia-C; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef OPENAMEDIA_OPENSL_RECORDER_H 22 | #define OPENAMEDIA_OPENSL_RECORDER_H 23 | 24 | extern "C" 25 | { 26 | #include 27 | #include 28 | } 29 | 30 | #include 31 | 32 | #include "android/MetaData.h" 33 | #include "Common.h" 34 | 35 | namespace openamedia { 36 | 37 | class OpenSLRecorder { 38 | public: 39 | OpenSLRecorder(bool (*acquireBuffer)( void** data, int* dataSize, void* context), void* context); 40 | ~OpenSLRecorder(); 41 | 42 | bool init(int sampleRate, int channels); 43 | 44 | bool start(void* data, int dataSize); 45 | bool stop(); 46 | 47 | private: 48 | bool mInited; 49 | bool mStarted; 50 | MetaData* mMetaData; 51 | 52 | // engine interfaces 53 | SLObjectItf engineObject; 54 | SLEngineItf engineEngine; 55 | 56 | // output mix interfaces 57 | SLObjectItf outputMixObject; 58 | SLEnvironmentalReverbItf outputMixEnvironmentalReverb; 59 | 60 | // buffer queue player interfaces 61 | SLObjectItf recorderObject; 62 | SLRecordItf recorderRecord; 63 | SLAndroidSimpleBufferQueueItf recorderBufferQueue; 64 | static SLEnvironmentalReverbSettings reverbSettings; 65 | 66 | bool deInit(); 67 | void reset(); 68 | 69 | static void bqRecorderCallback(SLAndroidSimpleBufferQueueItf bq, void *context); 70 | void bufferQueueCallback(SLAndroidSimpleBufferQueueItf bq); 71 | 72 | bool (*mAcquireBuffer)(void**, int*, void*); 73 | void* mAcquireBufferContext; 74 | 75 | OpenSLRecorder(const OpenSLRecorder&); 76 | OpenSLRecorder& operator=(const OpenSLRecorder&); 77 | }; 78 | 79 | }//namespace 80 | 81 | #endif//OPENAMEDIA_OPENSL_MIXER_H 82 | -------------------------------------------------------------------------------- /jni/openmax/OMX_IndexExt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 The Khronos Group Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject 10 | * to the following conditions: 11 | * The above copyright notice and this permission notice shall be included 12 | * in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | /** @file OMX_IndexExt.h - OpenMax IL version 1.1.2 25 | * The OMX_IndexExt header file contains extensions to the definitions 26 | * for both applications and components . 27 | */ 28 | 29 | #ifndef OMX_IndexExt_h 30 | #define OMX_IndexExt_h 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif /* __cplusplus */ 35 | 36 | /* Each OMX header shall include all required header files to allow the 37 | * header to compile without errors. The includes below are required 38 | * for this header file to compile successfully 39 | */ 40 | #include 41 | 42 | 43 | /** Khronos standard extension indices. 44 | 45 | This enum lists the current Khronos extension indices to OpenMAX IL. 46 | */ 47 | typedef enum OMX_INDEXEXTTYPE { 48 | 49 | /* Component parameters and configurations */ 50 | OMX_IndexExtComponentStartUnused = OMX_IndexKhronosExtensions + 0x00100000, 51 | OMX_IndexConfigCallbackRequest, /**< reference: OMX_CONFIG_CALLBACKREQUESTTYPE */ 52 | OMX_IndexConfigCommitMode, /**< reference: OMX_CONFIG_COMMITMODETYPE */ 53 | OMX_IndexConfigCommit, /**< reference: OMX_CONFIG_COMMITTYPE */ 54 | 55 | /* Port parameters and configurations */ 56 | OMX_IndexExtPortStartUnused = OMX_IndexKhronosExtensions + 0x00200000, 57 | 58 | /* Audio parameters and configurations */ 59 | OMX_IndexExtAudioStartUnused = OMX_IndexKhronosExtensions + 0x00400000, 60 | 61 | /* Image parameters and configurations */ 62 | OMX_IndexExtImageStartUnused = OMX_IndexKhronosExtensions + 0x00500000, 63 | 64 | /* Video parameters and configurations */ 65 | OMX_IndexExtVideoStartUnused = OMX_IndexKhronosExtensions + 0x00600000, 66 | OMX_IndexParamNalStreamFormatSupported, /**< reference: OMX_NALSTREAMFORMATTYPE */ 67 | OMX_IndexParamNalStreamFormat, /**< reference: OMX_NALSTREAMFORMATTYPE */ 68 | OMX_IndexParamNalStreamFormatSelect, /**< reference: OMX_NALSTREAMFORMATTYPE */ 69 | OMX_IndexParamVideoVp8, /**< reference: OMX_VIDEO_PARAM_VP8TYPE */ 70 | OMX_IndexConfigVideoVp8ReferenceFrame, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMETYPE */ 71 | OMX_IndexConfigVideoVp8ReferenceFrameType, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE */ 72 | 73 | /* Image & Video common configurations */ 74 | OMX_IndexExtCommonStartUnused = OMX_IndexKhronosExtensions + 0x00700000, 75 | 76 | /* Other configurations */ 77 | OMX_IndexExtOtherStartUnused = OMX_IndexKhronosExtensions + 0x00800000, 78 | 79 | /* Time configurations */ 80 | OMX_IndexExtTimeStartUnused = OMX_IndexKhronosExtensions + 0x00900000, 81 | 82 | OMX_IndexExtMax = 0x7FFFFFFF 83 | } OMX_INDEXEXTTYPE; 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif /* __cplusplus */ 88 | 89 | #endif /* OMX_IndexExt_h */ 90 | /* File EOF */ 91 | -------------------------------------------------------------------------------- /jni/openmax/OMX_Other.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/jni/openmax/OMX_Other.h -------------------------------------------------------------------------------- /jni/openmax/OMX_VideoExt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 The Khronos Group Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject 10 | * to the following conditions: 11 | * The above copyright notice and this permission notice shall be included 12 | * in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | /** OMX_VideoExt.h - OpenMax IL version 1.1.2 25 | * The OMX_VideoExt header file contains extensions to the 26 | * definitions used by both the application and the component to 27 | * access video items. 28 | */ 29 | 30 | #ifndef OMX_VideoExt_h 31 | #define OMX_VideoExt_h 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif /* __cplusplus */ 36 | 37 | /* Each OMX header shall include all required header files to allow the 38 | * header to compile without errors. The includes below are required 39 | * for this header file to compile successfully 40 | */ 41 | #include 42 | 43 | /** NALU Formats */ 44 | typedef enum OMX_NALUFORMATSTYPE { 45 | OMX_NaluFormatStartCodes = 1, 46 | OMX_NaluFormatOneNaluPerBuffer = 2, 47 | OMX_NaluFormatOneByteInterleaveLength = 4, 48 | OMX_NaluFormatTwoByteInterleaveLength = 8, 49 | OMX_NaluFormatFourByteInterleaveLength = 16, 50 | OMX_NaluFormatCodingMax = 0x7FFFFFFF 51 | } OMX_NALUFORMATSTYPE; 52 | 53 | /** NAL Stream Format */ 54 | typedef struct OMX_NALSTREAMFORMATTYPE{ 55 | OMX_U32 nSize; 56 | OMX_VERSIONTYPE nVersion; 57 | OMX_U32 nPortIndex; 58 | OMX_NALUFORMATSTYPE eNaluFormat; 59 | } OMX_NALSTREAMFORMATTYPE; 60 | 61 | /** Enum for standard video codingtype extensions */ 62 | typedef enum OMX_VIDEO_CODINGEXTTYPE { 63 | OMX_VIDEO_ExtCodingUnused = OMX_VIDEO_CodingKhronosExtensions, 64 | OMX_VIDEO_CodingVP8, /**< VP8/WebM */ 65 | } OMX_VIDEO_CODINGEXTTYPE; 66 | 67 | /** VP8 profiles */ 68 | typedef enum OMX_VIDEO_VP8PROFILETYPE { 69 | OMX_VIDEO_VP8ProfileMain = 0x01, 70 | OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF, 71 | OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF 72 | } OMX_VIDEO_VP8PROFILETYPE; 73 | 74 | /** VP8 levels */ 75 | typedef enum OMX_VIDEO_VP8LEVELTYPE { 76 | OMX_VIDEO_VP8Level_Version0 = 0x01, 77 | OMX_VIDEO_VP8Level_Version1 = 0x02, 78 | OMX_VIDEO_VP8Level_Version2 = 0x04, 79 | OMX_VIDEO_VP8Level_Version3 = 0x08, 80 | OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF, 81 | OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF 82 | } OMX_VIDEO_VP8LEVELTYPE; 83 | 84 | /** VP8 Param */ 85 | typedef struct OMX_VIDEO_PARAM_VP8TYPE { 86 | OMX_U32 nSize; 87 | OMX_VERSIONTYPE nVersion; 88 | OMX_U32 nPortIndex; 89 | OMX_VIDEO_VP8PROFILETYPE eProfile; 90 | OMX_VIDEO_VP8LEVELTYPE eLevel; 91 | OMX_U32 nDCTPartitions; 92 | OMX_BOOL bErrorResilientMode; 93 | } OMX_VIDEO_PARAM_VP8TYPE; 94 | 95 | /** Structure for configuring VP8 reference frames */ 96 | typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE { 97 | OMX_U32 nSize; 98 | OMX_VERSIONTYPE nVersion; 99 | OMX_U32 nPortIndex; 100 | OMX_BOOL bPreviousFrameRefresh; 101 | OMX_BOOL bGoldenFrameRefresh; 102 | OMX_BOOL bAlternateFrameRefresh; 103 | OMX_BOOL bUsePreviousFrame; 104 | OMX_BOOL bUseGoldenFrame; 105 | OMX_BOOL bUseAlternateFrame; 106 | } OMX_VIDEO_VP8REFERENCEFRAMETYPE; 107 | 108 | /** Structure for querying VP8 reference frame type */ 109 | typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE { 110 | OMX_U32 nSize; 111 | OMX_VERSIONTYPE nVersion; 112 | OMX_U32 nPortIndex; 113 | OMX_BOOL bIsIntraFrame; 114 | OMX_BOOL bIsGoldenOrAlternateFrame; 115 | } OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE; 116 | 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif /* __cplusplus */ 121 | 122 | #endif /* OMX_VideoExt_h */ 123 | /* File EOF */ 124 | -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/libs/android-support-v4.jar -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-18 15 | android.library.reference.1=../../workspace/OpenaMedia-R/appcompat_v7 16 | -------------------------------------------------------------------------------- /res/drawable-hdpi/controller_record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-hdpi/controller_record.png -------------------------------------------------------------------------------- /res/drawable-hdpi/controller_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-hdpi/controller_stop.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/controller_record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-mdpi/controller_record.png -------------------------------------------------------------------------------- /res/drawable-mdpi/controller_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-mdpi/controller_stop.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/controller_record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-xhdpi/controller_record.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/controller_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-xhdpi/controller_stop.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/controller_record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-xxhdpi/controller_record.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/controller_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-xxhdpi/controller_stop.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openamedia/recorder/30cd64060ff0b6ada61037faef5f387b94909bed/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 18 | 19 | 20 | 23 | 29 | 30 | 31 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OpenaMedia-R 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/com/openamedia/recorder/ARecorder.java: -------------------------------------------------------------------------------- 1 | package com.openamedia.recorder; 2 | 3 | import java.lang.ref.WeakReference; 4 | 5 | import android.os.Handler; 6 | import android.os.Looper; 7 | import android.os.Message; 8 | import android.view.Surface; 9 | import android.view.SurfaceHolder; 10 | 11 | public class ARecorder { 12 | 13 | private ARecorderListener mListener; 14 | public interface ARecorderListener { 15 | public void onStart(); 16 | } 17 | 18 | private Handler mEventHandler = null; 19 | 20 | private class EventHandler extends Handler { 21 | private ARecorder mRecorder = null; 22 | 23 | public EventHandler(ARecorder ar, Looper looper) { 24 | super(looper); 25 | mRecorder = ar; 26 | } 27 | 28 | @Override 29 | public void handleMessage(Message msg) { 30 | switch(msg.what) { 31 | case NATIVE_MSG_START_DONE: 32 | if(mListener != null) 33 | mListener.onStart(); 34 | break; 35 | default: 36 | break; 37 | } 38 | } 39 | } 40 | 41 | public ARecorder() { 42 | Looper looper; 43 | if ((looper = Looper.myLooper()) != null) { 44 | mEventHandler = new EventHandler(this, looper); 45 | } else if ((looper = Looper.getMainLooper()) != null) { 46 | mEventHandler = new EventHandler(this, looper); 47 | } else { 48 | mEventHandler = null; 49 | } 50 | 51 | nativeSetup(new WeakReference(this)); 52 | } 53 | 54 | private static void postEventFromNative(Object arecorder_ref, int what, int arg1, int arg2, byte[] bytes) { 55 | ARecorder mr = (ARecorder)((WeakReference)arecorder_ref).get(); 56 | if (mr == null) { 57 | return; 58 | } 59 | 60 | if (mr.mEventHandler != null) { 61 | Message m = mr.mEventHandler.obtainMessage(what, arg1, arg2); 62 | m.obj = bytes; 63 | mr.mEventHandler.sendMessage(m); 64 | } 65 | } 66 | 67 | static { 68 | System.loadLibrary("stlport_shared"); 69 | System.loadLibrary("arecorder-jni"); 70 | nativeInit(); 71 | } 72 | 73 | public void setListener(ARecorderListener listener){ 74 | mListener = listener; 75 | } 76 | 77 | public void setOutputFile(String path){ 78 | nativeSetOutputFile(path); 79 | } 80 | 81 | public void setPreivew(SurfaceHolder holder){ 82 | nativeSetPreview(holder.getSurface()); 83 | } 84 | 85 | public void setChannels(int channels){ 86 | nativeSetChannels(channels); 87 | } 88 | 89 | public void setSampleRate(int sampleRate){ 90 | nativeSetSampleRate(sampleRate); 91 | } 92 | 93 | public void setVideoSize(int width, int height){ 94 | nativeSetVideoSize(width, height); 95 | } 96 | 97 | public void setColorFormat(String fmt){ 98 | nativeSetColorFormat(fmt); 99 | } 100 | 101 | public void start(){ 102 | nativeStart(); 103 | } 104 | 105 | public void stop(){ 106 | nativeStop(); 107 | } 108 | 109 | public void release(){ 110 | nativeRelease(); 111 | } 112 | 113 | public void writeVideo(byte[] yuv, int len){ 114 | nativeWriteVideo(yuv, len); 115 | } 116 | 117 | @Override 118 | protected void finalize() { 119 | nativeRelease(); 120 | } 121 | 122 | //native 123 | private int mNativeContext = 0; 124 | 125 | private static final int NATIVE_MSG_SET_OUTPUT_FILE_DONE = 0; 126 | private static final int NATIVE_MSG_SET_LISTENER_DONE = 1; 127 | private static final int NATIVE_MSG_SET_PARAMETER_DONE = 2; 128 | private static final int NATIVE_MSG_SET_PREVIEW_DONE = 3; 129 | private static final int NATIVE_MSG_START_DONE = 4; 130 | private static final int NATIVE_MSG_ERROR = 5; 131 | private static final int NATIVE_MSG_NOTIFY_LOG_INFO = 6; 132 | 133 | private native void nativeSetOutputFile(String path); 134 | private native void nativeSetPreview(Surface surface); 135 | private native void nativeSetChannels(int channels); 136 | private native void nativeSetSampleRate(int sampleRate); 137 | private native void nativeSetVideoSize(int width, int height); 138 | private native void nativeSetColorFormat(String fmt); 139 | private native void nativeStart(); 140 | private native void nativeStop(); 141 | private native void nativeRelease(); 142 | private native void nativeWriteVideo(byte[] yuv, int len); 143 | 144 | private native void setParameter(String nameValuePair); 145 | private native final void nativeSetup(Object arecorder_this); 146 | 147 | private static native void nativeInit(); 148 | } 149 | --------------------------------------------------------------------------------