├── CMakeLists.txt ├── MppDecode.cpp ├── MppDecode.h ├── README.md ├── ffm_inc ├── libavcodec │ ├── avcodec.h │ ├── avfft.h │ ├── d3d11va.h │ ├── dv_profile.h │ ├── dxva2.h │ ├── old_codec_ids.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 │ ├── attributes.h │ ├── audio_fifo.h │ ├── audioconvert.h │ ├── avassert.h │ ├── avconfig.h │ ├── avstring.h │ ├── avutil.h │ ├── base64.h │ ├── blowfish.h │ ├── bprint.h │ ├── bswap.h │ ├── buffer.h │ ├── camellia.h │ ├── cast5.h │ ├── channel_layout.h │ ├── common.h │ ├── cpu.h │ ├── crc.h │ ├── dict.h │ ├── display.h │ ├── downmix_info.h │ ├── error.h │ ├── eval.h │ ├── ffversion.h │ ├── fifo.h │ ├── file.h │ ├── frame.h │ ├── hash.h │ ├── hmac.h │ ├── imgutils.h │ ├── intfloat.h │ ├── intreadwrite.h │ ├── lfg.h │ ├── log.h │ ├── lzo.h │ ├── macros.h │ ├── mathematics.h │ ├── md5.h │ ├── mem.h │ ├── motion_vector.h │ ├── murmur3.h │ ├── old_pix_fmts.h │ ├── opt.h │ ├── parseutils.h │ ├── pixdesc.h │ ├── pixelutils.h │ ├── pixfmt.h │ ├── random_seed.h │ ├── rational.h │ ├── replaygain.h │ ├── ripemd.h │ ├── samplefmt.h │ ├── sha.h │ ├── sha512.h │ ├── stereo3d.h │ ├── tea.h │ ├── threadmessage.h │ ├── time.h │ ├── timecode.h │ ├── timestamp.h │ ├── twofish.h │ ├── version.h │ └── xtea.h ├── ffm_lib ├── libavahi-client.so.3 ├── libavahi-client.so.3.2.9 ├── libavahi-common.so.3 ├── libavahi-common.so.3.5.3 ├── libavahi-core.so.7 ├── libavahi-core.so.7.0.2 ├── libavahi-glib.so.1 ├── libavahi-glib.so.1.0.2 ├── libavc1394.so.0 ├── libavc1394.so.0.3.0 ├── libavcodec-ffmpeg.so ├── libavcodec-ffmpeg.so.56 ├── libavcodec-ffmpeg.so.56.60.100 ├── libavcodec.so ├── libavformat-ffmpeg.so ├── libavformat-ffmpeg.so.56 ├── libavformat-ffmpeg.so.56.40.101 ├── libavformat.so ├── libavutil-ffmpeg.so ├── libavutil-ffmpeg.so.54 ├── libavutil-ffmpeg.so.54.31.100 └── libavutil.so ├── firefly_mpplib ├── libhal_dummy.a ├── libosal.a ├── librockchip_mpp.so ├── librockchip_mpp.so.0 ├── librockchip_mpp.so.1 ├── librockchip_mpp_static.a ├── librockchip_vpu.so ├── librockchip_vpu.so.0 ├── librockchip_vpu.so.1 ├── librockchip_vpu_static.a └── libutils.a ├── main.cpp ├── rockchip ├── dictionary.h ├── iniparser.h ├── mpi_enc_utils.h ├── mpi_impl.h ├── mpp.h ├── mpp_2str.h ├── mpp_allocator.h ├── mpp_bitput.h ├── mpp_bitread.h ├── mpp_bitwrite.h ├── mpp_buf_slot.h ├── mpp_buffer.h ├── mpp_buffer_impl.h ├── mpp_common.h ├── mpp_enc_cfg.h ├── mpp_env.h ├── mpp_err.h ├── mpp_frame.h ├── mpp_frame_impl.h ├── mpp_impl.h ├── mpp_info.h ├── mpp_list.h ├── mpp_log.h ├── mpp_mem.h ├── mpp_meta.h ├── mpp_meta_impl.h ├── mpp_packet.h ├── mpp_packet_impl.h ├── mpp_platform.h ├── mpp_queue.h ├── mpp_rc_api.h ├── mpp_rc_defs.h ├── mpp_runtime.h ├── mpp_task.h ├── mpp_task_impl.h ├── mpp_thread.h ├── mpp_time.h ├── rk_mpi.h ├── rk_mpi_cmd.h ├── rk_type.h ├── rk_venc_cmd.h ├── utils.h ├── vpu.h └── vpu_api.h ├── tmp ├── MppDecode.cpp ├── MppDecode.h └── RtspMppImpl.h ├── yuv.jpg └── yuvplayer.exe /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5.1) 2 | 3 | set(CMAKE_SYSTEM_NAME Linux) 4 | set(CMAKE_SYSTEM_PROCESSOR arm) 5 | 6 | set(tools /usr/local/cross-compile/aarch64-cc/) 7 | set(CMAKE_C_COMPILER ${tools}/bin/aarch64-linux-gnu-gcc) 8 | set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-linux-gnu-g++) 9 | 10 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 11 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 12 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 13 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 14 | 15 | 16 | project(mpp_test) 17 | 18 | set(CMAKE_CXX_STANDARD 14) 19 | 20 | set(CMAKE_CXX_FLAGS "-O0 -g") 21 | 22 | include_directories( 23 | /usr/include/aarch64-linux-gnu 24 | /env/platforms/aarch64/include 25 | ${CMAKE_CURRENT_LIST_DIR}/ffm_inc 26 | ${CMAKE_CURRENT_LIST_DIR}/rockchip 27 | ) 28 | 29 | link_directories( 30 | /env/platforms/aarch64/so 31 | /env/platforms/aarch64/static 32 | /usr/local/lib 33 | ${CMAKE_CURRENT_LIST_DIR}/firefly_mpplib 34 | ${CMAKE_CURRENT_LIST_DIR}/ffm_lib 35 | 36 | ) 37 | 38 | 39 | add_executable(mpp_test MppDecode.cpp MppDecode.h main.cpp) 40 | 41 | target_link_libraries(mpp_test 42 | rockchip_mpp 43 | utils 44 | avformat 45 | avcodec 46 | avutil 47 | opencv_core 48 | opencv_highgui 49 | opencv_imgproc 50 | opencv_imgcodecs 51 | m 52 | ) 53 | -------------------------------------------------------------------------------- /MppDecode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by LX on 2020/4/25. 3 | // 4 | 5 | #ifndef LIVERTSPCLIENT_MPPDECODE_H 6 | #define LIVERTSPCLIENT_MPPDECODE_H 7 | 8 | #define MODULE_TAG "mpi_dec_test" 9 | 10 | #include 11 | 12 | #include "utils.h" 13 | #include "rk_mpi.h" 14 | #include "mpp_log.h" 15 | #include "mpp_mem.h" 16 | #include "mpp_env.h" 17 | #include "mpp_time.h" 18 | #include "mpp_common.h" 19 | 20 | #include "mpp_frame.h" 21 | #include "mpp_buffer_impl.h" 22 | #include "mpp_frame_impl.h" 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | #define MPI_DEC_STREAM_SIZE (SZ_4K) 32 | #define MPI_DEC_LOOP_COUNT 4 33 | #define MAX_FILE_NAME_LENGTH 256 34 | 35 | typedef struct 36 | { 37 | MppCtx ctx; 38 | MppApi *mpi; 39 | RK_U32 eos; 40 | char *buf; 41 | 42 | MppBufferGroup frm_grp; 43 | MppBufferGroup pkt_grp; 44 | MppPacket packet; 45 | size_t packet_size; 46 | MppFrame frame; 47 | 48 | FILE *fp_input; 49 | FILE *fp_output; 50 | RK_S32 frame_count; 51 | RK_S32 frame_num; 52 | size_t max_usage; 53 | } MpiDecLoopData; 54 | 55 | typedef struct 56 | { 57 | char file_input[MAX_FILE_NAME_LENGTH]; 58 | char file_output[MAX_FILE_NAME_LENGTH]; 59 | MppCodingType type; 60 | MppFrameFormat format; 61 | RK_U32 width; 62 | RK_U32 height; 63 | RK_U32 debug; 64 | 65 | RK_U32 have_input; 66 | RK_U32 have_output; 67 | 68 | RK_U32 simple; 69 | RK_S32 timeout; 70 | RK_S32 frame_num; 71 | size_t max_usage; 72 | } MpiDecTestCmd; 73 | 74 | 75 | 76 | size_t mpp_frame_get_buf_size(const MppFrame s); 77 | void dump_mpp_frame_to_file(MppFrame frame, FILE *fp); 78 | size_t mpp_buffer_group_usage(MppBufferGroup group); 79 | 80 | int decode_simple(MpiDecLoopData *data, AVPacket* av_packet); 81 | 82 | void YUV420SP2Mat(MppFrame frames, cv::Mat & rgbImg ); 83 | 84 | #endif //LIVERTSPCLIENT_MPPDECODE_H 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ffmpeg_rtsp_mpp 2 | ffmpeg 拉取rtsp h264流, 使用mpp解码, 目前在firefly 板子上跑通了 3 | 4 | 保存的yuv文件可以用yuvplayer.exe文件打开, 设置文件大小, 就可以正常显示了 5 | ![](./yuv.jpg) 6 | 7 | 8 | # change log 9 | 重新添加了一个整的YUV420SP2Mat()函数, 修改了内存泄露的bug, 根据release 版本的mpp精简了一点代码 10 | 11 | 12 | # reference 13 | mpp 硬编码, 从文件中读取yuv一帧图片, 硬编码 14 | 15 | 该接口也可以直接传入yuv的void* 内存地址, 编码成h264的文件, 具体地址如下 16 | https://github.com/MUZLATAN/MPP_ENCODE 17 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | struct AVD3D11VAContext { 58 | /** 59 | * D3D11 decoder object 60 | */ 61 | ID3D11VideoDecoder *decoder; 62 | 63 | /** 64 | * D3D11 VideoContext 65 | */ 66 | ID3D11VideoContext *video_context; 67 | 68 | /** 69 | * D3D11 configuration used to create the decoder 70 | */ 71 | D3D11_VIDEO_DECODER_CONFIG *cfg; 72 | 73 | /** 74 | * The number of surface in the surface array 75 | */ 76 | unsigned surface_count; 77 | 78 | /** 79 | * The array of Direct3D surfaces used to create the decoder 80 | */ 81 | ID3D11VideoDecoderOutputView **surface; 82 | 83 | /** 84 | * A bit field configuring the workarounds needed for using the decoder 85 | */ 86 | uint64_t workaround; 87 | 88 | /** 89 | * Private to the FFmpeg AVHWAccel implementation 90 | */ 91 | unsigned report_id; 92 | }; 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | #endif /* AVCODEC_D3D11VA_H */ 99 | -------------------------------------------------------------------------------- /ffm_inc/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 | #if FF_API_DV_FRAME_PROFILE 62 | /** 63 | * @deprecated use av_dv_frame_profile() 64 | */ 65 | attribute_deprecated 66 | const AVDVProfile* avpriv_dv_frame_profile2(AVCodecContext* codec, const AVDVProfile *sys, 67 | const uint8_t* frame, unsigned buf_size); 68 | #endif 69 | 70 | /** 71 | * Get a DV profile for the provided compressed frame. 72 | * 73 | * @param sys the profile used for the previous frame, may be NULL 74 | * @param frame the compressed data buffer 75 | * @param buf_size size of the buffer in bytes 76 | * @return the DV profile for the supplied data or NULL on failure 77 | */ 78 | const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, 79 | const uint8_t *frame, unsigned buf_size); 80 | 81 | /** 82 | * Get a DV profile for the provided stream parameters. 83 | */ 84 | const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt); 85 | 86 | /** 87 | * Get a DV profile for the provided stream parameters. 88 | * The frame rate is used as a best-effort parameter. 89 | */ 90 | const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate); 91 | 92 | #endif /* AVCODEC_DV_PROFILE_H */ 93 | -------------------------------------------------------------------------------- /ffm_inc/libavcodec/dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DXVA2 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_DXVA_H 24 | #define AVCODEC_DXVA_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_dxva2 29 | * Public libavcodec DXVA2 header. 30 | */ 31 | 32 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 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_DXVA_H */ 94 | -------------------------------------------------------------------------------- /ffm_inc/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 | typedef struct AVQSVContext { 27 | mfxSession session; 28 | int iopattern; 29 | 30 | mfxExtBuffer **ext_buffers; 31 | int nb_ext_buffers; 32 | } AVQSVContext; 33 | 34 | /** 35 | * Allocate a new context. 36 | * 37 | * It must be freed by the caller with av_free(). 38 | */ 39 | AVQSVContext *av_qsv_alloc_context(void); 40 | 41 | #endif /* AVCODEC_QSV_H */ 42 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/libavcodec/vorbis_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of FFmpeg. 4 | * 5 | * FFmpeg is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * FFmpeg is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with FFmpeg; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | /** 21 | * @file 22 | * A public API for Vorbis parsing 23 | * 24 | * Determines the duration for each packet. 25 | */ 26 | 27 | #ifndef AVCODEC_VORBIS_PARSE_H 28 | #define AVCODEC_VORBIS_PARSE_H 29 | 30 | #include 31 | 32 | typedef struct AVVorbisParseContext AVVorbisParseContext; 33 | 34 | /** 35 | * Allocate and initialize the Vorbis parser using headers in the extradata. 36 | * 37 | * @param avctx codec context 38 | * @param s Vorbis parser context 39 | */ 40 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, 41 | int extradata_size); 42 | 43 | /** 44 | * Free the parser and everything associated with it. 45 | */ 46 | void av_vorbis_parse_free(AVVorbisParseContext **s); 47 | 48 | #define VORBIS_FLAG_HEADER 0x00000001 49 | #define VORBIS_FLAG_COMMENT 0x00000002 50 | #define VORBIS_FLAG_SETUP 0x00000004 51 | 52 | /** 53 | * Get the duration for a Vorbis packet. 54 | * 55 | * If @p flags is @c NULL, 56 | * special frames are considered invalid. 57 | * 58 | * @param s Vorbis parser context 59 | * @param buf buffer containing a Vorbis frame 60 | * @param buf_size size of the buffer 61 | * @param flags flags for special frames 62 | */ 63 | int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, 64 | int buf_size, int *flags); 65 | 66 | /** 67 | * Get the duration for a Vorbis packet. 68 | * 69 | * @param s Vorbis parser context 70 | * @param buf buffer containing a Vorbis frame 71 | * @param buf_size size of the buffer 72 | */ 73 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, 74 | int buf_size); 75 | 76 | void av_vorbis_parse_reset(AVVorbisParseContext *s); 77 | 78 | #endif /* AVCODEC_VORBIS_PARSE_H */ 79 | -------------------------------------------------------------------------------- /ffm_inc/libavformat/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFORMAT_VERSION_H 22 | #define AVFORMAT_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup libavf 27 | * Libavformat version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #define LIBAVFORMAT_VERSION_MAJOR 56 33 | #define LIBAVFORMAT_VERSION_MINOR 40 34 | #define LIBAVFORMAT_VERSION_MICRO 101 35 | 36 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ 37 | LIBAVFORMAT_VERSION_MINOR, \ 38 | LIBAVFORMAT_VERSION_MICRO) 39 | #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ 40 | LIBAVFORMAT_VERSION_MINOR, \ 41 | LIBAVFORMAT_VERSION_MICRO) 42 | #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT 43 | 44 | #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) 45 | 46 | /** 47 | * FF_API_* defines may be placed below to indicate public API that will be 48 | * dropped at a future version bump. The defines themselves are not part of 49 | * the public API and may change, break or disappear at any time. 50 | * 51 | * @note, when bumping the major version it is recommended to manually 52 | * disable each FF_API_* in its own commit instead of disabling them all 53 | * at once through the bump. This improves the git bisect-ability of the change. 54 | * 55 | */ 56 | #ifndef FF_API_LAVF_BITEXACT 57 | #define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 57) 58 | #endif 59 | #ifndef FF_API_LAVF_FRAC 60 | #define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 57) 61 | #endif 62 | #ifndef FF_API_LAVF_CODEC_TB 63 | #define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 57) 64 | #endif 65 | #ifndef FF_API_URL_FEOF 66 | #define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 57) 67 | #endif 68 | #ifndef FF_API_PROBESIZE_32 69 | #define FF_API_PROBESIZE_32 (LIBAVFORMAT_VERSION_MAJOR < 57) 70 | #endif 71 | 72 | #ifndef FF_API_R_FRAME_RATE 73 | #define FF_API_R_FRAME_RATE 1 74 | #endif 75 | #endif /* AVFORMAT_VERSION_H */ 76 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_ADLER32_H 22 | #define AVUTIL_ADLER32_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | /** 28 | * @file 29 | * Public header for libavutil Adler32 hasher 30 | * 31 | * @defgroup lavu_adler32 Adler32 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | /** 37 | * Calculate the Adler32 checksum of a buffer. 38 | * 39 | * Passing the return value to a subsequent av_adler32_update() call 40 | * allows the checksum of multiple buffers to be calculated as though 41 | * they were concatenated. 42 | * 43 | * @param adler initial checksum value 44 | * @param buf pointer to input buffer 45 | * @param len size of input buffer 46 | * @return updated checksum 47 | */ 48 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 49 | unsigned int len) av_pure; 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | #endif /* AVUTIL_ADLER32_H */ 56 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/attributes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * Macro definitions for various function/variable attributes 24 | */ 25 | 26 | #ifndef AVUTIL_ATTRIBUTES_H 27 | #define AVUTIL_ATTRIBUTES_H 28 | 29 | #ifdef __GNUC__ 30 | # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) 31 | #else 32 | # define AV_GCC_VERSION_AT_LEAST(x,y) 0 33 | #endif 34 | 35 | #ifndef av_always_inline 36 | #if AV_GCC_VERSION_AT_LEAST(3,1) 37 | # define av_always_inline __attribute__((always_inline)) inline 38 | #elif defined(_MSC_VER) 39 | # define av_always_inline __forceinline 40 | #else 41 | # define av_always_inline inline 42 | #endif 43 | #endif 44 | 45 | #ifndef av_extern_inline 46 | #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) 47 | # define av_extern_inline extern inline 48 | #else 49 | # define av_extern_inline inline 50 | #endif 51 | #endif 52 | 53 | #if AV_GCC_VERSION_AT_LEAST(3,1) 54 | # define av_noinline __attribute__((noinline)) 55 | #elif defined(_MSC_VER) 56 | # define av_noinline __declspec(noinline) 57 | #else 58 | # define av_noinline 59 | #endif 60 | 61 | #if AV_GCC_VERSION_AT_LEAST(3,1) 62 | # define av_pure __attribute__((pure)) 63 | #else 64 | # define av_pure 65 | #endif 66 | 67 | #if AV_GCC_VERSION_AT_LEAST(2,6) 68 | # define av_const __attribute__((const)) 69 | #else 70 | # define av_const 71 | #endif 72 | 73 | #if AV_GCC_VERSION_AT_LEAST(4,3) 74 | # define av_cold __attribute__((cold)) 75 | #else 76 | # define av_cold 77 | #endif 78 | 79 | #if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) 80 | # define av_flatten __attribute__((flatten)) 81 | #else 82 | # define av_flatten 83 | #endif 84 | 85 | #if AV_GCC_VERSION_AT_LEAST(3,1) 86 | # define attribute_deprecated __attribute__((deprecated)) 87 | #elif defined(_MSC_VER) 88 | # define attribute_deprecated __declspec(deprecated) 89 | #else 90 | # define attribute_deprecated 91 | #endif 92 | 93 | /** 94 | * Disable warnings about deprecated features 95 | * This is useful for sections of code kept for backward compatibility and 96 | * scheduled for removal. 97 | */ 98 | #ifndef AV_NOWARN_DEPRECATED 99 | #if AV_GCC_VERSION_AT_LEAST(4,6) 100 | # define AV_NOWARN_DEPRECATED(code) \ 101 | _Pragma("GCC diagnostic push") \ 102 | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ 103 | code \ 104 | _Pragma("GCC diagnostic pop") 105 | #elif defined(_MSC_VER) 106 | # define AV_NOWARN_DEPRECATED(code) \ 107 | __pragma(warning(push)) \ 108 | __pragma(warning(disable : 4996)) \ 109 | code; \ 110 | __pragma(warning(pop)) 111 | #else 112 | # define AV_NOWARN_DEPRECATED(code) code 113 | #endif 114 | #endif 115 | 116 | 117 | #if defined(__GNUC__) 118 | # define av_unused __attribute__((unused)) 119 | #else 120 | # define av_unused 121 | #endif 122 | 123 | /** 124 | * Mark a variable as used and prevent the compiler from optimizing it 125 | * away. This is useful for variables accessed only from inline 126 | * assembler without the compiler being aware. 127 | */ 128 | #if AV_GCC_VERSION_AT_LEAST(3,1) 129 | # define av_used __attribute__((used)) 130 | #else 131 | # define av_used 132 | #endif 133 | 134 | #if AV_GCC_VERSION_AT_LEAST(3,3) 135 | # define av_alias __attribute__((may_alias)) 136 | #else 137 | # define av_alias 138 | #endif 139 | 140 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) 141 | # define av_uninit(x) x=x 142 | #else 143 | # define av_uninit(x) x 144 | #endif 145 | 146 | #ifdef __GNUC__ 147 | # define av_builtin_constant_p __builtin_constant_p 148 | # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) 149 | #else 150 | # define av_builtin_constant_p(x) 0 151 | # define av_printf_format(fmtpos, attrpos) 152 | #endif 153 | 154 | #if AV_GCC_VERSION_AT_LEAST(2,5) 155 | # define av_noreturn __attribute__((noreturn)) 156 | #else 157 | # define av_noreturn 158 | #endif 159 | 160 | #endif /* AVUTIL_ATTRIBUTES_H */ 161 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/audioconvert.h: -------------------------------------------------------------------------------- 1 | 2 | #include "version.h" 3 | 4 | #if FF_API_AUDIOCONVERT 5 | #include "channel_layout.h" 6 | #endif 7 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/avassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple assert() macros that are a bit more flexible than ISO C assert(). 24 | * @author Michael Niedermayer 25 | */ 26 | 27 | #ifndef AVUTIL_AVASSERT_H 28 | #define AVUTIL_AVASSERT_H 29 | 30 | #include 31 | #include "avutil.h" 32 | #include "log.h" 33 | 34 | /** 35 | * assert() equivalent, that is always enabled. 36 | */ 37 | #define av_assert0(cond) do { \ 38 | if (!(cond)) { \ 39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ 40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \ 41 | abort(); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /** 47 | * assert() equivalent, that does not lie in speed critical code. 48 | * These asserts() thus can be enabled without fearing speedloss. 49 | */ 50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 51 | #define av_assert1(cond) av_assert0(cond) 52 | #else 53 | #define av_assert1(cond) ((void)0) 54 | #endif 55 | 56 | 57 | /** 58 | * assert() equivalent, that does lie in speed critical code. 59 | */ 60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 61 | #define av_assert2(cond) av_assert0(cond) 62 | #else 63 | #define av_assert2(cond) ((void)0) 64 | #endif 65 | 66 | #endif /* AVUTIL_AVASSERT_H */ 67 | -------------------------------------------------------------------------------- /ffm_inc/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 | #define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0 7 | #endif /* AVUTIL_AVCONFIG_H */ 8 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | 33 | /** 34 | * Decode a base64-encoded string. 35 | * 36 | * @param out buffer for decoded data 37 | * @param in null-terminated input string 38 | * @param out_size size in bytes of the out buffer, must be at 39 | * least 3/4 of the length of in 40 | * @return number of bytes written, or a negative value in case of 41 | * invalid input 42 | */ 43 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 44 | 45 | /** 46 | * Encode data to base64 and null-terminate. 47 | * 48 | * @param out buffer for encoded data 49 | * @param out_size size in bytes of the out buffer (including the 50 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 51 | * @param in input buffer containing the data to encode 52 | * @param in_size size in bytes of the in buffer 53 | * @return out or NULL in case of error 54 | */ 55 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 56 | 57 | /** 58 | * Calculate the output size needed to base64-encode x bytes to a 59 | * null-terminated string. 60 | */ 61 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | #endif /* AVUTIL_BASE64_H */ 68 | -------------------------------------------------------------------------------- /ffm_inc/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 | #include "version.h" 27 | 28 | /** 29 | * @defgroup lavu_blowfish Blowfish 30 | * @ingroup lavu_crypto 31 | * @{ 32 | */ 33 | 34 | #define AV_BF_ROUNDS 16 35 | 36 | typedef struct AVBlowfish { 37 | uint32_t p[AV_BF_ROUNDS + 2]; 38 | uint32_t s[4][256]; 39 | } AVBlowfish; 40 | 41 | /** 42 | * Allocate an AVBlowfish context. 43 | */ 44 | AVBlowfish *av_blowfish_alloc(void); 45 | 46 | /** 47 | * Initialize an AVBlowfish context. 48 | * 49 | * @param ctx an AVBlowfish context 50 | * @param key a key 51 | * @param key_len length of the key 52 | */ 53 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context. 57 | * 58 | * @param ctx an AVBlowfish context 59 | * @param xl left four bytes halves of input to be encrypted 60 | * @param xr right four bytes halves of input to be encrypted 61 | * @param decrypt 0 for encryption, 1 for decryption 62 | */ 63 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, 64 | int decrypt); 65 | 66 | /** 67 | * Encrypt or decrypt a buffer using a previously initialized context. 68 | * 69 | * @param ctx an AVBlowfish 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, if NULL ECB will be used 74 | * @param decrypt 0 for encryption, 1 for decryption 75 | */ 76 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, 77 | int count, uint8_t *iv, int decrypt); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_BLOWFISH_H */ 84 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | */ 52 | int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only 56 | * 57 | * @param ctx an AVCAST5 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 decrypt 0 for encryption, 1 for decryption 62 | */ 63 | void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); 64 | 65 | /** 66 | * Encrypt or decrypt a buffer using a previously initialized context 67 | * 68 | * @param ctx an AVCAST5 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, NULL for ECB mode 73 | * @param decrypt 0 for encryption, 1 for decryption 74 | */ 75 | void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 76 | /** 77 | * @} 78 | */ 79 | #endif /* AVUTIL_CAST5_H */ 80 | -------------------------------------------------------------------------------- /ffm_inc/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_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used 46 | #define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) 47 | #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions 48 | #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions 49 | // #if LIBAVUTIL_VERSION_MAJOR <52 50 | #define AV_CPU_FLAG_CMOV 0x1001000 ///< supports cmov instruction 51 | // #else 52 | // #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction 53 | // #endif 54 | #define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used 55 | #define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions 56 | #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 57 | #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 58 | 59 | #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard 60 | #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 61 | #define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07 62 | 63 | #define AV_CPU_FLAG_ARMV5TE (1 << 0) 64 | #define AV_CPU_FLAG_ARMV6 (1 << 1) 65 | #define AV_CPU_FLAG_ARMV6T2 (1 << 2) 66 | #define AV_CPU_FLAG_VFP (1 << 3) 67 | #define AV_CPU_FLAG_VFPV3 (1 << 4) 68 | #define AV_CPU_FLAG_NEON (1 << 5) 69 | #define AV_CPU_FLAG_ARMV8 (1 << 6) 70 | #define AV_CPU_FLAG_SETEND (1 <<16) 71 | 72 | /** 73 | * Return the flags which specify extensions supported by the CPU. 74 | * The returned value is affected by av_force_cpu_flags() if that was used 75 | * before. So av_get_cpu_flags() can easily be used in a application to 76 | * detect the enabled cpu flags. 77 | */ 78 | int av_get_cpu_flags(void); 79 | 80 | /** 81 | * Disables cpu detection and forces the specified flags. 82 | * -1 is a special case that disables forcing of specific flags. 83 | */ 84 | void av_force_cpu_flags(int flags); 85 | 86 | /** 87 | * Set a mask on flags returned by av_get_cpu_flags(). 88 | * This function is mainly useful for testing. 89 | * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible 90 | * 91 | * @warning this function is not thread safe. 92 | */ 93 | attribute_deprecated void av_set_cpu_flags_mask(int mask); 94 | 95 | /** 96 | * Parse CPU flags from a string. 97 | * 98 | * The returned flags contain the specified flags as well as related unspecified flags. 99 | * 100 | * This function exists only for compatibility with libav. 101 | * Please use av_parse_cpu_caps() when possible. 102 | * @return a combination of AV_CPU_* flags, negative on error. 103 | */ 104 | attribute_deprecated 105 | int av_parse_cpu_flags(const char *s); 106 | 107 | /** 108 | * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. 109 | * 110 | * @return negative on error. 111 | */ 112 | int av_parse_cpu_caps(unsigned *flags, const char *s); 113 | 114 | /** 115 | * @return the number of logical CPU cores present. 116 | */ 117 | int av_cpu_count(void); 118 | 119 | #endif /* AVUTIL_CPU_H */ 120 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_CRC_H 22 | #define AVUTIL_CRC_H 23 | 24 | #include 25 | #include 26 | #include "attributes.h" 27 | 28 | /** 29 | * @defgroup lavu_crc32 CRC32 30 | * @ingroup lavu_crypto 31 | * @{ 32 | */ 33 | 34 | typedef uint32_t AVCRC; 35 | 36 | typedef enum { 37 | AV_CRC_8_ATM, 38 | AV_CRC_16_ANSI, 39 | AV_CRC_16_CCITT, 40 | AV_CRC_32_IEEE, 41 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ 42 | AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ 43 | AV_CRC_24_IEEE = 12, 44 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ 45 | }AVCRCId; 46 | 47 | /** 48 | * Initialize a CRC table. 49 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 50 | * @param le If 1, the lowest bit represents the coefficient for the highest 51 | * exponent of the corresponding polynomial (both for poly and 52 | * actual CRC). 53 | * If 0, you must swap the CRC parameter and the result of av_crc 54 | * if you need the standard representation (can be simplified in 55 | * most cases to e.g. bswap16): 56 | * av_bswap32(crc << (32-bits)) 57 | * @param bits number of bits for the CRC 58 | * @param poly generator polynomial without the x**bits coefficient, in the 59 | * representation as specified by le 60 | * @param ctx_size size of ctx in bytes 61 | * @return <0 on failure 62 | */ 63 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); 64 | 65 | /** 66 | * Get an initialized standard CRC table. 67 | * @param crc_id ID of a standard CRC 68 | * @return a pointer to the CRC table or NULL on failure 69 | */ 70 | const AVCRC *av_crc_get_table(AVCRCId crc_id); 71 | 72 | /** 73 | * Calculate the CRC of a block. 74 | * @param crc CRC of previous blocks if any or initial value for CRC 75 | * @return CRC updated with the data from the given block 76 | * 77 | * @see av_crc_init() "le" parameter 78 | */ 79 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc, 80 | const uint8_t *buffer, size_t length) av_pure; 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | #endif /* AVUTIL_CRC_H */ 87 | -------------------------------------------------------------------------------- /ffm_inc/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 | 26 | /** 27 | * The display transformation matrix specifies an affine transformation that 28 | * should be applied to video frames for correct presentation. It is compatible 29 | * with the matrices stored in the ISO/IEC 14496-12 container format. 30 | * 31 | * The data is a 3x3 matrix represented as a 9-element array: 32 | * 33 | * | a b u | 34 | * (a, b, u, c, d, v, x, y, w) -> | c d v | 35 | * | x y w | 36 | * 37 | * All numbers are stored in native endianness, as 16.16 fixed-point values, 38 | * except for u, v and w, which are stored as 2.30 fixed-point values. 39 | * 40 | * The transformation maps a point (p, q) in the source (pre-transformation) 41 | * frame to the point (p', q') in the destination (post-transformation) frame as 42 | * follows: 43 | * | a b u | 44 | * (p, q, 1) . | c d v | = z * (p', q', 1) 45 | * | x y w | 46 | * 47 | * The transformation can also be more explicitly written in components as 48 | * follows: 49 | * p' = (a * p + c * q + x) / z; 50 | * q' = (b * p + d * q + y) / z; 51 | * z = u * p + v * q + w 52 | */ 53 | 54 | /** 55 | * Extract the rotation component of the transformation matrix. 56 | * 57 | * @param matrix the transformation matrix 58 | * @return the angle (in degrees) by which the transformation rotates the frame 59 | * counterclockwise. The angle will be in range [-180.0, 180.0], 60 | * or NaN if the matrix is singular. 61 | * 62 | * @note floating point numbers are inherently inexact, so callers are 63 | * recommended to round the return value to nearest integer before use. 64 | */ 65 | double av_display_rotation_get(const int32_t matrix[9]); 66 | 67 | /** 68 | * Initialize a transformation matrix describing a pure counterclockwise 69 | * rotation by the specified angle (in degrees). 70 | * 71 | * @param matrix an allocated transformation matrix (will be fully overwritten 72 | * by this function) 73 | * @param angle rotation angle in degrees. 74 | */ 75 | void av_display_rotation_set(int32_t matrix[9], double angle); 76 | 77 | /** 78 | * Flip the input matrix horizontally and/or vertically. 79 | * 80 | * @param matrix an allocated transformation matrix 81 | * @param hflip whether the matrix should be flipped horizontally 82 | * @param vflip whether the matrix should be flipped vertically 83 | */ 84 | void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); 85 | 86 | #endif /* AVUTIL_DISPLAY_H */ 87 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | #ifndef AVUTIL_FFVERSION_H 2 | #define AVUTIL_FFVERSION_H 3 | #define FFMPEG_VERSION "2.8.15-0ubuntu0.16.04.1" 4 | #endif /* AVUTIL_FFVERSION_H */ 5 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_FILE_H 20 | #define AVUTIL_FILE_H 21 | 22 | #include 23 | 24 | #include "avutil.h" 25 | 26 | /** 27 | * @file 28 | * Misc file utilities. 29 | */ 30 | 31 | /** 32 | * Read the file with name filename, and put its content in a newly 33 | * allocated buffer or map it with mmap() when available. 34 | * In case of success set *bufptr to the read or mmapped buffer, and 35 | * *size to the size in bytes of the buffer in *bufptr. 36 | * The returned buffer must be released with av_file_unmap(). 37 | * 38 | * @param log_offset loglevel offset used for logging 39 | * @param log_ctx context used for logging 40 | * @return a non negative number in case of success, a negative value 41 | * corresponding to an AVERROR error code in case of failure 42 | */ 43 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 44 | int log_offset, void *log_ctx); 45 | 46 | /** 47 | * Unmap or free the buffer bufptr created by av_file_map(). 48 | * 49 | * @param size size in bytes of bufptr, must be the same as returned 50 | * by av_file_map() 51 | */ 52 | void av_file_unmap(uint8_t *bufptr, size_t size); 53 | 54 | /** 55 | * Wrapper to work around the lack of mkstemp() on mingw. 56 | * Also, tries to create file in /tmp first, if possible. 57 | * *prefix can be a character constant; *filename will be allocated internally. 58 | * @return file descriptor of opened file (or negative value corresponding to an 59 | * AVERROR code on error) 60 | * and opened file name in **filename. 61 | * @note On very old libcs it is necessary to set a secure umask before 62 | * calling this, av_tempfile() can't call umask itself as it is used in 63 | * libraries and could interfere with the calling application. 64 | */ 65 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); 66 | 67 | #endif /* AVUTIL_FILE_H */ 68 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Reimar Döffinger 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_HASH_H 22 | #define AVUTIL_HASH_H 23 | 24 | #include 25 | 26 | struct AVHashContext; 27 | 28 | /** 29 | * Allocate a hash context for the algorithm specified by name. 30 | * 31 | * @return >= 0 for success, a negative error code for failure 32 | * @note The context is not initialized, you must call av_hash_init(). 33 | */ 34 | int av_hash_alloc(struct AVHashContext **ctx, const char *name); 35 | 36 | /** 37 | * Get the names of available hash algorithms. 38 | * 39 | * This function can be used to enumerate the algorithms. 40 | * 41 | * @param i index of the hash algorithm, starting from 0 42 | * @return a pointer to a static string or NULL if i is out of range 43 | */ 44 | const char *av_hash_names(int i); 45 | 46 | /** 47 | * Get the name of the algorithm corresponding to the given hash context. 48 | */ 49 | const char *av_hash_get_name(const struct AVHashContext *ctx); 50 | 51 | /** 52 | * Maximum value that av_hash_get_size will currently return. 53 | * 54 | * You can use this if you absolutely want or need to use static allocation 55 | * and are fine with not supporting hashes newly added to libavutil without 56 | * recompilation. 57 | * Note that you still need to check against av_hash_get_size, adding new hashes 58 | * with larger sizes will not be considered an ABI change and should not cause 59 | * your code to overflow a buffer. 60 | */ 61 | #define AV_HASH_MAX_SIZE 64 62 | 63 | /** 64 | * Get the size of the resulting hash value in bytes. 65 | * 66 | * The pointer passed to av_hash_final have space for at least this many bytes. 67 | */ 68 | int av_hash_get_size(const struct AVHashContext *ctx); 69 | 70 | /** 71 | * Initialize or reset a hash context. 72 | */ 73 | void av_hash_init(struct AVHashContext *ctx); 74 | 75 | /** 76 | * Update a hash context with additional data. 77 | */ 78 | void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); 79 | 80 | /** 81 | * Finalize a hash context and compute the actual hash value. 82 | */ 83 | void av_hash_final(struct AVHashContext *ctx, uint8_t *dst); 84 | 85 | /** 86 | * Finalize a hash context and compute the actual hash value. 87 | * If size is smaller than the hash size, the hash is truncated; 88 | * if size is larger, the buffer is padded with 0. 89 | */ 90 | void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size); 91 | 92 | /** 93 | * Finalize a hash context and compute the actual hash value as a hex string. 94 | * The string is always 0-terminated. 95 | * If size is smaller than 2 * hash_size + 1, the hex string is truncated. 96 | */ 97 | void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size); 98 | 99 | /** 100 | * Finalize a hash context and compute the actual hash value as a base64 string. 101 | * The string is always 0-terminated. 102 | * If size is smaller than AV_BASE64_SIZE(hash_size), the base64 string is 103 | * truncated. 104 | */ 105 | void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size); 106 | 107 | /** 108 | * Free hash context. 109 | */ 110 | void av_hash_freep(struct AVHashContext **ctx); 111 | 112 | #endif /* AVUTIL_HASH_H */ 113 | -------------------------------------------------------------------------------- /ffm_inc/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 | #if FF_API_HMAC 39 | AV_HMAC_SHA224_DEPRECATED = 10, 40 | AV_HMAC_SHA256_DEPRECATED, 41 | #endif 42 | AV_HMAC_SHA384 = 12, 43 | AV_HMAC_SHA512, 44 | }; 45 | 46 | typedef struct AVHMAC AVHMAC; 47 | 48 | /** 49 | * Allocate an AVHMAC context. 50 | * @param type The hash function used for the HMAC. 51 | */ 52 | AVHMAC *av_hmac_alloc(enum AVHMACType type); 53 | 54 | /** 55 | * Free an AVHMAC context. 56 | * @param ctx The context to free, may be NULL 57 | */ 58 | void av_hmac_free(AVHMAC *ctx); 59 | 60 | /** 61 | * Initialize an AVHMAC context with an authentication key. 62 | * @param ctx The HMAC context 63 | * @param key The authentication key 64 | * @param keylen The length of the key, in bytes 65 | */ 66 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); 67 | 68 | /** 69 | * Hash data with the HMAC. 70 | * @param ctx The HMAC context 71 | * @param data The data to hash 72 | * @param len The length of the data, in bytes 73 | */ 74 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); 75 | 76 | /** 77 | * Finish hashing and output the HMAC digest. 78 | * @param ctx The HMAC context 79 | * @param out The output buffer to write the digest into 80 | * @param outlen The length of the out buffer, in bytes 81 | * @return The number of bytes written to out, or a negative error code. 82 | */ 83 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); 84 | 85 | /** 86 | * Hash an array of data with a key. 87 | * @param ctx The HMAC context 88 | * @param data The data to hash 89 | * @param len The length of the data, in bytes 90 | * @param key The authentication key 91 | * @param keylen The length of the key, in bytes 92 | * @param out The output buffer to write the digest into 93 | * @param outlen The length of the out buffer, in bytes 94 | * @return The number of bytes written to out, or a negative error code. 95 | */ 96 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, 97 | const uint8_t *key, unsigned int keylen, 98 | uint8_t *out, unsigned int outlen); 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | #endif /* AVUTIL_HMAC_H */ 105 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/lzo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LZO 1x decompression 3 | * copyright (c) 2006 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LZO_H 23 | #define AVUTIL_LZO_H 24 | 25 | /** 26 | * @defgroup lavu_lzo LZO 27 | * @ingroup lavu_crypto 28 | * 29 | * @{ 30 | */ 31 | 32 | #include 33 | 34 | /** @name Error flags returned by av_lzo1x_decode 35 | * @{ */ 36 | /// end of the input buffer reached before decoding finished 37 | #define AV_LZO_INPUT_DEPLETED 1 38 | /// decoded data did not fit into output buffer 39 | #define AV_LZO_OUTPUT_FULL 2 40 | /// a reference to previously decoded data was wrong 41 | #define AV_LZO_INVALID_BACKPTR 4 42 | /// a non-specific error in the compressed bitstream 43 | #define AV_LZO_ERROR 8 44 | /** @} */ 45 | 46 | #define AV_LZO_INPUT_PADDING 8 47 | #define AV_LZO_OUTPUT_PADDING 12 48 | 49 | /** 50 | * @brief Decodes LZO 1x compressed data. 51 | * @param out output buffer 52 | * @param outlen size of output buffer, number of bytes left are returned here 53 | * @param in input buffer 54 | * @param inlen size of input buffer, number of bytes left are returned here 55 | * @return 0 on success, otherwise a combination of the error flags above 56 | * 57 | * Make sure all buffers are appropriately padded, in must provide 58 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. 59 | */ 60 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_LZO_H */ 67 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * @ingroup lavu 22 | * Utility Preprocessor macros 23 | */ 24 | 25 | #ifndef AVUTIL_MACROS_H 26 | #define AVUTIL_MACROS_H 27 | 28 | /** 29 | * @addtogroup preproc_misc Preprocessor String Macros 30 | * 31 | * String manipulation macros 32 | * 33 | * @{ 34 | */ 35 | 36 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 37 | #define AV_TOSTRING(s) #s 38 | 39 | #define AV_GLUE(a, b) a ## b 40 | #define AV_JOIN(a, b) AV_GLUE(a, b) 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | #define AV_PRAGMA(s) _Pragma(#s) 47 | 48 | #endif /* AVUTIL_MACROS_H */ 49 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MD5_H 22 | #define AVUTIL_MD5_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_md5 MD5 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_md5_size; 36 | 37 | struct AVMD5; 38 | 39 | /** 40 | * Allocate an AVMD5 context. 41 | */ 42 | struct AVMD5 *av_md5_alloc(void); 43 | 44 | /** 45 | * Initialize MD5 hashing. 46 | * 47 | * @param ctx pointer to the function context (of size av_md5_size) 48 | */ 49 | void av_md5_init(struct AVMD5 *ctx); 50 | 51 | /** 52 | * Update hash value. 53 | * 54 | * @param ctx hash function context 55 | * @param src input data to update hash with 56 | * @param len input data length 57 | */ 58 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); 59 | 60 | /** 61 | * Finish hashing and output digest value. 62 | * 63 | * @param ctx hash function context 64 | * @param dst buffer where output digest value is stored 65 | */ 66 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 67 | 68 | /** 69 | * Hash an array of data. 70 | * 71 | * @param dst The output buffer to write the digest into 72 | * @param src The data to hash 73 | * @param len The length of the data, in bytes 74 | */ 75 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | #endif /* AVUTIL_MD5_H */ 82 | -------------------------------------------------------------------------------- /ffm_inc/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 | } AVMotionVector; 49 | 50 | #endif /* AVUTIL_MOTION_VECTOR_H */ 51 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/murmur3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Reimar Döffinger 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MURMUR3_H 22 | #define AVUTIL_MURMUR3_H 23 | 24 | #include 25 | 26 | struct AVMurMur3 *av_murmur3_alloc(void); 27 | void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); 28 | void av_murmur3_init(struct AVMurMur3 *c); 29 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); 30 | void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); 31 | 32 | #endif /* AVUTIL_MURMUR3_H */ 33 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/rational.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rational numbers 3 | * Copyright (c) 2003 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * rational numbers 25 | * @author Michael Niedermayer 26 | */ 27 | 28 | #ifndef AVUTIL_RATIONAL_H 29 | #define AVUTIL_RATIONAL_H 30 | 31 | #include 32 | #include 33 | #include "attributes.h" 34 | 35 | /** 36 | * @addtogroup lavu_math 37 | * @{ 38 | */ 39 | 40 | /** 41 | * rational number numerator/denominator 42 | */ 43 | typedef struct AVRational{ 44 | int num; ///< numerator 45 | int den; ///< denominator 46 | } AVRational; 47 | 48 | /** 49 | * Create a rational. 50 | * Useful for compilers that do not support compound literals. 51 | * @note The return value is not reduced. 52 | */ 53 | static inline AVRational av_make_q(int num, int den) 54 | { 55 | AVRational r = { num, den }; 56 | return r; 57 | } 58 | 59 | /** 60 | * Compare two rationals. 61 | * @param a first rational 62 | * @param b second rational 63 | * @return 0 if a==b, 1 if a>b, -1 if a>63)|1; 70 | else if(b.den && a.den) return 0; 71 | else if(a.num && b.num) return (a.num>>31) - (b.num>>31); 72 | else return INT_MIN; 73 | } 74 | 75 | /** 76 | * Convert rational to double. 77 | * @param a rational to convert 78 | * @return (double) a 79 | */ 80 | static inline double av_q2d(AVRational a){ 81 | return a.num / (double) a.den; 82 | } 83 | 84 | /** 85 | * Reduce a fraction. 86 | * This is useful for framerate calculations. 87 | * @param dst_num destination numerator 88 | * @param dst_den destination denominator 89 | * @param num source numerator 90 | * @param den source denominator 91 | * @param max the maximum allowed for dst_num & dst_den 92 | * @return 1 if exact, 0 otherwise 93 | */ 94 | int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); 95 | 96 | /** 97 | * Multiply two rationals. 98 | * @param b first rational 99 | * @param c second rational 100 | * @return b*c 101 | */ 102 | AVRational av_mul_q(AVRational b, AVRational c) av_const; 103 | 104 | /** 105 | * Divide one rational by another. 106 | * @param b first rational 107 | * @param c second rational 108 | * @return b/c 109 | */ 110 | AVRational av_div_q(AVRational b, AVRational c) av_const; 111 | 112 | /** 113 | * Add two rationals. 114 | * @param b first rational 115 | * @param c second rational 116 | * @return b+c 117 | */ 118 | AVRational av_add_q(AVRational b, AVRational c) av_const; 119 | 120 | /** 121 | * Subtract one rational from another. 122 | * @param b first rational 123 | * @param c second rational 124 | * @return b-c 125 | */ 126 | AVRational av_sub_q(AVRational b, AVRational c) av_const; 127 | 128 | /** 129 | * Invert a rational. 130 | * @param q value 131 | * @return 1 / q 132 | */ 133 | static av_always_inline AVRational av_inv_q(AVRational q) 134 | { 135 | AVRational r = { q.den, q.num }; 136 | return r; 137 | } 138 | 139 | /** 140 | * Convert a double precision floating point number to a rational. 141 | * inf is expressed as {1,0} or {-1,0} depending on the sign. 142 | * 143 | * @param d double to convert 144 | * @param max the maximum allowed numerator and denominator 145 | * @return (AVRational) d 146 | */ 147 | AVRational av_d2q(double d, int max) av_const; 148 | 149 | /** 150 | * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer 151 | * than q1, 0 if they have the same distance. 152 | */ 153 | int av_nearer_q(AVRational q, AVRational q1, AVRational q2); 154 | 155 | /** 156 | * Find the nearest value in q_list to q. 157 | * @param q_list an array of rationals terminated by {0, 0} 158 | * @return the index of the nearest value found in the array 159 | */ 160 | int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); 161 | 162 | /** 163 | * Converts a AVRational to a IEEE 32bit float. 164 | * 165 | * The float is returned in a uint32_t and its value is platform indepenant. 166 | */ 167 | uint32_t av_q2intfloat(AVRational q); 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | #endif /* AVUTIL_RATIONAL_H */ 174 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/replaygain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of FFmpeg. 4 | * 5 | * FFmpeg is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * FFmpeg is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with FFmpeg; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef AVUTIL_REPLAYGAIN_H 21 | #define AVUTIL_REPLAYGAIN_H 22 | 23 | #include 24 | 25 | /** 26 | * ReplayGain information (see 27 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). 28 | * The size of this struct is a part of the public ABI. 29 | */ 30 | typedef struct AVReplayGain { 31 | /** 32 | * Track replay gain in microbels (divide by 100000 to get the value in dB). 33 | * Should be set to INT32_MIN when unknown. 34 | */ 35 | int32_t track_gain; 36 | /** 37 | * Peak track amplitude, with 100000 representing full scale (but values 38 | * may overflow). 0 when unknown. 39 | */ 40 | uint32_t track_peak; 41 | /** 42 | * Same as track_gain, but for the whole album. 43 | */ 44 | int32_t album_gain; 45 | /** 46 | * Same as track_peak, but for the whole album, 47 | */ 48 | uint32_t album_peak; 49 | } AVReplayGain; 50 | 51 | #endif /* AVUTIL_REPLAYGAIN_H */ 52 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_RIPEMD_H 23 | #define AVUTIL_RIPEMD_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | /** 31 | * @defgroup lavu_ripemd RIPEMD 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_ripemd_size; 37 | 38 | struct AVRIPEMD; 39 | 40 | /** 41 | * Allocate an AVRIPEMD context. 42 | */ 43 | struct AVRIPEMD *av_ripemd_alloc(void); 44 | 45 | /** 46 | * Initialize RIPEMD hashing. 47 | * 48 | * @param context pointer to the function context (of size av_ripemd_size) 49 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 50 | * @return zero if initialization succeeded, -1 otherwise 51 | */ 52 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 53 | 54 | /** 55 | * Update hash value. 56 | * 57 | * @param context hash function context 58 | * @param data input data to update hash with 59 | * @param len input data length 60 | */ 61 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); 62 | 63 | /** 64 | * Finish hashing and output digest value. 65 | * 66 | * @param context hash function context 67 | * @param digest buffer where output digest value is stored 68 | */ 69 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /* AVUTIL_RIPEMD_H */ 76 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_SHA_H 22 | #define AVUTIL_SHA_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_sha SHA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_sha_size; 36 | 37 | struct AVSHA; 38 | 39 | /** 40 | * Allocate an AVSHA context. 41 | */ 42 | struct AVSHA *av_sha_alloc(void); 43 | 44 | /** 45 | * Initialize SHA-1 or SHA-2 hashing. 46 | * 47 | * @param context pointer to the function context (of size av_sha_size) 48 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) 49 | * @return zero if initialization succeeded, -1 otherwise 50 | */ 51 | int av_sha_init(struct AVSHA* context, int bits); 52 | 53 | /** 54 | * Update hash value. 55 | * 56 | * @param context hash function context 57 | * @param data input data to update hash with 58 | * @param len input data length 59 | */ 60 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); 61 | 62 | /** 63 | * Finish hashing and output digest value. 64 | * 65 | * @param context hash function context 66 | * @param digest buffer where output digest value is stored 67 | */ 68 | void av_sha_final(struct AVSHA* context, uint8_t *digest); 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | #endif /* AVUTIL_SHA_H */ 75 | -------------------------------------------------------------------------------- /ffm_inc/libavutil/sha512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_SHA512_H 23 | #define AVUTIL_SHA512_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | /** 31 | * @defgroup lavu_sha512 SHA512 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_sha512_size; 37 | 38 | struct AVSHA512; 39 | 40 | /** 41 | * Allocate an AVSHA512 context. 42 | */ 43 | struct AVSHA512 *av_sha512_alloc(void); 44 | 45 | /** 46 | * Initialize SHA-2 512 hashing. 47 | * 48 | * @param context pointer to the function context (of size av_sha512_size) 49 | * @param bits number of bits in digest (224, 256, 384 or 512 bits) 50 | * @return zero if initialization succeeded, -1 otherwise 51 | */ 52 | int av_sha512_init(struct AVSHA512* context, int bits); 53 | 54 | /** 55 | * Update hash value. 56 | * 57 | * @param context hash function context 58 | * @param data input data to update hash with 59 | * @param len input data length 60 | */ 61 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); 62 | 63 | /** 64 | * Finish hashing and output digest value. 65 | * 66 | * @param context hash function context 67 | * @param digest buffer where output digest value is stored 68 | */ 69 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest); 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /* AVUTIL_SHA512_H */ 76 | -------------------------------------------------------------------------------- /ffm_inc/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 | #endif /* AVUTIL_STEREO3D_H */ 153 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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_recv() will 73 | * return it immediately when there are no longer available messages. 74 | * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used 75 | * to cause the receiving thread to stop or 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_send() will 84 | * return it immediately. Conventional values, such as AVERROR_EOF or 85 | * AVERROR(EAGAIN), can be used to cause the sending thread to stop or 86 | * suspend its operation. 87 | */ 88 | void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, 89 | int err); 90 | 91 | #endif /* AVUTIL_THREADMESSAGE_H */ 92 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | -------------------------------------------------------------------------------- /ffm_inc/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 | #ifndef AVUTIL_VERSION_H 22 | #define AVUTIL_VERSION_H 23 | 24 | #include "macros.h" 25 | 26 | /** 27 | * @addtogroup version_utils 28 | * 29 | * Useful to check and match library version in order to maintain 30 | * backward compatibility. 31 | * 32 | * @{ 33 | */ 34 | 35 | #define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c)) 36 | #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c 37 | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | /** 44 | * @file 45 | * @ingroup lavu 46 | * Libavutil version macros 47 | */ 48 | 49 | /** 50 | * @defgroup lavu_ver Version and Build diagnostics 51 | * 52 | * Macros and function useful to check at compiletime and at runtime 53 | * which version of libavutil is in use. 54 | * 55 | * @{ 56 | */ 57 | 58 | #define LIBAVUTIL_VERSION_MAJOR 54 59 | #define LIBAVUTIL_VERSION_MINOR 31 60 | #define LIBAVUTIL_VERSION_MICRO 100 61 | 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ 63 | LIBAVUTIL_VERSION_MINOR, \ 64 | LIBAVUTIL_VERSION_MICRO) 65 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ 66 | LIBAVUTIL_VERSION_MINOR, \ 67 | LIBAVUTIL_VERSION_MICRO) 68 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT 69 | 70 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) 71 | 72 | /** 73 | * @} 74 | * 75 | * @defgroup depr_guards Deprecation guards 76 | * FF_API_* defines may be placed below to indicate public API that will be 77 | * dropped at a future version bump. The defines themselves are not part of 78 | * the public API and may change, break or disappear at any time. 79 | * 80 | * @note, when bumping the major version it is recommended to manually 81 | * disable each FF_API_* in its own commit instead of disabling them all 82 | * at once through the bump. This improves the git bisect-ability of the change. 83 | * 84 | * @{ 85 | */ 86 | 87 | #ifndef FF_API_OLD_AVOPTIONS 88 | #define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 55) 89 | #endif 90 | #ifndef FF_API_PIX_FMT 91 | #define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 55) 92 | #endif 93 | #ifndef FF_API_CONTEXT_SIZE 94 | #define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 55) 95 | #endif 96 | #ifndef FF_API_PIX_FMT_DESC 97 | #define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 55) 98 | #endif 99 | #ifndef FF_API_AV_REVERSE 100 | #define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 55) 101 | #endif 102 | #ifndef FF_API_AUDIOCONVERT 103 | #define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 55) 104 | #endif 105 | #ifndef FF_API_CPU_FLAG_MMX2 106 | #define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 55) 107 | #endif 108 | #ifndef FF_API_LLS_PRIVATE 109 | #define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 55) 110 | #endif 111 | #ifndef FF_API_AVFRAME_LAVC 112 | #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55) 113 | #endif 114 | #ifndef FF_API_VDPAU 115 | #define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 55) 116 | #endif 117 | #ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT 118 | #define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 55) 119 | #endif 120 | #ifndef FF_API_XVMC 121 | #define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 55) 122 | #endif 123 | #ifndef FF_API_OPT_TYPE_METADATA 124 | #define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55) 125 | #endif 126 | #ifndef FF_API_DLOG 127 | #define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55) 128 | #endif 129 | #ifndef FF_API_HMAC 130 | #define FF_API_HMAC (LIBAVUTIL_VERSION_MAJOR < 55) 131 | #endif 132 | #ifndef FF_API_VAAPI 133 | #define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56) 134 | #endif 135 | 136 | #ifndef FF_CONST_AVUTIL55 137 | #if LIBAVUTIL_VERSION_MAJOR >= 55 138 | #define FF_CONST_AVUTIL55 const 139 | #else 140 | #define FF_CONST_AVUTIL55 141 | #endif 142 | #endif 143 | 144 | /** 145 | * @} 146 | */ 147 | 148 | #endif /* AVUTIL_VERSION_H */ 149 | 150 | -------------------------------------------------------------------------------- /ffm_inc/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 | #include "version.h" 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil XTEA algorithm 31 | * @defgroup lavu_xtea XTEA 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | typedef struct AVXTEA { 37 | uint32_t key[16]; 38 | } AVXTEA; 39 | 40 | /** 41 | * Allocate an AVXTEA context. 42 | */ 43 | AVXTEA *av_xtea_alloc(void); 44 | 45 | /** 46 | * Initialize an AVXTEA context. 47 | * 48 | * @param ctx an AVXTEA context 49 | * @param key a key of 16 bytes used for encryption/decryption 50 | */ 51 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); 52 | 53 | /** 54 | * Encrypt or decrypt a buffer using a previously initialized context. 55 | * 56 | * @param ctx an AVXTEA context 57 | * @param dst destination array, can be equal to src 58 | * @param src source array, can be equal to dst 59 | * @param count number of 8 byte blocks 60 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 61 | * @param decrypt 0 for encryption, 1 for decryption 62 | */ 63 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 64 | int count, uint8_t *iv, int decrypt); 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | #endif /* AVUTIL_XTEA_H */ 71 | -------------------------------------------------------------------------------- /ffm_lib/libavahi-client.so.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-client.so.3 -------------------------------------------------------------------------------- /ffm_lib/libavahi-client.so.3.2.9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-client.so.3.2.9 -------------------------------------------------------------------------------- /ffm_lib/libavahi-common.so.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-common.so.3 -------------------------------------------------------------------------------- /ffm_lib/libavahi-common.so.3.5.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-common.so.3.5.3 -------------------------------------------------------------------------------- /ffm_lib/libavahi-core.so.7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-core.so.7 -------------------------------------------------------------------------------- /ffm_lib/libavahi-core.so.7.0.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-core.so.7.0.2 -------------------------------------------------------------------------------- /ffm_lib/libavahi-glib.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-glib.so.1 -------------------------------------------------------------------------------- /ffm_lib/libavahi-glib.so.1.0.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavahi-glib.so.1.0.2 -------------------------------------------------------------------------------- /ffm_lib/libavc1394.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavc1394.so.0 -------------------------------------------------------------------------------- /ffm_lib/libavc1394.so.0.3.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavc1394.so.0.3.0 -------------------------------------------------------------------------------- /ffm_lib/libavcodec-ffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavcodec-ffmpeg.so -------------------------------------------------------------------------------- /ffm_lib/libavcodec-ffmpeg.so.56: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavcodec-ffmpeg.so.56 -------------------------------------------------------------------------------- /ffm_lib/libavcodec-ffmpeg.so.56.60.100: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavcodec-ffmpeg.so.56.60.100 -------------------------------------------------------------------------------- /ffm_lib/libavcodec.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavcodec.so -------------------------------------------------------------------------------- /ffm_lib/libavformat-ffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavformat-ffmpeg.so -------------------------------------------------------------------------------- /ffm_lib/libavformat-ffmpeg.so.56: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavformat-ffmpeg.so.56 -------------------------------------------------------------------------------- /ffm_lib/libavformat-ffmpeg.so.56.40.101: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavformat-ffmpeg.so.56.40.101 -------------------------------------------------------------------------------- /ffm_lib/libavformat.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavformat.so -------------------------------------------------------------------------------- /ffm_lib/libavutil-ffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavutil-ffmpeg.so -------------------------------------------------------------------------------- /ffm_lib/libavutil-ffmpeg.so.54: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavutil-ffmpeg.so.54 -------------------------------------------------------------------------------- /ffm_lib/libavutil-ffmpeg.so.54.31.100: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavutil-ffmpeg.so.54.31.100 -------------------------------------------------------------------------------- /ffm_lib/libavutil.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/ffm_lib/libavutil.so -------------------------------------------------------------------------------- /firefly_mpplib/libhal_dummy.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/libhal_dummy.a -------------------------------------------------------------------------------- /firefly_mpplib/libosal.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/libosal.a -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_mpp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_mpp.so -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_mpp.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_mpp.so.0 -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_mpp.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_mpp.so.1 -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_mpp_static.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_mpp_static.a -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_vpu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_vpu.so -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_vpu.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_vpu.so.0 -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_vpu.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_vpu.so.1 -------------------------------------------------------------------------------- /firefly_mpplib/librockchip_vpu_static.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/librockchip_vpu_static.a -------------------------------------------------------------------------------- /firefly_mpplib/libutils.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/firefly_mpplib/libutils.a -------------------------------------------------------------------------------- /rockchip/mpi_enc_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPI_ENC_UTILS_H__ 18 | #define __MPI_ENC_UTILS_H__ 19 | 20 | #include 21 | 22 | #include "rk_venc_cmd.h" 23 | 24 | typedef struct MpiEncTestArgs_t { 25 | char *file_input; 26 | char *file_output; 27 | MppCodingType type; 28 | MppFrameFormat format; 29 | RK_S32 num_frames; 30 | RK_S32 loop_cnt; 31 | 32 | RK_S32 width; 33 | RK_S32 height; 34 | RK_S32 hor_stride; 35 | RK_S32 ver_stride; 36 | 37 | RK_S32 bps_target; 38 | RK_S32 fps_in_flex; 39 | RK_S32 fps_in_num; 40 | RK_S32 fps_in_den; 41 | RK_S32 fps_out_flex; 42 | RK_S32 fps_out_num; 43 | RK_S32 fps_out_den; 44 | 45 | RK_S32 gop_mode; 46 | 47 | MppEncHeaderMode header_mode; 48 | 49 | MppEncSliceSplit split; 50 | } MpiEncTestArgs; 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | MPP_RET mpi_enc_gen_gop_ref(MppEncGopRef *ref, RK_S32 gop_mode); 57 | MPP_RET mpi_enc_gen_osd_data(MppEncOSDData *osd_data, MppBuffer osd_buf, RK_U32 frame_cnt); 58 | MPP_RET mpi_enc_gen_osd_plt(MppEncOSDPlt *osd_plt, RK_U32 *table); 59 | 60 | MpiEncTestArgs *mpi_enc_test_cmd_get(void); 61 | MPP_RET mpi_enc_test_cmd_update_by_args(MpiEncTestArgs* cmd, int argc, char **argv); 62 | MPP_RET mpi_enc_test_cmd_put(MpiEncTestArgs* cmd); 63 | 64 | MPP_RET mpi_enc_test_cmd_show_opt(MpiEncTestArgs* cmd); 65 | void mpi_enc_test_help(void); 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /*__MPI_ENC_UTILS_H__*/ 72 | -------------------------------------------------------------------------------- /rockchip/mpi_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPI_IMPL_H__ 18 | #define __MPI_IMPL_H__ 19 | 20 | #include "mpp.h" 21 | 22 | #define MPI_DBG_FUNCTION (0x00000001) 23 | 24 | #define mpi_dbg(flag, fmt, ...) _mpp_dbg(mpi_debug, flag, fmt, ## __VA_ARGS__) 25 | #define mpi_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpi_debug, flag, fmt, ## __VA_ARGS__) 26 | 27 | #define mpi_dbg_func(fmt, ...) mpi_dbg_f(MPI_DBG_FUNCTION, fmt, ## __VA_ARGS__) 28 | 29 | typedef struct MpiImpl_t MpiImpl; 30 | 31 | struct MpiImpl_t { 32 | MpiImpl *check; 33 | MppCtxType type; 34 | MppCodingType coding; 35 | 36 | MppApi *api; 37 | Mpp *ctx; 38 | }; 39 | 40 | extern RK_U32 mpi_debug; 41 | 42 | #endif /*__MPI_IMPL_H__*/ 43 | -------------------------------------------------------------------------------- /rockchip/mpp_2str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2015 Rockchip Electronics Co. LTD 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef __MPP_2STR_H__ 19 | #define __MPP_2STR_H__ 20 | 21 | #include "rk_type.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | const char *strof_ctx_type(MppCtxType type); 28 | const char *strof_coding_type(MppCodingType coding); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /rockchip/mpp_allocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_ALLOCATOR_H__ 18 | #define __MPP_ALLOCATOR_H__ 19 | 20 | #include "rk_type.h" 21 | #include "mpp_buffer.h" 22 | 23 | typedef void *MppAllocator; 24 | 25 | typedef struct MppAllocatorCfg_t { 26 | // input 27 | size_t alignment; 28 | RK_U32 flags; 29 | } MppAllocatorCfg; 30 | 31 | typedef struct MppAllocatorApi_t { 32 | RK_U32 size; 33 | RK_U32 version; 34 | 35 | MPP_RET (*alloc)(MppAllocator allocator, MppBufferInfo *data); 36 | MPP_RET (*free)(MppAllocator allocator, MppBufferInfo *data); 37 | MPP_RET (*import)(MppAllocator allocator, MppBufferInfo *data); 38 | MPP_RET (*release)(MppAllocator allocator, MppBufferInfo *data); 39 | MPP_RET (*mmap)(MppAllocator allocator, MppBufferInfo *data); 40 | } MppAllocatorApi; 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | MPP_RET mpp_allocator_get(MppAllocator *allocator, 47 | MppAllocatorApi **api, MppBufferType type); 48 | MPP_RET mpp_allocator_put(MppAllocator *allocator); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /*__MPP_ALLOCATOR_H__*/ 55 | 56 | -------------------------------------------------------------------------------- /rockchip/mpp_bitput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2015 Rockchip Electronics Co. LTD 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef __MPP_BITPUT_H__ 19 | #define __MPP_BITPUT_H__ 20 | 21 | #include 22 | #include 23 | 24 | #include "rk_type.h" 25 | #include "mpp_log.h" 26 | #include "mpp_common.h" 27 | #include "mpp_err.h" 28 | 29 | typedef struct bitput_ctx_t { 30 | RK_U32 buflen; //!< max buf length, 64bit uint 31 | RK_U32 index; //!< current uint position 32 | RK_U64 *pbuf; //!< outpacket data 33 | RK_U64 bvalue; //!< buffer value, 64 bit 34 | RK_U8 bitpos; //!< bit pos in 64bit 35 | RK_U32 size; //!< data size,except header 36 | } BitputCtx_t; 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | RK_S32 mpp_set_bitput_ctx(BitputCtx_t *bp, RK_U64 *data, RK_U32 len); 43 | void mpp_put_bits(BitputCtx_t *bp, RK_U64 invalue, RK_S32 lbits); 44 | void mpp_put_align(BitputCtx_t *bp, RK_S32 align_bits, int flag); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /rockchip/mpp_bitwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 - 2017 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_BITWRITER_H__ 18 | #define __MPP_BITWRITER_H__ 19 | 20 | #include "rk_type.h" 21 | #include "mpp_err.h" 22 | 23 | /* 24 | * Mpp bitstream writer for H.264/H.265 25 | */ 26 | typedef struct MppWriteCtx_t { 27 | RK_U8 *buffer; /* point to first byte of stream */ 28 | RK_U8 *stream; /* Pointer to next byte of stream */ 29 | RK_U32 size; /* Byte size of stream buffer */ 30 | RK_U32 byte_cnt; /* Byte counter */ 31 | RK_U32 byte_buffer; /* Byte buffer */ 32 | RK_U32 buffered_bits; /* Amount of bits in byte buffer, [0-7] */ 33 | RK_U32 zero_bytes; /* Amount of consecutive zero bytes */ 34 | RK_S32 overflow; /* This will signal a buffer overflow */ 35 | RK_U32 emul_cnt; /* Counter for emulation_3_byte, needed in SEI */ 36 | } MppWriteCtx; 37 | 38 | MPP_RET mpp_writer_init(MppWriteCtx *ctx, void *p, RK_S32 size); 39 | MPP_RET mpp_writer_reset(MppWriteCtx *ctx); 40 | 41 | /* check overflow status */ 42 | MPP_RET mpp_writer_status(MppWriteCtx *ctx); 43 | 44 | /* write raw bit without emulation prevention 0x03 byte */ 45 | void mpp_writer_put_raw_bits(MppWriteCtx *ctx, RK_S32 val, RK_S32 len); 46 | 47 | /* write bit with emulation prevention 0x03 byte */ 48 | void mpp_writer_put_bits(MppWriteCtx *ctx, RK_S32 val, RK_S32 len); 49 | 50 | /* insert zero bits until byte-aligned */ 51 | void mpp_writer_align_zero(MppWriteCtx *ctx); 52 | 53 | /* insert one bits until byte-aligned */ 54 | void mpp_writer_align_one(MppWriteCtx *ctx); 55 | 56 | /* insert one bit then pad to byte-align with zero */ 57 | void mpp_writer_trailing(MppWriteCtx * ctx); 58 | 59 | void mpp_writer_put_ue(MppWriteCtx *ctx, RK_U32 val); 60 | void mpp_writer_put_se(MppWriteCtx *ctx, RK_S32 val); 61 | 62 | RK_S32 mpp_writer_bytes(MppWriteCtx *ctx); 63 | RK_S32 mpp_writer_bits(MppWriteCtx *ctx); 64 | 65 | RK_S32 mpp_exp_golomb_signed(RK_S32 val); 66 | 67 | #endif /* __MPP_BITWRITER_H__ */ 68 | -------------------------------------------------------------------------------- /rockchip/mpp_enc_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_ENC_CFG_H__ 18 | #define __MPP_ENC_CFG_H__ 19 | 20 | #include "rk_venc_cmd.h" 21 | #include "rc_data.h" 22 | 23 | /* 24 | * MppEncCfgSet shows the relationship between different configuration 25 | * Due to the huge amount of configurable parameters we need to setup 26 | * only minimum amount of necessary parameters. 27 | * 28 | * For normal user rc and prep config are enough. 29 | */ 30 | typedef struct MppEncCfgSet_t { 31 | // esential config 32 | MppEncPrepCfg prep; 33 | MppEncRcCfg rc; 34 | 35 | // codec detail config 36 | MppEncCodecCfg codec; 37 | 38 | MppEncSliceSplit split; 39 | MppEncGopRef gop_ref; 40 | MppEncROICfg roi; 41 | MppEncOSDPltCfg plt_cfg; 42 | MppEncOSDPlt plt_data; 43 | } MppEncCfgSet; 44 | 45 | #endif /*__MPP_ENC_H__*/ 46 | -------------------------------------------------------------------------------- /rockchip/mpp_env.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_ENV_H__ 18 | #define __MPP_ENV_H__ 19 | 20 | #include "rk_type.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | RK_S32 mpp_env_get_u32(const char *name, RK_U32 *value, RK_U32 default_value); 27 | RK_S32 mpp_env_get_str(const char *name, const char **value, const char *default_value); 28 | 29 | RK_S32 mpp_env_set_u32(const char *name, RK_U32 value); 30 | RK_S32 mpp_env_set_str(const char *name, char *value); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /*__MPP_ENV_H__*/ 37 | 38 | -------------------------------------------------------------------------------- /rockchip/mpp_err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_ERR_H__ 18 | #define __MPP_ERR_H__ 19 | 20 | #define RK_OK 0 21 | #define RK_SUCCESS 0 22 | 23 | typedef enum { 24 | MPP_SUCCESS = RK_SUCCESS, 25 | MPP_OK = RK_OK, 26 | 27 | MPP_NOK = -1, 28 | MPP_ERR_UNKNOW = -2, 29 | MPP_ERR_NULL_PTR = -3, 30 | MPP_ERR_MALLOC = -4, 31 | MPP_ERR_OPEN_FILE = -5, 32 | MPP_ERR_VALUE = -6, 33 | MPP_ERR_READ_BIT = -7, 34 | MPP_ERR_TIMEOUT = -8, 35 | MPP_ERR_PERM = -9, 36 | 37 | MPP_ERR_BASE = -1000, 38 | 39 | /* The error in stream processing */ 40 | MPP_ERR_LIST_STREAM = MPP_ERR_BASE - 1, 41 | MPP_ERR_INIT = MPP_ERR_BASE - 2, 42 | MPP_ERR_VPU_CODEC_INIT = MPP_ERR_BASE - 3, 43 | MPP_ERR_STREAM = MPP_ERR_BASE - 4, 44 | MPP_ERR_FATAL_THREAD = MPP_ERR_BASE - 5, 45 | MPP_ERR_NOMEM = MPP_ERR_BASE - 6, 46 | MPP_ERR_PROTOL = MPP_ERR_BASE - 7, 47 | MPP_FAIL_SPLIT_FRAME = MPP_ERR_BASE - 8, 48 | MPP_ERR_VPUHW = MPP_ERR_BASE - 9, 49 | MPP_EOS_STREAM_REACHED = MPP_ERR_BASE - 11, 50 | MPP_ERR_BUFFER_FULL = MPP_ERR_BASE - 12, 51 | MPP_ERR_DISPLAY_FULL = MPP_ERR_BASE - 13, 52 | } MPP_RET; 53 | 54 | #endif /*__MPP_ERR_H__*/ 55 | -------------------------------------------------------------------------------- /rockchip/mpp_frame_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_FRAME_IMPL_H__ 18 | #define __MPP_FRAME_IMPL_H__ 19 | 20 | #include "mpp_frame.h" 21 | 22 | typedef struct MppFrameImpl_t MppFrameImpl; 23 | 24 | struct MppFrameImpl_t { 25 | const char *name; 26 | 27 | /* 28 | * dimension parameter for display 29 | */ 30 | RK_U32 width; 31 | RK_U32 height; 32 | RK_U32 hor_stride; 33 | RK_U32 ver_stride; 34 | 35 | /* 36 | * interlaced related mode status 37 | * 38 | * 0 - frame 39 | * 1 - top field 40 | * 2 - bottom field 41 | * 3 - paired top and bottom field 42 | * 4 - deinterlaced flag 43 | * 7 - deinterlaced paired field 44 | */ 45 | RK_U32 mode; 46 | /* 47 | * current decoded frame whether to display 48 | * 49 | * 0 - reserve 50 | * 1 - discard 51 | */ 52 | RK_U32 discard; 53 | /* 54 | * send decoded frame belong which view 55 | */ 56 | RK_U32 viewid; 57 | /* 58 | * poc - picture order count 59 | */ 60 | RK_U32 poc; 61 | /* 62 | * pts - display time stamp 63 | * dts - decode time stamp 64 | */ 65 | RK_S64 pts; 66 | RK_S64 dts; 67 | 68 | /* 69 | * eos - end of stream 70 | * info_change - set when buffer resized or frame infomation changed 71 | */ 72 | RK_U32 eos; 73 | RK_U32 info_change; 74 | RK_U32 errinfo; 75 | MppFrameColorRange color_range; 76 | MppFrameColorPrimaries color_primaries; 77 | MppFrameColorTransferCharacteristic color_trc; 78 | 79 | /** 80 | * YUV colorspace type. 81 | * It must be accessed using av_frame_get_colorspace() and 82 | * av_frame_set_colorspace(). 83 | * - encoding: Set by user 84 | * - decoding: Set by libavcodec 85 | */ 86 | MppFrameColorSpace colorspace; 87 | MppFrameChromaLocation chroma_location; 88 | 89 | MppFrameFormat fmt; 90 | 91 | MppFrameRational sar; 92 | MppFrameMasteringDisplayMetadata mastering_display; 93 | MppFrameContentLightMetadata content_light; 94 | 95 | /* 96 | * buffer information 97 | * NOTE: buf_size only access internally 98 | */ 99 | MppBuffer buffer; 100 | size_t buf_size; 101 | 102 | /* 103 | * meta data information 104 | */ 105 | MppMeta meta; 106 | 107 | /* 108 | * frame buffer compression (FBC) information 109 | * 110 | * NOTE: some constraint on fbc data 111 | * 1. FBC config need two addresses but only one buffer. 112 | * The second address should be represented by base + offset form. 113 | * 2. FBC has header address and payload address 114 | * Both addresses should be 4K aligned. 115 | * 3. The header section size is default defined by: 116 | * header size = aligned(aligned(width, 16) * aligned(height, 16) / 16, 4096) 117 | * 4. The stride in header section is defined by: 118 | * stride = aligned(width, 16) 119 | */ 120 | RK_U32 fbc_offset; 121 | 122 | /* 123 | * pointer for multiple frame output at one time 124 | */ 125 | MppFrameImpl *next; 126 | }; 127 | 128 | #ifdef __cplusplus 129 | extern "C" { 130 | #endif 131 | 132 | MPP_RET mpp_frame_set_next(MppFrame frame, MppFrame next); 133 | MPP_RET mpp_frame_copy(MppFrame frame, MppFrame next); 134 | MPP_RET mpp_frame_info_cmp(MppFrame frame0, MppFrame frame1); 135 | RK_U32 mpp_frame_get_fbc_offset(MppFrame frame); 136 | RK_U32 mpp_frame_get_fbc_stride(MppFrame frame); 137 | 138 | MPP_RET check_is_mpp_frame(void *pointer); 139 | 140 | #ifdef __cplusplus 141 | } 142 | #endif 143 | 144 | #endif /*__MPP_FRAME_IMPL_H__*/ 145 | -------------------------------------------------------------------------------- /rockchip/mpp_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2015 Rockchip Electronics Co. LTD 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef __MPP_IMPL_H__ 19 | #define __MPP_IMPL_H__ 20 | 21 | #include "rk_type.h" 22 | #include "mpp_err.h" 23 | 24 | typedef void* MppDump; 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | MPP_RET mpp_dump_init(MppDump *info); 31 | MPP_RET mpp_dump_deinit(MppDump *info); 32 | 33 | MPP_RET mpp_ops_init(MppDump info, MppCtxType type, MppCodingType coding); 34 | 35 | MPP_RET mpp_ops_dec_put_pkt(MppDump info, MppPacket pkt); 36 | MPP_RET mpp_ops_dec_get_frm(MppDump info, MppFrame frame); 37 | MPP_RET mpp_ops_enc_put_frm(MppDump info, MppFrame frame); 38 | MPP_RET mpp_ops_enc_get_pkt(MppDump info, MppPacket pkt); 39 | 40 | MPP_RET mpp_ops_ctrl(MppDump info, MpiCmd cmd); 41 | MPP_RET mpp_ops_reset(MppDump info); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /rockchip/mpp_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_INFO_H__ 18 | #define __MPP_INFO_H__ 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif /* __cplusplus */ 23 | 24 | void show_mpp_version(void); 25 | const char *get_mpp_version(void); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif /*__MPP_INFO_H__*/ 32 | -------------------------------------------------------------------------------- /rockchip/mpp_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_LOG_H__ 18 | #define __MPP_LOG_H__ 19 | 20 | #include 21 | #include 22 | 23 | #include "rk_type.h" 24 | 25 | /* 26 | * mpp runtime log system usage: 27 | * mpp_err is for error status message, it will print for sure. 28 | * mpp_log is for important message like open/close/reset/flush, it will print too. 29 | * mpp_dbg is for all optional message. it can be controlled by debug and flag. 30 | */ 31 | 32 | #define mpp_log(fmt, ...) _mpp_log(MODULE_TAG, fmt, NULL, ## __VA_ARGS__) 33 | #define mpp_err(fmt, ...) _mpp_err(MODULE_TAG, fmt, NULL, ## __VA_ARGS__) 34 | 35 | #define _mpp_dbg(debug, flag, fmt, ...) \ 36 | do { \ 37 | if (debug & flag) \ 38 | mpp_log(fmt, ## __VA_ARGS__); \ 39 | } while (0) 40 | 41 | #define mpp_dbg(flag, fmt, ...) _mpp_dbg(mpp_debug, flag, fmt, ## __VA_ARGS__) 42 | 43 | /* 44 | * _f function will add function name to the log 45 | */ 46 | #define mpp_log_f(fmt, ...) _mpp_log(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) 47 | #define mpp_err_f(fmt, ...) _mpp_err(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) 48 | #define _mpp_dbg_f(debug, flag, fmt, ...) \ 49 | do { \ 50 | if (debug & flag) \ 51 | mpp_log_f(fmt, ## __VA_ARGS__); \ 52 | } while (0) 53 | 54 | #define mpp_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_debug, flag, fmt, ## __VA_ARGS__) 55 | 56 | 57 | #define MPP_DBG_TIMING (0x00000001) 58 | #define MPP_DBG_PTS (0x00000002) 59 | #define MPP_DBG_INFO (0x00000004) 60 | #define MPP_DBG_PLATFORM (0x00000010) 61 | 62 | #define MPP_DBG_DUMP_LOG (0x00000100) 63 | #define MPP_DBG_DUMP_IN (0x00000200) 64 | #define MPP_DBG_DUMP_OUT (0x00000400) 65 | #define MPP_DBG_DUMP_CFG (0x00000800) 66 | 67 | #define MPP_ABORT (0x10000000) 68 | 69 | /* 70 | * mpp_dbg usage: 71 | * 72 | * in h264d module define module debug flag variable like: h265d_debug 73 | * then define h265d_dbg macro as follow : 74 | * 75 | * extern RK_U32 h265d_debug; 76 | * 77 | * #define H265D_DBG_FUNCTION (0x00000001) 78 | * #define H265D_DBG_VPS (0x00000002) 79 | * #define H265D_DBG_SPS (0x00000004) 80 | * #define H265D_DBG_PPS (0x00000008) 81 | * #define H265D_DBG_SLICE_HDR (0x00000010) 82 | * 83 | * #define h265d_dbg(flag, fmt, ...) mpp_dbg(h265d_debug, flag, fmt, ## __VA_ARGS__) 84 | * 85 | * finally use environment control the debug flag 86 | * 87 | * mpp_get_env_u32("h264d_debug", &h265d_debug, 0) 88 | * 89 | */ 90 | /* 91 | * sub-module debug flag usage example: 92 | * +------+-------------------+ 93 | * | 8bit | 24bit | 94 | * +------+-------------------+ 95 | * 0~15 bit: software debug print 96 | * 16~23 bit: hardware debug print 97 | * 24~31 bit: information print format 98 | */ 99 | 100 | #define mpp_abort() do { \ 101 | if (mpp_debug & MPP_ABORT) { \ 102 | abort(); \ 103 | } \ 104 | } while (0) 105 | 106 | #define MPP_STRINGS(x) MPP_TO_STRING(x) 107 | #define MPP_TO_STRING(x) #x 108 | 109 | #define mpp_assert(cond) do { \ 110 | if (!(cond)) { \ 111 | mpp_err("Assertion %s failed at %s:%d\n", \ 112 | MPP_STRINGS(cond), __FUNCTION__, __LINE__); \ 113 | mpp_abort(); \ 114 | } \ 115 | } while (0) 116 | 117 | 118 | #ifdef __cplusplus 119 | extern "C" { 120 | #endif 121 | 122 | extern RK_U32 mpp_debug; 123 | 124 | void mpp_log_set_flag(RK_U32 flag); 125 | RK_U32 mpp_log_get_flag(void); 126 | 127 | void _mpp_log(const char *tag, const char *fmt, const char *func, ...); 128 | void _mpp_err(const char *tag, const char *fmt, const char *func, ...); 129 | 130 | #ifdef __cplusplus 131 | } 132 | #endif 133 | 134 | #endif /*__MPP_LOG_H__*/ 135 | -------------------------------------------------------------------------------- /rockchip/mpp_mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_MEM_H__ 18 | #define __MPP_MEM_H__ 19 | 20 | #include 21 | 22 | #include "rk_type.h" 23 | #include "mpp_err.h" 24 | 25 | #define mpp_malloc_with_caller(type, count, caller) \ 26 | (type*)mpp_osal_malloc(caller, sizeof(type) * (count)) 27 | 28 | #define mpp_malloc(type, count) \ 29 | (type*)mpp_osal_malloc(__FUNCTION__, sizeof(type) * (count)) 30 | 31 | #define mpp_malloc_size(type, size) \ 32 | (type*)mpp_osal_malloc(__FUNCTION__, size) 33 | 34 | #define mpp_calloc_size(type, size) \ 35 | (type*)mpp_osal_calloc(__FUNCTION__, size) 36 | 37 | #define mpp_calloc(type, count) \ 38 | (type*)mpp_osal_calloc(__FUNCTION__, sizeof(type) * (count)) 39 | 40 | #define mpp_realloc(ptr, type, count) \ 41 | (type*)mpp_osal_realloc(__FUNCTION__, ptr, sizeof(type) * (count)) 42 | 43 | #define mpp_free(ptr) \ 44 | mpp_osal_free(__FUNCTION__, ptr) 45 | 46 | #define MPP_FREE(ptr) do { if(ptr) mpp_free(ptr); ptr = NULL; } while (0) 47 | #define MPP_FCLOSE(fp) do { if(fp) fclose(fp); fp = NULL; } while (0) 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | void *mpp_osal_malloc(const char *caller, size_t size); 54 | void *mpp_osal_calloc(const char *caller, size_t size); 55 | void *mpp_osal_realloc(const char *caller, void *ptr, size_t size); 56 | void mpp_osal_free(const char *caller, void *ptr); 57 | 58 | void mpp_show_mem_status(); 59 | 60 | /* 61 | * mpp memory usage snapshot tool 62 | * 63 | * usage: 64 | * call mpp_mem_get_snapshot on context init get one snapshot 65 | * call mpp_mem_get_snapshot on context deinit get another snapshot 66 | * call mpp_mem_diff_snapshot to show the difference between these two snapshot 67 | * call mpp_mem_put_snapshot twice to release these two snapshot 68 | */ 69 | typedef void* MppMemSnapshot; 70 | 71 | MPP_RET mpp_mem_get_snapshot(MppMemSnapshot *hnd); 72 | MPP_RET mpp_mem_put_snapshot(MppMemSnapshot *hnd); 73 | MPP_RET mpp_mem_squash_snapshot(MppMemSnapshot hnd0, MppMemSnapshot hnd1); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /*__MPP_MEM_H__*/ 80 | 81 | -------------------------------------------------------------------------------- /rockchip/mpp_meta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_META_H__ 18 | #define __MPP_META_H__ 19 | 20 | #include 21 | #include "rk_type.h" 22 | 23 | #define FOURCC_META(a, b, c, d) ((RK_U32)(a) << 24 | \ 24 | ((RK_U32)(b) << 16) | \ 25 | ((RK_U32)(c) << 8) | \ 26 | ((RK_U32)(d) << 0)) 27 | 28 | /* 29 | * Mpp Metadata definition 30 | * 31 | * Metadata is for information transmision in mpp. 32 | * Mpp task will contain two meta data: 33 | * 34 | * 1. Data flow metadata 35 | * This metadata contains information of input / output data flow. For example 36 | * A. decoder input side task the input packet must be defined and output frame 37 | * may not be defined. Then decoder will try malloc or use committed buffer to 38 | * complete decoding. 39 | * B. decoder output side task 40 | * 41 | * 42 | * 2. Flow control metadata 43 | * 44 | */ 45 | typedef enum MppMetaDataType_e { 46 | /* 47 | * mpp meta data of data flow 48 | * reference counter will be used for these meta data type 49 | */ 50 | TYPE_FRAME = FOURCC_META('m', 'f', 'r', 'm'), 51 | TYPE_PACKET = FOURCC_META('m', 'p', 'k', 't'), 52 | TYPE_BUFFER = FOURCC_META('m', 'b', 'u', 'f'), 53 | 54 | /* mpp meta data of normal data type */ 55 | TYPE_S32 = FOURCC_META('s', '3', '2', ' '), 56 | TYPE_S64 = FOURCC_META('s', '6', '4', ' '), 57 | TYPE_PTR = FOURCC_META('p', 't', 'r', ' '), 58 | } MppMetaType; 59 | 60 | typedef enum MppMetaKey_e { 61 | /* data flow key */ 62 | KEY_INPUT_FRAME = FOURCC_META('i', 'f', 'r', 'm'), 63 | KEY_INPUT_PACKET = FOURCC_META('i', 'p', 'k', 't'), 64 | KEY_OUTPUT_FRAME = FOURCC_META('o', 'f', 'r', 'm'), 65 | KEY_OUTPUT_PACKET = FOURCC_META('o', 'p', 'k', 't'), 66 | /* output motion information for motion detection */ 67 | KEY_MOTION_INFO = FOURCC_META('m', 'v', 'i', 'f'), 68 | KEY_HDR_INFO = FOURCC_META('h', 'd', 'r', ' '), 69 | 70 | /* flow control key */ 71 | KEY_INPUT_BLOCK = FOURCC_META('i', 'b', 'l', 'k'), 72 | KEY_OUTPUT_BLOCK = FOURCC_META('o', 'b', 'l', 'k'), 73 | KEY_INPUT_IDR_REQ = FOURCC_META('i', 'i', 'd', 'r'), /* input idr frame request flag */ 74 | KEY_OUTPUT_INTRA = FOURCC_META('o', 'i', 'd', 'r'), /* output intra frame indicator */ 75 | 76 | /* mpp_frame / mpp_packet meta data info key */ 77 | KEY_TEMPORAL_ID = FOURCC_META('t', 'l', 'i', 'd'), 78 | KEY_LONG_REF_IDX = FOURCC_META('l', 't', 'i', 'd'), 79 | KEY_ROI_DATA = FOURCC_META('r', 'o', 'i', ' '), 80 | KEY_OSD_DATA = FOURCC_META('o', 's', 'd', ' '), 81 | KEY_USER_DATA = FOURCC_META('u', 's', 'r', 'd'), 82 | 83 | /* input motion list for smart p rate control */ 84 | KEY_MV_LIST = FOURCC_META('m', 'v', 'l', 't'), 85 | } MppMetaKey; 86 | 87 | #define mpp_meta_get(meta) mpp_meta_get_with_tag(meta, MODULE_TAG, __FUNCTION__) 88 | 89 | #include "mpp_frame.h" 90 | #include "mpp_packet.h" 91 | 92 | #ifdef __cplusplus 93 | extern "C" { 94 | #endif 95 | 96 | MPP_RET mpp_meta_get_with_tag(MppMeta *meta, const char *tag, const char *caller); 97 | MPP_RET mpp_meta_put(MppMeta meta); 98 | RK_S32 mpp_meta_size(MppMeta meta); 99 | 100 | MPP_RET mpp_meta_set_s32(MppMeta meta, MppMetaKey key, RK_S32 val); 101 | MPP_RET mpp_meta_set_s64(MppMeta meta, MppMetaKey key, RK_S64 val); 102 | MPP_RET mpp_meta_set_ptr(MppMeta meta, MppMetaKey key, void *val); 103 | MPP_RET mpp_meta_get_s32(MppMeta meta, MppMetaKey key, RK_S32 *val); 104 | MPP_RET mpp_meta_get_s64(MppMeta meta, MppMetaKey key, RK_S64 *val); 105 | MPP_RET mpp_meta_get_ptr(MppMeta meta, MppMetaKey key, void **val); 106 | 107 | MPP_RET mpp_meta_set_frame (MppMeta meta, MppMetaKey key, MppFrame frame); 108 | MPP_RET mpp_meta_set_packet(MppMeta meta, MppMetaKey key, MppPacket packet); 109 | MPP_RET mpp_meta_set_buffer(MppMeta meta, MppMetaKey key, MppBuffer buffer); 110 | MPP_RET mpp_meta_get_frame (MppMeta meta, MppMetaKey key, MppFrame *frame); 111 | MPP_RET mpp_meta_get_packet(MppMeta meta, MppMetaKey key, MppPacket *packet); 112 | MPP_RET mpp_meta_get_buffer(MppMeta meta, MppMetaKey key, MppBuffer *buffer); 113 | 114 | #ifdef __cplusplus 115 | } 116 | #endif 117 | 118 | #endif /*__MPP_META_H__*/ 119 | -------------------------------------------------------------------------------- /rockchip/mpp_meta_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_META_IMPL_H__ 18 | #define __MPP_META_IMPL_H__ 19 | 20 | #include "mpp_common.h" 21 | 22 | #include "mpp_list.h" 23 | #include "mpp_meta.h" 24 | 25 | typedef struct MppMetaDef_t { 26 | MppMetaKey key; 27 | MppMetaType type; 28 | } MppMetaDef; 29 | 30 | typedef struct MppMetaImpl_t { 31 | char tag[MPP_TAG_SIZE]; 32 | const char *caller; 33 | RK_S32 meta_id; 34 | RK_S32 ref_count; 35 | 36 | struct list_head list_meta; 37 | struct list_head list_node; 38 | RK_S32 node_count; 39 | } MppMetaImpl; 40 | 41 | typedef union MppMetaVal_u { 42 | RK_S32 val_s32; 43 | RK_S64 val_s64; 44 | void *val_ptr; 45 | MppFrame frame; 46 | MppPacket packet; 47 | MppBuffer buffer; 48 | } MppMetaVal; 49 | 50 | typedef struct MppMetaNode_t { 51 | struct list_head list_meta; 52 | struct list_head list_node; 53 | MppMetaImpl *meta; 54 | RK_S32 node_id; 55 | 56 | RK_S32 type_id; 57 | MppMetaVal val; 58 | } MppMetaNode; 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | RK_S32 mpp_meta_size(MppMeta meta); 65 | MPP_RET mpp_meta_inc_ref(MppMeta meta); 66 | MppMetaNode *mpp_meta_next_node(MppMeta meta); 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /*__MPP_META_IMPL_H__*/ 73 | -------------------------------------------------------------------------------- /rockchip/mpp_packet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_PACKET_H__ 18 | #define __MPP_PACKET_H__ 19 | 20 | #include "mpp_meta.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* 27 | * MppPacket interface 28 | * 29 | * mpp_packet_init = mpp_packet_new + mpp_packet_set_data + mpp_packet_set_size 30 | * mpp_packet_copy_init = mpp_packet_init + memcpy 31 | */ 32 | MPP_RET mpp_packet_new(MppPacket *packet); 33 | MPP_RET mpp_packet_init(MppPacket *packet, void *data, size_t size); 34 | MPP_RET mpp_packet_init_with_buffer(MppPacket *packet, MppBuffer buffer); 35 | MPP_RET mpp_packet_copy_init(MppPacket *packet, const MppPacket src); 36 | MPP_RET mpp_packet_deinit(MppPacket *packet); 37 | 38 | /* 39 | * data : ( R/W ) start address of the whole packet memory 40 | * size : ( R/W ) total size of the whole packet memory 41 | * pos : ( R/W ) current access position of the whole packet memory, used for buffer read/write 42 | * length : ( R/W ) the rest length from current position to end of buffer 43 | * NOTE: normally length is updated only by set_pos, 44 | * so set length must be used carefully for special usage 45 | */ 46 | void mpp_packet_set_data(MppPacket packet, void *data); 47 | void mpp_packet_set_size(MppPacket packet, size_t size); 48 | void mpp_packet_set_pos(MppPacket packet, void *pos); 49 | void mpp_packet_set_length(MppPacket packet, size_t size); 50 | 51 | void* mpp_packet_get_data(const MppPacket packet); 52 | void* mpp_packet_get_pos(const MppPacket packet); 53 | size_t mpp_packet_get_size(const MppPacket packet); 54 | size_t mpp_packet_get_length(const MppPacket packet); 55 | 56 | 57 | void mpp_packet_set_pts(MppPacket packet, RK_S64 pts); 58 | RK_S64 mpp_packet_get_pts(const MppPacket packet); 59 | void mpp_packet_set_dts(MppPacket packet, RK_S64 dts); 60 | RK_S64 mpp_packet_get_dts(const MppPacket packet); 61 | 62 | void mpp_packet_set_flag(MppPacket packet, RK_U32 flag); 63 | RK_U32 mpp_packet_get_flag(const MppPacket packet); 64 | 65 | MPP_RET mpp_packet_set_eos(MppPacket packet); 66 | MPP_RET mpp_packet_clr_eos(MppPacket packet); 67 | RK_U32 mpp_packet_get_eos(MppPacket packet); 68 | MPP_RET mpp_packet_set_extra_data(MppPacket packet); 69 | 70 | void mpp_packet_set_buffer(MppPacket packet, MppBuffer buffer); 71 | MppBuffer mpp_packet_get_buffer(const MppPacket packet); 72 | 73 | /* 74 | * data access interface 75 | */ 76 | MPP_RET mpp_packet_read(MppPacket packet, size_t offset, void *data, size_t size); 77 | MPP_RET mpp_packet_write(MppPacket packet, size_t offset, void *data, size_t size); 78 | 79 | /* 80 | * meta data access interface 81 | */ 82 | MppMeta mpp_packet_get_meta(const MppPacket packet); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /*__MPP_PACKET_H__*/ 89 | -------------------------------------------------------------------------------- /rockchip/mpp_packet_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_PACKET_IMPL_H__ 18 | #define __MPP_PACKET_IMPL_H__ 19 | 20 | #include "mpp_meta.h" 21 | 22 | #define MPP_PACKET_FLAG_EOS (0x00000001) 23 | #define MPP_PACKET_FLAG_EXTRA_DATA (0x00000002) 24 | #define MPP_PACKET_FLAG_INTERNAL (0x00000004) 25 | 26 | /* 27 | * mpp_packet_imp structure 28 | * 29 | * data : pointer 30 | * size : total buffer size 31 | * offset : valid data start offset 32 | * length : valid data length 33 | * pts : packet pts 34 | * dts : packet dts 35 | */ 36 | typedef struct MppPacketImpl_t { 37 | const char *name; 38 | 39 | void *data; 40 | void *pos; 41 | size_t size; 42 | size_t length; 43 | 44 | RK_S64 pts; 45 | RK_S64 dts; 46 | 47 | RK_U32 flag; 48 | 49 | MppBuffer buffer; 50 | MppMeta meta; 51 | } MppPacketImpl; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | /* 57 | * mpp_packet_reset is only used internelly and should NOT be used outside 58 | */ 59 | MPP_RET mpp_packet_reset(MppPacketImpl *packet); 60 | MPP_RET mpp_packet_copy(MppPacket dst, MppPacket src); 61 | MPP_RET mpp_packet_append(MppPacket dst, MppPacket src); 62 | 63 | /* pointer check function */ 64 | MPP_RET check_is_mpp_packet(void *ptr); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /*__MPP_PACKET_IMPL_H__*/ 71 | -------------------------------------------------------------------------------- /rockchip/mpp_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_PLATFORM__ 18 | #define __MPP_PLATFORM__ 19 | 20 | #include "rk_type.h" 21 | 22 | /* 23 | * Platform flag detection is for rockchip hardware platform detection 24 | */ 25 | typedef enum MppIoctlVersion_e { 26 | IOCTL_VCODEC_SERVICE, 27 | IOCTL_MPP_SERVICE_V1, 28 | IOCTL_VERSION_BUTT, 29 | } MppIoctlVersion; 30 | 31 | /* 32 | * Platform video codec hardware feature 33 | */ 34 | typedef enum { 35 | VPU_CLIENT_VDPU1 = 0, /* 0x00000001 */ 36 | VPU_CLIENT_VDPU2 = 1, /* 0x00000002 */ 37 | VPU_CLIENT_VDPU1_PP = 2, /* 0x00000004 */ 38 | VPU_CLIENT_VDPU2_PP = 3, /* 0x00000008 */ 39 | 40 | VPU_CLIENT_HEVC_DEC = 8, /* 0x00000100 */ 41 | VPU_CLIENT_RKVDEC = 9, /* 0x00000200 */ 42 | VPU_CLIENT_AVSPLUS_DEC = 12, /* 0x00001000 */ 43 | 44 | VPU_CLIENT_RKVENC = 16, /* 0x00010000 */ 45 | VPU_CLIENT_VEPU1 = 17, /* 0x00020000 */ 46 | VPU_CLIENT_VEPU2 = 18, /* 0x00040000 */ 47 | VPU_CLIENT_VEPU2_LITE = 19, /* 0x00080000 */ 48 | VPU_CLIENT_VEPU22 = 24, /* 0x01000000 */ 49 | VPU_CLIENT_BUTT, 50 | } VPU_CLIENT2_TYPE; 51 | 52 | /* RK combined codec */ 53 | #define HAVE_VDPU1 (1 << VPU_CLIENT_VDPU1) /* 0x00000001 */ 54 | #define HAVE_VDPU2 (1 << VPU_CLIENT_VDPU2) /* 0x00000002 */ 55 | #define HAVE_VDPU1_PP (1 << VPU_CLIENT_VDPU1_PP) /* 0x00000004 */ 56 | #define HAVE_VDPU2_PP (1 << VPU_CLIENT_VDPU2_PP) /* 0x00000008 */ 57 | /* RK standalone decoder */ 58 | #define HAVE_HEVC_DEC (1 << VPU_CLIENT_HEVC_DEC) /* 0x00000100 */ 59 | #define HAVE_RKVDEC (1 << VPU_CLIENT_RKVDEC) /* 0x00000200 */ 60 | #define HAVE_AVSDEC (1 << VPU_CLIENT_AVSPLUS_DEC) /* 0x00001000 */ 61 | /* RK standalone encoder */ 62 | #define HAVE_RKVENC (1 << VPU_CLIENT_RKVENC) /* 0x00010000 */ 63 | #define HAVE_VEPU1 (1 << VPU_CLIENT_VEPU1) /* 0x00020000 */ 64 | #define HAVE_VEPU2 (1 << VPU_CLIENT_VEPU2) /* 0x00040000 */ 65 | #define HAVE_VEPU2_LITE (1 << VPU_CLIENT_VEPU2_LITE) /* 0x00080000 */ 66 | /* External encoder */ 67 | #define HAVE_VEPU22 (1 << VPU_CLIENT_VEPU22) /* 0x01000000 */ 68 | 69 | /* Platform image process hardware feature */ 70 | #define HAVE_IPP (0x00000001) 71 | #define HAVE_RGA (0x00000002) 72 | #define HAVE_RGA2 (0x00000004) 73 | #define HAVE_IEP (0x00000008) 74 | 75 | /* Hal device id */ 76 | typedef enum MppDeviceId_e { 77 | DEV_VDPU, //!< vpu combined decoder 78 | DEV_VEPU, //!< vpu combined encoder 79 | DEV_RKVDEC, //!< rockchip h264 h265 vp9 combined decoder 80 | DEV_RKVENC, //!< rockchip h264 h265 combined encoder 81 | DEV_ID_BUTT, 82 | } MppDeviceId; 83 | 84 | #ifdef __cplusplus 85 | extern "C" { 86 | #endif 87 | 88 | MppIoctlVersion mpp_get_ioctl_version(void); 89 | const char *mpp_get_soc_name(void); 90 | RK_U32 mpp_get_vcodec_type(void); 91 | RK_U32 mpp_get_2d_hw_flag(void); 92 | RK_U32 mpp_refresh_vcodec_type(RK_U32 vcodec_type); 93 | const char *mpp_get_platform_dev_name(MppCtxType type, MppCodingType coding, RK_U32 platform); 94 | const char *mpp_get_vcodec_dev_name(MppCtxType type, MppCodingType coding); 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif /*__MPP_PLATFORM__*/ 101 | 102 | -------------------------------------------------------------------------------- /rockchip/mpp_queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_QUEUE_H__ 18 | #define __MPP_QUEUE_H__ 19 | 20 | #include "mpp_list.h" 21 | 22 | class MppQueue: public mpp_list 23 | { 24 | private: 25 | sem_t mQueuePending; 26 | int mFlushFlag; 27 | public: 28 | MppQueue(node_destructor func); 29 | ~MppQueue(); 30 | RK_S32 push(void *data, RK_S32 size); 31 | RK_S32 pull(void *data, RK_S32 size); 32 | RK_S32 flush(); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /rockchip/mpp_rc_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __RC_DEFS_H__ 18 | #define __RC_DEFS_H__ 19 | 20 | #include "rk_type.h" 21 | 22 | /* 23 | * EncFrmStatus controls record the encoding frame status and also control 24 | * work flow of encoder. It is the communicat channel between encoder implement 25 | * module, rate control module and hardware module. 26 | * 27 | * bit 0 ~ 31 frame status 28 | * 0 ~ 15 current frame status 29 | * 16 ~ 31 reference frame status 30 | * bit 32 ~ 63 encoding flow control 31 | */ 32 | typedef struct EncFrmStatus_t { 33 | /* 34 | * bit 0 ~ 31 frame status 35 | */ 36 | /* 37 | * 0 - inter frame 38 | * 1 - intra frame 39 | */ 40 | RK_U32 is_intra : 1; 41 | 42 | /* 43 | * Valid when is_intra is true 44 | * 0 - normal intra frame 45 | * 1 - IDR frame 46 | */ 47 | RK_U32 is_idr : 1; 48 | 49 | /* 50 | * 0 - mark as reference frame 51 | * 1 - mark as non-refernce frame 52 | */ 53 | RK_U32 is_non_ref : 1; 54 | 55 | /* 56 | * Valid when is_non_ref is false 57 | * 0 - mark as short-term reference frame 58 | * 1 - mark as long-term refernce frame 59 | */ 60 | RK_U32 is_lt_ref : 1; 61 | 62 | RK_U32 reserved0 : 4; 63 | 64 | /* bit 8 - 15 */ 65 | RK_U32 lt_idx : 4; 66 | RK_U32 temporal_id : 4; 67 | 68 | /* distance between current frame and reference frame */ 69 | RK_S32 ref_dist : 16; 70 | 71 | /* 72 | * bit 32 ~ 63 encoder flow control flags 73 | */ 74 | /* 75 | * 0 - normal frame encoding 76 | * 1 - current frame will be dropped 77 | */ 78 | RK_U32 drop : 1; 79 | 80 | /* 81 | * 0 - rate control module does not change frame type parameter 82 | * 1 - rate control module changes frame type parameter reencode is needed 83 | * to reprocess the dpb process. Also this means dpb module will follow 84 | * the frame status parameter provided by rate control module. 85 | */ 86 | RK_U32 re_dpb_proc : 1; 87 | 88 | /* 89 | * 0 - current frame encoding is in normal flow 90 | * 1 - current frame encoding is in reencode flow 91 | */ 92 | RK_U32 reencode : 1; 93 | 94 | /* 95 | * When true current frame size is super large then the frame should be reencoded. 96 | */ 97 | RK_U32 super_frame : 1; 98 | 99 | /* 100 | * When true currnet frame is force to encoded as software skip frame 101 | */ 102 | RK_U32 force_pskip : 1; 103 | RK_U32 reserved1 : 3; 104 | 105 | /* reencode times */ 106 | RK_U32 reencode_times : 8; 107 | 108 | /* sequential index for each frame */ 109 | RK_U32 seq_idx : 16; 110 | } EncFrmStatus; 111 | 112 | /* 113 | * communication channel between rc / hal / hardware 114 | * 115 | * rc -> hal bit_target / bit_max / bit_min 116 | * hal -> hw quality_target / quality_max / quality_min 117 | * hw -> rc / hal bit_real / quality_real / madi / madp 118 | */ 119 | typedef struct EncRcCommonInfo_t { 120 | /* rc to hal */ 121 | RK_S32 bit_target; 122 | RK_S32 bit_max; 123 | RK_S32 bit_min; 124 | 125 | RK_S32 quality_target; 126 | RK_S32 quality_max; 127 | RK_S32 quality_min; 128 | 129 | /* rc from hardware */ 130 | RK_S32 bit_real; 131 | RK_S32 quality_real; 132 | RK_S32 madi; 133 | RK_S32 madp; 134 | 135 | RK_S32 reserve[16]; 136 | } EncRcTaskInfo; 137 | 138 | typedef struct EncRcTask_s { 139 | EncFrmStatus frm; 140 | EncRcTaskInfo info; 141 | MppFrame frame; 142 | } EncRcTask; 143 | 144 | #endif /* __RC_DEFS_H__ */ 145 | -------------------------------------------------------------------------------- /rockchip/mpp_runtime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_RUNTIME__ 18 | #define __MPP_RUNTIME__ 19 | 20 | #include "mpp_buffer.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* 27 | * Runtime function detection is to support different binary on different 28 | * runtime environment. This is usefull on product environemnt. 29 | */ 30 | RK_U32 mpp_rt_allcator_is_valid(MppBufferType type); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /*__MPP_RUNTIME__*/ 37 | 38 | -------------------------------------------------------------------------------- /rockchip/mpp_time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __MPP_TIME_H__ 18 | #define __MPP_TIME_H__ 19 | 20 | #include "rk_type.h" 21 | #include "mpp_thread.h" 22 | 23 | #if defined(_WIN32) && !defined(__MINGW32CE__) 24 | #include 25 | #define msleep Sleep 26 | #define sleep(x) Sleep((x)*1000) 27 | #else 28 | #include 29 | #define msleep(x) usleep((x)*1000) 30 | #endif 31 | 32 | typedef void* MppClock; 33 | typedef void* MppTimer; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | RK_S64 mpp_time(); 40 | void mpp_time_diff(RK_S64 start, RK_S64 end, RK_S64 limit, const char *fmt); 41 | 42 | /* 43 | * Clock create / destroy / enable / disable function 44 | * Note when clock is create it is default disabled user need to call enable 45 | * fucntion with enable = 1 to enable the clock. 46 | * User can use enable function with enable = 0 to disable the clock. 47 | */ 48 | MppClock mpp_clock_get(const char *name); 49 | void mpp_clock_put(MppClock clock); 50 | void mpp_clock_enable(MppClock clock, RK_U32 enable); 51 | 52 | /* 53 | * Clock basic operation function: 54 | * start : let clock start timing counter 55 | * pause : let clock pause and return the diff to start time 56 | * reset : let clock counter to all zero 57 | */ 58 | RK_S64 mpp_clock_start(MppClock clock); 59 | RK_S64 mpp_clock_pause(MppClock clock); 60 | RK_S64 mpp_clock_reset(MppClock clock); 61 | 62 | /* 63 | * These clock helper function can only be call when clock is paused: 64 | * mpp_clock_get_sum - Return clock sum up total value 65 | * mpp_clock_get_count - Return clock sum up counter value 66 | * mpp_clock_get_name - Return clock name 67 | */ 68 | RK_S64 mpp_clock_get_sum(MppClock clock); 69 | RK_S64 mpp_clock_get_count(MppClock clock); 70 | const char *mpp_clock_get_name(MppClock clock); 71 | 72 | /* 73 | * MppTimer is for timer with callback function 74 | * It will provide the ability to repeat doing something until it is 75 | * disalble or put. 76 | * 77 | * Timer work flow: 78 | * 79 | * 1. mpp_timer_get 80 | * 2. mpp_timer_set_callback 81 | * 3. mpp_timer_set_timing(initial, interval) 82 | * 4. mpp_timer_set_enable(initial, 1) 83 | * ... running ... 84 | * 5. mpp_timer_set_enable(initial, 0) 85 | * 6. mpp_timer_put 86 | */ 87 | MppTimer mpp_timer_get(const char *name); 88 | void mpp_timer_set_callback(MppTimer timer, MppThreadFunc func, void *ctx); 89 | void mpp_timer_set_timing(MppTimer timer, RK_S32 initial, RK_S32 interval); 90 | void mpp_timer_set_enable(MppTimer timer, RK_S32 enable); 91 | void mpp_timer_put(MppTimer timer); 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #ifdef __cplusplus 98 | class AutoTiming 99 | { 100 | public: 101 | AutoTiming(const char *name = __FUNCTION__); 102 | ~AutoTiming(); 103 | private: 104 | const char *mName; 105 | RK_S64 mStart; 106 | RK_S64 mEnd; 107 | 108 | AutoTiming(const AutoTiming &); 109 | AutoTiming &operator = (const AutoTiming&); 110 | }; 111 | 112 | #endif 113 | 114 | #define AUTO_TIMER_STRING(name, cnt) name ## cnt 115 | #define AUTO_TIMER_NAME_STRING(name, cnt) AUTO_TIMER_STRING(name, cnt) 116 | #define AUTO_TIMER_NAME(name) AUTO_TIMER_NAME_STRING(name, __COUNTER__) 117 | #define AUTO_TIMING() AutoTiming AUTO_TIMER_NAME(auto_timing)(__FUNCTION__) 118 | 119 | #endif /*__MPP_TIME_H__*/ 120 | -------------------------------------------------------------------------------- /rockchip/rk_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __RK_TYPE_H__ 18 | #define __RK_TYPE_H__ 19 | 20 | #include 21 | 22 | #if defined(_WIN32) && !defined(__MINGW32CE__) 23 | 24 | typedef unsigned char RK_U8; 25 | typedef unsigned short RK_U16; 26 | typedef unsigned int RK_U32; 27 | typedef unsigned long RK_ULONG; 28 | typedef unsigned __int64 RK_U64; 29 | 30 | typedef signed char RK_S8; 31 | typedef signed short RK_S16; 32 | typedef signed int RK_S32; 33 | typedef signed long RK_LONG; 34 | typedef signed __int64 RK_S64; 35 | 36 | #else 37 | 38 | typedef unsigned char RK_U8; 39 | typedef unsigned short RK_U16; 40 | typedef unsigned int RK_U32; 41 | typedef unsigned long RK_ULONG; 42 | typedef unsigned long long int RK_U64; 43 | 44 | 45 | typedef signed char RK_S8; 46 | typedef signed short RK_S16; 47 | typedef signed int RK_S32; 48 | typedef signed long RK_LONG; 49 | typedef signed long long int RK_S64; 50 | 51 | #endif 52 | 53 | #ifndef MODULE_TAG 54 | #define MODULE_TAG NULL 55 | #endif 56 | 57 | /** 58 | * @ingroup rk_mpi 59 | * @brief The type of mpp context 60 | */ 61 | typedef enum { 62 | MPP_CTX_DEC, /**< decoder */ 63 | MPP_CTX_ENC, /**< encoder */ 64 | MPP_CTX_ISP, /**< isp */ 65 | MPP_CTX_BUTT, /**< undefined */ 66 | } MppCtxType; 67 | 68 | /** 69 | * @ingroup rk_mpi 70 | * @brief Enumeration used to define the possible video compression codings. 71 | * sync with the omx_video.h 72 | * 73 | * @note This essentially refers to file extensions. If the coding is 74 | * being used to specify the ENCODE type, then additional work 75 | * must be done to configure the exact flavor of the compression 76 | * to be used. For decode cases where the user application can 77 | * not differentiate between MPEG-4 and H.264 bit streams, it is 78 | * up to the codec to handle this. 79 | */ 80 | typedef enum { 81 | MPP_VIDEO_CodingUnused, /**< Value when coding is N/A */ 82 | MPP_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */ 83 | MPP_VIDEO_CodingMPEG2, /**< AKA: H.262 */ 84 | MPP_VIDEO_CodingH263, /**< H.263 */ 85 | MPP_VIDEO_CodingMPEG4, /**< MPEG-4 */ 86 | MPP_VIDEO_CodingWMV, /**< Windows Media Video (WMV1,WMV2,WMV3)*/ 87 | MPP_VIDEO_CodingRV, /**< all versions of Real Video */ 88 | MPP_VIDEO_CodingAVC, /**< H.264/AVC */ 89 | MPP_VIDEO_CodingMJPEG, /**< Motion JPEG */ 90 | MPP_VIDEO_CodingVP8, /**< VP8 */ 91 | MPP_VIDEO_CodingVP9, /**< VP9 */ 92 | MPP_VIDEO_CodingVC1 = 0x01000000, /**< Windows Media Video (WMV1,WMV2,WMV3)*/ 93 | MPP_VIDEO_CodingFLV1, /**< Sorenson H.263 */ 94 | MPP_VIDEO_CodingDIVX3, /**< DIVX3 */ 95 | MPP_VIDEO_CodingVP6, 96 | MPP_VIDEO_CodingHEVC, /**< H.265/HEVC */ 97 | MPP_VIDEO_CodingAVSPLUS, /**< AVS+ */ 98 | MPP_VIDEO_CodingAVS, /**< AVS profile=0x20 */ 99 | MPP_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 100 | MPP_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ 101 | MPP_VIDEO_CodingMax = 0x7FFFFFFF 102 | } MppCodingType; 103 | 104 | /* 105 | * All external interface object list here. 106 | * The interface object is defined as void * for expandability 107 | * The cross include between these objects will introduce extra 108 | * compiling difficulty. So we move them together in this header. 109 | * 110 | * Object interface header list: 111 | * 112 | * MppCtx - rk_mpi.h 113 | * MppParam - rk_mpi.h 114 | * 115 | * MppFrame - mpp_frame.h 116 | * MppPacket - mpp_packet.h 117 | * 118 | * MppBuffer - mpp_buffer.h 119 | * MppBufferGroup - mpp_buffer.h 120 | * 121 | * MppTask - mpp_task.h 122 | * MppMeta - mpp_meta.h 123 | */ 124 | 125 | typedef void* MppCtx; 126 | typedef void* MppParam; 127 | 128 | typedef void* MppFrame; 129 | typedef void* MppPacket; 130 | 131 | typedef void* MppBuffer; 132 | typedef void* MppBufferGroup; 133 | 134 | typedef void* MppTask; 135 | typedef void* MppMeta; 136 | 137 | #endif /*__RK_TYPE_H__*/ 138 | -------------------------------------------------------------------------------- /rockchip/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rockchip Electronics Co. LTD 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __UTILS_H__ 18 | #define __UTILS_H__ 19 | 20 | #include 21 | 22 | #include "mpp_frame.h" 23 | 24 | typedef struct OptionInfo_t { 25 | const char* name; 26 | const char* argname; 27 | const char* help; 28 | } OptionInfo; 29 | 30 | typedef struct data_crc_t { 31 | RK_U32 len; 32 | RK_U32 sum; 33 | RK_U32 vor; // value of the xor 34 | } DataCrc; 35 | 36 | typedef struct frame_crc_t { 37 | DataCrc luma; 38 | DataCrc chroma; 39 | } FrmCrc; 40 | 41 | 42 | #define show_options(opt) \ 43 | do { \ 44 | _show_options(sizeof(opt)/sizeof(OptionInfo), opt); \ 45 | } while (0) 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | void _show_options(int count, OptionInfo *options); 52 | void dump_mpp_frame_to_file(MppFrame frame, FILE *fp); 53 | 54 | void calc_data_crc(RK_U8 *dat, RK_U32 len, DataCrc *crc); 55 | void write_data_crc(FILE *fp, DataCrc *crc); 56 | void read_data_crc(FILE *fp, DataCrc *crc); 57 | 58 | void calc_frm_crc(MppFrame frame, FrmCrc *crc); 59 | void write_frm_crc(FILE *fp, FrmCrc *crc); 60 | void read_frm_crc(FILE *fp, FrmCrc *crc); 61 | 62 | MPP_RET read_image(RK_U8 *buf, FILE *fp, RK_U32 width, RK_U32 height, 63 | RK_U32 hor_stride, RK_U32 ver_stride, 64 | MppFrameFormat fmt); 65 | MPP_RET fill_image(RK_U8 *buf, RK_U32 width, RK_U32 height, 66 | RK_U32 hor_stride, RK_U32 ver_stride, MppFrameFormat fmt, 67 | RK_U32 frame_count); 68 | 69 | typedef struct OpsLine_t { 70 | RK_U32 index; 71 | char cmd[8]; 72 | RK_U64 value1; 73 | RK_U64 value2; 74 | } OpsLine; 75 | 76 | RK_S32 parse_config_line(const char *str, OpsLine *info); 77 | 78 | MPP_RET name_to_frame_format(const char *name, MppFrameFormat *fmt); 79 | MPP_RET name_to_coding_type(const char *name, MppCodingType *coding); 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /*__UTILS_H__*/ 86 | -------------------------------------------------------------------------------- /tmp/MppDecode.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #pragma once 4 | 5 | 6 | 7 | #include 8 | 9 | #include "utils.h" 10 | #include "rk_mpi.h" 11 | #include "mpp_log.h" 12 | #include "mpp_mem.h" 13 | #include "mpp_env.h" 14 | #include "mpp_time.h" 15 | #include "mpp_common.h" 16 | 17 | #include "mpp_frame.h" 18 | #include "mpp_buffer_impl.h" 19 | #include "mpp_frame_impl.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "Callback.h" 27 | 28 | #define ROK 0 29 | #define RERR -1 30 | 31 | #define MAX_DEC_ERROR_NUM (30) // 错误帧数超过当前值则重新初始化MPP 32 | #define MAX_DEC_ERROR_TRY_NUM (5) // 超过当前次数未能成功发送,则丢弃当前帧 33 | 34 | 35 | class MppDecode { 36 | public: 37 | MppDecode() 38 | : ctx(NULL), 39 | mpi(NULL), 40 | eos(0), 41 | packet(NULL), 42 | frame(NULL), 43 | param(NULL), 44 | need_split(1), 45 | type(MPP_VIDEO_CodingAVC), 46 | frm_grp(NULL), 47 | pkt_grp(NULL), 48 | mpi_cmd(MPP_CMD_BASE), 49 | frame_count(1), 50 | frame_num(0), 51 | max_usage(0), 52 | fp_output(NULL), 53 | m_nDecPutErrNum(0) {} 54 | ~MppDecode() { deInitMpp(); } 55 | 56 | /** 57 | * set type for h264 or h265 decode 58 | * MPP_VIDEO_CodingAVC ---> h264 59 | * MPP_VIDEO_CodingHEVC ---> h265 60 | */ 61 | void setMppDecodeType(MppCodingType t) { type = t; } 62 | void setMppFp(FILE* fp) { fp_output = fp; } 63 | 64 | int initMpp(); 65 | 66 | int decode(AVPacket* av_packet, cv::Mat& image); 67 | 68 | //转码, 将yuv转码为rgb的格式 69 | void YUV420SP2Mat(cv::Mat& image); 70 | 71 | void deInitMpp(); 72 | // void setDataCallback(const rtsp_data_callback_t& cb) { cb_ = cb; } 73 | 74 | private: 75 | MppCtx ctx; 76 | MppApi* mpi; 77 | RK_U32 eos; 78 | MppBufferGroup frm_grp; 79 | MppBufferGroup pkt_grp; 80 | MppPacket packet; 81 | MppFrame frame; 82 | MppParam param; 83 | RK_U32 need_split; 84 | MpiCmd mpi_cmd; 85 | RK_S32 frame_count; 86 | RK_S32 frame_num; 87 | size_t max_usage; 88 | MppCodingType type; 89 | FILE* fp_output; 90 | 91 | // rtsp_data_callback_t cb_; 92 | 93 | int m_nDecPutErrNum; 94 | 95 | public: 96 | cv::Mat rgbImg; 97 | }; 98 | -------------------------------------------------------------------------------- /tmp/RtspMppImpl.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #pragma once 4 | 5 | 6 | extern "C" { 7 | #include 8 | }; 9 | 10 | #include 11 | #include 12 | 13 | #include "MppDecode.h" 14 | // #include "Callback.h" 15 | 16 | 17 | 18 | class RtspImpl { 19 | public: 20 | RtspImpl(const std::string &rtsp_addr) : rtsp_addr_(rtsp_addr) {} 21 | virtual ~RtspImpl() {} 22 | virtual int init() {} 23 | virtual bool read(cv::Mat &image) {} 24 | virtual bool open(const std::string &rtsp_addr) {} 25 | virtual void release(){}; 26 | virtual void set(int option, int value) {} 27 | virtual bool isOpened() {} 28 | // virtual void setDataCallback(const rtsp_data_callback_t &cb) {} 29 | 30 | protected: 31 | std::string rtsp_addr_; 32 | bool opened_; 33 | }; 34 | 35 | class RtspMppImpl : public RtspImpl { 36 | public: 37 | RtspMppImpl(const std::string &rtsp_addr) 38 | : RtspImpl(rtsp_addr), 39 | inited_(false), 40 | pFormatCtx_(NULL), 41 | options_(NULL), 42 | packet_(NULL), 43 | videoindex_(-1), 44 | codec_id_(AV_CODEC_ID_NONE), 45 | mppdec_(std::make_shared()) { 46 | av_register_all(); 47 | avformat_network_init(); 48 | } 49 | 50 | ~RtspMppImpl() { 51 | av_free(packet_); 52 | avformat_close_input(&pFormatCtx_); 53 | } 54 | 55 | int init(); 56 | bool open(const std::string &rtsp_addr) {} 57 | 58 | void reopen() {} 59 | 60 | bool read(cv::Mat &image); 61 | void set(int option, int value) {} 62 | bool isOpened() {} 63 | void release() {} 64 | 65 | int getFrame(cv::Mat &image); 66 | 67 | // void setDataCallback(const rtsp_data_callback_t &cb) { 68 | // mppdec_->setDataCallback(cb); 69 | // } 70 | void restart(); 71 | 72 | private: 73 | int inited_; 74 | AVFormatContext *pFormatCtx_; 75 | AVDictionary *options_; 76 | int videoindex_; 77 | AVPacket *packet_; 78 | enum AVCodecID codec_id_; 79 | std::shared_ptr mppdec_; 80 | int64_t last_decode_time_; 81 | const int mpp_exception_decode_time_window_ = 5 * 60 * 1000; 82 | const int decode_gop_time_window_ = 60 * 1000; 83 | }; 84 | 85 | -------------------------------------------------------------------------------- /yuv.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/yuv.jpg -------------------------------------------------------------------------------- /yuvplayer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MUZLATAN/ffmpeg_rtsp_mpp/d5caa3dc7c2310d7fb35a563e0b07aab7aa37df3/yuvplayer.exe --------------------------------------------------------------------------------