├── Android.mk ├── H264EncService └── H264EncService.h ├── LICENSE ├── MediaRecorder.java ├── camdev.cpp ├── camdev.h ├── com_apical_dvr_ffRecorder.cpp ├── com_apical_dvr_ffRecorder.h ├── encodertest.cpp ├── ffencoder.cpp ├── ffencoder.h ├── ffjpeg.cpp ├── ffjpeg.h ├── ffmpeg ├── build_ffmpeg_for_android.sh ├── howto ├── include │ ├── libavcodec │ │ ├── avcodec.h │ │ ├── avdct.h │ │ ├── avfft.h │ │ ├── d3d11va.h │ │ ├── dirac.h │ │ ├── dv_profile.h │ │ ├── dxva2.h │ │ ├── jni.h │ │ ├── mediacodec.h │ │ ├── qsv.h │ │ ├── vaapi.h │ │ ├── vda.h │ │ ├── vdpau.h │ │ ├── version.h │ │ ├── videotoolbox.h │ │ ├── vorbis_parser.h │ │ └── xvmc.h │ ├── libavformat │ │ ├── avformat.h │ │ ├── avio.h │ │ └── version.h │ ├── libavutil │ │ ├── adler32.h │ │ ├── aes.h │ │ ├── aes_ctr.h │ │ ├── attributes.h │ │ ├── audio_fifo.h │ │ ├── avassert.h │ │ ├── avconfig.h │ │ ├── avstring.h │ │ ├── avutil.h │ │ ├── base64.h │ │ ├── blowfish.h │ │ ├── bprint.h │ │ ├── bswap.h │ │ ├── buffer.h │ │ ├── camellia.h │ │ ├── cast5.h │ │ ├── channel_layout.h │ │ ├── common.h │ │ ├── cpu.h │ │ ├── crc.h │ │ ├── des.h │ │ ├── dict.h │ │ ├── display.h │ │ ├── downmix_info.h │ │ ├── error.h │ │ ├── eval.h │ │ ├── ffversion.h │ │ ├── fifo.h │ │ ├── file.h │ │ ├── frame.h │ │ ├── hash.h │ │ ├── hmac.h │ │ ├── hwcontext.h │ │ ├── hwcontext_cuda.h │ │ ├── hwcontext_dxva2.h │ │ ├── hwcontext_qsv.h │ │ ├── hwcontext_vaapi.h │ │ ├── hwcontext_vdpau.h │ │ ├── imgutils.h │ │ ├── intfloat.h │ │ ├── intreadwrite.h │ │ ├── lfg.h │ │ ├── log.h │ │ ├── macros.h │ │ ├── mastering_display_metadata.h │ │ ├── mathematics.h │ │ ├── md5.h │ │ ├── mem.h │ │ ├── motion_vector.h │ │ ├── murmur3.h │ │ ├── opt.h │ │ ├── parseutils.h │ │ ├── pixdesc.h │ │ ├── pixelutils.h │ │ ├── pixfmt.h │ │ ├── random_seed.h │ │ ├── rational.h │ │ ├── rc4.h │ │ ├── replaygain.h │ │ ├── ripemd.h │ │ ├── samplefmt.h │ │ ├── sha.h │ │ ├── sha512.h │ │ ├── stereo3d.h │ │ ├── tea.h │ │ ├── threadmessage.h │ │ ├── time.h │ │ ├── timecode.h │ │ ├── timestamp.h │ │ ├── tree.h │ │ ├── twofish.h │ │ ├── version.h │ │ └── xtea.h │ ├── libswresample │ │ ├── swresample.h │ │ └── version.h │ ├── libswscale │ │ ├── swscale.h │ │ └── version.h │ ├── x264.h │ └── x264_config.h └── lib │ ├── libavcodec.a │ ├── libavformat.a │ ├── libavutil.a │ ├── libswresample.a │ ├── libswscale.a │ ├── libx264.a │ └── pkgconfig │ ├── libavcodec.pc │ ├── libavformat.pc │ ├── libavutil.pc │ ├── libswresample.pc │ ├── libswscale.pc │ └── x264.pc ├── ffrecorder.cpp ├── ffrecorder.h ├── ffutils.h ├── h264hwenc.h ├── h264hwenc_mediacodec.cpp ├── h264hwenc_mediaserver.cpp ├── micdev.h ├── micdev_android.h ├── micdev_audiorecord_jni.cpp ├── micdev_audiorecord_native.cpp ├── micdev_tinyalsa.cpp ├── micdev_tinyalsa.h ├── readme.txt ├── recordertest.cpp ├── release ├── CameraDVR.apk ├── encodertest ├── libffrecorder_jni.so ├── recordertest └── v4l2test ├── v4l2test.cpp └── watermark.h /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := v4l2test 6 | 7 | LOCAL_MODULE_TAGS := optional 8 | 9 | LOCAL_MODULE_PATH := $(TARGET_OUT)/bin 10 | 11 | LOCAL_SRC_FILES := \ 12 | v4l2test.cpp \ 13 | ffjpeg.cpp \ 14 | camdev.cpp 15 | 16 | LOCAL_SHARED_LIBRARIES := \ 17 | libutils \ 18 | libcutils \ 19 | libui \ 20 | libgui \ 21 | libandroid_runtime 22 | 23 | #++ for ffmpeg library 24 | LOCAL_CFLAGS += \ 25 | -D__STDC_CONSTANT_MACROS 26 | 27 | LOCAL_C_INCLUDES += \ 28 | $(LOCAL_PATH)/ffmpeg/include 29 | 30 | LOCAL_LDFLAGS += -ldl \ 31 | $(LOCAL_PATH)/ffmpeg/lib/libavformat.a \ 32 | $(LOCAL_PATH)/ffmpeg/lib/libavcodec.a \ 33 | $(LOCAL_PATH)/ffmpeg/lib/libswresample.a \ 34 | $(LOCAL_PATH)/ffmpeg/lib/libswscale.a \ 35 | $(LOCAL_PATH)/ffmpeg/lib/libavutil.a \ 36 | $(LOCAL_PATH)/ffmpeg/lib/libx264.a 37 | #-- for ffmpeg library 38 | 39 | LOCAL_MULTILIB := 32 40 | 41 | include $(BUILD_EXECUTABLE) 42 | 43 | 44 | 45 | include $(CLEAR_VARS) 46 | 47 | LOCAL_MODULE := encodertest 48 | 49 | LOCAL_MODULE_TAGS := optional 50 | 51 | LOCAL_MODULE_PATH := $(TARGET_OUT)/bin 52 | 53 | LOCAL_SRC_FILES := \ 54 | ffjpeg.cpp \ 55 | ffencoder.cpp \ 56 | encodertest.cpp 57 | 58 | LOCAL_SHARED_LIBRARIES := \ 59 | libutils \ 60 | libcutils 61 | 62 | #++ for ffmpeg library 63 | LOCAL_CFLAGS += \ 64 | -D__STDC_CONSTANT_MACROS 65 | 66 | LOCAL_C_INCLUDES += \ 67 | $(LOCAL_PATH)/ffmpeg/include 68 | 69 | LOCAL_LDFLAGS += -ldl \ 70 | $(LOCAL_PATH)/ffmpeg/lib/libavformat.a \ 71 | $(LOCAL_PATH)/ffmpeg/lib/libavcodec.a \ 72 | $(LOCAL_PATH)/ffmpeg/lib/libswresample.a \ 73 | $(LOCAL_PATH)/ffmpeg/lib/libswscale.a \ 74 | $(LOCAL_PATH)/ffmpeg/lib/libavutil.a \ 75 | $(LOCAL_PATH)/ffmpeg/lib/libx264.a 76 | #-- for ffmpeg library 77 | 78 | LOCAL_MULTILIB := 32 79 | 80 | include $(BUILD_EXECUTABLE) 81 | 82 | 83 | 84 | include $(CLEAR_VARS) 85 | 86 | LOCAL_MODULE := recordertest 87 | 88 | LOCAL_MODULE_TAGS := optional 89 | 90 | LOCAL_MODULE_PATH := $(TARGET_OUT)/bin 91 | 92 | LOCAL_C_INCLUDES := external/tinyalsa/include 93 | 94 | LOCAL_SRC_FILES := \ 95 | micdev_tinyalsa.cpp \ 96 | camdev.cpp \ 97 | ffjpeg.cpp \ 98 | ffencoder.cpp \ 99 | ffrecorder.cpp \ 100 | recordertest.cpp 101 | 102 | LOCAL_SHARED_LIBRARIES := \ 103 | libutils \ 104 | libcutils \ 105 | libui \ 106 | libgui \ 107 | libandroid_runtime \ 108 | libtinyalsa 109 | 110 | #++ for ffmpeg library 111 | LOCAL_CFLAGS += \ 112 | -D__STDC_CONSTANT_MACROS 113 | 114 | LOCAL_C_INCLUDES += \ 115 | $(LOCAL_PATH)/ffmpeg/include 116 | 117 | LOCAL_LDFLAGS += -ldl \ 118 | $(LOCAL_PATH)/ffmpeg/lib/libavformat.a \ 119 | $(LOCAL_PATH)/ffmpeg/lib/libavcodec.a \ 120 | $(LOCAL_PATH)/ffmpeg/lib/libswresample.a \ 121 | $(LOCAL_PATH)/ffmpeg/lib/libswscale.a \ 122 | $(LOCAL_PATH)/ffmpeg/lib/libavutil.a \ 123 | $(LOCAL_PATH)/ffmpeg/lib/libx264.a 124 | #-- for ffmpeg library 125 | 126 | LOCAL_MULTILIB := 32 127 | 128 | include $(BUILD_EXECUTABLE) 129 | 130 | 131 | include $(CLEAR_VARS) 132 | 133 | LOCAL_MODULE := libffrecorder_jni 134 | 135 | LOCAL_MODULE_TAGS := optional 136 | 137 | LOCAL_CFLAGS += \ 138 | -DENABLE_MEDIARECORDER_JNI \ 139 | -DUSE_MICDEV_ANDROID \ 140 | -DUSE_MEDIASERVER_H264ENC \ 141 | -DPLATFORM_ALLWINNER_A33 142 | 143 | LOCAL_SRC_FILES := \ 144 | h264hwenc_mediacodec.cpp \ 145 | h264hwenc_mediaserver.cpp \ 146 | micdev_audiorecord_native.cpp \ 147 | camdev.cpp \ 148 | ffjpeg.cpp \ 149 | ffencoder.cpp \ 150 | ffrecorder.cpp \ 151 | com_apical_dvr_ffRecorder.cpp 152 | 153 | LOCAL_SHARED_LIBRARIES := \ 154 | libutils \ 155 | libcutils \ 156 | libbinder \ 157 | libui \ 158 | libgui \ 159 | libandroid_runtime \ 160 | libmedia \ 161 | libion_alloc 162 | 163 | #++ for ffmpeg library 164 | LOCAL_CFLAGS += \ 165 | -D__STDC_CONSTANT_MACROS 166 | 167 | LOCAL_C_INCLUDES += \ 168 | $(LOCAL_PATH)/ffmpeg/include 169 | 170 | LOCAL_LDFLAGS += -ldl \ 171 | $(LOCAL_PATH)/ffmpeg/lib/libavformat.a \ 172 | $(LOCAL_PATH)/ffmpeg/lib/libavcodec.a \ 173 | $(LOCAL_PATH)/ffmpeg/lib/libswresample.a \ 174 | $(LOCAL_PATH)/ffmpeg/lib/libswscale.a \ 175 | $(LOCAL_PATH)/ffmpeg/lib/libavutil.a \ 176 | $(LOCAL_PATH)/ffmpeg/lib/libx264.a 177 | #-- for ffmpeg library 178 | 179 | LOCAL_MULTILIB := 32 180 | 181 | include $(BUILD_SHARED_LIBRARY) 182 | 183 | -------------------------------------------------------------------------------- /H264EncService/H264EncService.h: -------------------------------------------------------------------------------- 1 | #ifndef __H264ENC_SERVICE_H__ 2 | #define __H264ENC_SERVICE_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace android; 9 | 10 | namespace android 11 | { 12 | class IH264EncService : public IInterface { 13 | public: 14 | DECLARE_META_INTERFACE(H264EncService); 15 | virtual int init(int iw, int ih, int ow, int oh, int frate, int bitrate) = 0; 16 | virtual void close(int handle) = 0; 17 | virtual int encode(int handle, int64_t pts, void *phyy, void *phyc, int timeout, void *param) = 0; 18 | }; 19 | 20 | enum { 21 | INIT = IBinder::FIRST_CALL_TRANSACTION, 22 | CLOSE, 23 | ENCODE, 24 | }; 25 | 26 | // server class 27 | class BnH264EncService: public BnInterface { 28 | public: 29 | virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); 30 | virtual int init(int iw, int ih, int ow, int oh, int frate, int bitrate); 31 | virtual void close(int handle); 32 | virtual int encode(int handle, int64_t pts, void *phyy, void *phyc, int timeout, void *param); 33 | }; 34 | 35 | // client class 36 | class BpH264EncService: public BpInterface { 37 | public: 38 | BpH264EncService(const sp& impl); 39 | virtual int init(int iw, int ih, int ow, int oh, int frate, int bitrate); 40 | virtual void close(int handle); 41 | virtual int encode(int handle, int64_t pts, void *phyy, void *phyc, int timeout, void *param); 42 | }; 43 | } 44 | 45 | #endif 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /MediaRecorder.java: -------------------------------------------------------------------------------- 1 | package com.apical.dvr; 2 | 3 | import android.content.Context; 4 | import android.graphics.SurfaceTexture; 5 | import android.view.SurfaceView; 6 | import android.util.Log; 7 | 8 | public class ffRecorder { 9 | private static final String TAG = "ffRecorder"; 10 | 11 | private static ffRecorder mSingleInstance = null; 12 | 13 | public static ffRecorder getInstance(Context context) { 14 | if (mSingleInstance == null) { 15 | mSingleInstance = new ffRecorder(); 16 | mSingleInstance.mContext = context; 17 | } 18 | return mSingleInstance; 19 | } 20 | 21 | private Context mContext = null; 22 | private long mRecorderContext = 0; 23 | 24 | public void init(int cam_main_w, int cam_main_h, int cam_usb_w, int cam_usb_h) { 25 | mRecorderContext = nativeInit(cam_main_w, cam_main_h, cam_usb_w, cam_usb_h); 26 | nativeInitCallback(mRecorderContext); 27 | } 28 | 29 | public void release() { 30 | nativeFree(mRecorderContext); 31 | mSingleInstance = null; 32 | } 33 | 34 | public boolean getMicMute(int micidx) { 35 | int mute = nativeGetMicMute(mRecorderContext, micidx); 36 | return (nativeGetMicMute(mRecorderContext, micidx) == 1); 37 | } 38 | 39 | public void setMicMute(int micidx, boolean mute) { 40 | nativeSetMicMute(mRecorderContext, micidx, mute ? 1 : 0); 41 | } 42 | 43 | public void resetCamera(int camidx, int w, int h, int frate) { 44 | nativeResetCamera(mRecorderContext, camidx, w, h, frate); 45 | } 46 | 47 | public void setWatermark(int camidx, int x, int y, String watermark) { 48 | nativeSetWatermark(mRecorderContext, camidx, x, y, watermark); 49 | } 50 | 51 | public void setPreviewDisplay(int camidx, SurfaceView win) { 52 | nativeSetPreviewWindow(mRecorderContext, camidx, win); 53 | } 54 | 55 | public void setPreviewTexture(int camidx, SurfaceTexture win) { 56 | nativeSetPreviewTarget(mRecorderContext, camidx, win); 57 | } 58 | 59 | public void startPreview(int camidx) { 60 | nativeStartPreview(mRecorderContext, camidx); 61 | } 62 | 63 | public void stopPreview(int camidx) { 64 | nativeStopPreview(mRecorderContext, camidx); 65 | } 66 | 67 | public void startRecording(int encidx, String filename) { 68 | nativeStartRecording(mRecorderContext, encidx, filename); 69 | } 70 | 71 | public void stopRecording(int encidx) { 72 | nativeStopRecording(mRecorderContext, encidx); 73 | } 74 | 75 | public void setAudioSource(int encidx, int source) { 76 | nativeSetAudioSource(mRecorderContext, encidx, source); 77 | } 78 | 79 | public void setVideoSource(int encidx, int source) { 80 | nativeSetVideoSource(mRecorderContext, encidx, source); 81 | } 82 | 83 | public void takePhoto(int camidx, String filename, takePhotoCallback callback) { 84 | mTakePhotoCB = callback; // setup callback 85 | nativeTakePhoto(mRecorderContext, camidx, filename); 86 | } 87 | 88 | public interface takePhotoCallback { 89 | public void onPhotoTaken(String filename, int w, int h); 90 | } 91 | 92 | 93 | //++ for take photo callback 94 | private takePhotoCallback mTakePhotoCB = null; 95 | 96 | private void internalTakePhotoCallback(String filename, int w, int h) { 97 | if (mTakePhotoCB != null) { 98 | mTakePhotoCB.onPhotoTaken(filename, w, h); 99 | } 100 | } 101 | 102 | private native void nativeInitCallback(long ctxt); 103 | //-- for take photo callback 104 | 105 | 106 | private static native long nativeInit(int cam_main_w, int cam_main_h, int cam_usb_w, int cam_usb_h); 107 | private static native void nativeFree(long ctxt); 108 | 109 | private static native int nativeGetMicMute (long ctxt, int micidx); 110 | private static native void nativeSetMicMute (long ctxt, int micidx, int mute); 111 | 112 | private static native void nativeResetCamera (long ctxt, int camidx, int w, int h, int frate); 113 | private static native void nativeSetWatermark(long ctxt, int camidx, int x, int y, String watermark); 114 | 115 | private static native void nativeSetPreviewWindow(long ctxt, int camidx, Object win); 116 | private static native void nativeSetPreviewTarget(long ctxt, int camidx, Object win); 117 | 118 | private static native void nativeStartPreview(long ctxt, int camidx); 119 | private static native void nativeStopPreview (long ctxt, int camidx); 120 | 121 | private static native void nativeStartRecording(long ctxt, int encidx, String filename); 122 | private static native void nativeStopRecording (long ctxt, int encidx); 123 | 124 | private static native void nativeSetAudioSource(long ctxt, int encidx, int source); 125 | private static native void nativeSetVideoSource(long ctxt, int encidx, int source); 126 | 127 | private static native void nativeTakePhoto(long ctxt, int camidx, String filename); 128 | 129 | static { 130 | System.loadLibrary("ffrecorder_jni"); 131 | } 132 | } 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /camdev.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/camdev.h -------------------------------------------------------------------------------- /com_apical_dvr_ffRecorder.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_apical_dvr_ffRecorder */ 4 | 5 | #ifndef _Included_com_apical_dvr_ffRecorder 6 | #define _Included_com_apical_dvr_ffRecorder 7 | 8 | extern JavaVM* g_jvm; 9 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM*, void*); 10 | JNIEXPORT JNIEnv* get_jni_env(void); 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* 17 | * Class: com_apical_dvr_ffRecorder 18 | * Method: nativeInitCallback 19 | * Signature: (J)V 20 | */ 21 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeInitCallback 22 | (JNIEnv *, jobject, jlong); 23 | 24 | /* 25 | * Class: com_apical_dvr_ffRecorder 26 | * Method: nativeInit 27 | * Signature: (IIII)J 28 | */ 29 | JNIEXPORT jlong JNICALL Java_com_apical_dvr_ffRecorder_nativeInit 30 | (JNIEnv *, jclass, jint, jint, jint, jint); 31 | 32 | /* 33 | * Class: com_apical_dvr_ffRecorder 34 | * Method: nativeFree 35 | * Signature: (J)V 36 | */ 37 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeFree 38 | (JNIEnv *, jclass, jlong); 39 | 40 | /* 41 | * Class: com_apical_dvr_ffRecorder 42 | * Method: nativeGetMicMute 43 | * Signature: (JI)I 44 | */ 45 | JNIEXPORT jint JNICALL Java_com_apical_dvr_ffRecorder_nativeGetMicMute 46 | (JNIEnv *, jclass, jlong, jint); 47 | 48 | /* 49 | * Class: com_apical_dvr_ffRecorder 50 | * Method: nativeSetMicMute 51 | * Signature: (JII)V 52 | */ 53 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeSetMicMute 54 | (JNIEnv *, jclass, jlong, jint, jint); 55 | 56 | /* 57 | * Class: com_apical_dvr_ffRecorder 58 | * Method: nativeResetCamera 59 | * Signature: (JIIII)V 60 | */ 61 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeResetCamera 62 | (JNIEnv *, jclass, jlong, jint, jint, jint, jint); 63 | 64 | /* 65 | * Class: com_apical_dvr_ffRecorder 66 | * Method: nativeSetWatermark 67 | * Signature: (JIIILjava/lang/String;)V 68 | */ 69 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeSetWatermark 70 | (JNIEnv *, jclass, jlong, jint, jint, jint, jstring); 71 | 72 | /* 73 | * Class: com_apical_dvr_ffRecorder 74 | * Method: nativeSetPreviewWindow 75 | * Signature: (JILjava/lang/Object;)V 76 | */ 77 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeSetPreviewWindow 78 | (JNIEnv *, jclass, jlong, jint, jobject); 79 | 80 | /* 81 | * Class: com_apical_dvr_ffRecorder 82 | * Method: nativeSetPreviewTarget 83 | * Signature: (JILjava/lang/Object;)V 84 | */ 85 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeSetPreviewTarget 86 | (JNIEnv *, jclass, jlong, jint, jobject); 87 | 88 | /* 89 | * Class: com_apical_dvr_ffRecorder 90 | * Method: nativeStartPreview 91 | * Signature: (JI)V 92 | */ 93 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeStartPreview 94 | (JNIEnv *, jclass, jlong, jint); 95 | 96 | /* 97 | * Class: com_apical_dvr_ffRecorder 98 | * Method: nativeStopPreview 99 | * Signature: (JI)V 100 | */ 101 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeStopPreview 102 | (JNIEnv *, jclass, jlong, jint); 103 | 104 | /* 105 | * Class: com_apical_dvr_ffRecorder 106 | * Method: nativeStartRecording 107 | * Signature: (JILjava/lang/String;)V 108 | */ 109 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeStartRecording 110 | (JNIEnv *, jclass, jlong, jint, jstring); 111 | 112 | /* 113 | * Class: com_apical_dvr_ffRecorder 114 | * Method: nativeStopRecording 115 | * Signature: (JI)V 116 | */ 117 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeStopRecording 118 | (JNIEnv *, jclass, jlong, jint); 119 | 120 | /* 121 | * Class: com_apical_dvr_ffRecorder 122 | * Method: nativeSetAudioSource 123 | * Signature: (JII)V 124 | */ 125 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeSetAudioSource 126 | (JNIEnv *, jclass, jlong, jint, jint); 127 | 128 | /* 129 | * Class: com_apical_dvr_ffRecorder 130 | * Method: nativeSetVideoSource 131 | * Signature: (JII)V 132 | */ 133 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeSetVideoSource 134 | (JNIEnv *, jclass, jlong, jint, jint); 135 | 136 | /* 137 | * Class: com_apical_dvr_ffRecorder 138 | * Method: nativeTakePhoto 139 | * Signature: (JILjava/lang/String;)V 140 | */ 141 | JNIEXPORT void JNICALL Java_com_apical_dvr_ffRecorder_nativeTakePhoto 142 | (JNIEnv *, jclass, jlong, jint, jstring); 143 | 144 | #ifdef __cplusplus 145 | } 146 | #endif 147 | #endif 148 | -------------------------------------------------------------------------------- /encodertest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/encodertest.cpp -------------------------------------------------------------------------------- /ffencoder.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffencoder.cpp -------------------------------------------------------------------------------- /ffencoder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffencoder.h -------------------------------------------------------------------------------- /ffjpeg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffjpeg.cpp -------------------------------------------------------------------------------- /ffjpeg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffjpeg.h -------------------------------------------------------------------------------- /ffmpeg/build_ffmpeg_for_android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | PREFIX_DIR=$PWD/ffmpeg-android-sdk 5 | SYSROOT=$NDK_HOME/platforms/android-19/arch-arm/ 6 | CROSS_COMPILE=$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/arm-linux-androideabi- 7 | EXTRA_CFLAGS="-I$PREFIX_DIR/include -DANDROID -DNDEBUG -Os -ffast-math -mfpu=neon-vfpv4 -mfloat-abi=softfp" 8 | EXTRA_LDFLAGS="-L$PREFIX_DIR/lib" 9 | 10 | # speed of faac is slower than ffmpeg native aac encoder now 11 | # so we do not use faac 12 | if false; then 13 | #++ build faac ++# 14 | if [ ! -d faac-1.28 ]; then 15 | wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz 16 | tar xvf faac-1.28.tar.gz 17 | fi 18 | CROSS_COMPILE=arm-linux-androideabi- 19 | export CFLAGS="$CFLAGS" 20 | export CPPFLAGS="$CFLAGS" 21 | export CXXFLAGS="$CFLAGS" 22 | export LDFLAGS="$LDFLAGS" 23 | export CC="${CROSS_COMPILE}gcc" 24 | export CXX="${CROSS_COMPILE}g++" 25 | export NM="${CROSS_COMPILE}nm" 26 | export LD="${CROSS_COMPILE}ld" 27 | export STRIP="${CROSS_COMPILE}strip" 28 | export AR="${CROSS_COMPILE}ar" 29 | cd faac-1.28 30 | ./configure --prefix=$PWD/../ffmpeg-android-sdk \ 31 | --host=arm-linux \ 32 | --enable-static \ 33 | --enable-shared \ 34 | --without-mp4v2 35 | make -j8 && make install 36 | cd - 37 | #-- build faac --# 38 | fi 39 | 40 | #++ build x264 ++# 41 | if [ ! -d x264 ]; then 42 | git clone -b stable git://git.videolan.org/x264.git 43 | fi 44 | cd x264 45 | ./configure --prefix=$PREFIX_DIR \ 46 | --enable-strip \ 47 | --enable-static \ 48 | --enable-pic \ 49 | --disable-cli \ 50 | --disable-opencl \ 51 | --disable-avs \ 52 | --host=arm-linux-androideabi \ 53 | --cross-prefix=$CROSS_COMPILE \ 54 | --sysroot=$SYSROOT 55 | make STRIP= -j8 && make install 56 | cd - 57 | #-- build x264 --# 58 | 59 | #++ build ffmpeg ++# 60 | if [ ! -d ffmpeg ]; then 61 | git clone -b fanplayer https://github.com/rockcarry/ffmpeg 62 | fi 63 | cd ffmpeg 64 | ./configure \ 65 | --pkg-config=pkg-config \ 66 | --arch=armv7 \ 67 | --cpu=armv7-a \ 68 | --target-os=android \ 69 | --enable-cross-compile \ 70 | --cross-prefix=$CROSS_COMPILE \ 71 | --sysroot=$SYSROOT \ 72 | --prefix=$PREFIX_DIR \ 73 | --enable-thumb \ 74 | --enable-static \ 75 | --enable-small \ 76 | --disable-shared \ 77 | --disable-symver \ 78 | --disable-debug \ 79 | --disable-programs \ 80 | --disable-doc \ 81 | --disable-avdevice \ 82 | --disable-avfilter \ 83 | --disable-postproc \ 84 | --disable-everything \ 85 | --disable-swscale-alpha \ 86 | --enable-encoder=libx264 \ 87 | --enable-encoder=aac \ 88 | --enable-encoder=mjpeg \ 89 | --enable-decoder=mjpeg \ 90 | --enable-muxer=avi \ 91 | --enable-muxer=mp4 \ 92 | --enable-protocol=file \ 93 | --enable-protocol=rtmp \ 94 | --enable-asm \ 95 | --enable-gpl \ 96 | --enable-version3 \ 97 | --enable-nonfree \ 98 | --enable-libx264 \ 99 | --extra-cflags="$EXTRA_CFLAGS" \ 100 | --extra-ldflags="$EXTRA_LDFLAGS" 101 | make -j8 && make install 102 | cd - 103 | #++ build ffmpeg ++# 104 | 105 | echo done 106 | 107 | -------------------------------------------------------------------------------- /ffmpeg/howto: -------------------------------------------------------------------------------- 1 | how to build ffmpeg lib for android 2 | 3 | 1. you need a ndk toolchain named arm-linux-androideabi-4.7.1-full-linux-x86.tar.bz2. 4 | you can get it from internet or contact me. 5 | 6 | 2. run build_ffmpeg_for_android.sh to build the ffmpeg for android 7 | ./build_ffmpeg_for_android.sh 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/avdct.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_AVDCT_H 20 | #define AVCODEC_AVDCT_H 21 | 22 | #include "libavutil/opt.h" 23 | 24 | /** 25 | * AVDCT context. 26 | * @note function pointers can be NULL if the specific features have been 27 | * disabled at build time. 28 | */ 29 | typedef struct AVDCT { 30 | const AVClass *av_class; 31 | 32 | void (*idct)(int16_t *block /* align 16 */); 33 | 34 | /** 35 | * IDCT input permutation. 36 | * Several optimized IDCTs need a permutated input (relative to the 37 | * normal order of the reference IDCT). 38 | * This permutation must be performed before the idct_put/add. 39 | * Note, normally this can be merged with the zigzag/alternate scan
40 | * An example to avoid confusion: 41 | * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) 42 | * - (x -> reference DCT -> reference IDCT -> x) 43 | * - (x -> reference DCT -> simple_mmx_perm = idct_permutation 44 | * -> simple_idct_mmx -> x) 45 | * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant 46 | * -> simple_idct_mmx -> ...) 47 | */ 48 | uint8_t idct_permutation[64]; 49 | 50 | void (*fdct)(int16_t *block /* align 16 */); 51 | 52 | 53 | /** 54 | * DCT algorithm. 55 | * must use AVOptions to set this field. 56 | */ 57 | int dct_algo; 58 | 59 | /** 60 | * IDCT algorithm. 61 | * must use AVOptions to set this field. 62 | */ 63 | int idct_algo; 64 | 65 | void (*get_pixels)(int16_t *block /* align 16 */, 66 | const uint8_t *pixels /* align 8 */, 67 | ptrdiff_t line_size); 68 | 69 | int bits_per_sample; 70 | } AVDCT; 71 | 72 | /** 73 | * Allocates a AVDCT context. 74 | * This needs to be initialized with avcodec_dct_init() after optionally 75 | * configuring it with AVOptions. 76 | * 77 | * To free it use av_free() 78 | */ 79 | AVDCT *avcodec_dct_alloc(void); 80 | int avcodec_dct_init(AVDCT *); 81 | 82 | const AVClass *avcodec_dct_get_class(void); 83 | 84 | #endif /* AVCODEC_AVDCT_H */ 85 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/d3d11va.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Direct3D11 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * copyright (c) 2015 Steve Lhomme 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_D3D11VA_H 25 | #define AVCODEC_D3D11VA_H 26 | 27 | /** 28 | * @file 29 | * @ingroup lavc_codec_hwaccel_d3d11va 30 | * Public libavcodec D3D11VA header. 31 | */ 32 | 33 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 34 | #undef _WIN32_WINNT 35 | #define _WIN32_WINNT 0x0602 36 | #endif 37 | 38 | #include 39 | #include 40 | 41 | /** 42 | * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11 43 | * @ingroup lavc_codec_hwaccel 44 | * 45 | * @{ 46 | */ 47 | 48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards 49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface 50 | 51 | /** 52 | * This structure is used to provides the necessary configurations and data 53 | * to the Direct3D11 FFmpeg HWAccel implementation. 54 | * 55 | * The application must make it available as AVCodecContext.hwaccel_context. 56 | * 57 | * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. 58 | */ 59 | typedef struct AVD3D11VAContext { 60 | /** 61 | * D3D11 decoder object 62 | */ 63 | ID3D11VideoDecoder *decoder; 64 | 65 | /** 66 | * D3D11 VideoContext 67 | */ 68 | ID3D11VideoContext *video_context; 69 | 70 | /** 71 | * D3D11 configuration used to create the decoder 72 | */ 73 | D3D11_VIDEO_DECODER_CONFIG *cfg; 74 | 75 | /** 76 | * The number of surface in the surface array 77 | */ 78 | unsigned surface_count; 79 | 80 | /** 81 | * The array of Direct3D surfaces used to create the decoder 82 | */ 83 | ID3D11VideoDecoderOutputView **surface; 84 | 85 | /** 86 | * A bit field configuring the workarounds needed for using the decoder 87 | */ 88 | uint64_t workaround; 89 | 90 | /** 91 | * Private to the FFmpeg AVHWAccel implementation 92 | */ 93 | unsigned report_id; 94 | 95 | /** 96 | * Mutex to access video_context 97 | */ 98 | HANDLE context_mutex; 99 | } AVD3D11VAContext; 100 | 101 | /** 102 | * Allocate an AVD3D11VAContext. 103 | * 104 | * @return Newly-allocated AVD3D11VAContext or NULL on failure. 105 | */ 106 | AVD3D11VAContext *av_d3d11va_alloc_context(void); 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | #endif /* AVCODEC_D3D11VA_H */ 113 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/dirac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Marco Gerards 3 | * Copyright (C) 2009 David Conrad 4 | * Copyright (C) 2011 Jordi Ortiz 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_DIRAC_H 24 | #define AVCODEC_DIRAC_H 25 | 26 | /** 27 | * @file 28 | * Interface to Dirac Decoder/Encoder 29 | * @author Marco Gerards 30 | * @author David Conrad 31 | * @author Jordi Ortiz 32 | */ 33 | 34 | #include "avcodec.h" 35 | 36 | /** 37 | * The spec limits the number of wavelet decompositions to 4 for both 38 | * level 1 (VC-2) and 128 (long-gop default). 39 | * 5 decompositions is the maximum before >16-bit buffers are needed. 40 | * Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting 41 | * the others to 4 decompositions (or 3 for the fidelity filter). 42 | * 43 | * We use this instead of MAX_DECOMPOSITIONS to save some memory. 44 | */ 45 | #define MAX_DWT_LEVELS 5 46 | 47 | /** 48 | * Parse code values: 49 | * 50 | * Dirac Specification -> 51 | * 9.6.1 Table 9.1 52 | * 53 | * VC-2 Specification -> 54 | * 10.4.1 Table 10.1 55 | */ 56 | 57 | enum DiracParseCodes { 58 | DIRAC_PCODE_SEQ_HEADER = 0x00, 59 | DIRAC_PCODE_END_SEQ = 0x10, 60 | DIRAC_PCODE_AUX = 0x20, 61 | DIRAC_PCODE_PAD = 0x30, 62 | DIRAC_PCODE_PICTURE_CODED = 0x08, 63 | DIRAC_PCODE_PICTURE_RAW = 0x48, 64 | DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8, 65 | DIRAC_PCODE_PICTURE_HQ = 0xE8, 66 | DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A, 67 | DIRAC_PCODE_INTER_NOREF_CO2 = 0x09, 68 | DIRAC_PCODE_INTER_REF_CO1 = 0x0D, 69 | DIRAC_PCODE_INTER_REF_CO2 = 0x0E, 70 | DIRAC_PCODE_INTRA_REF_CO = 0x0C, 71 | DIRAC_PCODE_INTRA_REF_RAW = 0x4C, 72 | DIRAC_PCODE_INTRA_REF_PICT = 0xCC, 73 | DIRAC_PCODE_MAGIC = 0x42424344, 74 | }; 75 | 76 | typedef struct DiracVersionInfo { 77 | int major; 78 | int minor; 79 | } DiracVersionInfo; 80 | 81 | typedef struct AVDiracSeqHeader { 82 | unsigned width; 83 | unsigned height; 84 | uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 85 | 86 | uint8_t interlaced; 87 | uint8_t top_field_first; 88 | 89 | uint8_t frame_rate_index; ///< index into dirac_frame_rate[] 90 | uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[] 91 | 92 | uint16_t clean_width; 93 | uint16_t clean_height; 94 | uint16_t clean_left_offset; 95 | uint16_t clean_right_offset; 96 | 97 | uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[] 98 | uint8_t color_spec_index; ///< index into dirac_color_spec_presets[] 99 | 100 | int profile; 101 | int level; 102 | 103 | AVRational framerate; 104 | AVRational sample_aspect_ratio; 105 | 106 | enum AVPixelFormat pix_fmt; 107 | enum AVColorRange color_range; 108 | enum AVColorPrimaries color_primaries; 109 | enum AVColorTransferCharacteristic color_trc; 110 | enum AVColorSpace colorspace; 111 | 112 | DiracVersionInfo version; 113 | int bit_depth; 114 | } AVDiracSeqHeader; 115 | 116 | /** 117 | * Parse a Dirac sequence header. 118 | * 119 | * @param dsh this function will allocate and fill an AVDiracSeqHeader struct 120 | * and write it into this pointer. The caller must free it with 121 | * av_free(). 122 | * @param buf the data buffer 123 | * @param buf_size the size of the data buffer in bytes 124 | * @param log_ctx if non-NULL, this function will log errors here 125 | * @return 0 on success, a negative AVERROR code on failure 126 | */ 127 | int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh, 128 | const uint8_t *buf, size_t buf_size, 129 | void *log_ctx); 130 | 131 | #endif /* AVCODEC_DIRAC_H */ 132 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/dv_profile.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_DV_PROFILE_H 20 | #define AVCODEC_DV_PROFILE_H 21 | 22 | #include 23 | 24 | #include "libavutil/pixfmt.h" 25 | #include "libavutil/rational.h" 26 | #include "avcodec.h" 27 | 28 | /* minimum number of bytes to read from a DV stream in order to 29 | * determine the profile */ 30 | #define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */ 31 | 32 | 33 | /* 34 | * AVDVProfile is used to express the differences between various 35 | * DV flavors. For now it's primarily used for differentiating 36 | * 525/60 and 625/50, but the plans are to use it for various 37 | * DV specs as well (e.g. SMPTE314M vs. IEC 61834). 38 | */ 39 | typedef struct AVDVProfile { 40 | int dsf; /* value of the dsf in the DV header */ 41 | int video_stype; /* stype for VAUX source pack */ 42 | int frame_size; /* total size of one frame in bytes */ 43 | int difseg_size; /* number of DIF segments per DIF channel */ 44 | int n_difchan; /* number of DIF channels per frame */ 45 | AVRational time_base; /* 1/framerate */ 46 | int ltc_divisor; /* FPS from the LTS standpoint */ 47 | int height; /* picture height in pixels */ 48 | int width; /* picture width in pixels */ 49 | AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */ 50 | enum AVPixelFormat pix_fmt; /* picture pixel format */ 51 | int bpm; /* blocks per macroblock */ 52 | const uint8_t *block_sizes; /* AC block sizes, in bits */ 53 | int audio_stride; /* size of audio_shuffle table */ 54 | int audio_min_samples[3]; /* min amount of audio samples */ 55 | /* for 48kHz, 44.1kHz and 32kHz */ 56 | int audio_samples_dist[5]; /* how many samples are supposed to be */ 57 | /* in each frame in a 5 frames window */ 58 | const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ 59 | } AVDVProfile; 60 | 61 | /** 62 | * Get a DV profile for the provided compressed frame. 63 | * 64 | * @param sys the profile used for the previous frame, may be NULL 65 | * @param frame the compressed data buffer 66 | * @param buf_size size of the buffer in bytes 67 | * @return the DV profile for the supplied data or NULL on failure 68 | */ 69 | const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, 70 | const uint8_t *frame, unsigned buf_size); 71 | 72 | /** 73 | * Get a DV profile for the provided stream parameters. 74 | */ 75 | const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt); 76 | 77 | /** 78 | * Get a DV profile for the provided stream parameters. 79 | * The frame rate is used as a best-effort parameter. 80 | */ 81 | const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate); 82 | 83 | #endif /* AVCODEC_DV_PROFILE_H */ 84 | -------------------------------------------------------------------------------- /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_DXVA2_H 24 | #define AVCODEC_DXVA2_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 < 0x0602 33 | #undef _WIN32_WINNT 34 | #define _WIN32_WINNT 0x0602 35 | #endif 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | /** 42 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 43 | * @ingroup lavc_codec_hwaccel 44 | * 45 | * @{ 46 | */ 47 | 48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards 49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface 50 | 51 | /** 52 | * This structure is used to provides the necessary configurations and data 53 | * to the DXVA2 FFmpeg HWAccel implementation. 54 | * 55 | * The application must make it available as AVCodecContext.hwaccel_context. 56 | */ 57 | struct dxva_context { 58 | /** 59 | * DXVA2 decoder object 60 | */ 61 | IDirectXVideoDecoder *decoder; 62 | 63 | /** 64 | * DXVA2 configuration used to create the decoder 65 | */ 66 | const DXVA2_ConfigPictureDecode *cfg; 67 | 68 | /** 69 | * The number of surface in the surface array 70 | */ 71 | unsigned surface_count; 72 | 73 | /** 74 | * The array of Direct3D surfaces used to create the decoder 75 | */ 76 | LPDIRECT3DSURFACE9 *surface; 77 | 78 | /** 79 | * A bit field configuring the workarounds needed for using the decoder 80 | */ 81 | uint64_t workaround; 82 | 83 | /** 84 | * Private to the FFmpeg AVHWAccel implementation 85 | */ 86 | unsigned report_id; 87 | }; 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | #endif /* AVCODEC_DXVA2_H */ 94 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/jni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JNI public API functions 3 | * 4 | * Copyright (c) 2015-2016 Matthieu Bouron 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_JNI_H 24 | #define AVCODEC_JNI_H 25 | 26 | /* 27 | * Manually set a Java virtual machine which will be used to retrieve the JNI 28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning 29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer 30 | * however it will error out if you try to set a different Java VM. 31 | * 32 | * @param vm Java virtual machine 33 | * @param log_ctx context used for logging, can be NULL 34 | * @return 0 on success, < 0 otherwise 35 | */ 36 | int av_jni_set_java_vm(void *vm, void *log_ctx); 37 | 38 | /* 39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm. 40 | * 41 | * @param vm Java virtual machine 42 | * @return a pointer to the Java virtual machine 43 | */ 44 | void *av_jni_get_java_vm(void *log_ctx); 45 | 46 | #endif /* AVCODEC_JNI_H */ 47 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/mediacodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Android MediaCodec public API 3 | * 4 | * Copyright (c) 2016 Matthieu Bouron 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_MEDIACODEC_H 24 | #define AVCODEC_MEDIACODEC_H 25 | 26 | #include "libavcodec/avcodec.h" 27 | 28 | /** 29 | * This structure holds a reference to a android/view/Surface object that will 30 | * be used as output by the decoder. 31 | * 32 | */ 33 | typedef struct AVMediaCodecContext { 34 | 35 | /** 36 | * android/view/Surface object reference. 37 | */ 38 | void *surface; 39 | 40 | } AVMediaCodecContext; 41 | 42 | /** 43 | * Allocate and initialize a MediaCodec context. 44 | * 45 | * When decoding with MediaCodec is finished, the caller must free the 46 | * MediaCodec context with av_mediacodec_default_free. 47 | * 48 | * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise 49 | */ 50 | AVMediaCodecContext *av_mediacodec_alloc_context(void); 51 | 52 | /** 53 | * Convenience function that sets up the MediaCodec context. 54 | * 55 | * @param avctx codec context 56 | * @param ctx MediaCodec context to initialize 57 | * @param surface reference to an android/view/Surface 58 | * @return 0 on success, < 0 otherwise 59 | */ 60 | int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface); 61 | 62 | /** 63 | * This function must be called to free the MediaCodec context initialized with 64 | * av_mediacodec_default_init(). 65 | * 66 | * @param avctx codec context 67 | */ 68 | void av_mediacodec_default_free(AVCodecContext *avctx); 69 | 70 | /** 71 | * Opaque structure representing a MediaCodec buffer to render. 72 | */ 73 | typedef struct MediaCodecBuffer AVMediaCodecBuffer; 74 | 75 | /** 76 | * Release a MediaCodec buffer and render it to the surface that is associated 77 | * with the decoder. This function should only be called once on a given 78 | * buffer, once released the underlying buffer returns to the codec, thus 79 | * subsequent calls to this function will have no effect. 80 | * 81 | * @param buffer the buffer to render 82 | * @param render 1 to release and render the buffer to the surface or 0 to 83 | * discard the buffer 84 | * @return 0 on success, < 0 otherwise 85 | */ 86 | int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render); 87 | 88 | #endif /* AVCODEC_MEDIACODEC_H */ 89 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/qsv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Intel MediaSDK QSV public API 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 AVCODEC_QSV_H 22 | #define AVCODEC_QSV_H 23 | 24 | #include 25 | 26 | #include "libavutil/buffer.h" 27 | 28 | /** 29 | * This struct is used for communicating QSV parameters between libavcodec and 30 | * the caller. It is managed by the caller and must be assigned to 31 | * AVCodecContext.hwaccel_context. 32 | * - decoding: hwaccel_context must be set on return from the get_format() 33 | * callback 34 | * - encoding: hwaccel_context must be set before avcodec_open2() 35 | */ 36 | typedef struct AVQSVContext { 37 | /** 38 | * If non-NULL, the session to use for encoding or decoding. 39 | * Otherwise, libavcodec will try to create an internal session. 40 | */ 41 | mfxSession session; 42 | 43 | /** 44 | * The IO pattern to use. 45 | */ 46 | int iopattern; 47 | 48 | /** 49 | * Extra buffers to pass to encoder or decoder initialization. 50 | */ 51 | mfxExtBuffer **ext_buffers; 52 | int nb_ext_buffers; 53 | 54 | /** 55 | * Encoding only. If this field is set to non-zero by the caller, libavcodec 56 | * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to 57 | * the encoder initialization. This only makes sense if iopattern is also 58 | * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY. 59 | * 60 | * The number of allocated opaque surfaces will be the sum of the number 61 | * required by the encoder and the user-provided value nb_opaque_surfaces. 62 | * The array of the opaque surfaces will be exported to the caller through 63 | * the opaque_surfaces field. 64 | */ 65 | int opaque_alloc; 66 | 67 | /** 68 | * Encoding only, and only if opaque_alloc is set to non-zero. Before 69 | * calling avcodec_open2(), the caller should set this field to the number 70 | * of extra opaque surfaces to allocate beyond what is required by the 71 | * encoder. 72 | * 73 | * On return from avcodec_open2(), this field will be set by libavcodec to 74 | * the total number of allocated opaque surfaces. 75 | */ 76 | int nb_opaque_surfaces; 77 | 78 | /** 79 | * Encoding only, and only if opaque_alloc is set to non-zero. On return 80 | * from avcodec_open2(), this field will be used by libavcodec to export the 81 | * array of the allocated opaque surfaces to the caller, so they can be 82 | * passed to other parts of the pipeline. 83 | * 84 | * The buffer reference exported here is owned and managed by libavcodec, 85 | * the callers should make their own reference with av_buffer_ref() and free 86 | * it with av_buffer_unref() when it is no longer needed. 87 | * 88 | * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1. 89 | */ 90 | AVBufferRef *opaque_surfaces; 91 | 92 | /** 93 | * Encoding only, and only if opaque_alloc is set to non-zero. On return 94 | * from avcodec_open2(), this field will be set to the surface type used in 95 | * the opaque allocation request. 96 | */ 97 | int opaque_alloc_type; 98 | } AVQSVContext; 99 | 100 | /** 101 | * Allocate a new context. 102 | * 103 | * It must be freed by the caller with av_free(). 104 | */ 105 | AVQSVContext *av_qsv_alloc_context(void); 106 | 107 | #endif /* AVCODEC_QSV_H */ 108 | -------------------------------------------------------------------------------- /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 | #include "libavutil/attributes.h" 35 | #include "version.h" 36 | 37 | /** 38 | * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding 39 | * @ingroup lavc_codec_hwaccel 40 | * @{ 41 | */ 42 | 43 | /** 44 | * This structure is used to share data between the FFmpeg library and 45 | * the client video application. 46 | * This shall be zero-allocated and available as 47 | * AVCodecContext.hwaccel_context. All user members can be set once 48 | * during initialization or through each AVCodecContext.get_buffer() 49 | * function call. In any case, they must be valid prior to calling 50 | * decoding functions. 51 | */ 52 | struct vaapi_context { 53 | /** 54 | * Window system dependent data 55 | * 56 | * - encoding: unused 57 | * - decoding: Set by user 58 | */ 59 | void *display; 60 | 61 | /** 62 | * Configuration ID 63 | * 64 | * - encoding: unused 65 | * - decoding: Set by user 66 | */ 67 | uint32_t config_id; 68 | 69 | /** 70 | * Context ID (video decode pipeline) 71 | * 72 | * - encoding: unused 73 | * - decoding: Set by user 74 | */ 75 | uint32_t context_id; 76 | 77 | #if FF_API_VAAPI_CONTEXT 78 | /** 79 | * VAPictureParameterBuffer ID 80 | * 81 | * - encoding: unused 82 | * - decoding: Set by libavcodec 83 | */ 84 | attribute_deprecated 85 | uint32_t pic_param_buf_id; 86 | 87 | /** 88 | * VAIQMatrixBuffer ID 89 | * 90 | * - encoding: unused 91 | * - decoding: Set by libavcodec 92 | */ 93 | attribute_deprecated 94 | uint32_t iq_matrix_buf_id; 95 | 96 | /** 97 | * VABitPlaneBuffer ID (for VC-1 decoding) 98 | * 99 | * - encoding: unused 100 | * - decoding: Set by libavcodec 101 | */ 102 | attribute_deprecated 103 | uint32_t bitplane_buf_id; 104 | 105 | /** 106 | * Slice parameter/data buffer IDs 107 | * 108 | * - encoding: unused 109 | * - decoding: Set by libavcodec 110 | */ 111 | attribute_deprecated 112 | uint32_t *slice_buf_ids; 113 | 114 | /** 115 | * Number of effective slice buffer IDs to send to the HW 116 | * 117 | * - encoding: unused 118 | * - decoding: Set by libavcodec 119 | */ 120 | attribute_deprecated 121 | unsigned int n_slice_buf_ids; 122 | 123 | /** 124 | * Size of pre-allocated slice_buf_ids 125 | * 126 | * - encoding: unused 127 | * - decoding: Set by libavcodec 128 | */ 129 | attribute_deprecated 130 | unsigned int slice_buf_ids_alloc; 131 | 132 | /** 133 | * Pointer to VASliceParameterBuffers 134 | * 135 | * - encoding: unused 136 | * - decoding: Set by libavcodec 137 | */ 138 | attribute_deprecated 139 | void *slice_params; 140 | 141 | /** 142 | * Size of a VASliceParameterBuffer element 143 | * 144 | * - encoding: unused 145 | * - decoding: Set by libavcodec 146 | */ 147 | attribute_deprecated 148 | unsigned int slice_param_size; 149 | 150 | /** 151 | * Size of pre-allocated slice_params 152 | * 153 | * - encoding: unused 154 | * - decoding: Set by libavcodec 155 | */ 156 | attribute_deprecated 157 | unsigned int slice_params_alloc; 158 | 159 | /** 160 | * Number of slices currently filled in 161 | * 162 | * - encoding: unused 163 | * - decoding: Set by libavcodec 164 | */ 165 | attribute_deprecated 166 | unsigned int slice_count; 167 | 168 | /** 169 | * Pointer to slice data buffer base 170 | * - encoding: unused 171 | * - decoding: Set by libavcodec 172 | */ 173 | attribute_deprecated 174 | const uint8_t *slice_data; 175 | 176 | /** 177 | * Current size of slice data 178 | * 179 | * - encoding: unused 180 | * - decoding: Set by libavcodec 181 | */ 182 | attribute_deprecated 183 | uint32_t slice_data_size; 184 | #endif 185 | }; 186 | 187 | /* @} */ 188 | 189 | #endif /* AVCODEC_VAAPI_H */ 190 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/videotoolbox.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Videotoolbox hardware acceleration 3 | * 4 | * copyright (c) 2012 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_VIDEOTOOLBOX_H 24 | #define AVCODEC_VIDEOTOOLBOX_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_videotoolbox 29 | * Public libavcodec Videotoolbox header. 30 | */ 31 | 32 | #include 33 | 34 | #define Picture QuickdrawPicture 35 | #include 36 | #undef Picture 37 | 38 | #include "libavcodec/avcodec.h" 39 | 40 | /** 41 | * This struct holds all the information that needs to be passed 42 | * between the caller and libavcodec for initializing Videotoolbox decoding. 43 | * Its size is not a part of the public ABI, it must be allocated with 44 | * av_videotoolbox_alloc_context() and freed with av_free(). 45 | */ 46 | typedef struct AVVideotoolboxContext { 47 | /** 48 | * Videotoolbox decompression session object. 49 | * Created and freed the caller. 50 | */ 51 | VTDecompressionSessionRef session; 52 | 53 | /** 54 | * The output callback that must be passed to the session. 55 | * Set by av_videottoolbox_default_init() 56 | */ 57 | VTDecompressionOutputCallback output_callback; 58 | 59 | /** 60 | * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames. 61 | * set by the caller. 62 | */ 63 | OSType cv_pix_fmt_type; 64 | 65 | /** 66 | * CoreMedia Format Description that Videotoolbox will use to create the decompression session. 67 | * Set by the caller. 68 | */ 69 | CMVideoFormatDescriptionRef cm_fmt_desc; 70 | 71 | /** 72 | * CoreMedia codec type that Videotoolbox will use to create the decompression session. 73 | * Set by the caller. 74 | */ 75 | int cm_codec_type; 76 | } AVVideotoolboxContext; 77 | 78 | /** 79 | * Allocate and initialize a Videotoolbox context. 80 | * 81 | * This function should be called from the get_format() callback when the caller 82 | * selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create 83 | * the decoder object (using the output callback provided by libavcodec) that 84 | * will be used for Videotoolbox-accelerated decoding. 85 | * 86 | * When decoding with Videotoolbox is finished, the caller must destroy the decoder 87 | * object and free the Videotoolbox context using av_free(). 88 | * 89 | * @return the newly allocated context or NULL on failure 90 | */ 91 | AVVideotoolboxContext *av_videotoolbox_alloc_context(void); 92 | 93 | /** 94 | * This is a convenience function that creates and sets up the Videotoolbox context using 95 | * an internal implementation. 96 | * 97 | * @param avctx the corresponding codec context 98 | * 99 | * @return >= 0 on success, a negative AVERROR code on failure 100 | */ 101 | int av_videotoolbox_default_init(AVCodecContext *avctx); 102 | 103 | /** 104 | * This is a convenience function that creates and sets up the Videotoolbox context using 105 | * an internal implementation. 106 | * 107 | * @param avctx the corresponding codec context 108 | * @param vtctx the Videotoolbox context to use 109 | * 110 | * @return >= 0 on success, a negative AVERROR code on failure 111 | */ 112 | int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx); 113 | 114 | /** 115 | * This function must be called to free the Videotoolbox context initialized with 116 | * av_videotoolbox_default_init(). 117 | * 118 | * @param avctx the corresponding codec context 119 | */ 120 | void av_videotoolbox_default_free(AVCodecContext *avctx); 121 | 122 | /** 123 | * @} 124 | */ 125 | 126 | #endif /* AVCODEC_VIDEOTOOLBOX_H */ 127 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/vorbis_parser.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 | * A public API for Vorbis parsing 22 | * 23 | * Determines the duration for each packet. 24 | */ 25 | 26 | #ifndef AVCODEC_VORBIS_PARSER_H 27 | #define AVCODEC_VORBIS_PARSER_H 28 | 29 | #include 30 | 31 | typedef struct AVVorbisParseContext AVVorbisParseContext; 32 | 33 | /** 34 | * Allocate and initialize the Vorbis parser using headers in the extradata. 35 | * 36 | * @param avctx codec context 37 | * @param s Vorbis parser context 38 | */ 39 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, 40 | int extradata_size); 41 | 42 | /** 43 | * Free the parser and everything associated with it. 44 | */ 45 | void av_vorbis_parse_free(AVVorbisParseContext **s); 46 | 47 | #define VORBIS_FLAG_HEADER 0x00000001 48 | #define VORBIS_FLAG_COMMENT 0x00000002 49 | #define VORBIS_FLAG_SETUP 0x00000004 50 | 51 | /** 52 | * Get the duration for a Vorbis packet. 53 | * 54 | * If @p flags is @c NULL, 55 | * special frames are considered invalid. 56 | * 57 | * @param s Vorbis parser context 58 | * @param buf buffer containing a Vorbis frame 59 | * @param buf_size size of the buffer 60 | * @param flags flags for special frames 61 | */ 62 | int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, 63 | int buf_size, int *flags); 64 | 65 | /** 66 | * Get the duration for a Vorbis packet. 67 | * 68 | * @param s Vorbis parser context 69 | * @param buf buffer containing a Vorbis frame 70 | * @param buf_size size of the buffer 71 | */ 72 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, 73 | int buf_size); 74 | 75 | void av_vorbis_parse_reset(AVVorbisParseContext *s); 76 | 77 | #endif /* AVCODEC_VORBIS_PARSER_H */ 78 | -------------------------------------------------------------------------------- /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 | // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) 33 | // Also please add any ticket numbers that you believe might be affected here 34 | #define LIBAVFORMAT_VERSION_MAJOR 57 35 | #define LIBAVFORMAT_VERSION_MINOR 56 36 | #define LIBAVFORMAT_VERSION_MICRO 101 37 | 38 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ 39 | LIBAVFORMAT_VERSION_MINOR, \ 40 | LIBAVFORMAT_VERSION_MICRO) 41 | #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ 42 | LIBAVFORMAT_VERSION_MINOR, \ 43 | LIBAVFORMAT_VERSION_MICRO) 44 | #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT 45 | 46 | #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) 47 | 48 | /** 49 | * FF_API_* defines may be placed below to indicate public API that will be 50 | * dropped at a future version bump. The defines themselves are not part of 51 | * the public API and may change, break or disappear at any time. 52 | * 53 | * @note, when bumping the major version it is recommended to manually 54 | * disable each FF_API_* in its own commit instead of disabling them all 55 | * at once through the bump. This improves the git bisect-ability of the change. 56 | * 57 | */ 58 | #ifndef FF_API_LAVF_BITEXACT 59 | #define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 58) 60 | #endif 61 | #ifndef FF_API_LAVF_FRAC 62 | #define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 58) 63 | #endif 64 | #ifndef FF_API_LAVF_CODEC_TB 65 | #define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 58) 66 | #endif 67 | #ifndef FF_API_URL_FEOF 68 | #define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 58) 69 | #endif 70 | #ifndef FF_API_LAVF_FMT_RAWPICTURE 71 | #define FF_API_LAVF_FMT_RAWPICTURE (LIBAVFORMAT_VERSION_MAJOR < 58) 72 | #endif 73 | #ifndef FF_API_COMPUTE_PKT_FIELDS2 74 | #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 58) 75 | #endif 76 | #ifndef FF_API_OLD_OPEN_CALLBACKS 77 | #define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 58) 78 | #endif 79 | #ifndef FF_API_LAVF_AVCTX 80 | #define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 58) 81 | #endif 82 | #ifndef FF_API_NOCONST_GET_SIDE_DATA 83 | #define FF_API_NOCONST_GET_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 58) 84 | #endif 85 | #ifndef FF_API_HTTP_USER_AGENT 86 | #define FF_API_HTTP_USER_AGENT (LIBAVFORMAT_VERSION_MAJOR < 58) 87 | #endif 88 | 89 | #ifndef FF_API_R_FRAME_RATE 90 | #define FF_API_R_FRAME_RATE 1 91 | #endif 92 | #endif /* AVFORMAT_VERSION_H */ 93 | -------------------------------------------------------------------------------- /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 | /** 22 | * @file 23 | * @ingroup lavu_adler32 24 | * Public header for Adler-32 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_ADLER32_H 28 | #define AVUTIL_ADLER32_H 29 | 30 | #include 31 | #include "attributes.h" 32 | 33 | /** 34 | * @defgroup lavu_adler32 Adler-32 35 | * @ingroup lavu_hash 36 | * Adler-32 hash function implementation. 37 | * 38 | * @{ 39 | */ 40 | 41 | /** 42 | * Calculate the Adler32 checksum of a buffer. 43 | * 44 | * Passing the return value to a subsequent av_adler32_update() call 45 | * allows the checksum of multiple buffers to be calculated as though 46 | * they were concatenated. 47 | * 48 | * @param adler initial checksum value 49 | * @param buf pointer to input buffer 50 | * @param len size of input buffer 51 | * @return updated checksum 52 | */ 53 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 54 | unsigned int len) av_pure; 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | #endif /* AVUTIL_ADLER32_H */ 61 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/aes_ctr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-CTR cipher 3 | * Copyright (c) 2015 Eran Kornblau 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_AES_CTR_H 23 | #define AVUTIL_AES_CTR_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | #define AES_CTR_KEY_SIZE (16) 31 | #define AES_CTR_IV_SIZE (8) 32 | 33 | struct AVAESCTR; 34 | 35 | /** 36 | * Allocate an AVAESCTR context. 37 | */ 38 | struct AVAESCTR *av_aes_ctr_alloc(void); 39 | 40 | /** 41 | * Initialize an AVAESCTR context. 42 | * @param key encryption key, must have a length of AES_CTR_KEY_SIZE 43 | */ 44 | int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); 45 | 46 | /** 47 | * Release an AVAESCTR context. 48 | */ 49 | void av_aes_ctr_free(struct AVAESCTR *a); 50 | 51 | /** 52 | * Process a buffer using a previously initialized context. 53 | * @param dst destination array, can be equal to src 54 | * @param src source array, can be equal to dst 55 | * @param size the size of src and dst 56 | */ 57 | void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); 58 | 59 | /** 60 | * Get the current iv 61 | */ 62 | const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); 63 | 64 | /** 65 | * Generate a random iv 66 | */ 67 | void av_aes_ctr_set_random_iv(struct AVAESCTR *a); 68 | 69 | /** 70 | * Forcefully change the iv 71 | */ 72 | void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); 73 | 74 | /** 75 | * Increment the top 64 bit of the iv (performed after each frame) 76 | */ 77 | void av_aes_ctr_increment_iv(struct AVAESCTR *a); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_AES_CTR_H */ 84 | -------------------------------------------------------------------------------- /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 | # define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y)) 32 | #else 33 | # define AV_GCC_VERSION_AT_LEAST(x,y) 0 34 | # define AV_GCC_VERSION_AT_MOST(x,y) 0 35 | #endif 36 | 37 | #ifndef av_always_inline 38 | #if AV_GCC_VERSION_AT_LEAST(3,1) 39 | # define av_always_inline __attribute__((always_inline)) inline 40 | #elif defined(_MSC_VER) 41 | # define av_always_inline __forceinline 42 | #else 43 | # define av_always_inline inline 44 | #endif 45 | #endif 46 | 47 | #ifndef av_extern_inline 48 | #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) 49 | # define av_extern_inline extern inline 50 | #else 51 | # define av_extern_inline inline 52 | #endif 53 | #endif 54 | 55 | #if AV_GCC_VERSION_AT_LEAST(3,4) 56 | # define av_warn_unused_result __attribute__((warn_unused_result)) 57 | #else 58 | # define av_warn_unused_result 59 | #endif 60 | 61 | #if AV_GCC_VERSION_AT_LEAST(3,1) 62 | # define av_noinline __attribute__((noinline)) 63 | #elif defined(_MSC_VER) 64 | # define av_noinline __declspec(noinline) 65 | #else 66 | # define av_noinline 67 | #endif 68 | 69 | #if AV_GCC_VERSION_AT_LEAST(3,1) 70 | # define av_pure __attribute__((pure)) 71 | #else 72 | # define av_pure 73 | #endif 74 | 75 | #if AV_GCC_VERSION_AT_LEAST(2,6) 76 | # define av_const __attribute__((const)) 77 | #else 78 | # define av_const 79 | #endif 80 | 81 | #if AV_GCC_VERSION_AT_LEAST(4,3) 82 | # define av_cold __attribute__((cold)) 83 | #else 84 | # define av_cold 85 | #endif 86 | 87 | #if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) 88 | # define av_flatten __attribute__((flatten)) 89 | #else 90 | # define av_flatten 91 | #endif 92 | 93 | #if AV_GCC_VERSION_AT_LEAST(3,1) 94 | # define attribute_deprecated __attribute__((deprecated)) 95 | #elif defined(_MSC_VER) 96 | # define attribute_deprecated __declspec(deprecated) 97 | #else 98 | # define attribute_deprecated 99 | #endif 100 | 101 | /** 102 | * Disable warnings about deprecated features 103 | * This is useful for sections of code kept for backward compatibility and 104 | * scheduled for removal. 105 | */ 106 | #ifndef AV_NOWARN_DEPRECATED 107 | #if AV_GCC_VERSION_AT_LEAST(4,6) 108 | # define AV_NOWARN_DEPRECATED(code) \ 109 | _Pragma("GCC diagnostic push") \ 110 | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ 111 | code \ 112 | _Pragma("GCC diagnostic pop") 113 | #elif defined(_MSC_VER) 114 | # define AV_NOWARN_DEPRECATED(code) \ 115 | __pragma(warning(push)) \ 116 | __pragma(warning(disable : 4996)) \ 117 | code; \ 118 | __pragma(warning(pop)) 119 | #else 120 | # define AV_NOWARN_DEPRECATED(code) code 121 | #endif 122 | #endif 123 | 124 | 125 | #if defined(__GNUC__) 126 | # define av_unused __attribute__((unused)) 127 | #else 128 | # define av_unused 129 | #endif 130 | 131 | /** 132 | * Mark a variable as used and prevent the compiler from optimizing it 133 | * away. This is useful for variables accessed only from inline 134 | * assembler without the compiler being aware. 135 | */ 136 | #if AV_GCC_VERSION_AT_LEAST(3,1) 137 | # define av_used __attribute__((used)) 138 | #else 139 | # define av_used 140 | #endif 141 | 142 | #if AV_GCC_VERSION_AT_LEAST(3,3) 143 | # define av_alias __attribute__((may_alias)) 144 | #else 145 | # define av_alias 146 | #endif 147 | 148 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) 149 | # define av_uninit(x) x=x 150 | #else 151 | # define av_uninit(x) x 152 | #endif 153 | 154 | #ifdef __GNUC__ 155 | # define av_builtin_constant_p __builtin_constant_p 156 | # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) 157 | #else 158 | # define av_builtin_constant_p(x) 0 159 | # define av_printf_format(fmtpos, attrpos) 160 | #endif 161 | 162 | #if AV_GCC_VERSION_AT_LEAST(2,5) 163 | # define av_noreturn __attribute__((noreturn)) 164 | #else 165 | # define av_noreturn 166 | #endif 167 | 168 | #endif /* AVUTIL_ATTRIBUTES_H */ 169 | -------------------------------------------------------------------------------- /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 speed loss. 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 | #define av_assert2_fpu() av_assert0_fpu() 63 | #else 64 | #define av_assert2(cond) ((void)0) 65 | #define av_assert2_fpu() ((void)0) 66 | #endif 67 | 68 | /** 69 | * Assert that floating point opperations can be executed. 70 | * 71 | * This will av_assert0() that the cpu is not in MMX state on X86 72 | */ 73 | void av_assert0_fpu(void); 74 | 75 | #endif /* AVUTIL_AVASSERT_H */ 76 | -------------------------------------------------------------------------------- /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 1 6 | #endif /* AVUTIL_AVCONFIG_H */ 7 | -------------------------------------------------------------------------------- /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 | * Decode a base64-encoded string. 34 | * 35 | * @param out buffer for decoded data 36 | * @param in null-terminated input string 37 | * @param out_size size in bytes of the out buffer, must be at 38 | * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in)) 39 | * @return number of bytes written, or a negative value in case of 40 | * invalid input 41 | */ 42 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 43 | 44 | /** 45 | * Calculate the output size in bytes needed to decode a base64 string 46 | * with length x to a data buffer. 47 | */ 48 | #define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) 49 | 50 | /** 51 | * Encode data to base64 and null-terminate. 52 | * 53 | * @param out buffer for encoded data 54 | * @param out_size size in bytes of the out buffer (including the 55 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 56 | * @param in input buffer containing the data to encode 57 | * @param in_size size in bytes of the in buffer 58 | * @return out or NULL in case of error 59 | */ 60 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 61 | 62 | /** 63 | * Calculate the output size needed to base64-encode x bytes to a 64 | * null-terminated string. 65 | */ 66 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | #endif /* AVUTIL_BASE64_H */ 73 | -------------------------------------------------------------------------------- /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 | * Allocate an AVBlowfish context. 42 | */ 43 | AVBlowfish *av_blowfish_alloc(void); 44 | 45 | /** 46 | * Initialize an AVBlowfish context. 47 | * 48 | * @param ctx an AVBlowfish context 49 | * @param key a key 50 | * @param key_len length of the key 51 | */ 52 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context. 56 | * 57 | * @param ctx an AVBlowfish context 58 | * @param xl left four bytes halves of input to be encrypted 59 | * @param xr right four bytes halves of input to be encrypted 60 | * @param decrypt 0 for encryption, 1 for decryption 61 | */ 62 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, 63 | int decrypt); 64 | 65 | /** 66 | * Encrypt or decrypt a buffer using a previously initialized context. 67 | * 68 | * @param ctx an AVBlowfish context 69 | * @param dst destination array, can be equal to src 70 | * @param src source array, can be equal to dst 71 | * @param count number of 8 byte blocks 72 | * @param iv initialization vector for CBC mode, if NULL ECB will be used 73 | * @param decrypt 0 for encryption, 1 for decryption 74 | */ 75 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, 76 | int count, uint8_t *iv, int decrypt); 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | #endif /* AVUTIL_BLOWFISH_H */ 83 | -------------------------------------------------------------------------------- /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_SH4 44 | # include "sh4/bswap.h" 45 | #elif ARCH_X86 46 | # include "x86/bswap.h" 47 | #endif 48 | 49 | #endif /* HAVE_AV_CONFIG_H */ 50 | 51 | #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) 52 | #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) 53 | #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) 54 | 55 | #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) 56 | 57 | #ifndef av_bswap16 58 | static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 59 | { 60 | x= (x>>8) | (x<<8); 61 | return x; 62 | } 63 | #endif 64 | 65 | #ifndef av_bswap32 66 | static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67 | { 68 | return AV_BSWAP32C(x); 69 | } 70 | #endif 71 | 72 | #ifndef av_bswap64 73 | static inline uint64_t av_const av_bswap64(uint64_t x) 74 | { 75 | return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); 76 | } 77 | #endif 78 | 79 | // be2ne ... big-endian to native-endian 80 | // le2ne ... little-endian to native-endian 81 | 82 | #if AV_HAVE_BIGENDIAN 83 | #define av_be2ne16(x) (x) 84 | #define av_be2ne32(x) (x) 85 | #define av_be2ne64(x) (x) 86 | #define av_le2ne16(x) av_bswap16(x) 87 | #define av_le2ne32(x) av_bswap32(x) 88 | #define av_le2ne64(x) av_bswap64(x) 89 | #define AV_BE2NEC(s, x) (x) 90 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x) 91 | #else 92 | #define av_be2ne16(x) av_bswap16(x) 93 | #define av_be2ne32(x) av_bswap32(x) 94 | #define av_be2ne64(x) av_bswap64(x) 95 | #define av_le2ne16(x) (x) 96 | #define av_le2ne32(x) (x) 97 | #define av_le2ne64(x) (x) 98 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x) 99 | #define AV_LE2NEC(s, x) (x) 100 | #endif 101 | 102 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x) 103 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x) 104 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x) 105 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x) 106 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x) 107 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x) 108 | 109 | #endif /* AVUTIL_BSWAP_H */ 110 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/camellia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 3 | * Copyright (c) 2014 Supraja Meedinti 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_CAMELLIA_H 23 | #define AVUTIL_CAMELLIA_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAMELLIA algorithm 31 | * @defgroup lavu_camellia CAMELLIA 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_camellia_size; 37 | 38 | struct AVCAMELLIA; 39 | 40 | /** 41 | * Allocate an AVCAMELLIA context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAMELLIA *av_camellia_alloc(void); 45 | 46 | /** 47 | * Initialize an AVCAMELLIA context. 48 | * 49 | * @param ctx an AVCAMELLIA context 50 | * @param key a key of 16, 24, 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: possible are 128, 192, 256 52 | */ 53 | int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVCAMELLIA context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_CAMELLIA_H */ 71 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/cast5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAST128 algorithm as mentioned in RFC2144 3 | * Copyright (c) 2014 Supraja Meedinti 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_CAST5_H 23 | #define AVUTIL_CAST5_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAST5 algorithm 31 | * @defgroup lavu_cast5 CAST5 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_cast5_size; 37 | 38 | struct AVCAST5; 39 | 40 | /** 41 | * Allocate an AVCAST5 context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAST5 *av_cast5_alloc(void); 45 | /** 46 | * Initialize an AVCAST5 context. 47 | * 48 | * @param ctx an AVCAST5 context 49 | * @param key a key of 5,6,...16 bytes used for encryption/decryption 50 | * @param key_bits number of keybits: possible are 40,48,...,128 51 | * @return 0 on success, less than 0 on failure 52 | */ 53 | int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only 57 | * 58 | * @param ctx an AVCAST5 context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 8 byte blocks 62 | * @param decrypt 0 for encryption, 1 for decryption 63 | */ 64 | void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); 65 | 66 | /** 67 | * Encrypt or decrypt a buffer using a previously initialized context 68 | * 69 | * @param ctx an AVCAST5 context 70 | * @param dst destination array, can be equal to src 71 | * @param src source array, can be equal to dst 72 | * @param count number of 8 byte blocks 73 | * @param iv initialization vector for CBC mode, NULL for ECB mode 74 | * @param decrypt 0 for encryption, 1 for decryption 75 | */ 76 | void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 77 | /** 78 | * @} 79 | */ 80 | #endif /* AVUTIL_CAST5_H */ 81 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/cpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2001, 2002 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_CPU_H 22 | #define AVUTIL_CPU_H 23 | 24 | #include "attributes.h" 25 | 26 | #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ 27 | 28 | /* lower 16 bits - CPU features */ 29 | #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX 30 | #define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext 31 | #define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext 32 | #define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW 33 | #define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions 34 | #define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions 35 | #define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster 36 | ///< than regular MMX/SSE (e.g. Core1) 37 | #define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt 38 | #define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions 39 | #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster 40 | ///< than regular MMX/SSE (e.g. Core1) 41 | #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions 42 | #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower 43 | #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions 44 | #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions 45 | #define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions 46 | #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used 47 | #define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) 48 | #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions 49 | #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions 50 | #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction 51 | #define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used 52 | #define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions 53 | #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 54 | #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 55 | 56 | #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard 57 | #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 58 | #define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07 59 | 60 | #define AV_CPU_FLAG_ARMV5TE (1 << 0) 61 | #define AV_CPU_FLAG_ARMV6 (1 << 1) 62 | #define AV_CPU_FLAG_ARMV6T2 (1 << 2) 63 | #define AV_CPU_FLAG_VFP (1 << 3) 64 | #define AV_CPU_FLAG_VFPV3 (1 << 4) 65 | #define AV_CPU_FLAG_NEON (1 << 5) 66 | #define AV_CPU_FLAG_ARMV8 (1 << 6) 67 | #define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations 68 | #define AV_CPU_FLAG_SETEND (1 <<16) 69 | 70 | /** 71 | * Return the flags which specify extensions supported by the CPU. 72 | * The returned value is affected by av_force_cpu_flags() if that was used 73 | * before. So av_get_cpu_flags() can easily be used in an application to 74 | * detect the enabled cpu flags. 75 | */ 76 | int av_get_cpu_flags(void); 77 | 78 | /** 79 | * Disables cpu detection and forces the specified flags. 80 | * -1 is a special case that disables forcing of specific flags. 81 | */ 82 | void av_force_cpu_flags(int flags); 83 | 84 | /** 85 | * Set a mask on flags returned by av_get_cpu_flags(). 86 | * This function is mainly useful for testing. 87 | * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible 88 | * 89 | * @warning this function is not thread safe. 90 | */ 91 | attribute_deprecated void av_set_cpu_flags_mask(int mask); 92 | 93 | /** 94 | * Parse CPU flags from a string. 95 | * 96 | * The returned flags contain the specified flags as well as related unspecified flags. 97 | * 98 | * This function exists only for compatibility with libav. 99 | * Please use av_parse_cpu_caps() when possible. 100 | * @return a combination of AV_CPU_* flags, negative on error. 101 | */ 102 | attribute_deprecated 103 | int av_parse_cpu_flags(const char *s); 104 | 105 | /** 106 | * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. 107 | * 108 | * @return negative on error. 109 | */ 110 | int av_parse_cpu_caps(unsigned *flags, const char *s); 111 | 112 | /** 113 | * @return the number of logical CPU cores present. 114 | */ 115 | int av_cpu_count(void); 116 | 117 | #endif /* AVUTIL_CPU_H */ 118 | -------------------------------------------------------------------------------- /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 | /** 22 | * @file 23 | * @ingroup lavu_crc32 24 | * Public header for CRC hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_CRC_H 28 | #define AVUTIL_CRC_H 29 | 30 | #include 31 | #include 32 | #include "attributes.h" 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_crc32 CRC 37 | * @ingroup lavu_hash 38 | * CRC (Cyclic Redundancy Check) hash function implementation. 39 | * 40 | * This module supports numerous CRC polynomials, in addition to the most 41 | * widely used CRC-32-IEEE. See @ref AVCRCId for a list of available 42 | * polynomials. 43 | * 44 | * @{ 45 | */ 46 | 47 | typedef uint32_t AVCRC; 48 | 49 | typedef enum { 50 | AV_CRC_8_ATM, 51 | AV_CRC_16_ANSI, 52 | AV_CRC_16_CCITT, 53 | AV_CRC_32_IEEE, 54 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ 55 | AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ 56 | #if FF_API_CRC_BIG_TABLE 57 | AV_CRC_24_IEEE = 12, 58 | #else 59 | AV_CRC_24_IEEE, 60 | #endif /* FF_API_CRC_BIG_TABLE */ 61 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ 62 | }AVCRCId; 63 | 64 | /** 65 | * Initialize a CRC table. 66 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 67 | * @param le If 1, the lowest bit represents the coefficient for the highest 68 | * exponent of the corresponding polynomial (both for poly and 69 | * actual CRC). 70 | * If 0, you must swap the CRC parameter and the result of av_crc 71 | * if you need the standard representation (can be simplified in 72 | * most cases to e.g. bswap16): 73 | * av_bswap32(crc << (32-bits)) 74 | * @param bits number of bits for the CRC 75 | * @param poly generator polynomial without the x**bits coefficient, in the 76 | * representation as specified by le 77 | * @param ctx_size size of ctx in bytes 78 | * @return <0 on failure 79 | */ 80 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); 81 | 82 | /** 83 | * Get an initialized standard CRC table. 84 | * @param crc_id ID of a standard CRC 85 | * @return a pointer to the CRC table or NULL on failure 86 | */ 87 | const AVCRC *av_crc_get_table(AVCRCId crc_id); 88 | 89 | /** 90 | * Calculate the CRC of a block. 91 | * @param crc CRC of previous blocks if any or initial value for CRC 92 | * @return CRC updated with the data from the given block 93 | * 94 | * @see av_crc_init() "le" parameter 95 | */ 96 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc, 97 | const uint8_t *buffer, size_t length) av_pure; 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | #endif /* AVUTIL_CRC_H */ 104 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/des.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DES encryption/decryption 3 | * Copyright (c) 2007 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_DES_H 23 | #define AVUTIL_DES_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_des DES 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | typedef struct AVDES { 34 | uint64_t round_keys[3][16]; 35 | int triple_des; 36 | } AVDES; 37 | 38 | /** 39 | * Allocate an AVDES context. 40 | */ 41 | AVDES *av_des_alloc(void); 42 | 43 | /** 44 | * @brief Initializes an AVDES context. 45 | * 46 | * @param key_bits must be 64 or 192 47 | * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption 48 | * @return zero on success, negative value otherwise 49 | */ 50 | int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); 51 | 52 | /** 53 | * @brief Encrypts / decrypts using the DES algorithm. 54 | * 55 | * @param count number of 8 byte blocks 56 | * @param dst destination array, can be equal to src, must be 8-byte aligned 57 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 58 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used, 59 | * must be 8-byte aligned 60 | * @param decrypt 0 for encryption, 1 for decryption 61 | */ 62 | void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 63 | 64 | /** 65 | * @brief Calculates CBC-MAC using the DES algorithm. 66 | * 67 | * @param count number of 8 byte blocks 68 | * @param dst destination array, can be equal to src, must be 8-byte aligned 69 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 70 | */ 71 | void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* AVUTIL_DES_H */ 78 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/display.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 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 | #ifndef AVUTIL_DISPLAY_H 22 | #define AVUTIL_DISPLAY_H 23 | 24 | #include 25 | #include "common.h" 26 | 27 | /** 28 | * The display transformation matrix specifies an affine transformation that 29 | * should be applied to video frames for correct presentation. It is compatible 30 | * with the matrices stored in the ISO/IEC 14496-12 container format. 31 | * 32 | * The data is a 3x3 matrix represented as a 9-element array: 33 | * 34 | * | a b u | 35 | * (a, b, u, c, d, v, x, y, w) -> | c d v | 36 | * | x y w | 37 | * 38 | * All numbers are stored in native endianness, as 16.16 fixed-point values, 39 | * except for u, v and w, which are stored as 2.30 fixed-point values. 40 | * 41 | * The transformation maps a point (p, q) in the source (pre-transformation) 42 | * frame to the point (p', q') in the destination (post-transformation) frame as 43 | * follows: 44 | * | a b u | 45 | * (p, q, 1) . | c d v | = z * (p', q', 1) 46 | * | x y w | 47 | * 48 | * The transformation can also be more explicitly written in components as 49 | * follows: 50 | * p' = (a * p + c * q + x) / z; 51 | * q' = (b * p + d * q + y) / z; 52 | * z = u * p + v * q + w 53 | */ 54 | 55 | /** 56 | * Extract the rotation component of the transformation matrix. 57 | * 58 | * @param matrix the transformation matrix 59 | * @return the angle (in degrees) by which the transformation rotates the frame 60 | * counterclockwise. The angle will be in range [-180.0, 180.0], 61 | * or NaN if the matrix is singular. 62 | * 63 | * @note floating point numbers are inherently inexact, so callers are 64 | * recommended to round the return value to nearest integer before use. 65 | */ 66 | double av_display_rotation_get(const int32_t matrix[9]); 67 | 68 | /** 69 | * Initialize a transformation matrix describing a pure counterclockwise 70 | * rotation by the specified angle (in degrees). 71 | * 72 | * @param matrix an allocated transformation matrix (will be fully overwritten 73 | * by this function) 74 | * @param angle rotation angle in degrees. 75 | */ 76 | void av_display_rotation_set(int32_t matrix[9], double angle); 77 | 78 | /** 79 | * Flip the input matrix horizontally and/or vertically. 80 | * 81 | * @param matrix an allocated transformation matrix 82 | * @param hflip whether the matrix should be flipped horizontally 83 | * @param vflip whether the matrix should be flipped vertically 84 | */ 85 | void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); 86 | 87 | #endif /* AVUTIL_DISPLAY_H */ 88 | -------------------------------------------------------------------------------- /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 | * If the side data is absent, it is created and added to the frame. 99 | * 100 | * @param frame the frame for which the side data is to be obtained or created 101 | * 102 | * @return the AVDownmixInfo structure to be edited by the caller, or NULL if 103 | * the structure cannot be allocated. 104 | */ 105 | AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | #endif /* AVUTIL_DOWNMIX_INFO_H */ 116 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/eval.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002 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 arithmetic expression evaluator 24 | */ 25 | 26 | #ifndef AVUTIL_EVAL_H 27 | #define AVUTIL_EVAL_H 28 | 29 | #include "avutil.h" 30 | 31 | typedef struct AVExpr AVExpr; 32 | 33 | /** 34 | * Parse and evaluate an expression. 35 | * Note, this is significantly slower than av_expr_eval(). 36 | * 37 | * @param res a pointer to a double where is put the result value of 38 | * the expression, or NAN in case of error 39 | * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" 40 | * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} 41 | * @param const_values a zero terminated array of values for the identifiers from const_names 42 | * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers 43 | * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument 44 | * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers 45 | * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments 46 | * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 47 | * @param log_ctx parent logging context 48 | * @return >= 0 in case of success, a negative value corresponding to an 49 | * AVERROR code otherwise 50 | */ 51 | int av_expr_parse_and_eval(double *res, const char *s, 52 | const char * const *const_names, const double *const_values, 53 | const char * const *func1_names, double (* const *funcs1)(void *, double), 54 | const char * const *func2_names, double (* const *funcs2)(void *, double, double), 55 | void *opaque, int log_offset, void *log_ctx); 56 | 57 | /** 58 | * Parse an expression. 59 | * 60 | * @param expr a pointer where is put an AVExpr containing the parsed 61 | * value in case of successful parsing, or NULL otherwise. 62 | * The pointed to AVExpr must be freed with av_expr_free() by the user 63 | * when it is not needed anymore. 64 | * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" 65 | * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} 66 | * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers 67 | * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument 68 | * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers 69 | * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments 70 | * @param log_ctx parent logging context 71 | * @return >= 0 in case of success, a negative value corresponding to an 72 | * AVERROR code otherwise 73 | */ 74 | int av_expr_parse(AVExpr **expr, const char *s, 75 | const char * const *const_names, 76 | const char * const *func1_names, double (* const *funcs1)(void *, double), 77 | const char * const *func2_names, double (* const *funcs2)(void *, double, double), 78 | int log_offset, void *log_ctx); 79 | 80 | /** 81 | * Evaluate a previously parsed expression. 82 | * 83 | * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names 84 | * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 85 | * @return the value of the expression 86 | */ 87 | double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); 88 | 89 | /** 90 | * Free a parsed expression previously created with av_expr_parse(). 91 | */ 92 | void av_expr_free(AVExpr *e); 93 | 94 | /** 95 | * Parse the string in numstr and return its value as a double. If 96 | * the string is empty, contains only whitespaces, or does not contain 97 | * an initial substring that has the expected syntax for a 98 | * floating-point number, no conversion is performed. In this case, 99 | * returns a value of zero and the value returned in tail is the value 100 | * of numstr. 101 | * 102 | * @param numstr a string representing a number, may contain one of 103 | * the International System number postfixes, for example 'K', 'M', 104 | * 'G'. If 'i' is appended after the postfix, powers of 2 are used 105 | * instead of powers of 10. The 'B' postfix multiplies the value by 106 | * 8, and can be appended after another postfix or used alone. This 107 | * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. 108 | * @param tail if non-NULL puts here the pointer to the char next 109 | * after the last parsed character 110 | */ 111 | double av_strtod(const char *numstr, char **tail); 112 | 113 | #endif /* AVUTIL_EVAL_H */ 114 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | /* Automatically generated by version.sh, do not manually edit! */ 2 | #ifndef AVUTIL_FFVERSION_H 3 | #define AVUTIL_FFVERSION_H 4 | #define FFMPEG_VERSION "n3.2.10-5-g03e5bda" 5 | #endif /* AVUTIL_FFVERSION_H */ 6 | -------------------------------------------------------------------------------- /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 | av_warn_unused_result 44 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 45 | int log_offset, void *log_ctx); 46 | 47 | /** 48 | * Unmap or free the buffer bufptr created by av_file_map(). 49 | * 50 | * @param size size in bytes of bufptr, must be the same as returned 51 | * by av_file_map() 52 | */ 53 | void av_file_unmap(uint8_t *bufptr, size_t size); 54 | 55 | /** 56 | * Wrapper to work around the lack of mkstemp() on mingw. 57 | * Also, tries to create file in /tmp first, if possible. 58 | * *prefix can be a character constant; *filename will be allocated internally. 59 | * @return file descriptor of opened file (or negative value corresponding to an 60 | * AVERROR code on error) 61 | * and opened file name in **filename. 62 | * @note On very old libcs it is necessary to set a secure umask before 63 | * calling this, av_tempfile() can't call umask itself as it is used in 64 | * libraries and could interfere with the calling application. 65 | * @deprecated as fd numbers cannot be passed saftely between libs on some platforms 66 | */ 67 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); 68 | 69 | #endif /* AVUTIL_FILE_H */ 70 | -------------------------------------------------------------------------------- /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 | #include "version.h" 27 | /** 28 | * @defgroup lavu_hmac HMAC 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | enum AVHMACType { 34 | AV_HMAC_MD5, 35 | AV_HMAC_SHA1, 36 | AV_HMAC_SHA224, 37 | AV_HMAC_SHA256, 38 | AV_HMAC_SHA384 = 12, 39 | AV_HMAC_SHA512, 40 | }; 41 | 42 | typedef struct AVHMAC AVHMAC; 43 | 44 | /** 45 | * Allocate an AVHMAC context. 46 | * @param type The hash function used for the HMAC. 47 | */ 48 | AVHMAC *av_hmac_alloc(enum AVHMACType type); 49 | 50 | /** 51 | * Free an AVHMAC context. 52 | * @param ctx The context to free, may be NULL 53 | */ 54 | void av_hmac_free(AVHMAC *ctx); 55 | 56 | /** 57 | * Initialize an AVHMAC context with an authentication key. 58 | * @param ctx The HMAC context 59 | * @param key The authentication key 60 | * @param keylen The length of the key, in bytes 61 | */ 62 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); 63 | 64 | /** 65 | * Hash data with the HMAC. 66 | * @param ctx The HMAC context 67 | * @param data The data to hash 68 | * @param len The length of the data, in bytes 69 | */ 70 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); 71 | 72 | /** 73 | * Finish hashing and output the HMAC digest. 74 | * @param ctx The HMAC context 75 | * @param out The output buffer to write the digest into 76 | * @param outlen The length of the out buffer, in bytes 77 | * @return The number of bytes written to out, or a negative error code. 78 | */ 79 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); 80 | 81 | /** 82 | * Hash an array of data with a key. 83 | * @param ctx The HMAC context 84 | * @param data The data to hash 85 | * @param len The length of the data, in bytes 86 | * @param key The authentication key 87 | * @param keylen The length of the key, in bytes 88 | * @param out The output buffer to write the digest into 89 | * @param outlen The length of the out buffer, in bytes 90 | * @return The number of bytes written to out, or a negative error code. 91 | */ 92 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, 93 | const uint8_t *key, unsigned int keylen, 94 | uint8_t *out, unsigned int outlen); 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | #endif /* AVUTIL_HMAC_H */ 101 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/hwcontext_cuda.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 | #ifndef AVUTIL_HWCONTEXT_CUDA_H 21 | #define AVUTIL_HWCONTEXT_CUDA_H 22 | 23 | #include 24 | 25 | #include "pixfmt.h" 26 | 27 | /** 28 | * @file 29 | * An API-specific header for AV_HWDEVICE_TYPE_CUDA. 30 | * 31 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 32 | * AVBufferRefs whose data pointer is a CUdeviceptr. 33 | */ 34 | 35 | /** 36 | * This struct is allocated as AVHWDeviceContext.hwctx 37 | */ 38 | typedef struct AVCUDADeviceContext { 39 | CUcontext cuda_ctx; 40 | } AVCUDADeviceContext; 41 | 42 | /** 43 | * AVHWFramesContext.hwctx is currently not used 44 | */ 45 | 46 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */ 47 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/hwcontext_dxva2.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 | #ifndef AVUTIL_HWCONTEXT_DXVA2_H 21 | #define AVUTIL_HWCONTEXT_DXVA2_H 22 | 23 | /** 24 | * @file 25 | * An API-specific header for AV_HWDEVICE_TYPE_DXVA2. 26 | * 27 | * Only fixed-size pools are supported. 28 | * 29 | * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs 30 | * with the data pointer set to a pointer to IDirect3DSurface9. 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | * This struct is allocated as AVHWDeviceContext.hwctx 38 | */ 39 | typedef struct AVDXVA2DeviceContext { 40 | IDirect3DDeviceManager9 *devmgr; 41 | } AVDXVA2DeviceContext; 42 | 43 | /** 44 | * This struct is allocated as AVHWFramesContext.hwctx 45 | */ 46 | typedef struct AVDXVA2FramesContext { 47 | /** 48 | * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or 49 | * DXVA2_VideoDecoderRenderTarget). Must be set by the caller. 50 | */ 51 | DWORD surface_type; 52 | 53 | /** 54 | * The surface pool. When an external pool is not provided by the caller, 55 | * this will be managed (allocated and filled on init, freed on uninit) by 56 | * libavutil. 57 | */ 58 | IDirect3DSurface9 **surfaces; 59 | int nb_surfaces; 60 | 61 | /** 62 | * Certain drivers require the decoder to be destroyed before the surfaces. 63 | * To allow internally managed pools to work properly in such cases, this 64 | * field is provided. 65 | * 66 | * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on 67 | * it just before the internal surface pool is freed. 68 | */ 69 | IDirectXVideoDecoder *decoder_to_release; 70 | } AVDXVA2FramesContext; 71 | 72 | #endif /* AVUTIL_HWCONTEXT_DXVA2_H */ 73 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/hwcontext_qsv.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_HWCONTEXT_QSV_H 20 | #define AVUTIL_HWCONTEXT_QSV_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV. 27 | * 28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must 29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVQSVDeviceContext { 36 | mfxSession session; 37 | } AVQSVDeviceContext; 38 | 39 | /** 40 | * This struct is allocated as AVHWFramesContext.hwctx 41 | */ 42 | typedef struct AVQSVFramesContext { 43 | mfxFrameSurface1 *surfaces; 44 | int nb_surfaces; 45 | 46 | /** 47 | * A combination of MFX_MEMTYPE_* describing the frame pool. 48 | */ 49 | int frame_type; 50 | } AVQSVFramesContext; 51 | 52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */ 53 | 54 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/hwcontext_vaapi.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_HWCONTEXT_VAAPI_H 20 | #define AVUTIL_HWCONTEXT_VAAPI_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * API-specific header for AV_HWDEVICE_TYPE_VAAPI. 27 | * 28 | * Dynamic frame pools are supported, but note that any pool used as a render 29 | * target is required to be of fixed size in order to be be usable as an 30 | * argument to vaCreateContext(). 31 | * 32 | * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs 33 | * with the data pointer set to a VASurfaceID. 34 | */ 35 | 36 | /** 37 | * VAAPI connection details. 38 | * 39 | * Allocated as AVHWDeviceContext.hwctx 40 | */ 41 | typedef struct AVVAAPIDeviceContext { 42 | /** 43 | * The VADisplay handle, to be filled by the user. 44 | */ 45 | VADisplay display; 46 | } AVVAAPIDeviceContext; 47 | 48 | /** 49 | * VAAPI-specific data associated with a frame pool. 50 | * 51 | * Allocated as AVHWFramesContext.hwctx. 52 | */ 53 | typedef struct AVVAAPIFramesContext { 54 | /** 55 | * Set by the user to apply surface attributes to all surfaces in 56 | * the frame pool. If null, default settings are used. 57 | */ 58 | VASurfaceAttrib *attributes; 59 | int nb_attributes; 60 | /** 61 | * The surfaces IDs of all surfaces in the pool after creation. 62 | * Only valid if AVHWFramesContext.initial_pool_size was positive. 63 | * These are intended to be used as the render_targets arguments to 64 | * vaCreateContext(). 65 | */ 66 | VASurfaceID *surface_ids; 67 | int nb_surfaces; 68 | } AVVAAPIFramesContext; 69 | 70 | /** 71 | * VAAPI hardware pipeline configuration details. 72 | * 73 | * Allocated with av_hwdevice_hwconfig_alloc(). 74 | */ 75 | typedef struct AVVAAPIHWConfig { 76 | /** 77 | * ID of a VAAPI pipeline configuration. 78 | */ 79 | VAConfigID config_id; 80 | } AVVAAPIHWConfig; 81 | 82 | #endif /* AVUTIL_HWCONTEXT_VAAPI_H */ 83 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/hwcontext_vdpau.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_HWCONTEXT_VDPAU_H 20 | #define AVUTIL_HWCONTEXT_VDPAU_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. 27 | * 28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 29 | * AVBufferRefs whose data pointer is a VdpVideoSurface. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVVDPAUDeviceContext { 36 | VdpDevice device; 37 | VdpGetProcAddress *get_proc_address; 38 | } AVVDPAUDeviceContext; 39 | 40 | /** 41 | * AVHWFramesContext.hwctx is currently not used 42 | */ 43 | 44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */ 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) 49 | 50 | #endif /* AVUTIL_MACROS_H */ 51 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/mastering_display_metadata.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2016 Neil Birkbeck 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_MASTERING_DISPLAY_METADATA_H 22 | #define AVUTIL_MASTERING_DISPLAY_METADATA_H 23 | 24 | #include "frame.h" 25 | #include "rational.h" 26 | 27 | 28 | /** 29 | * Mastering display metadata capable of representing the color volume of 30 | * the display used to master the content (SMPTE 2086:2014). 31 | * 32 | * To be used as payload of a AVFrameSideData or AVPacketSideData with the 33 | * appropriate type. 34 | * 35 | * @note The struct should be allocated with av_mastering_display_metadata_alloc() 36 | * and its size is not a part of the public ABI. 37 | */ 38 | typedef struct AVMasteringDisplayMetadata { 39 | /** 40 | * CIE 1931 xy chromaticity coords of color primaries (r, g, b order). 41 | */ 42 | AVRational display_primaries[3][2]; 43 | 44 | /** 45 | * CIE 1931 xy chromaticity coords of white point. 46 | */ 47 | AVRational white_point[2]; 48 | 49 | /** 50 | * Min luminance of mastering display (cd/m^2). 51 | */ 52 | AVRational min_luminance; 53 | 54 | /** 55 | * Max luminance of mastering display (cd/m^2). 56 | */ 57 | AVRational max_luminance; 58 | 59 | /** 60 | * Flag indicating whether the display primaries (and white point) are set. 61 | */ 62 | int has_primaries; 63 | 64 | /** 65 | * Flag indicating whether the luminance (min_ and max_) have been set. 66 | */ 67 | int has_luminance; 68 | 69 | } AVMasteringDisplayMetadata; 70 | 71 | /** 72 | * Allocate an AVMasteringDisplayMetadata structure and set its fields to 73 | * default values. The resulting struct can be freed using av_freep(). 74 | * 75 | * @return An AVMasteringDisplayMetadata filled with default values or NULL 76 | * on failure. 77 | */ 78 | AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); 79 | 80 | /** 81 | * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. 82 | * 83 | * @param frame The frame which side data is added to. 84 | * 85 | * @return The AVMasteringDisplayMetadata structure to be filled by caller. 86 | */ 87 | AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame); 88 | 89 | #endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */ 90 | -------------------------------------------------------------------------------- /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 | /** 22 | * @file 23 | * @ingroup lavu_md5 24 | * Public header for MD5 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_MD5_H 28 | #define AVUTIL_MD5_H 29 | 30 | #include 31 | 32 | #include "attributes.h" 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_md5 MD5 37 | * @ingroup lavu_hash 38 | * MD5 hash function implementation. 39 | * 40 | * @{ 41 | */ 42 | 43 | extern const int av_md5_size; 44 | 45 | struct AVMD5; 46 | 47 | /** 48 | * Allocate an AVMD5 context. 49 | */ 50 | struct AVMD5 *av_md5_alloc(void); 51 | 52 | /** 53 | * Initialize MD5 hashing. 54 | * 55 | * @param ctx pointer to the function context (of size av_md5_size) 56 | */ 57 | void av_md5_init(struct AVMD5 *ctx); 58 | 59 | /** 60 | * Update hash value. 61 | * 62 | * @param ctx hash function context 63 | * @param src input data to update hash with 64 | * @param len input data length 65 | */ 66 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); 67 | 68 | /** 69 | * Finish hashing and output digest value. 70 | * 71 | * @param ctx hash function context 72 | * @param dst buffer where output digest value is stored 73 | */ 74 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 75 | 76 | /** 77 | * Hash an array of data. 78 | * 79 | * @param dst The output buffer to write the digest into 80 | * @param src The data to hash 81 | * @param len The length of the data, in bytes 82 | */ 83 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | #endif /* AVUTIL_MD5_H */ 90 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/motion_vector.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_MOTION_VECTOR_H 20 | #define AVUTIL_MOTION_VECTOR_H 21 | 22 | #include 23 | 24 | typedef struct AVMotionVector { 25 | /** 26 | * Where the current macroblock comes from; negative value when it comes 27 | * from the past, positive value when it comes from the future. 28 | * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". 29 | */ 30 | int32_t source; 31 | /** 32 | * Width and height of the block. 33 | */ 34 | uint8_t w, h; 35 | /** 36 | * Absolute source position. Can be outside the frame area. 37 | */ 38 | int16_t src_x, src_y; 39 | /** 40 | * Absolute destination position. Can be outside the frame area. 41 | */ 42 | int16_t dst_x, dst_y; 43 | /** 44 | * Extra flag information. 45 | * Currently unused. 46 | */ 47 | uint64_t flags; 48 | /** 49 | * Motion vector 50 | * src_x = dst_x + motion_x / motion_scale 51 | * src_y = dst_y + motion_y / motion_scale 52 | */ 53 | int32_t motion_x, motion_y; 54 | uint16_t motion_scale; 55 | } AVMotionVector; 56 | 57 | #endif /* AVUTIL_MOTION_VECTOR_H */ 58 | -------------------------------------------------------------------------------- /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 | /** 22 | * @file 23 | * @ingroup lavu_murmur3 24 | * Public header for MurmurHash3 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_MURMUR3_H 28 | #define AVUTIL_MURMUR3_H 29 | 30 | #include 31 | 32 | /** 33 | * @defgroup lavu_murmur3 Murmur3 34 | * @ingroup lavu_hash 35 | * MurmurHash3 hash function implementation. 36 | * 37 | * MurmurHash3 is a non-cryptographic hash function, of which three 38 | * incompatible versions were created by its inventor Austin Appleby: 39 | * 40 | * - 32-bit output 41 | * - 128-bit output for 32-bit platforms 42 | * - 128-bit output for 64-bit platforms 43 | * 44 | * FFmpeg only implements the last variant: 128-bit output designed for 64-bit 45 | * platforms. Even though the hash function was designed for 64-bit platforms, 46 | * the function in reality works on 32-bit systems too, only with reduced 47 | * performance. 48 | * 49 | * @anchor lavu_murmur3_seedinfo 50 | * By design, MurmurHash3 requires a seed to operate. In response to this, 51 | * libavutil provides two functions for hash initiation, one that requires a 52 | * seed (av_murmur3_init_seeded()) and one that uses a fixed arbitrary integer 53 | * as the seed, and therefore does not (av_murmur3_init()). 54 | * 55 | * To make hashes comparable, you should provide the same seed for all calls to 56 | * this hash function -- if you are supplying one yourself, that is. 57 | * 58 | * @{ 59 | */ 60 | 61 | /** 62 | * Allocate an AVMurMur3 hash context. 63 | * 64 | * @return Uninitialized hash context or `NULL` in case of error 65 | */ 66 | struct AVMurMur3 *av_murmur3_alloc(void); 67 | 68 | /** 69 | * Initialize or reinitialize an AVMurMur3 hash context with a seed. 70 | * 71 | * @param[out] c Hash context 72 | * @param[in] seed Random seed 73 | * 74 | * @see av_murmur3_init() 75 | * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of 76 | * seeds for MurmurHash3. 77 | */ 78 | void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); 79 | 80 | /** 81 | * Initialize or reinitialize an AVMurMur3 hash context. 82 | * 83 | * Equivalent to av_murmur3_init_seeded() with a built-in seed. 84 | * 85 | * @param[out] c Hash context 86 | * 87 | * @see av_murmur3_init_seeded() 88 | * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of 89 | * seeds for MurmurHash3. 90 | */ 91 | void av_murmur3_init(struct AVMurMur3 *c); 92 | 93 | /** 94 | * Update hash context with new data. 95 | * 96 | * @param[out] c Hash context 97 | * @param[in] src Input data to update hash with 98 | * @param[in] len Number of bytes to read from `src` 99 | */ 100 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); 101 | 102 | /** 103 | * Finish hashing and output digest value. 104 | * 105 | * @param[in,out] c Hash context 106 | * @param[out] dst Buffer where output digest value is stored 107 | */ 108 | void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | #endif /* AVUTIL_MURMUR3_H */ 115 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/pixelutils.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_PIXELUTILS_H 20 | #define AVUTIL_PIXELUTILS_H 21 | 22 | #include 23 | #include 24 | #include "common.h" 25 | 26 | /** 27 | * Sum of abs(src1[x] - src2[x]) 28 | */ 29 | typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, 30 | const uint8_t *src2, ptrdiff_t stride2); 31 | 32 | /** 33 | * Get a potentially optimized pointer to a Sum-of-absolute-differences 34 | * function (see the av_pixelutils_sad_fn prototype). 35 | * 36 | * @param w_bits 1< 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 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RC4 encryption/decryption/pseudo-random number generator 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_RC4_H 22 | #define AVUTIL_RC4_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_rc4 RC4 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | typedef struct AVRC4 { 33 | uint8_t state[256]; 34 | int x, y; 35 | } AVRC4; 36 | 37 | /** 38 | * Allocate an AVRC4 context. 39 | */ 40 | AVRC4 *av_rc4_alloc(void); 41 | 42 | /** 43 | * @brief Initializes an AVRC4 context. 44 | * 45 | * @param key_bits must be a multiple of 8 46 | * @param decrypt 0 for encryption, 1 for decryption, currently has no effect 47 | * @return zero on success, negative value otherwise 48 | */ 49 | int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * @brief Encrypts / decrypts using the RC4 algorithm. 53 | * 54 | * @param count number of bytes 55 | * @param dst destination array, can be equal to src 56 | * @param src source array, can be equal to dst, may be NULL 57 | * @param iv not (yet) used for RC4, should be NULL 58 | * @param decrypt 0 for encryption, 1 for decryption, not (yet) used 59 | */ 60 | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_RC4_H */ 67 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/replaygain.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_REPLAYGAIN_H 20 | #define AVUTIL_REPLAYGAIN_H 21 | 22 | #include 23 | 24 | /** 25 | * ReplayGain information (see 26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). 27 | * The size of this struct is a part of the public ABI. 28 | */ 29 | typedef struct AVReplayGain { 30 | /** 31 | * Track replay gain in microbels (divide by 100000 to get the value in dB). 32 | * Should be set to INT32_MIN when unknown. 33 | */ 34 | int32_t track_gain; 35 | /** 36 | * Peak track amplitude, with 100000 representing full scale (but values 37 | * may overflow). 0 when unknown. 38 | */ 39 | uint32_t track_peak; 40 | /** 41 | * Same as track_gain, but for the whole album. 42 | */ 43 | int32_t album_gain; 44 | /** 45 | * Same as track_peak, but for the whole album, 46 | */ 47 | uint32_t album_peak; 48 | } AVReplayGain; 49 | 50 | #endif /* AVUTIL_REPLAYGAIN_H */ 51 | -------------------------------------------------------------------------------- /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 | /** 23 | * @file 24 | * @ingroup lavu_ripemd 25 | * Public header for RIPEMD hash function implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_RIPEMD_H 29 | #define AVUTIL_RIPEMD_H 30 | 31 | #include 32 | 33 | #include "attributes.h" 34 | #include "version.h" 35 | 36 | /** 37 | * @defgroup lavu_ripemd RIPEMD 38 | * @ingroup lavu_hash 39 | * RIPEMD hash function implementation. 40 | * 41 | * @{ 42 | */ 43 | 44 | extern const int av_ripemd_size; 45 | 46 | struct AVRIPEMD; 47 | 48 | /** 49 | * Allocate an AVRIPEMD context. 50 | */ 51 | struct AVRIPEMD *av_ripemd_alloc(void); 52 | 53 | /** 54 | * Initialize RIPEMD hashing. 55 | * 56 | * @param context pointer to the function context (of size av_ripemd_size) 57 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 58 | * @return zero if initialization succeeded, -1 otherwise 59 | */ 60 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 61 | 62 | /** 63 | * Update hash value. 64 | * 65 | * @param context hash function context 66 | * @param data input data to update hash with 67 | * @param len input data length 68 | */ 69 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); 70 | 71 | /** 72 | * Finish hashing and output digest value. 73 | * 74 | * @param context hash function context 75 | * @param digest buffer where output digest value is stored 76 | */ 77 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_RIPEMD_H */ 84 | -------------------------------------------------------------------------------- /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 | /** 22 | * @file 23 | * @ingroup lavu_sha 24 | * Public header for SHA-1 & SHA-256 hash function implementations. 25 | */ 26 | 27 | #ifndef AVUTIL_SHA_H 28 | #define AVUTIL_SHA_H 29 | 30 | #include 31 | 32 | #include "attributes.h" 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_sha SHA 37 | * @ingroup lavu_hash 38 | * SHA-1 and SHA-256 (Secure Hash Algorithm) hash function implementations. 39 | * 40 | * This module supports the following SHA hash functions: 41 | * 42 | * - SHA-1: 160 bits 43 | * - SHA-224: 224 bits, as a variant of SHA-2 44 | * - SHA-256: 256 bits, as a variant of SHA-2 45 | * 46 | * @see For SHA-384, SHA-512, and variants thereof, see @ref lavu_sha512. 47 | * 48 | * @{ 49 | */ 50 | 51 | extern const int av_sha_size; 52 | 53 | struct AVSHA; 54 | 55 | /** 56 | * Allocate an AVSHA context. 57 | */ 58 | struct AVSHA *av_sha_alloc(void); 59 | 60 | /** 61 | * Initialize SHA-1 or SHA-2 hashing. 62 | * 63 | * @param context pointer to the function context (of size av_sha_size) 64 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) 65 | * @return zero if initialization succeeded, -1 otherwise 66 | */ 67 | int av_sha_init(struct AVSHA* context, int bits); 68 | 69 | /** 70 | * Update hash value. 71 | * 72 | * @param context hash function context 73 | * @param data input data to update hash with 74 | * @param len input data length 75 | */ 76 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); 77 | 78 | /** 79 | * Finish hashing and output digest value. 80 | * 81 | * @param context hash function context 82 | * @param digest buffer where output digest value is stored 83 | */ 84 | void av_sha_final(struct AVSHA* context, uint8_t *digest); 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | #endif /* AVUTIL_SHA_H */ 91 | -------------------------------------------------------------------------------- /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 | /** 23 | * @file 24 | * @ingroup lavu_sha512 25 | * Public header for SHA-512 implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_SHA512_H 29 | #define AVUTIL_SHA512_H 30 | 31 | #include 32 | 33 | #include "attributes.h" 34 | #include "version.h" 35 | 36 | /** 37 | * @defgroup lavu_sha512 SHA-512 38 | * @ingroup lavu_hash 39 | * SHA-512 (Secure Hash Algorithm) hash function implementations. 40 | * 41 | * This module supports the following SHA-2 hash functions: 42 | * 43 | * - SHA-512/224: 224 bits 44 | * - SHA-512/256: 256 bits 45 | * - SHA-384: 384 bits 46 | * - SHA-512: 512 bits 47 | * 48 | * @see For SHA-1, SHA-256, and variants thereof, see @ref lavu_sha. 49 | * 50 | * @{ 51 | */ 52 | 53 | extern const int av_sha512_size; 54 | 55 | struct AVSHA512; 56 | 57 | /** 58 | * Allocate an AVSHA512 context. 59 | */ 60 | struct AVSHA512 *av_sha512_alloc(void); 61 | 62 | /** 63 | * Initialize SHA-2 512 hashing. 64 | * 65 | * @param context pointer to the function context (of size av_sha512_size) 66 | * @param bits number of bits in digest (224, 256, 384 or 512 bits) 67 | * @return zero if initialization succeeded, -1 otherwise 68 | */ 69 | int av_sha512_init(struct AVSHA512* context, int bits); 70 | 71 | /** 72 | * Update hash value. 73 | * 74 | * @param context hash function context 75 | * @param data input data to update hash with 76 | * @param len input data length 77 | */ 78 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); 79 | 80 | /** 81 | * Finish hashing and output digest value. 82 | * 83 | * @param context hash function context 84 | * @param digest buffer where output digest value is stored 85 | */ 86 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest); 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | #endif /* AVUTIL_SHA512_H */ 93 | -------------------------------------------------------------------------------- /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 | #ifndef AVUTIL_STEREO3D_H 22 | #define AVUTIL_STEREO3D_H 23 | 24 | #include 25 | 26 | #include "frame.h" 27 | 28 | /** 29 | * List of possible 3D Types 30 | */ 31 | enum AVStereo3DType { 32 | /** 33 | * Video is not stereoscopic (and metadata has to be there). 34 | */ 35 | AV_STEREO3D_2D, 36 | 37 | /** 38 | * Views are next to each other. 39 | * 40 | * LLLLRRRR 41 | * LLLLRRRR 42 | * LLLLRRRR 43 | * ... 44 | */ 45 | AV_STEREO3D_SIDEBYSIDE, 46 | 47 | /** 48 | * Views are on top of each other. 49 | * 50 | * LLLLLLLL 51 | * LLLLLLLL 52 | * RRRRRRRR 53 | * RRRRRRRR 54 | */ 55 | AV_STEREO3D_TOPBOTTOM, 56 | 57 | /** 58 | * Views are alternated temporally. 59 | * 60 | * frame0 frame1 frame2 ... 61 | * LLLLLLLL RRRRRRRR LLLLLLLL 62 | * LLLLLLLL RRRRRRRR LLLLLLLL 63 | * LLLLLLLL RRRRRRRR LLLLLLLL 64 | * ... ... ... 65 | */ 66 | AV_STEREO3D_FRAMESEQUENCE, 67 | 68 | /** 69 | * Views are packed in a checkerboard-like structure per pixel. 70 | * 71 | * LRLRLRLR 72 | * RLRLRLRL 73 | * LRLRLRLR 74 | * ... 75 | */ 76 | AV_STEREO3D_CHECKERBOARD, 77 | 78 | /** 79 | * Views are next to each other, but when upscaling 80 | * apply a checkerboard pattern. 81 | * 82 | * LLLLRRRR L L L L R R R R 83 | * LLLLRRRR => L L L L R R R R 84 | * LLLLRRRR L L L L R R R R 85 | * LLLLRRRR L L L L R R R R 86 | */ 87 | AV_STEREO3D_SIDEBYSIDE_QUINCUNX, 88 | 89 | /** 90 | * Views are packed per line, as if interlaced. 91 | * 92 | * LLLLLLLL 93 | * RRRRRRRR 94 | * LLLLLLLL 95 | * ... 96 | */ 97 | AV_STEREO3D_LINES, 98 | 99 | /** 100 | * Views are packed per column. 101 | * 102 | * LRLRLRLR 103 | * LRLRLRLR 104 | * LRLRLRLR 105 | * ... 106 | */ 107 | AV_STEREO3D_COLUMNS, 108 | }; 109 | 110 | 111 | /** 112 | * Inverted views, Right/Bottom represents the left view. 113 | */ 114 | #define AV_STEREO3D_FLAG_INVERT (1 << 0) 115 | 116 | /** 117 | * Stereo 3D type: this structure describes how two videos are packed 118 | * within a single video surface, with additional information as needed. 119 | * 120 | * @note The struct must be allocated with av_stereo3d_alloc() and 121 | * its size is not a part of the public ABI. 122 | */ 123 | typedef struct AVStereo3D { 124 | /** 125 | * How views are packed within the video. 126 | */ 127 | enum AVStereo3DType type; 128 | 129 | /** 130 | * Additional information about the frame packing. 131 | */ 132 | int flags; 133 | } AVStereo3D; 134 | 135 | /** 136 | * Allocate an AVStereo3D structure and set its fields to default values. 137 | * The resulting struct can be freed using av_freep(). 138 | * 139 | * @return An AVStereo3D filled with default values or NULL on failure. 140 | */ 141 | AVStereo3D *av_stereo3d_alloc(void); 142 | 143 | /** 144 | * Allocate a complete AVFrameSideData and add it to the frame. 145 | * 146 | * @param frame The frame which side data is added to. 147 | * 148 | * @return The AVStereo3D structure to be filled by caller. 149 | */ 150 | AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); 151 | 152 | /** 153 | * Provide a human-readable name of a given stereo3d type. 154 | * 155 | * @param type The input stereo3d type value. 156 | * 157 | * @return The name of the stereo3d value, or "unknown". 158 | */ 159 | const char *av_stereo3d_type_name(unsigned int type); 160 | 161 | /** 162 | * Get the AVStereo3DType form a human-readable name. 163 | * 164 | * @param type The input string. 165 | * 166 | * @return The AVStereo3DType value, or -1 if not found. 167 | */ 168 | int av_stereo3d_from_name(const char *name); 169 | 170 | #endif /* AVUTIL_STEREO3D_H */ 171 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/tea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the TEA algorithm 3 | * Copyright (c) 2015 Vesselin Bontchev 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_TEA_H 23 | #define AVUTIL_TEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil TEA algorithm 30 | * @defgroup lavu_tea TEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_tea_size; 36 | 37 | struct AVTEA; 38 | 39 | /** 40 | * Allocate an AVTEA context 41 | * To free the struct: av_free(ptr) 42 | */ 43 | struct AVTEA *av_tea_alloc(void); 44 | 45 | /** 46 | * Initialize an AVTEA context. 47 | * 48 | * @param ctx an AVTEA context 49 | * @param key a key of 16 bytes used for encryption/decryption 50 | * @param rounds the number of rounds in TEA (64 is the "standard") 51 | */ 52 | void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context. 56 | * 57 | * @param ctx an AVTEA context 58 | * @param dst destination array, can be equal to src 59 | * @param src source array, can be equal to dst 60 | * @param count number of 8 byte blocks 61 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 62 | * @param decrypt 0 for encryption, 1 for decryption 63 | */ 64 | void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, 65 | int count, uint8_t *iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | #endif /* AVUTIL_TEA_H */ 72 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/threadmessage.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 License 6 | * 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 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with FFmpeg; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_THREADMESSAGE_H 20 | #define AVUTIL_THREADMESSAGE_H 21 | 22 | typedef struct AVThreadMessageQueue AVThreadMessageQueue; 23 | 24 | typedef enum AVThreadMessageFlags { 25 | 26 | /** 27 | * Perform non-blocking operation. 28 | * If this flag is set, send and recv operations are non-blocking and 29 | * return AVERROR(EAGAIN) immediately if they can not proceed. 30 | */ 31 | AV_THREAD_MESSAGE_NONBLOCK = 1, 32 | 33 | } AVThreadMessageFlags; 34 | 35 | /** 36 | * Allocate a new message queue. 37 | * 38 | * @param mq pointer to the message queue 39 | * @param nelem maximum number of elements in the queue 40 | * @param elsize size of each element in the queue 41 | * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if 42 | * lavu was built without thread support 43 | */ 44 | int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, 45 | unsigned nelem, 46 | unsigned elsize); 47 | 48 | /** 49 | * Free a message queue. 50 | * 51 | * The message queue must no longer be in use by another thread. 52 | */ 53 | void av_thread_message_queue_free(AVThreadMessageQueue **mq); 54 | 55 | /** 56 | * Send a message on the queue. 57 | */ 58 | int av_thread_message_queue_send(AVThreadMessageQueue *mq, 59 | void *msg, 60 | unsigned flags); 61 | 62 | /** 63 | * Receive a message from the queue. 64 | */ 65 | int av_thread_message_queue_recv(AVThreadMessageQueue *mq, 66 | void *msg, 67 | unsigned flags); 68 | 69 | /** 70 | * Set the sending error code. 71 | * 72 | * If the error code is set to non-zero, av_thread_message_queue_send() will 73 | * return it immediately. Conventional values, such as AVERROR_EOF or 74 | * AVERROR(EAGAIN), can be used to cause the sending thread to stop or 75 | * suspend its operation. 76 | */ 77 | void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, 78 | int err); 79 | 80 | /** 81 | * Set the receiving error code. 82 | * 83 | * If the error code is set to non-zero, av_thread_message_queue_recv() will 84 | * return it immediately when there are no longer available messages. 85 | * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used 86 | * to cause the receiving thread to stop or suspend its operation. 87 | */ 88 | void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, 89 | int err); 90 | 91 | /** 92 | * Set the optional free message callback function which will be called if an 93 | * operation is removing messages from the queue. 94 | */ 95 | void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq, 96 | void (*free_func)(void *msg)); 97 | 98 | /** 99 | * Flush the message queue 100 | * 101 | * This function is mostly equivalent to reading and free-ing every message 102 | * except that it will be done in a single operation (no lock/unlock between 103 | * reads). 104 | */ 105 | void av_thread_message_flush(AVThreadMessageQueue *mq); 106 | 107 | #endif /* AVUTIL_THREADMESSAGE_H */ 108 | -------------------------------------------------------------------------------- /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 | * Get the current time in microseconds since some unspecified starting point. 33 | * On platforms that support it, the time comes from a monotonic clock 34 | * This property makes this time source ideal for measuring relative time. 35 | * The returned values may not be monotonic on platforms where a monotonic 36 | * clock is not available. 37 | */ 38 | int64_t av_gettime_relative(void); 39 | 40 | /** 41 | * Indicates with a boolean result if the av_gettime_relative() time source 42 | * is monotonic. 43 | */ 44 | int av_gettime_relative_is_monotonic(void); 45 | 46 | /** 47 | * Sleep for a period of time. Although the duration is expressed in 48 | * microseconds, the actual delay may be rounded to the precision of the 49 | * system timer. 50 | * 51 | * @param usec Number of microseconds to sleep. 52 | * @return zero on success or (negative) error code. 53 | */ 54 | int av_usleep(unsigned usec); 55 | 56 | #endif /* AVUTIL_TIME_H */ 57 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/twofish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the TwoFish algorithm 3 | * Copyright (c) 2015 Supraja Meedinti 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_TWOFISH_H 23 | #define AVUTIL_TWOFISH_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil TWOFISH algorithm 31 | * @defgroup lavu_twofish TWOFISH 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_twofish_size; 37 | 38 | struct AVTWOFISH; 39 | 40 | /** 41 | * Allocate an AVTWOFISH context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVTWOFISH *av_twofish_alloc(void); 45 | 46 | /** 47 | * Initialize an AVTWOFISH context. 48 | * 49 | * @param ctx an AVTWOFISH context 50 | * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise 52 | */ 53 | int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVTWOFISH context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_TWOFISH_H */ 71 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 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 | /** 22 | * @file 23 | * @ingroup lavu 24 | * Libavutil version macros 25 | */ 26 | 27 | #ifndef AVUTIL_VERSION_H 28 | #define AVUTIL_VERSION_H 29 | 30 | #include "macros.h" 31 | 32 | /** 33 | * @addtogroup version_utils 34 | * 35 | * Useful to check and match library version in order to maintain 36 | * backward compatibility. 37 | * 38 | * The FFmpeg libraries follow a versioning sheme very similar to 39 | * Semantic Versioning (http://semver.org/) 40 | * The difference is that the component called PATCH is called MICRO in FFmpeg 41 | * and its value is reset to 100 instead of 0 to keep it above or equal to 100. 42 | * Also we do not increase MICRO for every bugfix or change in git master. 43 | * 44 | * Prior to FFmpeg 3.2 point releases did not change any lib version number to 45 | * avoid aliassing different git master checkouts. 46 | * Starting with FFmpeg 3.2, the released library versions will occupy 47 | * a separate MAJOR.MINOR that is not used on the master development branch. 48 | * That is if we branch a release of master 55.10.123 we will bump to 55.11.100 49 | * for the release and master will continue at 55.12.100 after it. Each new 50 | * point release will then bump the MICRO improving the usefulness of the lib 51 | * versions. 52 | * 53 | * @{ 54 | */ 55 | 56 | #define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c)) 57 | #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c 58 | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) 59 | 60 | /** 61 | * Extract version components from the full ::AV_VERSION_INT int as returned 62 | * by functions like ::avformat_version() and ::avcodec_version() 63 | */ 64 | #define AV_VERSION_MAJOR(a) ((a) >> 16) 65 | #define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8) 66 | #define AV_VERSION_MICRO(a) ((a) & 0xFF) 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** 73 | * @defgroup lavu_ver Version and Build diagnostics 74 | * 75 | * Macros and function useful to check at compiletime and at runtime 76 | * which version of libavutil is in use. 77 | * 78 | * @{ 79 | */ 80 | 81 | #define LIBAVUTIL_VERSION_MAJOR 55 82 | #define LIBAVUTIL_VERSION_MINOR 34 83 | #define LIBAVUTIL_VERSION_MICRO 101 84 | 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ 86 | LIBAVUTIL_VERSION_MINOR, \ 87 | LIBAVUTIL_VERSION_MICRO) 88 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ 89 | LIBAVUTIL_VERSION_MINOR, \ 90 | LIBAVUTIL_VERSION_MICRO) 91 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT 92 | 93 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) 94 | 95 | /** 96 | * @defgroup lavu_depr_guards Deprecation Guards 97 | * FF_API_* defines may be placed below to indicate public API that will be 98 | * dropped at a future version bump. The defines themselves are not part of 99 | * the public API and may change, break or disappear at any time. 100 | * 101 | * @note, when bumping the major version it is recommended to manually 102 | * disable each FF_API_* in its own commit instead of disabling them all 103 | * at once through the bump. This improves the git bisect-ability of the change. 104 | * 105 | * @{ 106 | */ 107 | 108 | #ifndef FF_API_VDPAU 109 | #define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 56) 110 | #endif 111 | #ifndef FF_API_XVMC 112 | #define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 56) 113 | #endif 114 | #ifndef FF_API_OPT_TYPE_METADATA 115 | #define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 56) 116 | #endif 117 | #ifndef FF_API_DLOG 118 | #define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 56) 119 | #endif 120 | #ifndef FF_API_VAAPI 121 | #define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56) 122 | #endif 123 | #ifndef FF_API_FRAME_QP 124 | #define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 56) 125 | #endif 126 | #ifndef FF_API_PLUS1_MINUS1 127 | #define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 56) 128 | #endif 129 | #ifndef FF_API_ERROR_FRAME 130 | #define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 56) 131 | #endif 132 | #ifndef FF_API_CRC_BIG_TABLE 133 | #define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56) 134 | #endif 135 | #ifndef FF_API_PKT_PTS 136 | #define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 56) 137 | #endif 138 | 139 | 140 | /** 141 | * @} 142 | * @} 143 | */ 144 | 145 | #endif /* AVUTIL_VERSION_H */ 146 | -------------------------------------------------------------------------------- /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 | * Allocate an AVXTEA context. 41 | */ 42 | AVXTEA *av_xtea_alloc(void); 43 | 44 | /** 45 | * Initialize an AVXTEA context. 46 | * 47 | * @param ctx an AVXTEA context 48 | * @param key a key of 16 bytes used for encryption/decryption, 49 | * interpreted as big endian 32 bit numbers 50 | */ 51 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); 52 | 53 | /** 54 | * Initialize an AVXTEA context. 55 | * 56 | * @param ctx an AVXTEA context 57 | * @param key a key of 16 bytes used for encryption/decryption, 58 | * interpreted as little endian 32 bit numbers 59 | */ 60 | void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]); 61 | 62 | /** 63 | * Encrypt or decrypt a buffer using a previously initialized context, 64 | * in big endian format. 65 | * 66 | * @param ctx an AVXTEA context 67 | * @param dst destination array, can be equal to src 68 | * @param src source array, can be equal to dst 69 | * @param count number of 8 byte blocks 70 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 71 | * @param decrypt 0 for encryption, 1 for decryption 72 | */ 73 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 74 | int count, uint8_t *iv, int decrypt); 75 | 76 | /** 77 | * Encrypt or decrypt a buffer using a previously initialized context, 78 | * in little endian format. 79 | * 80 | * @param ctx an AVXTEA context 81 | * @param dst destination array, can be equal to src 82 | * @param src source array, can be equal to dst 83 | * @param count number of 8 byte blocks 84 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 85 | * @param decrypt 0 for encryption, 1 for decryption 86 | */ 87 | void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 88 | int count, uint8_t *iv, int decrypt); 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | #endif /* AVUTIL_XTEA_H */ 95 | -------------------------------------------------------------------------------- /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 SWRESAMPLE_VERSION_H 22 | #define SWRESAMPLE_VERSION_H 23 | 24 | /** 25 | * @file 26 | * Libswresample version macros 27 | */ 28 | 29 | #include "libavutil/avutil.h" 30 | 31 | #define LIBSWRESAMPLE_VERSION_MAJOR 2 32 | #define LIBSWRESAMPLE_VERSION_MINOR 3 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 /* SWRESAMPLE_VERSION_H */ 46 | -------------------------------------------------------------------------------- /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 4 30 | #define LIBSWSCALE_VERSION_MINOR 2 31 | #define LIBSWSCALE_VERSION_MICRO 100 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_VECTOR 50 | #define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6) 51 | #endif 52 | 53 | #endif /* SWSCALE_VERSION_H */ 54 | -------------------------------------------------------------------------------- /ffmpeg/include/x264_config.h: -------------------------------------------------------------------------------- 1 | #define X264_BIT_DEPTH 8 2 | #define X264_GPL 1 3 | #define X264_INTERLACED 1 4 | #define X264_CHROMA_FORMAT 0 5 | #define X264_REV 2854 6 | #define X264_REV_DIFF 0 7 | #define X264_VERSION " r2854 e9a5903" 8 | #define X264_POINTVER "0.152.2854 e9a5903" 9 | -------------------------------------------------------------------------------- /ffmpeg/lib/libavcodec.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffmpeg/lib/libavcodec.a -------------------------------------------------------------------------------- /ffmpeg/lib/libavformat.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffmpeg/lib/libavformat.a -------------------------------------------------------------------------------- /ffmpeg/lib/libavutil.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffmpeg/lib/libavutil.a -------------------------------------------------------------------------------- /ffmpeg/lib/libswresample.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffmpeg/lib/libswresample.a -------------------------------------------------------------------------------- /ffmpeg/lib/libswscale.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffmpeg/lib/libswscale.a -------------------------------------------------------------------------------- /ffmpeg/lib/libx264.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffmpeg/lib/libx264.a -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libavcodec.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/chenk/ffmpeg-android-sdk 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libavcodec 7 | Description: FFmpeg codec library 8 | Version: 57.64.101 9 | Requires: libavutil >= 55.34.101 10 | Requires.private: 11 | Conflicts: 12 | Libs: -L${libdir} -lavcodec -lx264 -lm -lz -pthread 13 | Libs.private: 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libavformat.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/chenk/ffmpeg-android-sdk 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libavformat 7 | Description: FFmpeg container format library 8 | Version: 57.56.101 9 | Requires: libavcodec >= 57.64.101, libavutil >= 55.34.101 10 | Requires.private: 11 | Conflicts: 12 | Libs: -L${libdir} -lavformat -lx264 -lm -lz -pthread 13 | Libs.private: 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libavutil.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/chenk/ffmpeg-android-sdk 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libavutil 7 | Description: FFmpeg utility library 8 | Version: 55.34.101 9 | Requires: 10 | Requires.private: 11 | Conflicts: 12 | Libs: -L${libdir} -lavutil -lm 13 | Libs.private: 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libswresample.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/chenk/ffmpeg-android-sdk 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libswresample 7 | Description: FFmpeg audio resampling library 8 | Version: 2.3.100 9 | Requires: libavutil >= 55.34.101 10 | Requires.private: 11 | Conflicts: 12 | Libs: -L${libdir} -lswresample -lm 13 | Libs.private: 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libswscale.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/chenk/ffmpeg-android-sdk 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libswscale 7 | Description: FFmpeg image rescaling library 8 | Version: 4.2.100 9 | Requires: libavutil >= 55.34.101 10 | Requires.private: 11 | Conflicts: 12 | Libs: -L${libdir} -lswscale -lm 13 | Libs.private: 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/x264.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/chenk/ffmpeg-android-sdk 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: x264 7 | Description: H.264 (MPEG4 AVC) encoder library 8 | Version: 0.152.2854 e9a5903 9 | Libs: -L${exec_prefix}/lib -lx264 -lm 10 | Libs.private: 11 | Cflags: -I${prefix}/include 12 | -------------------------------------------------------------------------------- /ffrecorder.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffrecorder.cpp -------------------------------------------------------------------------------- /ffrecorder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffrecorder.h -------------------------------------------------------------------------------- /ffutils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/ffutils.h -------------------------------------------------------------------------------- /h264hwenc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/h264hwenc.h -------------------------------------------------------------------------------- /h264hwenc_mediacodec.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/h264hwenc_mediacodec.cpp -------------------------------------------------------------------------------- /h264hwenc_mediaserver.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/h264hwenc_mediaserver.cpp -------------------------------------------------------------------------------- /micdev.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/micdev.h -------------------------------------------------------------------------------- /micdev_android.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/micdev_android.h -------------------------------------------------------------------------------- /micdev_audiorecord_native.cpp: -------------------------------------------------------------------------------- 1 | #define LOG_TAG "micdev" 2 | 3 | // 包含头文件 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "micdev.h" 11 | 12 | // 内部类型定义 13 | // micdev context 14 | typedef struct { 15 | MICDEV_COMMON 16 | android::sp record; 17 | } MICDEV; 18 | 19 | // 内部函数实现 20 | static void* micdev_capture_thread_proc(void *param) 21 | { 22 | MICDEV *mic = (MICDEV*)param; 23 | int nread = 0; 24 | 25 | while (!(mic->thread_state & MICDEV_TS_EXIT)) { 26 | nread = mic->record->read(mic->buffer, mic->buflen); 27 | // ALOGD("buflen = %d, nread = %d\n", mic->buflen, nread); 28 | 29 | if (nread <= 0 || (mic->thread_state & MICDEV_TS_PAUSE)) { 30 | usleep(10*1000); 31 | continue; 32 | } 33 | 34 | if (mic->mute) { 35 | memset(mic->buffer, 0, mic->buflen); 36 | } 37 | 38 | if (mic->callback) { 39 | void *data[AV_NUM_DATA_POINTERS] = { mic->buffer }; 40 | int sampnum = nread / (2 * mic->channels); 41 | mic->callback(mic->recorder, data, sampnum); 42 | } 43 | } 44 | 45 | return NULL; 46 | } 47 | 48 | // 函数实现 49 | void* micdev_android_init(int samprate, int channels, void *extra) 50 | { 51 | int chcfg = channels == 2 ? AUDIO_CHANNEL_IN_STEREO : AUDIO_CHANNEL_IN_MONO; 52 | MICDEV *mic = new MICDEV(); 53 | if (!mic) { 54 | ALOGE("failed to allocate micdev context !\n"); 55 | return NULL; 56 | } 57 | 58 | mic->thread_state = MICDEV_TS_PAUSE; 59 | mic->samprate = samprate; 60 | mic->channels = channels; 61 | mic->extra = extra; 62 | 63 | size_t minfcount = 0; 64 | android::AudioRecord::getMinFrameCount( 65 | &minfcount, samprate, AUDIO_FORMAT_PCM_16_BIT, chcfg); 66 | mic->buflen = 2 * minfcount * channels * 2; 67 | mic->buffer = new uint8_t[mic->buflen]; 68 | mic->record = new android::AudioRecord(AUDIO_SOURCE_MIC, samprate, AUDIO_FORMAT_PCM_16_BIT, chcfg, minfcount); 69 | 70 | if (mic->record->initCheck() != android::NO_ERROR) { 71 | ALOGE("failed to init audio recorder of android !\n"); 72 | } 73 | 74 | // create thread for micdev 75 | pthread_create(&mic->thread_id, NULL, micdev_capture_thread_proc, mic); 76 | 77 | return mic; 78 | } 79 | 80 | void micdev_android_close(void *ctxt) 81 | { 82 | MICDEV *mic = (MICDEV*)ctxt; 83 | if (!mic) return; 84 | 85 | // wait thread safely exited 86 | mic->thread_state |= MICDEV_TS_EXIT; 87 | pthread_join(mic->thread_id, NULL); 88 | 89 | // release 90 | mic->record->stop(); 91 | 92 | // free 93 | delete mic->buffer; 94 | delete mic; 95 | } 96 | 97 | void micdev_android_start_capture(void *ctxt) 98 | { 99 | MICDEV *mic = (MICDEV*)ctxt; 100 | if (!mic) return; 101 | 102 | // start recording 103 | mic->record->start(); 104 | 105 | // start capture 106 | mic->thread_state &= ~MICDEV_TS_PAUSE; 107 | } 108 | 109 | void micdev_android_stop_capture(void *ctxt) 110 | { 111 | MICDEV *mic = (MICDEV*)ctxt; 112 | if (!mic) return; 113 | 114 | // stop capture 115 | mic->thread_state |= MICDEV_TS_PAUSE; 116 | 117 | // stop 118 | mic->record->stop(); 119 | } 120 | 121 | int micdev_android_get_mute(void *ctxt) 122 | { 123 | MICDEV *mic = (MICDEV*)ctxt; 124 | if (!mic) return 1; 125 | return mic->mute; 126 | } 127 | 128 | void micdev_android_set_mute(void *ctxt, int mute) 129 | { 130 | MICDEV *mic = (MICDEV*)ctxt; 131 | if (!mic) return; 132 | mic->mute = mute; 133 | } 134 | 135 | void micdev_android_set_callback(void *ctxt, void *callback, void *recorder) 136 | { 137 | MICDEV *mic = (MICDEV*)ctxt; 138 | if (!mic) return; 139 | mic->callback = (MICDEV_CAPTURE_CALLBACK)callback; 140 | mic->recorder = recorder; 141 | } 142 | 143 | -------------------------------------------------------------------------------- /micdev_tinyalsa.cpp: -------------------------------------------------------------------------------- 1 | #define LOG_TAG "micdev" 2 | 3 | // 包含头文件 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "micdev.h" 9 | 10 | // 内部类型定义 11 | // micdev context 12 | typedef struct { 13 | MICDEV_COMMON 14 | struct pcm_config config; 15 | struct pcm *pcm; 16 | } MICDEV; 17 | 18 | // 内部常量定义 19 | #define DEF_PCM_CARD 0 20 | #define DEF_PCM_DEVICE 0 21 | #define DEF_PCM_FORMAT PCM_FORMAT_S16_LE 22 | #define DEF_PCM_BUF_SIZE 2048 23 | #define DEF_PCM_BUF_COUNT 6 24 | 25 | // 内部函数实现 26 | static void* micdev_capture_thread_proc(void *param) 27 | { 28 | MICDEV *mic = (MICDEV*)param; 29 | int ret = 0; 30 | 31 | while (!(mic->thread_state & MICDEV_TS_EXIT)) { 32 | // read data from pcm 33 | #if 0 34 | ret = pcm_read(mic->pcm, mic->buffer, mic->buflen); 35 | #else 36 | ret = pcm_read_ex(mic->pcm, mic->buffer, mic->buflen); 37 | #endif 38 | 39 | if (ret != 0 || (mic->thread_state & MICDEV_TS_PAUSE)) { 40 | usleep(10*1000); 41 | continue; 42 | } 43 | 44 | if (mic->mute) { 45 | memset(mic->buffer, 0, mic->buflen); 46 | } 47 | 48 | if (mic->callback) { 49 | void *data[AV_NUM_DATA_POINTERS] = { mic->buffer }; 50 | int sampnum = mic->buflen / (2 * mic->config.channels); 51 | mic->callback(mic->recorder, data, sampnum); 52 | } 53 | } 54 | 55 | return NULL; 56 | } 57 | 58 | // 函数实现 59 | void* micdev_tinyalsa_init(int samprate, int channels, void *extra) 60 | { 61 | MICDEV *mic = (MICDEV*)calloc(1, sizeof(MICDEV)); 62 | if (!mic) { 63 | ALOGE("failed to allocate micdev context !\n"); 64 | return NULL; 65 | } 66 | 67 | mic->thread_state = MICDEV_TS_PAUSE; 68 | mic->samprate = samprate; 69 | mic->channels = channels; 70 | mic->extra = extra; 71 | mic->config.channels = channels; 72 | mic->config.rate = samprate; 73 | mic->config.period_size = DEF_PCM_BUF_SIZE; 74 | mic->config.period_count = DEF_PCM_BUF_COUNT; 75 | mic->config.format = DEF_PCM_FORMAT; 76 | mic->config.start_threshold = 0; 77 | mic->config.stop_threshold = 0; 78 | mic->config.silence_threshold = 0; 79 | mic->pcm = pcm_open(DEF_PCM_CARD, DEF_PCM_DEVICE, PCM_IN, &mic->config); 80 | if (!mic->pcm) { 81 | ALOGE("pcm_open failed !\n"); 82 | goto failed; 83 | } 84 | 85 | mic->buflen = pcm_frames_to_bytes(mic->pcm, pcm_get_buffer_size(mic->pcm)); 86 | mic->buffer = (uint8_t*)calloc(mic->buflen, sizeof(uint8_t)); 87 | if (!mic->buffer) { 88 | ALOGE("unable to allocate %d bytes buffer !\n", mic->buflen); 89 | goto failed; 90 | } 91 | 92 | pthread_create(&mic->thread_id, NULL, micdev_capture_thread_proc, mic); 93 | 94 | return mic; 95 | 96 | failed: 97 | if (mic) { 98 | if (mic->buffer) free(mic->buffer); 99 | if (mic->pcm ) pcm_close(mic->pcm); 100 | free(mic); 101 | } 102 | return NULL; 103 | } 104 | 105 | void micdev_tinyalsa_close(void *ctxt) 106 | { 107 | MICDEV *mic = (MICDEV*)ctxt; 108 | if (!mic) return; 109 | 110 | // wait thread safely exited 111 | mic->thread_state |= MICDEV_TS_EXIT; 112 | pthread_join(mic->thread_id, NULL); 113 | 114 | if (mic->buffer) free(mic->buffer); 115 | if (mic->pcm ) pcm_close(mic->pcm); 116 | free(mic); 117 | } 118 | 119 | void micdev_tinyalsa_start_capture(void *ctxt) 120 | { 121 | MICDEV *mic = (MICDEV*)ctxt; 122 | if (!mic) return; 123 | 124 | // start capture 125 | mic->thread_state &= ~MICDEV_TS_PAUSE; 126 | } 127 | 128 | void micdev_tinyalsa_stop_capture(void *ctxt) 129 | { 130 | MICDEV *mic = (MICDEV*)ctxt; 131 | if (!mic) return; 132 | 133 | // stop capture 134 | mic->thread_state |= MICDEV_TS_PAUSE; 135 | } 136 | 137 | int micdev_tinyalsa_get_mute(void *ctxt) 138 | { 139 | MICDEV *mic = (MICDEV*)ctxt; 140 | if (!mic) return 1; 141 | return mic->mute; 142 | } 143 | 144 | void micdev_tinyalsa_set_mute(void *ctxt, int mute) 145 | { 146 | MICDEV *mic = (MICDEV*)ctxt; 147 | if (!mic) return; 148 | mic->mute = mute; 149 | } 150 | 151 | void micdev_tinyalsa_set_callback(void *ctxt, void *callback, void *recorder) 152 | { 153 | MICDEV *mic = (MICDEV*)ctxt; 154 | if (!mic) return; 155 | mic->callback = (MICDEV_CAPTURE_CALLBACK)callback; 156 | mic->recorder = recorder; 157 | } 158 | 159 | 160 | -------------------------------------------------------------------------------- /micdev_tinyalsa.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/micdev_tinyalsa.h -------------------------------------------------------------------------------- /recordertest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ffutils.h" 3 | #include "ffrecorder.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | void *recorder = NULL; 8 | char filename[128]; 9 | uint64_t curtick = 0; 10 | int i = 0; 11 | 12 | // set exit flag to 0 13 | property_set("sys.ffrecorder.test.exit", "0"); 14 | 15 | // create a client to surfaceflinger 16 | sp client = new SurfaceComposerClient(); 17 | sp dtoken(SurfaceComposerClient::getBuiltInDisplay( 18 | ISurfaceComposer::eDisplayIdMain)); 19 | 20 | DisplayInfo dinfo; 21 | status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &dinfo); 22 | if (status) { 23 | return -1; 24 | } 25 | 26 | sp surfaceControl = client->createSurface(String8("yuvtest_surface"), 27 | dinfo.w, dinfo.h, PIXEL_FORMAT_RGBX_8888, 0); 28 | 29 | SurfaceComposerClient::openGlobalTransaction(); 30 | surfaceControl->setLayer(0x40000000); 31 | // surfaceControl->setPosition(0, 0); 32 | // surfaceControl->setSize(320, 180); 33 | SurfaceComposerClient::closeGlobalTransaction(); 34 | 35 | sp surface = surfaceControl->getSurface(); 36 | sp win = surface; 37 | 38 | // init camdev 39 | FFRECORDER_PARAMS params; 40 | memset(¶ms, 0, sizeof(params)); 41 | params.cam_frame_width_0 = 640; 42 | params.cam_frame_height_0 = 480; 43 | params.cam_frame_rate_0 = 25; 44 | params.out_video_bitrate_0= 2000000; 45 | params.out_video_width_0 = 640; 46 | params.out_video_height_0 = 480; 47 | params.cam_frame_rate_0 = 25; 48 | recorder = ffrecorder_init(¶ms, NULL); 49 | 50 | // startpreview 51 | ffrecorder_preview_window(recorder, 0, win); 52 | ffrecorder_preview_start (recorder, 0); 53 | 54 | // wait exit 55 | while (1) { 56 | if (get_tick_count() - curtick > 60 * 1000) { 57 | curtick = get_tick_count(); 58 | sprintf(filename, "/sdcard/test%03d.mp4", i); i++; 59 | ffrecorder_record_start(recorder, 0, filename); 60 | ffrecorder_record_start(recorder,-1, NULL ); 61 | } 62 | 63 | char exit[PROP_VALUE_MAX]; 64 | property_get("sys.ffrecorder.test.exit", exit, "0"); 65 | if (strcmp(exit, "1") == 0) { 66 | break; 67 | } 68 | 69 | usleep(100*1000); 70 | } 71 | 72 | // stop record 73 | ffrecorder_record_stop(recorder, 0); 74 | ffrecorder_record_stop(recorder,-1); 75 | 76 | // stop preview 77 | ffrecorder_preview_stop(recorder, 0); 78 | 79 | // close camdev 80 | ffrecorder_free(recorder); 81 | 82 | return 0; 83 | } 84 | 85 | -------------------------------------------------------------------------------- /release/CameraDVR.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/release/CameraDVR.apk -------------------------------------------------------------------------------- /release/encodertest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/release/encodertest -------------------------------------------------------------------------------- /release/libffrecorder_jni.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/release/libffrecorder_jni.so -------------------------------------------------------------------------------- /release/recordertest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/release/recordertest -------------------------------------------------------------------------------- /release/v4l2test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rockcarry/v4l2test/8066c7a0ae0480ba857be009d5531c66d22d538b/release/v4l2test -------------------------------------------------------------------------------- /v4l2test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "camdev.h" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | void *cam = NULL; 7 | char dev[32] = "/dev/video0"; 8 | int sub = 0; 9 | int w = 640; 10 | int h = 480; 11 | 12 | switch (argc) { 13 | case 5: h = atoi(argv[4]); 14 | case 4: w = atoi(argv[3]); 15 | case 3: sub = atoi(argv[2]); 16 | case 2: strcpy(dev, argv[1]); 17 | } 18 | printf("dev = %s, sub = %d, w = %d, h = %d\n", dev, sub, w, h); 19 | 20 | // set exit flag to 0 21 | property_set("sys.v4l2.test.exit", "0"); 22 | 23 | // create a client to surfaceflinger 24 | sp client = new SurfaceComposerClient(); 25 | sp dtoken(SurfaceComposerClient::getBuiltInDisplay( 26 | ISurfaceComposer::eDisplayIdMain)); 27 | 28 | DisplayInfo dinfo; 29 | status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &dinfo); 30 | if (status) { 31 | return -1; 32 | } 33 | 34 | sp surfaceControl = client->createSurface(String8("yuvtest_surface"), 35 | dinfo.w, dinfo.h, PIXEL_FORMAT_RGBX_8888, 0); 36 | 37 | SurfaceComposerClient::openGlobalTransaction(); 38 | surfaceControl->setLayer(0x40000000); 39 | // surfaceControl->setPosition(0, 0); 40 | // surfaceControl->setSize(320, 180); 41 | SurfaceComposerClient::closeGlobalTransaction(); 42 | 43 | sp surface = surfaceControl->getSurface(); 44 | sp win = surface; 45 | 46 | // init camdev 47 | cam = camdev_init(dev, sub, w, h, 30); 48 | if (!cam) { 49 | printf("failed to create camdev !\n"); 50 | exit(1); 51 | } 52 | 53 | // startpreview 54 | camdev_set_preview_window(cam, win); 55 | camdev_capture_start(cam); 56 | camdev_preview_start(cam); 57 | 58 | // wait exit 59 | while (1) { 60 | char exit[PROP_VALUE_MAX]; 61 | property_get("sys.v4l2.test.exit", exit, "0"); 62 | if (strcmp(exit, "1") == 0) { 63 | break; 64 | } 65 | usleep(100*1000); 66 | } 67 | 68 | // stoppreview 69 | camdev_preview_stop(cam); 70 | camdev_capture_stop(cam); 71 | 72 | // close camdev 73 | camdev_close(cam); 74 | 75 | return 0; 76 | } 77 | 78 | --------------------------------------------------------------------------------