├── rtsp.cpp
├── aren_thread.cpp
├── inc_lib
├── avutil.lib
├── avcodec.lib
├── avdevice.lib
├── avfilter.lib
├── avformat.lib
├── postproc.lib
├── swscale.lib
├── libavutil.dll.a
├── swresample.lib
├── libavcodec.dll.a
├── libavdevice.dll.a
├── libavfilter.dll.a
├── libavformat.dll.a
├── libpostproc.dll.a
├── libswscale.dll.a
├── libswresample.dll.a
├── postproc-54.def
├── swresample-2.def
├── avdevice-57.def
├── swscale-4.def
└── avfilter-6.def
├── README.md
├── rtsp.vcxproj.user
├── inc_header
├── libavutil
│ ├── avconfig.h
│ ├── ffversion.h
│ ├── macros.h
│ ├── hwcontext_vdpau.h
│ ├── random_seed.h
│ ├── hwcontext_cuda.h
│ ├── hwcontext_qsv.h
│ ├── replaygain.h
│ ├── adler32.h
│ ├── motion_vector.h
│ ├── time.h
│ ├── intfloat.h
│ ├── aes.h
│ ├── rc4.h
│ ├── pixelutils.h
│ ├── lzo.h
│ ├── tea.h
│ ├── camellia.h
│ ├── aes_ctr.h
│ ├── md5.h
│ ├── lfg.h
│ ├── ripemd.h
│ ├── twofish.h
│ ├── base64.h
│ ├── hwcontext_dxva2.h
│ ├── des.h
│ ├── avassert.h
│ ├── blowfish.h
│ ├── sha.h
│ ├── sha512.h
│ ├── file.h
│ ├── cast5.h
│ ├── timestamp.h
│ ├── mastering_display_metadata.h
│ ├── xtea.h
│ ├── hmac.h
│ ├── bswap.h
│ ├── display.h
│ ├── crc.h
│ ├── downmix_info.h
│ ├── hwcontext_vaapi.h
│ ├── murmur3.h
│ └── threadmessage.h
├── libavfilter
│ ├── avfiltergraph.h
│ └── version.h
├── libavcodec
│ ├── jni.h
│ ├── vorbis_parser.h
│ ├── dxva2.h
│ ├── avdct.h
│ ├── mediacodec.h
│ ├── d3d11va.h
│ ├── avfft.h
│ ├── dv_profile.h
│ └── qsv.h
├── libswresample
│ └── version.h
├── libpostproc
│ ├── version.h
│ └── postprocess.h
├── inttypes.h
├── libavdevice
│ └── version.h
└── libswscale
│ └── version.h
├── rtsp.h
├── r_thread.h
├── libyuv
├── include
│ ├── libyuv
│ │ ├── version.h
│ │ ├── rotate_argb.h
│ │ ├── basic_types.h
│ │ ├── scale_argb.h
│ │ └── compare.h
│ └── libyuv.h
└── source
│ ├── video_common.cc
│ ├── mjpeg_validate.cc
│ ├── compare_common.cc
│ ├── compare_msa.cc
│ ├── rotate_any.cc
│ ├── rotate_common.cc
│ ├── compare_neon64.cc
│ └── compare_neon.cc
├── r_sock.h
├── media_track.h
├── ren_thread.h
├── rtsp.sln
├── r_util.h
├── vren_thread.h
├── dec_thread.h
├── r_thread.cpp
├── r_string.h
├── aren_thread.h
├── rev_thread.h
├── r_sock.cpp
├── r_util.cpp
└── ren_thread.cpp
/rtsp.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/rtsp.cpp
--------------------------------------------------------------------------------
/aren_thread.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/aren_thread.cpp
--------------------------------------------------------------------------------
/inc_lib/avutil.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/avutil.lib
--------------------------------------------------------------------------------
/inc_lib/avcodec.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/avcodec.lib
--------------------------------------------------------------------------------
/inc_lib/avdevice.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/avdevice.lib
--------------------------------------------------------------------------------
/inc_lib/avfilter.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/avfilter.lib
--------------------------------------------------------------------------------
/inc_lib/avformat.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/avformat.lib
--------------------------------------------------------------------------------
/inc_lib/postproc.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/postproc.lib
--------------------------------------------------------------------------------
/inc_lib/swscale.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/swscale.lib
--------------------------------------------------------------------------------
/inc_lib/libavutil.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libavutil.dll.a
--------------------------------------------------------------------------------
/inc_lib/swresample.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/swresample.lib
--------------------------------------------------------------------------------
/inc_lib/libavcodec.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libavcodec.dll.a
--------------------------------------------------------------------------------
/inc_lib/libavdevice.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libavdevice.dll.a
--------------------------------------------------------------------------------
/inc_lib/libavfilter.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libavfilter.dll.a
--------------------------------------------------------------------------------
/inc_lib/libavformat.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libavformat.dll.a
--------------------------------------------------------------------------------
/inc_lib/libpostproc.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libpostproc.dll.a
--------------------------------------------------------------------------------
/inc_lib/libswscale.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libswscale.dll.a
--------------------------------------------------------------------------------
/inc_lib/libswresample.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greenjim301/rtsp/HEAD/inc_lib/libswresample.dll.a
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # rtsp
2 | 简单的rtsp播放器,实现了rtp over tcp方式收流,h264、g711、aac等音视频解码,音频渲染使用xaudio,视频渲染支持d3d9、d3d11和opengl。
3 |
--------------------------------------------------------------------------------
/rtsp.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/inc_header/libavutil/avconfig.h:
--------------------------------------------------------------------------------
1 | /* Generated by ffconf */
2 | #ifndef AVUTIL_AVCONFIG_H
3 | #define AVUTIL_AVCONFIG_H
4 | #define AV_HAVE_BIGENDIAN 0
5 | #define AV_HAVE_FAST_UNALIGNED 1
6 | #endif /* AVUTIL_AVCONFIG_H */
7 |
--------------------------------------------------------------------------------
/inc_header/libavutil/ffversion.h:
--------------------------------------------------------------------------------
1 | /* Automatically generated by version.sh, do not manually edit! */
2 | #ifndef AVUTIL_FFVERSION_H
3 | #define AVUTIL_FFVERSION_H
4 | #define FFMPEG_VERSION "3.3.3"
5 | #endif /* AVUTIL_FFVERSION_H */
6 |
--------------------------------------------------------------------------------
/inc_lib/postproc-54.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | postproc_configuration
3 | postproc_ffversion DATA
4 | postproc_license
5 | postproc_version
6 | pp_free_context
7 | pp_free_mode
8 | pp_get_context
9 | pp_get_mode_by_name_and_quality
10 | pp_help DATA
11 | pp_postprocess
12 |
--------------------------------------------------------------------------------
/rtsp.h:
--------------------------------------------------------------------------------
1 | #ifndef __RTSP_H__
2 | #define __RTSP_H__
3 |
4 | #include "r_string.h"
5 | #include "rev_thread.h"
6 | #include
7 |
8 | class rtsp_ctx
9 | {
10 | public:
11 | rtsp_ctx();
12 | ~rtsp_ctx();
13 |
14 | static LRESULT WINAPI WindowProc(HWND hwnd, UINT msg, WPARAM wparam,
15 | LPARAM lparam);
16 |
17 | rev_thread m_rev_thread;
18 | HWND m_hwhd;
19 | };
20 |
21 | #endif
22 |
--------------------------------------------------------------------------------
/r_thread.h:
--------------------------------------------------------------------------------
1 | #ifndef __R_THREAD_H__
2 | #define __R_THREAD_H__
3 |
4 | #include
5 | #include
6 |
7 | class r_thread
8 | {
9 | public:
10 | r_thread();
11 | virtual ~r_thread();
12 | virtual int WaitStop();
13 | virtual int Run() = 0;
14 | int Start();
15 | void RLock();
16 | void RUnlock();
17 | inline void SetExitFlag(){m_exit_flag = 1;}
18 |
19 | private:
20 | HANDLE m_handle;
21 | HANDLE m_mutex;
22 | protected:
23 | int m_exit_flag;
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/inc_lib/swresample-2.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | swr_alloc
3 | swr_alloc_set_opts
4 | swr_build_matrix
5 | swr_close
6 | swr_config_frame
7 | swr_convert
8 | swr_convert_frame
9 | swr_drop_output
10 | swr_ffversion DATA
11 | swr_free
12 | swr_get_class
13 | swr_get_delay
14 | swr_get_out_samples
15 | swr_init
16 | swr_inject_silence
17 | swr_is_initialized
18 | swr_next_pts
19 | swr_set_channel_mapping
20 | swr_set_compensation
21 | swr_set_matrix
22 | swresample_configuration
23 | swresample_license
24 | swresample_version
25 |
--------------------------------------------------------------------------------
/libyuv/include/libyuv/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_VERSION_H_
12 | #define INCLUDE_LIBYUV_VERSION_H_
13 |
14 | #define LIBYUV_VERSION 1727
15 |
16 | #endif // INCLUDE_LIBYUV_VERSION_H_
17 |
--------------------------------------------------------------------------------
/inc_lib/avdevice-57.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | av_device_capabilities DATA
3 | av_device_ffversion DATA
4 | av_input_audio_device_next
5 | av_input_video_device_next
6 | av_output_audio_device_next
7 | av_output_video_device_next
8 | avdevice_app_to_dev_control_message
9 | avdevice_capabilities_create
10 | avdevice_capabilities_free
11 | avdevice_configuration
12 | avdevice_dev_to_app_control_message
13 | avdevice_free_list_devices
14 | avdevice_license
15 | avdevice_list_devices
16 | avdevice_list_input_sources
17 | avdevice_list_output_sinks
18 | avdevice_register_all
19 | avdevice_version
20 |
--------------------------------------------------------------------------------
/r_sock.h:
--------------------------------------------------------------------------------
1 | #ifndef __R_SOCK_H__
2 | #define __R_SOCK_H__
3 |
4 | #ifdef _WIN32
5 | #include
6 | #else
7 | #include
8 | #include
9 | #include
10 | #endif // _WIN32
11 |
12 | #include "r_string.h"
13 |
14 | class r_sock
15 | {
16 | public:
17 | r_sock();
18 | ~r_sock();
19 |
20 | int Connect(r_string& host, int port);
21 | int Send(const char* buf, int size);
22 | int Recv(char* buf, int size);
23 |
24 | private:
25 | void Close();
26 | bool Valid();
27 |
28 | private:
29 | #ifdef _WIN32
30 | SOCKET m_sock;
31 | #else
32 | int m_sock;
33 | #endif
34 | };
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/media_track.h:
--------------------------------------------------------------------------------
1 | #ifndef __MEDIA_TRACK_H__
2 | #define __MEDIA_TRACK_H__
3 |
4 | #include
5 | #include "r_string.h"
6 |
7 | class media_track
8 | {
9 | public:
10 | media_track()
11 | : m_timestamp(0)
12 | , m_base_timestamp(0)
13 | , m_unwrapped_timestamp(0)
14 | , m_last_time_stamp(0)
15 | , playload(0)
16 | , channel(1)
17 | , sample(8000)
18 | , is_aac(0)
19 | {
20 | }
21 |
22 | int type;
23 | int playload;
24 | int sample;
25 | int channel;
26 | int is_aac;
27 | r_string url;
28 | r_string codec;
29 | uint32_t m_last_time_stamp;
30 | uint32_t m_timestamp;
31 | uint32_t m_base_timestamp;
32 | int64_t m_unwrapped_timestamp;
33 | };
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/ren_thread.h:
--------------------------------------------------------------------------------
1 | #ifndef __REN_THREAD_H__
2 | #define __REN_THREAD_H__
3 |
4 | #include "r_thread.h"
5 |
6 | struct AVFrame;
7 |
8 | class ren_thread : public r_thread
9 | {
10 | private:
11 | class frame_queue
12 | {
13 | public:
14 | frame_queue()
15 | : m_frame(NULL)
16 | , m_next(NULL)
17 | {
18 | }
19 |
20 | AVFrame* m_frame;
21 | frame_queue* m_next;
22 | };
23 |
24 | public:
25 | ren_thread();
26 | virtual ~ren_thread();
27 |
28 | void Enque(AVFrame* frame);
29 | AVFrame* Deque();
30 | int Run();
31 |
32 | private:
33 | void ClearQue();
34 | virtual int Render(AVFrame* frame) = 0;
35 | virtual void DestroyRender() = 0;
36 |
37 | private:
38 | frame_queue* m_head;
39 | };
40 |
41 | #endif
--------------------------------------------------------------------------------
/inc_lib/swscale-4.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | sws_addVec
3 | sws_allocVec
4 | sws_alloc_context
5 | sws_alloc_set_opts
6 | sws_cloneVec
7 | sws_convVec
8 | sws_convertPalette8ToPacked24
9 | sws_convertPalette8ToPacked32
10 | sws_freeContext
11 | sws_freeFilter
12 | sws_freeVec
13 | sws_getCachedContext
14 | sws_getCoefficients
15 | sws_getColorspaceDetails
16 | sws_getConstVec
17 | sws_getContext
18 | sws_getDefaultFilter
19 | sws_getGaussianVec
20 | sws_getIdentityVec
21 | sws_get_class
22 | sws_init_context
23 | sws_isSupportedEndiannessConversion
24 | sws_isSupportedInput
25 | sws_isSupportedOutput
26 | sws_normalizeVec
27 | sws_printVec2
28 | sws_scale
29 | sws_scaleVec
30 | sws_setColorspaceDetails
31 | sws_shiftVec
32 | sws_subVec
33 | swscale_configuration
34 | swscale_license
35 | swscale_version
36 |
--------------------------------------------------------------------------------
/rtsp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtsp", "rtsp.vcxproj", "{9B2DB721-EDEA-4A4D-A7CD-B5876FD818F8}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {9B2DB721-EDEA-4A4D-A7CD-B5876FD818F8}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {9B2DB721-EDEA-4A4D-A7CD-B5876FD818F8}.Debug|Win32.Build.0 = Debug|Win32
14 | {9B2DB721-EDEA-4A4D-A7CD-B5876FD818F8}.Release|Win32.ActiveCfg = Release|Win32
15 | {9B2DB721-EDEA-4A4D-A7CD-B5876FD818F8}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/r_util.h:
--------------------------------------------------------------------------------
1 | #ifndef __R_UTIL_H__
2 | #define __R_UTIL_H__
3 |
4 | #include "r_string.h"
5 | #include
6 | #include
7 | #include
8 |
9 | enum
10 | {
11 | RTSP_INIT,
12 | RTSP_OPTIONS_SEND,
13 | RTSP_DESCRIBE_SEND,
14 | RTSP_SETUP0_SEND,
15 | RTSP_SETUP1_SEND,
16 | RTSP_PLAY_SEND,
17 | RTSP_REV_STREAM,
18 | RTSP_TEARDOWN_SEND,
19 | };
20 |
21 | #define VIDEO_TYPE 0
22 | #define AUDIO_TYPE 1
23 |
24 | #define RTP_VERSION 2
25 | #define RTP_FLAG_MARKER 0x2 ///< RTP marker bit was set for this packet
26 |
27 | #define R_RB16(x) ((((const uint8_t*)(x))[0] << 8) | ((const uint8_t*)(x))[1])
28 | #define R_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \
29 | (((const uint8_t*)(x))[1] << 16) | \
30 | (((const uint8_t*)(x))[2] << 8) | \
31 | ((const uint8_t*)(x))[3])
32 |
33 | static const uint8_t start_sequence[] = { 0, 0, 0, 1 };
34 |
35 | void SkipSpace(char*& p);
36 | int SkipLine(char*& p);
37 | int get_rtsp_addr(r_string& url, r_string& host, int& port);
38 | void r_log(const char* pszFormat, ...) ;
39 |
40 | #endif
--------------------------------------------------------------------------------
/inc_header/libavfilter/avfiltergraph.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Filter graphs
3 | * copyright (c) 2007 Bobby Bingham
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVFILTER_AVFILTERGRAPH_H
23 | #define AVFILTER_AVFILTERGRAPH_H
24 |
25 | #include "avfilter.h"
26 | #include "libavutil/log.h"
27 |
28 | #endif /* AVFILTER_AVFILTERGRAPH_H */
29 |
--------------------------------------------------------------------------------
/libyuv/include/libyuv.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_H_
12 | #define INCLUDE_LIBYUV_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/compare.h"
16 | #include "libyuv/convert.h"
17 | #include "libyuv/convert_argb.h"
18 | #include "libyuv/convert_from.h"
19 | #include "libyuv/convert_from_argb.h"
20 | #include "libyuv/cpu_id.h"
21 | #include "libyuv/mjpeg_decoder.h"
22 | #include "libyuv/planar_functions.h"
23 | #include "libyuv/rotate.h"
24 | #include "libyuv/rotate_argb.h"
25 | #include "libyuv/row.h"
26 | #include "libyuv/scale.h"
27 | #include "libyuv/scale_argb.h"
28 | #include "libyuv/scale_row.h"
29 | #include "libyuv/version.h"
30 | #include "libyuv/video_common.h"
31 |
32 | #endif // INCLUDE_LIBYUV_H_
33 |
--------------------------------------------------------------------------------
/libyuv/include/libyuv/rotate_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_ROTATE_ARGB_H_
12 | #define INCLUDE_LIBYUV_ROTATE_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/rotate.h" // For RotationMode.
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | // Rotate ARGB frame
23 | LIBYUV_API
24 | int ARGBRotate(const uint8_t* src_argb,
25 | int src_stride_argb,
26 | uint8_t* dst_argb,
27 | int dst_stride_argb,
28 | int src_width,
29 | int src_height,
30 | enum RotationMode mode);
31 |
32 | #ifdef __cplusplus
33 | } // extern "C"
34 | } // namespace libyuv
35 | #endif
36 |
37 | #endif // INCLUDE_LIBYUV_ROTATE_ARGB_H_
38 |
--------------------------------------------------------------------------------
/vren_thread.h:
--------------------------------------------------------------------------------
1 | #ifndef __VREN_THREAD_H__
2 | #define __VREN_THREAD_H__
3 |
4 | #include "ren_thread.h"
5 | #include
6 | #include
7 |
8 | #include
9 | #include
10 |
11 | class vren_thread : public ren_thread
12 | {
13 | public:
14 | vren_thread();
15 |
16 | inline void SetParam(HWND& hwnd)
17 | {
18 | m_hwhd = hwnd;
19 | }
20 |
21 | void TryResizeViewport(size_t width, size_t height);
22 |
23 | private:
24 | int Render(AVFrame* frame);
25 | void DestroyRender();
26 |
27 | int Render_d3d(AVFrame* frame);
28 | void DestroyRender_d3d();
29 | int InitRender_d3d(size_t width, size_t height);
30 |
31 | int InitRender_gl(size_t width, size_t height);
32 | int Render_gl(AVFrame* frame);
33 | void DestroyRender_gl();
34 |
35 | void ResizeViewport(size_t width, size_t height);
36 |
37 | private:
38 | HWND m_hwhd;
39 | bool m_d3dinit;
40 | IDirect3D9* m_d3d;
41 | IDirect3DDevice9* m_d3d_device;
42 | IDirect3DSurface9* m_surface;
43 | RECT m_rtViewport;
44 | int m_width;
45 | int m_height;
46 |
47 | bool m_glInit;
48 | HDC m_ghDC;
49 | HGLRC m_ghRC;
50 | uint8_t* m_y_data;
51 | GLuint m_y_texture;
52 | bool m_try_resize;
53 | int m_new_width;
54 | int m_new_height;
55 | };
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/dec_thread.h:
--------------------------------------------------------------------------------
1 | #ifndef __DEC_THREAD_H__
2 | #define __DEC_THREAD_H__
3 |
4 | #include "r_thread.h"
5 |
6 | struct AVPacket;
7 | class ren_thread;
8 | struct AVCodecContext;
9 | class media_track;
10 | enum AVCodecID;
11 |
12 | class dec_thread : public r_thread
13 | {
14 | private:
15 | class packet_queue
16 | {
17 | public:
18 | packet_queue()
19 | : m_packet(NULL)
20 | , m_next(NULL)
21 | {
22 | }
23 |
24 | AVPacket* m_packet;
25 | packet_queue* m_next;
26 | };
27 |
28 | public:
29 | dec_thread();
30 | ~dec_thread();
31 |
32 | void Enque(AVPacket* pkt);
33 | AVPacket* Deque();
34 | int Run();
35 | inline void SetParam(ren_thread* vrthr, ren_thread* arthr, media_track* atrack)
36 | {
37 | m_vrthread = vrthr;
38 | m_arthread = arthr;
39 | m_atrack = atrack;
40 | }
41 |
42 | private:
43 | void ClearQue();
44 | int DecodeVideo(AVPacket* pkt);
45 | int DecodeAudio(AVPacket* pkt);
46 | int GetAudioParam(AVCodecID& codec_id, int& sample, int& channel);
47 |
48 | private:
49 | packet_queue* m_head;
50 | ren_thread * m_vrthread;
51 | ren_thread * m_arthread;
52 | media_track* m_atrack;
53 | AVCodecContext* m_vdec_ctx;
54 | AVCodecContext* m_adec_ctx;
55 | };
56 |
57 | #endif
--------------------------------------------------------------------------------
/r_thread.cpp:
--------------------------------------------------------------------------------
1 | #include "r_thread.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include "r_util.h"
7 |
8 | unsigned WINAPI ThreadFunction( LPVOID lpParam )
9 | {
10 | r_thread* ctx = static_cast(lpParam);
11 | int ret = ctx->Run();
12 | _endthreadex( 0 );
13 | return ret;
14 | }
15 |
16 | r_thread::r_thread()
17 | : m_handle(NULL)
18 | , m_mutex(NULL)
19 | , m_exit_flag(0)
20 | {
21 | }
22 |
23 | r_thread::~r_thread()
24 | {
25 | if (m_handle != NULL) {
26 | CloseHandle(m_handle);
27 | }
28 |
29 | if (m_mutex != NULL) {
30 | CloseHandle(m_mutex);
31 | }
32 | }
33 |
34 |
35 | int r_thread::Start()
36 | {
37 | m_handle =(HANDLE) _beginthreadex(NULL, 0, ThreadFunction, this, 0, NULL);
38 |
39 | if (m_handle == NULL) {
40 | r_log("fail to create thread\n");
41 | return -1;
42 | }
43 |
44 | m_mutex = CreateMutex(NULL, FALSE, NULL);
45 | return 0;
46 | }
47 |
48 | void r_thread::RLock()
49 | {
50 | WaitForSingleObject(m_mutex, INFINITE);
51 | }
52 |
53 |
54 | void r_thread::RUnlock()
55 | {
56 | ReleaseMutex(m_mutex);
57 | }
58 |
59 | int r_thread::WaitStop()
60 | {
61 | WaitForSingleObject(m_handle, 5000);
62 | CloseHandle( m_handle );
63 | m_handle = NULL;
64 |
65 | CloseHandle( m_mutex );
66 | m_mutex = NULL;
67 | return 0;
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/r_string.h:
--------------------------------------------------------------------------------
1 | #ifndef __R_STRING_H__
2 | #define __R_STRING_H__
3 |
4 | #include
5 |
6 | class r_string
7 | {
8 | public:
9 | r_string()
10 | :m_size(0)
11 | {
12 | m_buf[0] = '\0';
13 | }
14 |
15 | r_string(const char* str, const int in_size)
16 | : m_size(in_size)
17 | {
18 | memcpy(m_buf, str, in_size);
19 | m_buf[in_size] = '\0';
20 | }
21 |
22 | r_string(const char* str)
23 | {
24 | m_size = strlen(str);
25 | memcpy(m_buf, str, m_size);
26 | m_buf[m_size] = '\0';
27 | }
28 |
29 | r_string& operator=(const r_string& r)
30 | {
31 | m_size = r.m_size;
32 | memcpy(m_buf, r.m_buf, m_size);
33 | m_buf[m_size] = '\0';
34 | return *this;
35 | }
36 |
37 | void assign(const char* str, const int in_size)
38 | {
39 | memcpy(m_buf, str, in_size);
40 | m_size = in_size;
41 | m_buf[m_size] = '\0';
42 | }
43 |
44 | void append(const char* str, const int in_size)
45 | {
46 | memcpy(m_buf + m_size, str, in_size);
47 | m_size += in_size;
48 | m_buf[m_size] = '\0';
49 | }
50 |
51 | const char* c_str()
52 | {
53 | return m_buf;
54 | }
55 |
56 | char* Data()
57 | {
58 | return m_buf;
59 | }
60 |
61 | int Size()
62 | {
63 | return m_size;
64 | }
65 |
66 | private:
67 | char m_buf[256];
68 | int m_size;
69 | };
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/inc_header/libavutil/macros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * @file
21 | * @ingroup lavu
22 | * Utility Preprocessor macros
23 | */
24 |
25 | #ifndef AVUTIL_MACROS_H
26 | #define AVUTIL_MACROS_H
27 |
28 | /**
29 | * @addtogroup preproc_misc Preprocessor String Macros
30 | *
31 | * String manipulation macros
32 | *
33 | * @{
34 | */
35 |
36 | #define AV_STRINGIFY(s) AV_TOSTRING(s)
37 | #define AV_TOSTRING(s) #s
38 |
39 | #define AV_GLUE(a, b) a ## b
40 | #define AV_JOIN(a, b) AV_GLUE(a, b)
41 |
42 | /**
43 | * @}
44 | */
45 |
46 | #define AV_PRAGMA(s) _Pragma(#s)
47 |
48 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
49 |
50 | #endif /* AVUTIL_MACROS_H */
51 |
--------------------------------------------------------------------------------
/inc_header/libavutil/hwcontext_vdpau.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_VDPAU_H
20 | #define AVUTIL_HWCONTEXT_VDPAU_H
21 |
22 | #include
23 |
24 | /**
25 | * @file
26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU.
27 | *
28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return
29 | * AVBufferRefs whose data pointer is a VdpVideoSurface.
30 | */
31 |
32 | /**
33 | * This struct is allocated as AVHWDeviceContext.hwctx
34 | */
35 | typedef struct AVVDPAUDeviceContext {
36 | VdpDevice device;
37 | VdpGetProcAddress *get_proc_address;
38 | } AVVDPAUDeviceContext;
39 |
40 | /**
41 | * AVHWFramesContext.hwctx is currently not used
42 | */
43 |
44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */
45 |
--------------------------------------------------------------------------------
/aren_thread.h:
--------------------------------------------------------------------------------
1 | #ifndef __AREN_THREAD_H__
2 | #define __AREN_THREAD_H__
3 |
4 | #include "ren_thread.h"
5 | #include "xaudio2.h"
6 | #include
7 |
8 | class media_track;
9 | struct SwrContext;
10 |
11 | struct StreamingVoiceContext : public IXAudio2VoiceCallback
12 | {
13 | STDMETHOD_( void, OnVoiceProcessingPassStart )( UINT32 )
14 | {
15 | }
16 | STDMETHOD_( void, OnVoiceProcessingPassEnd )()
17 | {
18 | }
19 | STDMETHOD_( void, OnStreamEnd )()
20 | {
21 | }
22 | STDMETHOD_( void, OnBufferStart )( void* )
23 | {
24 | }
25 | STDMETHOD_( void, OnBufferEnd )( void* pBufferContext)
26 | {
27 | free(pBufferContext);
28 | }
29 | STDMETHOD_( void, OnLoopEnd )( void* )
30 | {
31 | }
32 | STDMETHOD_( void, OnVoiceError )( void*, HRESULT )
33 | {
34 | }
35 | };
36 |
37 |
38 | class aren_thread : public ren_thread
39 | {
40 | public:
41 | aren_thread();
42 | ~aren_thread();
43 |
44 | inline void SetParam( media_track* atrack)
45 | {
46 | m_atrack = atrack;
47 | }
48 |
49 | private:
50 | int Render(AVFrame* frame);
51 | void DestroyRender();
52 | int InitRender();
53 | int InitSwr(AVFrame* frame);
54 | void DestroySwr();
55 |
56 | private:
57 | IXAudio2 * m_pXAudio2;
58 | IXAudio2MasteringVoice* m_pMasteringVoice;
59 | IXAudio2SourceVoice* m_pSourceVoice;
60 | media_track* m_atrack;
61 | int64_t m_last_pts;
62 | SwrContext * swr_ctx;
63 | uint8_t **dst_data;
64 | int m_last_nb_sample;
65 | StreamingVoiceContext m_call_back;
66 | };
67 |
68 | #endif
69 |
--------------------------------------------------------------------------------
/inc_header/libavutil/random_seed.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009 Baptiste Coudurier
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_RANDOM_SEED_H
22 | #define AVUTIL_RANDOM_SEED_H
23 |
24 | #include
25 | /**
26 | * @addtogroup lavu_crypto
27 | * @{
28 | */
29 |
30 | /**
31 | * Get a seed to use in conjunction with random functions.
32 | * This function tries to provide a good seed at a best effort bases.
33 | * Its possible to call this function multiple times if more bits are needed.
34 | * It can be quite slow, which is why it should only be used as seed for a faster
35 | * PRNG. The quality of the seed depends on the platform.
36 | */
37 | uint32_t av_get_random_seed(void);
38 |
39 | /**
40 | * @}
41 | */
42 |
43 | #endif /* AVUTIL_RANDOM_SEED_H */
44 |
--------------------------------------------------------------------------------
/rev_thread.h:
--------------------------------------------------------------------------------
1 | #ifndef __REV_THREAD_H__
2 | #define __REV_THREAD_H__
3 |
4 | #include "r_thread.h"
5 | #include "r_sock.h"
6 | #include "dec_thread.h"
7 | #include "vren_thread.h"
8 | #include "aren_thread.h"
9 | #include "media_track.h"
10 | #include
11 |
12 | struct AVPacket;
13 | class media_track;
14 | class dec_thread;
15 |
16 | class rev_thread : public r_thread
17 | {
18 | public:
19 | rev_thread();
20 | ~rev_thread();
21 |
22 | int Run();
23 | inline void SetParam(HWND& hwnd, r_string& url)
24 | {
25 | m_hwhd = hwnd;
26 | m_url = url;
27 | }
28 |
29 | vren_thread m_vren_thread;
30 |
31 | private:
32 | int ParseRtpRtcp(int8_t channel, uint8_t* buf, int len);
33 | void finalize_packet(media_track* tr, AVPacket* pkt);
34 | int ParseRespone();
35 | int Connect();
36 | int SendRtspCmd(const char* cmd);
37 | int ParseHead(char* buf, int& con_len);
38 | int ParseSdp(char* buf, int size);
39 | int SendRtspSetup(r_string& setup_url, const char* transport);
40 | int StartPlay();
41 | int StopPlay();
42 |
43 |
44 | private:
45 | HWND m_hwhd;
46 | r_string m_url;
47 |
48 | char* m_rev_buf;
49 | int m_rev_len;
50 |
51 | char* m_video_buf;
52 | int m_video_size;
53 |
54 | r_sock m_sock;
55 | int m_seq;
56 | char m_send_buf[1024];
57 |
58 | int m_state;
59 | r_string m_content_base;
60 | r_string m_klive_method;
61 | media_track m_track[2];
62 | r_string m_session;
63 | int m_time_out;
64 | r_string m_sps;
65 |
66 | dec_thread m_dec_thread;
67 | aren_thread m_aren_thread;
68 | int m_last_tt;
69 | };
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/inc_header/libavutil/hwcontext_cuda.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 |
20 | #ifndef AVUTIL_HWCONTEXT_CUDA_H
21 | #define AVUTIL_HWCONTEXT_CUDA_H
22 |
23 | #ifndef CUDA_VERSION
24 | #include
25 | #endif
26 |
27 | #include "pixfmt.h"
28 |
29 | /**
30 | * @file
31 | * An API-specific header for AV_HWDEVICE_TYPE_CUDA.
32 | *
33 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return
34 | * AVBufferRefs whose data pointer is a CUdeviceptr.
35 | */
36 |
37 | typedef struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal;
38 |
39 | /**
40 | * This struct is allocated as AVHWDeviceContext.hwctx
41 | */
42 | typedef struct AVCUDADeviceContext {
43 | CUcontext cuda_ctx;
44 | AVCUDADeviceContextInternal *internal;
45 | } AVCUDADeviceContext;
46 |
47 | /**
48 | * AVHWFramesContext.hwctx is currently not used
49 | */
50 |
51 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */
52 |
--------------------------------------------------------------------------------
/inc_header/libavutil/hwcontext_qsv.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_QSV_H
20 | #define AVUTIL_HWCONTEXT_QSV_H
21 |
22 | #include
23 |
24 | /**
25 | * @file
26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV.
27 | *
28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must
29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct.
30 | */
31 |
32 | /**
33 | * This struct is allocated as AVHWDeviceContext.hwctx
34 | */
35 | typedef struct AVQSVDeviceContext {
36 | mfxSession session;
37 | } AVQSVDeviceContext;
38 |
39 | /**
40 | * This struct is allocated as AVHWFramesContext.hwctx
41 | */
42 | typedef struct AVQSVFramesContext {
43 | mfxFrameSurface1 *surfaces;
44 | int nb_surfaces;
45 |
46 | /**
47 | * A combination of MFX_MEMTYPE_* describing the frame pool.
48 | */
49 | int frame_type;
50 | } AVQSVFramesContext;
51 |
52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */
53 |
54 |
--------------------------------------------------------------------------------
/inc_header/libavutil/replaygain.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_REPLAYGAIN_H
20 | #define AVUTIL_REPLAYGAIN_H
21 |
22 | #include
23 |
24 | /**
25 | * ReplayGain information (see
26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification).
27 | * The size of this struct is a part of the public ABI.
28 | */
29 | typedef struct AVReplayGain {
30 | /**
31 | * Track replay gain in microbels (divide by 100000 to get the value in dB).
32 | * Should be set to INT32_MIN when unknown.
33 | */
34 | int32_t track_gain;
35 | /**
36 | * Peak track amplitude, with 100000 representing full scale (but values
37 | * may overflow). 0 when unknown.
38 | */
39 | uint32_t track_peak;
40 | /**
41 | * Same as track_gain, but for the whole album.
42 | */
43 | int32_t album_gain;
44 | /**
45 | * Same as track_peak, but for the whole album,
46 | */
47 | uint32_t album_peak;
48 | } AVReplayGain;
49 |
50 | #endif /* AVUTIL_REPLAYGAIN_H */
51 |
--------------------------------------------------------------------------------
/r_sock.cpp:
--------------------------------------------------------------------------------
1 | #include "r_sock.h"
2 | #include
3 | #include
4 | #include "r_util.h"
5 |
6 | #ifdef _LINUX
7 | #include
8 | #endif
9 |
10 | r_sock::r_sock()
11 | #ifdef _WIN32
12 | : m_sock(INVALID_SOCKET)
13 | #else
14 | : m_sock(-1)
15 | #endif
16 | {
17 | }
18 |
19 | r_sock::~r_sock()
20 | {
21 | this->Close();
22 | }
23 |
24 | void r_sock::Close()
25 | {
26 | if(this->Valid())
27 | {
28 | #ifdef _WIN32
29 | closesocket(m_sock);
30 | m_sock = INVALID_SOCKET;
31 | #else
32 | close(m_sock);
33 | m_sock = -1;
34 | #endif
35 | }
36 | }
37 |
38 | bool r_sock::Valid()
39 | {
40 | #ifdef _WIN32
41 | return m_sock != INVALID_SOCKET;
42 | #else
43 | return m_sock != -1;
44 | #endif // _WIN32
45 | }
46 |
47 | int r_sock::Connect(r_string& host, int port )
48 | {
49 | m_sock = socket(AF_INET, SOCK_STREAM, 0);
50 | if(!this->Valid())
51 | {
52 | r_log("fail to create sock, err:%d\n", errno);
53 | return -1;
54 | }
55 |
56 | struct sockaddr_in server_addr;
57 | memset(&server_addr, 0, sizeof(server_addr));
58 | server_addr.sin_family = AF_INET;
59 | server_addr.sin_addr.s_addr = inet_addr(host.c_str());
60 | server_addr.sin_port = htons(port);
61 |
62 | int ret = connect(m_sock, (struct sockaddr*)&server_addr, sizeof(server_addr));
63 | if(ret)
64 | {
65 | r_log("fail to connect %s:%d, err:%d\n", host.c_str(), port, errno);
66 | this->Close();
67 | return -1;
68 | }
69 |
70 | return 0;
71 | }
72 |
73 | int r_sock::Send(const char* buf, int size)
74 | {
75 | return send(m_sock, buf, size, 0);
76 | }
77 |
78 | int r_sock::Recv(char* buf, int size)
79 | {
80 | return recv(m_sock, buf, size, 0);
81 | }
82 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/jni.h:
--------------------------------------------------------------------------------
1 | /*
2 | * JNI public API functions
3 | *
4 | * Copyright (c) 2015-2016 Matthieu Bouron
5 | *
6 | * This file is part of FFmpeg.
7 | *
8 | * FFmpeg is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * FFmpeg is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with FFmpeg; if not, write to the Free Software
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 | */
22 |
23 | #ifndef AVCODEC_JNI_H
24 | #define AVCODEC_JNI_H
25 |
26 | /*
27 | * Manually set a Java virtual machine which will be used to retrieve the JNI
28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning
29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer
30 | * however it will error out if you try to set a different Java VM.
31 | *
32 | * @param vm Java virtual machine
33 | * @param log_ctx context used for logging, can be NULL
34 | * @return 0 on success, < 0 otherwise
35 | */
36 | int av_jni_set_java_vm(void *vm, void *log_ctx);
37 |
38 | /*
39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm.
40 | *
41 | * @param vm Java virtual machine
42 | * @return a pointer to the Java virtual machine
43 | */
44 | void *av_jni_get_java_vm(void *log_ctx);
45 |
46 | #endif /* AVCODEC_JNI_H */
47 |
--------------------------------------------------------------------------------
/r_util.cpp:
--------------------------------------------------------------------------------
1 | #include "r_util.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | void SkipSpace(char*& p)
12 | {
13 | while(*p == ' ')
14 | ++p;
15 | }
16 |
17 | int SkipLine(char*& p)
18 | {
19 | char* pp = strstr(p, "\r\n");
20 | if(pp)
21 | {
22 | p = pp + strlen("\r\n");
23 | return 0;
24 | }
25 |
26 | return -1;
27 | }
28 |
29 | int get_rtsp_addr(r_string& url, r_string& host, int& port)
30 | {
31 | port = 554;
32 |
33 | if(0 != memcmp(url.c_str(), "rtsp://", strlen("rtsp://")))
34 | {
35 | r_log("%s illegal\n", url.c_str());
36 | return -1;
37 | }
38 |
39 | char* start = url.Data() + strlen("rtsp://");
40 | char* p = strchr(start, ':');
41 | if(p)
42 | {
43 | host.assign(start, p - start);
44 | ++p;
45 | port = atoi(p);
46 | }
47 | else
48 | {
49 | p = strchr(start, '/');
50 | if(p)
51 | {
52 | host.assign(start, p - start);
53 | }
54 | else
55 | {
56 | host.assign(start, url.Size() - (start - url.c_str()));
57 | }
58 | }
59 |
60 | r_log("host:%s, port:%d\n", host.c_str(), port);
61 | return 0;
62 | }
63 |
64 | void r_log(const char* pszFormat, ...)
65 | {
66 | va_list pArgs;
67 |
68 | char szMessageBuffer[64]={0};
69 | va_start( pArgs, pszFormat );
70 | _vsnprintf( szMessageBuffer, 64, pszFormat, pArgs );
71 | va_end( pArgs );
72 |
73 | TCHAR buf[64] = {0};
74 |
75 | #ifdef UNICODE
76 | MultiByteToWideChar(CP_ACP, 0, szMessageBuffer, -1, buf, 64);
77 | #else
78 | strcpy(buf, strszMessageBufferUsr);
79 | #endif
80 |
81 | OutputDebugString(buf);
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/inc_header/libswresample/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version macros.
3 | *
4 | * This file is part of libswresample
5 | *
6 | * libswresample is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * libswresample is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with libswresample; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef SWRESAMPLE_VERSION_H
22 | #define SWRESAMPLE_VERSION_H
23 |
24 | /**
25 | * @file
26 | * Libswresample version macros
27 | */
28 |
29 | #include "libavutil/avutil.h"
30 |
31 | #define LIBSWRESAMPLE_VERSION_MAJOR 2
32 | #define LIBSWRESAMPLE_VERSION_MINOR 7
33 | #define LIBSWRESAMPLE_VERSION_MICRO 100
34 |
35 | #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
36 | LIBSWRESAMPLE_VERSION_MINOR, \
37 | LIBSWRESAMPLE_VERSION_MICRO)
38 | #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \
39 | LIBSWRESAMPLE_VERSION_MINOR, \
40 | LIBSWRESAMPLE_VERSION_MICRO)
41 | #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT
42 |
43 | #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION)
44 |
45 | #endif /* SWRESAMPLE_VERSION_H */
46 |
--------------------------------------------------------------------------------
/inc_header/libavutil/adler32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Mans Rullgard
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | /**
22 | * @file
23 | * @ingroup lavu_adler32
24 | * Public header for Adler-32 hash function implementation.
25 | */
26 |
27 | #ifndef AVUTIL_ADLER32_H
28 | #define AVUTIL_ADLER32_H
29 |
30 | #include
31 | #include "attributes.h"
32 |
33 | /**
34 | * @defgroup lavu_adler32 Adler-32
35 | * @ingroup lavu_hash
36 | * Adler-32 hash function implementation.
37 | *
38 | * @{
39 | */
40 |
41 | /**
42 | * Calculate the Adler32 checksum of a buffer.
43 | *
44 | * Passing the return value to a subsequent av_adler32_update() call
45 | * allows the checksum of multiple buffers to be calculated as though
46 | * they were concatenated.
47 | *
48 | * @param adler initial checksum value
49 | * @param buf pointer to input buffer
50 | * @param len size of input buffer
51 | * @return updated checksum
52 | */
53 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
54 | unsigned int len) av_pure;
55 |
56 | /**
57 | * @}
58 | */
59 |
60 | #endif /* AVUTIL_ADLER32_H */
61 |
--------------------------------------------------------------------------------
/inc_header/libpostproc/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 POSTPROC_VERSION_H
22 | #define POSTPROC_VERSION_H
23 |
24 | /**
25 | * @file
26 | * Libpostproc version macros
27 | */
28 |
29 | #include "libavutil/avutil.h"
30 |
31 | #define LIBPOSTPROC_VERSION_MAJOR 54
32 | #define LIBPOSTPROC_VERSION_MINOR 5
33 | #define LIBPOSTPROC_VERSION_MICRO 100
34 |
35 | #define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
36 | LIBPOSTPROC_VERSION_MINOR, \
37 | LIBPOSTPROC_VERSION_MICRO)
38 | #define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
39 | LIBPOSTPROC_VERSION_MINOR, \
40 | LIBPOSTPROC_VERSION_MICRO)
41 | #define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT
42 |
43 | #define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
44 |
45 | #ifndef FF_API_QP_TYPE
46 | #define FF_API_QP_TYPE (LIBPOSTPROC_VERSION_MAJOR < 55)
47 | #endif
48 |
49 | #endif /* POSTPROC_VERSION_H */
50 |
--------------------------------------------------------------------------------
/inc_header/libavutil/motion_vector.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_MOTION_VECTOR_H
20 | #define AVUTIL_MOTION_VECTOR_H
21 |
22 | #include
23 |
24 | typedef struct AVMotionVector {
25 | /**
26 | * Where the current macroblock comes from; negative value when it comes
27 | * from the past, positive value when it comes from the future.
28 | * XXX: set exact relative ref frame reference instead of a +/- 1 "direction".
29 | */
30 | int32_t source;
31 | /**
32 | * Width and height of the block.
33 | */
34 | uint8_t w, h;
35 | /**
36 | * Absolute source position. Can be outside the frame area.
37 | */
38 | int16_t src_x, src_y;
39 | /**
40 | * Absolute destination position. Can be outside the frame area.
41 | */
42 | int16_t dst_x, dst_y;
43 | /**
44 | * Extra flag information.
45 | * Currently unused.
46 | */
47 | uint64_t flags;
48 | /**
49 | * Motion vector
50 | * src_x = dst_x + motion_x / motion_scale
51 | * src_y = dst_y + motion_y / motion_scale
52 | */
53 | int32_t motion_x, motion_y;
54 | uint16_t motion_scale;
55 | } AVMotionVector;
56 |
57 | #endif /* AVUTIL_MOTION_VECTOR_H */
58 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/inc_header/inttypes.h:
--------------------------------------------------------------------------------
1 | #ifndef _CYGWIN_INTTYPES_H
2 | #define _CYGWIN_INTTYPES_H
3 | /* /usr/include/inttypes.h for CYGWIN
4 | * Copyleft 2001-2002 by Felix Buenemann
5 | *
6 | */
7 | #include
8 |
9 | typedef signed char int8_t;
10 | typedef unsigned char uint8_t;
11 | typedef short int int16_t;
12 | typedef unsigned short uint16_t;
13 | typedef int int32_t;
14 | typedef unsigned int uint32_t;
15 | #ifndef WIN64
16 | typedef signed int intptr_t;
17 | typedef unsigned int uintptr_t;
18 | #endif
19 |
20 | #ifdef _MSC_VER
21 | typedef __int64 int64_t;
22 | typedef unsigned __int64 uint64_t;
23 | #else
24 | typedef long long int64_t;
25 | typedef unsigned long long uint64_t;
26 | #endif
27 |
28 | #ifndef WIN64
29 | #define __WORDSIZE 32
30 | #else
31 | #define __WORDSIZE 64
32 | #endif
33 | /*
34 | typedef unsigned short UINT16;
35 | typedef signed short INT16;
36 | typedef unsigned char UINT8;
37 | typedef unsigned int UINT32;
38 | typedef uint64_t UINT64;
39 | typedef signed char INT8;
40 | typedef signed int INT32;
41 | typedef int64_t INT64;
42 |
43 | typedef long _ssize_t;
44 | typedef _ssize_t ssize_t;
45 | */
46 |
47 | #define PRId64 "I64d"
48 | #define PRIx64 "I64x"
49 |
50 | #ifndef M_PI
51 | #define M_PI 3.14159265358979323846
52 | #endif
53 |
54 | #ifndef M_E
55 | #define M_E 2.718281828459
56 | #endif
57 |
58 | #ifndef _I64_MIN
59 | #define _I64_MIN (-9223372036854775807LL-1)
60 | #endif
61 |
62 | #ifndef _I64_MAX
63 | #define _I64_MAX 9223372036854775807LL
64 | #endif
65 |
66 | #ifndef _UI32_MAX
67 | #define _UI32_MAX 0xffffffffL
68 | #endif
69 |
70 | #ifndef INT32_MIN
71 | #define INT32_MIN (-2147483647 - 1)
72 | #endif
73 |
74 | #ifndef INT32_MAX
75 | #define INT32_MAX 2147483647
76 | #endif
77 |
78 | #ifndef INT_MIN
79 | #define INT_MIN INT32_MIN
80 | #endif
81 |
82 | #ifndef INT_MAX
83 | #define INT_MAX INT32_MAX
84 | #endif
85 |
86 | #ifndef INT16_MIN
87 | #define INT16_MIN (-0x7fff-1)
88 | #endif
89 |
90 | #ifndef INT16_MAX
91 | #define INT16_MAX 0x7fff
92 | #endif
93 |
94 | #endif
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/inc_header/libavdevice/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVDEVICE_VERSION_H
20 | #define AVDEVICE_VERSION_H
21 |
22 | /**
23 | * @file
24 | * @ingroup lavd
25 | * Libavdevice version macros
26 | */
27 |
28 | #include "libavutil/version.h"
29 |
30 | #define LIBAVDEVICE_VERSION_MAJOR 57
31 | #define LIBAVDEVICE_VERSION_MINOR 6
32 | #define LIBAVDEVICE_VERSION_MICRO 100
33 |
34 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
35 | LIBAVDEVICE_VERSION_MINOR, \
36 | LIBAVDEVICE_VERSION_MICRO)
37 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
38 | LIBAVDEVICE_VERSION_MINOR, \
39 | LIBAVDEVICE_VERSION_MICRO)
40 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
41 |
42 | #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION)
43 |
44 | /**
45 | * FF_API_* defines may be placed below to indicate public API that will be
46 | * dropped at a future version bump. The defines themselves are not part of
47 | * the public API and may change, break or disappear at any time.
48 | */
49 |
50 | #endif /* AVDEVICE_VERSION_H */
51 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/inc_header/libswscale/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef SWSCALE_VERSION_H
20 | #define SWSCALE_VERSION_H
21 |
22 | /**
23 | * @file
24 | * swscale version macros
25 | */
26 |
27 | #include "libavutil/version.h"
28 |
29 | #define LIBSWSCALE_VERSION_MAJOR 4
30 | #define LIBSWSCALE_VERSION_MINOR 6
31 | #define LIBSWSCALE_VERSION_MICRO 100
32 |
33 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
34 | LIBSWSCALE_VERSION_MINOR, \
35 | LIBSWSCALE_VERSION_MICRO)
36 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
37 | LIBSWSCALE_VERSION_MINOR, \
38 | LIBSWSCALE_VERSION_MICRO)
39 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
40 |
41 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
42 |
43 | /**
44 | * FF_API_* defines may be placed below to indicate public API that will be
45 | * dropped at a future version bump. The defines themselves are not part of
46 | * the public API and may change, break or disappear at any time.
47 | */
48 |
49 | #ifndef FF_API_SWS_VECTOR
50 | #define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6)
51 | #endif
52 |
53 | #endif /* SWSCALE_VERSION_H */
54 |
--------------------------------------------------------------------------------
/inc_header/libavutil/rc4.h:
--------------------------------------------------------------------------------
1 | /*
2 | * RC4 encryption/decryption/pseudo-random number generator
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_RC4_H
22 | #define AVUTIL_RC4_H
23 |
24 | #include
25 |
26 | /**
27 | * @defgroup lavu_rc4 RC4
28 | * @ingroup lavu_crypto
29 | * @{
30 | */
31 |
32 | typedef struct AVRC4 {
33 | uint8_t state[256];
34 | int x, y;
35 | } AVRC4;
36 |
37 | /**
38 | * Allocate an AVRC4 context.
39 | */
40 | AVRC4 *av_rc4_alloc(void);
41 |
42 | /**
43 | * @brief Initializes an AVRC4 context.
44 | *
45 | * @param key_bits must be a multiple of 8
46 | * @param decrypt 0 for encryption, 1 for decryption, currently has no effect
47 | * @return zero on success, negative value otherwise
48 | */
49 | int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt);
50 |
51 | /**
52 | * @brief Encrypts / decrypts using the RC4 algorithm.
53 | *
54 | * @param count number of bytes
55 | * @param dst destination array, can be equal to src
56 | * @param src source array, can be equal to dst, may be NULL
57 | * @param iv not (yet) used for RC4, should be NULL
58 | * @param decrypt 0 for encryption, 1 for decryption, not (yet) used
59 | */
60 | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | #endif /* AVUTIL_RC4_H */
67 |
--------------------------------------------------------------------------------
/libyuv/source/video_common.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/video_common.h"
12 |
13 | #ifdef __cplusplus
14 | namespace libyuv {
15 | extern "C" {
16 | #endif
17 |
18 | struct FourCCAliasEntry {
19 | uint32_t alias;
20 | uint32_t canonical;
21 | };
22 |
23 | #define NUM_ALIASES 18
24 | static const struct FourCCAliasEntry kFourCCAliases[NUM_ALIASES] = {
25 | {FOURCC_IYUV, FOURCC_I420},
26 | {FOURCC_YU12, FOURCC_I420},
27 | {FOURCC_YU16, FOURCC_I422},
28 | {FOURCC_YU24, FOURCC_I444},
29 | {FOURCC_YUYV, FOURCC_YUY2},
30 | {FOURCC_YUVS, FOURCC_YUY2}, // kCMPixelFormat_422YpCbCr8_yuvs
31 | {FOURCC_HDYC, FOURCC_UYVY},
32 | {FOURCC_2VUY, FOURCC_UYVY}, // kCMPixelFormat_422YpCbCr8
33 | {FOURCC_JPEG, FOURCC_MJPG}, // Note: JPEG has DHT while MJPG does not.
34 | {FOURCC_DMB1, FOURCC_MJPG},
35 | {FOURCC_BA81, FOURCC_BGGR}, // deprecated.
36 | {FOURCC_RGB3, FOURCC_RAW},
37 | {FOURCC_BGR3, FOURCC_24BG},
38 | {FOURCC_CM32, FOURCC_BGRA}, // kCMPixelFormat_32ARGB
39 | {FOURCC_CM24, FOURCC_RAW}, // kCMPixelFormat_24RGB
40 | {FOURCC_L555, FOURCC_RGBO}, // kCMPixelFormat_16LE555
41 | {FOURCC_L565, FOURCC_RGBP}, // kCMPixelFormat_16LE565
42 | {FOURCC_5551, FOURCC_RGBO}, // kCMPixelFormat_16LE5551
43 | };
44 | // TODO(fbarchard): Consider mapping kCMPixelFormat_32BGRA to FOURCC_ARGB.
45 | // {FOURCC_BGRA, FOURCC_ARGB}, // kCMPixelFormat_32BGRA
46 |
47 | LIBYUV_API
48 | uint32_t CanonicalFourCC(uint32_t fourcc) {
49 | int i;
50 | for (i = 0; i < NUM_ALIASES; ++i) {
51 | if (kFourCCAliases[i].alias == fourcc) {
52 | return kFourCCAliases[i].canonical;
53 | }
54 | }
55 | // Not an alias, so return it as-is.
56 | return fourcc;
57 | }
58 |
59 | #ifdef __cplusplus
60 | } // extern "C"
61 | } // namespace libyuv
62 | #endif
63 |
--------------------------------------------------------------------------------
/inc_header/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<
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 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/inc_lib/avfilter-6.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | av_abuffersink_params_alloc
3 | av_buffersink_get_channel_layout
4 | av_buffersink_get_channels
5 | av_buffersink_get_format
6 | av_buffersink_get_frame
7 | av_buffersink_get_frame_flags
8 | av_buffersink_get_frame_rate
9 | av_buffersink_get_h
10 | av_buffersink_get_hw_frames_ctx
11 | av_buffersink_get_sample_aspect_ratio
12 | av_buffersink_get_sample_rate
13 | av_buffersink_get_samples
14 | av_buffersink_get_time_base
15 | av_buffersink_get_type
16 | av_buffersink_get_w
17 | av_buffersink_params_alloc
18 | av_buffersink_set_frame_size
19 | av_buffersrc_add_frame
20 | av_buffersrc_add_frame_flags
21 | av_buffersrc_get_nb_failed_requests
22 | av_buffersrc_parameters_alloc
23 | av_buffersrc_parameters_set
24 | av_buffersrc_write_frame
25 | av_filter_ffversion DATA
26 | av_filter_next
27 | avfilter_add_matrix
28 | avfilter_all_channel_layouts DATA
29 | avfilter_config_links
30 | avfilter_configuration
31 | avfilter_free
32 | avfilter_get_by_name
33 | avfilter_get_class
34 | avfilter_get_matrix
35 | avfilter_graph_add_filter
36 | avfilter_graph_alloc
37 | avfilter_graph_alloc_filter
38 | avfilter_graph_config
39 | avfilter_graph_create_filter
40 | avfilter_graph_dump
41 | avfilter_graph_free
42 | avfilter_graph_get_filter
43 | avfilter_graph_parse
44 | avfilter_graph_parse2
45 | avfilter_graph_parse_ptr
46 | avfilter_graph_queue_command
47 | avfilter_graph_request_oldest
48 | avfilter_graph_send_command
49 | avfilter_graph_set_auto_convert
50 | avfilter_init_dict
51 | avfilter_init_filter
52 | avfilter_init_str
53 | avfilter_inout_alloc
54 | avfilter_inout_free
55 | avfilter_insert_filter
56 | avfilter_license
57 | avfilter_link
58 | avfilter_link_free
59 | avfilter_link_get_channels
60 | avfilter_link_set_closed
61 | avfilter_make_format64_list
62 | avfilter_mul_matrix
63 | avfilter_next
64 | avfilter_open
65 | avfilter_pad_count
66 | avfilter_pad_get_name
67 | avfilter_pad_get_type
68 | avfilter_process_command
69 | avfilter_register
70 | avfilter_register_all
71 | avfilter_sub_matrix
72 | avfilter_transform
73 | avfilter_uninit
74 | avfilter_version
75 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/libyuv/include/libyuv/basic_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_
12 | #define INCLUDE_LIBYUV_BASIC_TYPES_H_
13 |
14 | #include // For size_t and NULL
15 |
16 | #if !defined(INT_TYPES_DEFINED) && !defined(GG_LONGLONG)
17 | #define INT_TYPES_DEFINED
18 |
19 | #if defined(_MSC_VER) && (_MSC_VER < 1600)
20 | #include // for uintptr_t on x86
21 | typedef unsigned __int64 uint64_t;
22 | typedef __int64 int64_t;
23 | typedef unsigned int uint32_t;
24 | typedef int int32_t;
25 | typedef unsigned short uint16_t;
26 | typedef short int16_t;
27 | typedef unsigned char uint8_t;
28 | typedef signed char int8_t;
29 | #else
30 | #include // for uintptr_t and C99 types
31 | #endif // defined(_MSC_VER) && (_MSC_VER < 1600)
32 | // Types are deprecated. Enable this macro for legacy types.
33 | #ifdef LIBYUV_LEGACY_TYPES
34 | typedef uint64_t uint64;
35 | typedef int64_t int64;
36 | typedef uint32_t uint32;
37 | typedef int32_t int32;
38 | typedef uint16_t uint16;
39 | typedef int16_t int16;
40 | typedef uint8_t uint8;
41 | typedef int8_t int8;
42 | #endif // LIBYUV_LEGACY_TYPES
43 | #endif // INT_TYPES_DEFINED
44 |
45 | #if !defined(LIBYUV_API)
46 | #if defined(_WIN32) || defined(__CYGWIN__)
47 | #if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
48 | #define LIBYUV_API __declspec(dllexport)
49 | #elif defined(LIBYUV_USING_SHARED_LIBRARY)
50 | #define LIBYUV_API __declspec(dllimport)
51 | #else
52 | #define LIBYUV_API
53 | #endif // LIBYUV_BUILDING_SHARED_LIBRARY
54 | #elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__APPLE__) && \
55 | (defined(LIBYUV_BUILDING_SHARED_LIBRARY) || \
56 | defined(LIBYUV_USING_SHARED_LIBRARY))
57 | #define LIBYUV_API __attribute__((visibility("default")))
58 | #else
59 | #define LIBYUV_API
60 | #endif // __GNUC__
61 | #endif // LIBYUV_API
62 |
63 | // TODO(fbarchard): Remove bool macros.
64 | #define LIBYUV_BOOL int
65 | #define LIBYUV_FALSE 0
66 | #define LIBYUV_TRUE 1
67 |
68 | #endif // INCLUDE_LIBYUV_BASIC_TYPES_H_
69 |
--------------------------------------------------------------------------------
/inc_header/libavutil/aes_ctr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * AES-CTR cipher
3 | * Copyright (c) 2015 Eran Kornblau
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_AES_CTR_H
23 | #define AVUTIL_AES_CTR_H
24 |
25 | #include
26 |
27 | #include "attributes.h"
28 | #include "version.h"
29 |
30 | #define AES_CTR_KEY_SIZE (16)
31 | #define AES_CTR_IV_SIZE (8)
32 |
33 | struct AVAESCTR;
34 |
35 | /**
36 | * Allocate an AVAESCTR context.
37 | */
38 | struct AVAESCTR *av_aes_ctr_alloc(void);
39 |
40 | /**
41 | * Initialize an AVAESCTR context.
42 | * @param key encryption key, must have a length of AES_CTR_KEY_SIZE
43 | */
44 | int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key);
45 |
46 | /**
47 | * Release an AVAESCTR context.
48 | */
49 | void av_aes_ctr_free(struct AVAESCTR *a);
50 |
51 | /**
52 | * Process a buffer using a previously initialized context.
53 | * @param dst destination array, can be equal to src
54 | * @param src source array, can be equal to dst
55 | * @param size the size of src and dst
56 | */
57 | void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size);
58 |
59 | /**
60 | * Get the current iv
61 | */
62 | const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a);
63 |
64 | /**
65 | * Generate a random iv
66 | */
67 | void av_aes_ctr_set_random_iv(struct AVAESCTR *a);
68 |
69 | /**
70 | * Forcefully change the iv
71 | */
72 | void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv);
73 |
74 | /**
75 | * Increment the top 64 bit of the iv (performed after each frame)
76 | */
77 | void av_aes_ctr_increment_iv(struct AVAESCTR *a);
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | #endif /* AVUTIL_AES_CTR_H */
84 |
--------------------------------------------------------------------------------
/inc_header/libavutil/md5.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Michael Niedermayer
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | /**
22 | * @file
23 | * @ingroup lavu_md5
24 | * Public header for MD5 hash function implementation.
25 | */
26 |
27 | #ifndef AVUTIL_MD5_H
28 | #define AVUTIL_MD5_H
29 |
30 | #include
31 |
32 | #include "attributes.h"
33 | #include "version.h"
34 |
35 | /**
36 | * @defgroup lavu_md5 MD5
37 | * @ingroup lavu_hash
38 | * MD5 hash function implementation.
39 | *
40 | * @{
41 | */
42 |
43 | extern const int av_md5_size;
44 |
45 | struct AVMD5;
46 |
47 | /**
48 | * Allocate an AVMD5 context.
49 | */
50 | struct AVMD5 *av_md5_alloc(void);
51 |
52 | /**
53 | * Initialize MD5 hashing.
54 | *
55 | * @param ctx pointer to the function context (of size av_md5_size)
56 | */
57 | void av_md5_init(struct AVMD5 *ctx);
58 |
59 | /**
60 | * Update hash value.
61 | *
62 | * @param ctx hash function context
63 | * @param src input data to update hash with
64 | * @param len input data length
65 | */
66 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
67 |
68 | /**
69 | * Finish hashing and output digest value.
70 | *
71 | * @param ctx hash function context
72 | * @param dst buffer where output digest value is stored
73 | */
74 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
75 |
76 | /**
77 | * Hash an array of data.
78 | *
79 | * @param dst The output buffer to write the digest into
80 | * @param src The data to hash
81 | * @param len The length of the data, in bytes
82 | */
83 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | #endif /* AVUTIL_MD5_H */
90 |
--------------------------------------------------------------------------------
/inc_header/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 | #include
26 |
27 | typedef struct AVLFG {
28 | unsigned int state[64];
29 | int index;
30 | } AVLFG;
31 |
32 | void av_lfg_init(AVLFG *c, unsigned int seed);
33 |
34 | /**
35 | * Seed the state of the ALFG using binary data.
36 | *
37 | * Return value: 0 on success, negative value (AVERROR) on failure.
38 | */
39 | int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
40 |
41 | /**
42 | * Get the next random unsigned 32-bit number using an ALFG.
43 | *
44 | * Please also consider a simple LCG like state= state*1664525+1013904223,
45 | * it may be good enough and faster for your specific use case.
46 | */
47 | static inline unsigned int av_lfg_get(AVLFG *c){
48 | c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
49 | return c->state[c->index++ & 63];
50 | }
51 |
52 | /**
53 | * Get the next random unsigned 32-bit number using a MLFG.
54 | *
55 | * Please also consider av_lfg_get() above, it is faster.
56 | */
57 | static inline unsigned int av_mlfg_get(AVLFG *c){
58 | unsigned int a= c->state[(c->index-55) & 63];
59 | unsigned int b= c->state[(c->index-24) & 63];
60 | return c->state[c->index++ & 63] = 2*a*b+a+b;
61 | }
62 |
63 | /**
64 | * Get the next two numbers generated by a Box-Muller Gaussian
65 | * generator using the random numbers issued by lfg.
66 | *
67 | * @param out array where the two generated numbers are placed
68 | */
69 | void av_bmg_get(AVLFG *lfg, double out[2]);
70 |
71 | #endif /* AVUTIL_LFG_H */
72 |
--------------------------------------------------------------------------------
/inc_header/libavutil/ripemd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Michael Niedermayer
3 | * Copyright (C) 2013 James Almer
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | /**
23 | * @file
24 | * @ingroup lavu_ripemd
25 | * Public header for RIPEMD hash function implementation.
26 | */
27 |
28 | #ifndef AVUTIL_RIPEMD_H
29 | #define AVUTIL_RIPEMD_H
30 |
31 | #include
32 |
33 | #include "attributes.h"
34 | #include "version.h"
35 |
36 | /**
37 | * @defgroup lavu_ripemd RIPEMD
38 | * @ingroup lavu_hash
39 | * RIPEMD hash function implementation.
40 | *
41 | * @{
42 | */
43 |
44 | extern const int av_ripemd_size;
45 |
46 | struct AVRIPEMD;
47 |
48 | /**
49 | * Allocate an AVRIPEMD context.
50 | */
51 | struct AVRIPEMD *av_ripemd_alloc(void);
52 |
53 | /**
54 | * Initialize RIPEMD hashing.
55 | *
56 | * @param context pointer to the function context (of size av_ripemd_size)
57 | * @param bits number of bits in digest (128, 160, 256 or 320 bits)
58 | * @return zero if initialization succeeded, -1 otherwise
59 | */
60 | int av_ripemd_init(struct AVRIPEMD* context, int bits);
61 |
62 | /**
63 | * Update hash value.
64 | *
65 | * @param context hash function context
66 | * @param data input data to update hash with
67 | * @param len input data length
68 | */
69 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len);
70 |
71 | /**
72 | * Finish hashing and output digest value.
73 | *
74 | * @param context hash function context
75 | * @param digest buffer where output digest value is stored
76 | */
77 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest);
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | #endif /* AVUTIL_RIPEMD_H */
84 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/libyuv/source/mjpeg_validate.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/mjpeg_decoder.h"
12 |
13 | #include // For memchr.
14 |
15 | #ifdef __cplusplus
16 | namespace libyuv {
17 | extern "C" {
18 | #endif
19 |
20 | // Helper function to scan for EOI marker (0xff 0xd9).
21 | static LIBYUV_BOOL ScanEOI(const uint8_t* src_mjpg, size_t src_size_mjpg) {
22 | if (src_size_mjpg >= 2) {
23 | const uint8_t* end = src_mjpg + src_size_mjpg - 1;
24 | const uint8_t* it = src_mjpg;
25 | while (it < end) {
26 | // TODO(fbarchard): scan for 0xd9 instead.
27 | it = (const uint8_t*)(memchr(it, 0xff, end - it));
28 | if (it == NULL) {
29 | break;
30 | }
31 | if (it[1] == 0xd9) {
32 | return LIBYUV_TRUE; // Success: Valid jpeg.
33 | }
34 | ++it; // Skip over current 0xff.
35 | }
36 | }
37 | // ERROR: Invalid jpeg end code not found. Size src_size_mjpg
38 | return LIBYUV_FALSE;
39 | }
40 |
41 | // Helper function to validate the jpeg appears intact.
42 | LIBYUV_BOOL ValidateJpeg(const uint8_t* src_mjpg, size_t src_size_mjpg) {
43 | // Maximum size that ValidateJpeg will consider valid.
44 | const size_t kMaxJpegSize = 0x7fffffffull;
45 | const size_t kBackSearchSize = 1024;
46 | if (src_size_mjpg < 64 || src_size_mjpg > kMaxJpegSize || !src_mjpg) {
47 | // ERROR: Invalid jpeg size: src_size_mjpg
48 | return LIBYUV_FALSE;
49 | }
50 | if (src_mjpg[0] != 0xff || src_mjpg[1] != 0xd8) { // SOI marker
51 | // ERROR: Invalid jpeg initial start code
52 | return LIBYUV_FALSE;
53 | }
54 |
55 | // Look for the End Of Image (EOI) marker near the end of the buffer.
56 | if (src_size_mjpg > kBackSearchSize) {
57 | if (ScanEOI(src_mjpg + src_size_mjpg - kBackSearchSize, kBackSearchSize)) {
58 | return LIBYUV_TRUE; // Success: Valid jpeg.
59 | }
60 | // Reduce search size for forward search.
61 | src_size_mjpg = src_size_mjpg - kBackSearchSize + 1;
62 | }
63 | // Step over SOI marker and scan for EOI.
64 | return ScanEOI(src_mjpg + 2, src_size_mjpg - 2);
65 | }
66 |
67 | #ifdef __cplusplus
68 | } // extern "C"
69 | } // namespace libyuv
70 | #endif
71 |
--------------------------------------------------------------------------------
/inc_header/libavutil/base64.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_BASE64_H
22 | #define AVUTIL_BASE64_H
23 |
24 | #include
25 |
26 | /**
27 | * @defgroup lavu_base64 Base64
28 | * @ingroup lavu_crypto
29 | * @{
30 | */
31 |
32 | /**
33 | * Decode a base64-encoded string.
34 | *
35 | * @param out buffer for decoded data
36 | * @param in null-terminated input string
37 | * @param out_size size in bytes of the out buffer, must be at
38 | * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
39 | * @return number of bytes written, or a negative value in case of
40 | * invalid input
41 | */
42 | int av_base64_decode(uint8_t *out, const char *in, int out_size);
43 |
44 | /**
45 | * Calculate the output size in bytes needed to decode a base64 string
46 | * with length x to a data buffer.
47 | */
48 | #define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
49 |
50 | /**
51 | * Encode data to base64 and null-terminate.
52 | *
53 | * @param out buffer for encoded data
54 | * @param out_size size in bytes of the out buffer (including the
55 | * null terminator), must be at least AV_BASE64_SIZE(in_size)
56 | * @param in input buffer containing the data to encode
57 | * @param in_size size in bytes of the in buffer
58 | * @return out or NULL in case of error
59 | */
60 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
61 |
62 | /**
63 | * Calculate the output size needed to base64-encode x bytes to a
64 | * null-terminated string.
65 | */
66 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
67 |
68 | /**
69 | * @}
70 | */
71 |
72 | #endif /* AVUTIL_BASE64_H */
73 |
--------------------------------------------------------------------------------
/inc_header/libavutil/hwcontext_dxva2.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 |
20 | #ifndef AVUTIL_HWCONTEXT_DXVA2_H
21 | #define AVUTIL_HWCONTEXT_DXVA2_H
22 |
23 | /**
24 | * @file
25 | * An API-specific header for AV_HWDEVICE_TYPE_DXVA2.
26 | *
27 | * Only fixed-size pools are supported.
28 | *
29 | * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
30 | * with the data pointer set to a pointer to IDirect3DSurface9.
31 | */
32 |
33 | #include
34 | #include
35 |
36 | /**
37 | * This struct is allocated as AVHWDeviceContext.hwctx
38 | */
39 | typedef struct AVDXVA2DeviceContext {
40 | IDirect3DDeviceManager9 *devmgr;
41 | } AVDXVA2DeviceContext;
42 |
43 | /**
44 | * This struct is allocated as AVHWFramesContext.hwctx
45 | */
46 | typedef struct AVDXVA2FramesContext {
47 | /**
48 | * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or
49 | * DXVA2_VideoDecoderRenderTarget). Must be set by the caller.
50 | */
51 | DWORD surface_type;
52 |
53 | /**
54 | * The surface pool. When an external pool is not provided by the caller,
55 | * this will be managed (allocated and filled on init, freed on uninit) by
56 | * libavutil.
57 | */
58 | IDirect3DSurface9 **surfaces;
59 | int nb_surfaces;
60 |
61 | /**
62 | * Certain drivers require the decoder to be destroyed before the surfaces.
63 | * To allow internally managed pools to work properly in such cases, this
64 | * field is provided.
65 | *
66 | * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on
67 | * it just before the internal surface pool is freed.
68 | */
69 | IDirectXVideoDecoder *decoder_to_release;
70 | } AVDXVA2FramesContext;
71 |
72 | #endif /* AVUTIL_HWCONTEXT_DXVA2_H */
73 |
--------------------------------------------------------------------------------
/inc_header/libavutil/des.h:
--------------------------------------------------------------------------------
1 | /*
2 | * DES encryption/decryption
3 | * Copyright (c) 2007 Reimar Doeffinger
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_DES_H
23 | #define AVUTIL_DES_H
24 |
25 | #include
26 |
27 | /**
28 | * @defgroup lavu_des DES
29 | * @ingroup lavu_crypto
30 | * @{
31 | */
32 |
33 | typedef struct AVDES {
34 | uint64_t round_keys[3][16];
35 | int triple_des;
36 | } AVDES;
37 |
38 | /**
39 | * Allocate an AVDES context.
40 | */
41 | AVDES *av_des_alloc(void);
42 |
43 | /**
44 | * @brief Initializes an AVDES context.
45 | *
46 | * @param key_bits must be 64 or 192
47 | * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption
48 | * @return zero on success, negative value otherwise
49 | */
50 | int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt);
51 |
52 | /**
53 | * @brief Encrypts / decrypts using the DES algorithm.
54 | *
55 | * @param count number of 8 byte blocks
56 | * @param dst destination array, can be equal to src, must be 8-byte aligned
57 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
58 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used,
59 | * must be 8-byte aligned
60 | * @param decrypt 0 for encryption, 1 for decryption
61 | */
62 | void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
63 |
64 | /**
65 | * @brief Calculates CBC-MAC using the DES algorithm.
66 | *
67 | * @param count number of 8 byte blocks
68 | * @param dst destination array, can be equal to src, must be 8-byte aligned
69 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
70 | */
71 | void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count);
72 |
73 | /**
74 | * @}
75 | */
76 |
77 | #endif /* AVUTIL_DES_H */
78 |
--------------------------------------------------------------------------------
/inc_header/libavutil/avassert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2010 Michael Niedermayer
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | /**
22 | * @file
23 | * simple assert() macros that are a bit more flexible than ISO C assert().
24 | * @author Michael Niedermayer
25 | */
26 |
27 | #ifndef AVUTIL_AVASSERT_H
28 | #define AVUTIL_AVASSERT_H
29 |
30 | #include
31 | #include "avutil.h"
32 | #include "log.h"
33 |
34 | /**
35 | * assert() equivalent, that is always enabled.
36 | */
37 | #define av_assert0(cond) do { \
38 | if (!(cond)) { \
39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \
40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \
41 | abort(); \
42 | } \
43 | } while (0)
44 |
45 |
46 | /**
47 | * assert() equivalent, that does not lie in speed critical code.
48 | * These asserts() thus can be enabled without fearing speed loss.
49 | */
50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
51 | #define av_assert1(cond) av_assert0(cond)
52 | #else
53 | #define av_assert1(cond) ((void)0)
54 | #endif
55 |
56 |
57 | /**
58 | * assert() equivalent, that does lie in speed critical code.
59 | */
60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
61 | #define av_assert2(cond) av_assert0(cond)
62 | #define av_assert2_fpu() av_assert0_fpu()
63 | #else
64 | #define av_assert2(cond) ((void)0)
65 | #define av_assert2_fpu() ((void)0)
66 | #endif
67 |
68 | /**
69 | * Assert that floating point opperations can be executed.
70 | *
71 | * This will av_assert0() that the cpu is not in MMX state on X86
72 | */
73 | void av_assert0_fpu(void);
74 |
75 | #endif /* AVUTIL_AVASSERT_H */
76 |
--------------------------------------------------------------------------------
/ren_thread.cpp:
--------------------------------------------------------------------------------
1 | #include "ren_thread.h"
2 |
3 | extern "C"
4 | {
5 | #include "libavformat/avformat.h"
6 | };
7 |
8 | ren_thread::ren_thread()
9 | : m_head(NULL)
10 | {
11 | }
12 |
13 | ren_thread::~ren_thread()
14 | {
15 | this->ClearQue();
16 | }
17 |
18 | AVFrame* ren_thread::Deque()
19 | {
20 | AVFrame* pkt = NULL;
21 |
22 | while (true)
23 | {
24 | RLock();
25 |
26 | if(m_exit_flag)
27 | {
28 | this->ClearQue();
29 | RUnlock();
30 | return NULL;
31 | }
32 |
33 | if(m_head)
34 | {
35 | pkt = m_head->m_frame;
36 |
37 | if(m_head->m_next)
38 | {
39 | frame_queue* temp = m_head;
40 | m_head = m_head->m_next;
41 | free(temp);
42 | }
43 | else
44 | {
45 | free(m_head);
46 | m_head = NULL;
47 | }
48 |
49 | RUnlock();
50 | return pkt;
51 | }
52 | else
53 | {
54 | RUnlock();
55 | Sleep(10);
56 | }
57 | }
58 | }
59 |
60 | int ren_thread::Run()
61 | {
62 | AVFrame* frame = this->Deque();
63 |
64 | while(frame)
65 | {
66 | this->Render(frame);
67 | av_frame_unref(frame);
68 | av_frame_free(&frame);
69 | frame = this->Deque();
70 | }
71 | this->DestroyRender();
72 |
73 | return 0;
74 | }
75 |
76 | void ren_thread::ClearQue()
77 | {
78 | while (m_head)
79 | {
80 | frame_queue* p = m_head;
81 | m_head = m_head->m_next;
82 | av_frame_unref(p->m_frame);
83 | av_frame_free(&p->m_frame);
84 | free(p);
85 | }
86 | }
87 |
88 | void ren_thread::Enque(AVFrame* frame)
89 | {
90 | RLock();
91 |
92 | if(m_exit_flag)
93 | {
94 | RUnlock();
95 | av_frame_unref(frame);
96 | av_frame_free(&frame);
97 | return;
98 | }
99 |
100 | if (!m_head) {
101 | frame_queue* pp = (frame_queue*)malloc(sizeof(frame_queue));
102 | pp->m_frame = frame;
103 | pp->m_next = NULL;
104 | m_head = pp;
105 | }
106 | else
107 | {
108 | frame_queue* p = m_head;
109 | while(p->m_next) {
110 | p = p->m_next;
111 | }
112 |
113 | frame_queue* pp = (frame_queue*)malloc(sizeof(frame_queue));
114 | pp->m_frame = frame;
115 | pp->m_next = NULL;
116 | p->m_next = pp;
117 | }
118 |
119 | RUnlock();
120 | }
121 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/vorbis_parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * @file
21 | * A public API for Vorbis parsing
22 | *
23 | * Determines the duration for each packet.
24 | */
25 |
26 | #ifndef AVCODEC_VORBIS_PARSER_H
27 | #define AVCODEC_VORBIS_PARSER_H
28 |
29 | #include
30 |
31 | typedef struct AVVorbisParseContext AVVorbisParseContext;
32 |
33 | /**
34 | * Allocate and initialize the Vorbis parser using headers in the extradata.
35 | *
36 | * @param avctx codec context
37 | * @param s Vorbis parser context
38 | */
39 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata,
40 | int extradata_size);
41 |
42 | /**
43 | * Free the parser and everything associated with it.
44 | */
45 | void av_vorbis_parse_free(AVVorbisParseContext **s);
46 |
47 | #define VORBIS_FLAG_HEADER 0x00000001
48 | #define VORBIS_FLAG_COMMENT 0x00000002
49 | #define VORBIS_FLAG_SETUP 0x00000004
50 |
51 | /**
52 | * Get the duration for a Vorbis packet.
53 | *
54 | * If @p flags is @c NULL,
55 | * special frames are considered invalid.
56 | *
57 | * @param s Vorbis parser context
58 | * @param buf buffer containing a Vorbis frame
59 | * @param buf_size size of the buffer
60 | * @param flags flags for special frames
61 | */
62 | int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf,
63 | int buf_size, int *flags);
64 |
65 | /**
66 | * Get the duration for a Vorbis packet.
67 | *
68 | * @param s Vorbis parser context
69 | * @param buf buffer containing a Vorbis frame
70 | * @param buf_size size of the buffer
71 | */
72 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf,
73 | int buf_size);
74 |
75 | void av_vorbis_parse_reset(AVVorbisParseContext *s);
76 |
77 | #endif /* AVCODEC_VORBIS_PARSER_H */
78 |
--------------------------------------------------------------------------------
/inc_header/libavutil/blowfish.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Blowfish algorithm
3 | * Copyright (c) 2012 Samuel Pitoiset
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_BLOWFISH_H
23 | #define AVUTIL_BLOWFISH_H
24 |
25 | #include
26 |
27 | /**
28 | * @defgroup lavu_blowfish Blowfish
29 | * @ingroup lavu_crypto
30 | * @{
31 | */
32 |
33 | #define AV_BF_ROUNDS 16
34 |
35 | typedef struct AVBlowfish {
36 | uint32_t p[AV_BF_ROUNDS + 2];
37 | uint32_t s[4][256];
38 | } AVBlowfish;
39 |
40 | /**
41 | * Allocate an AVBlowfish context.
42 | */
43 | AVBlowfish *av_blowfish_alloc(void);
44 |
45 | /**
46 | * Initialize an AVBlowfish context.
47 | *
48 | * @param ctx an AVBlowfish context
49 | * @param key a key
50 | * @param key_len length of the key
51 | */
52 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len);
53 |
54 | /**
55 | * Encrypt or decrypt a buffer using a previously initialized context.
56 | *
57 | * @param ctx an AVBlowfish context
58 | * @param xl left four bytes halves of input to be encrypted
59 | * @param xr right four bytes halves of input to be encrypted
60 | * @param decrypt 0 for encryption, 1 for decryption
61 | */
62 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr,
63 | int decrypt);
64 |
65 | /**
66 | * Encrypt or decrypt a buffer using a previously initialized context.
67 | *
68 | * @param ctx an AVBlowfish context
69 | * @param dst destination array, can be equal to src
70 | * @param src source array, can be equal to dst
71 | * @param count number of 8 byte blocks
72 | * @param iv initialization vector for CBC mode, if NULL ECB will be used
73 | * @param decrypt 0 for encryption, 1 for decryption
74 | */
75 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
76 | int count, uint8_t *iv, int decrypt);
77 |
78 | /**
79 | * @}
80 | */
81 |
82 | #endif /* AVUTIL_BLOWFISH_H */
83 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/dxva2.h:
--------------------------------------------------------------------------------
1 | /*
2 | * DXVA2 HW acceleration
3 | *
4 | * copyright (c) 2009 Laurent Aimar
5 | *
6 | * This file is part of FFmpeg.
7 | *
8 | * FFmpeg is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * FFmpeg is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with FFmpeg; if not, write to the Free Software
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 | */
22 |
23 | #ifndef AVCODEC_DXVA2_H
24 | #define AVCODEC_DXVA2_H
25 |
26 | /**
27 | * @file
28 | * @ingroup lavc_codec_hwaccel_dxva2
29 | * Public libavcodec DXVA2 header.
30 | */
31 |
32 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
33 | #undef _WIN32_WINNT
34 | #define _WIN32_WINNT 0x0602
35 | #endif
36 |
37 | #include
38 | #include
39 | #include
40 |
41 | /**
42 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2
43 | * @ingroup lavc_codec_hwaccel
44 | *
45 | * @{
46 | */
47 |
48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface
50 |
51 | /**
52 | * This structure is used to provides the necessary configurations and data
53 | * to the DXVA2 FFmpeg HWAccel implementation.
54 | *
55 | * The application must make it available as AVCodecContext.hwaccel_context.
56 | */
57 | struct dxva_context {
58 | /**
59 | * DXVA2 decoder object
60 | */
61 | IDirectXVideoDecoder *decoder;
62 |
63 | /**
64 | * DXVA2 configuration used to create the decoder
65 | */
66 | const DXVA2_ConfigPictureDecode *cfg;
67 |
68 | /**
69 | * The number of surface in the surface array
70 | */
71 | unsigned surface_count;
72 |
73 | /**
74 | * The array of Direct3D surfaces used to create the decoder
75 | */
76 | LPDIRECT3DSURFACE9 *surface;
77 |
78 | /**
79 | * A bit field configuring the workarounds needed for using the decoder
80 | */
81 | uint64_t workaround;
82 |
83 | /**
84 | * Private to the FFmpeg AVHWAccel implementation
85 | */
86 | unsigned report_id;
87 | };
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | #endif /* AVCODEC_DXVA2_H */
94 |
--------------------------------------------------------------------------------
/inc_header/libavutil/sha.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Michael Niedermayer
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | /**
22 | * @file
23 | * @ingroup lavu_sha
24 | * Public header for SHA-1 & SHA-256 hash function implementations.
25 | */
26 |
27 | #ifndef AVUTIL_SHA_H
28 | #define AVUTIL_SHA_H
29 |
30 | #include
31 |
32 | #include "attributes.h"
33 | #include "version.h"
34 |
35 | /**
36 | * @defgroup lavu_sha SHA
37 | * @ingroup lavu_hash
38 | * SHA-1 and SHA-256 (Secure Hash Algorithm) hash function implementations.
39 | *
40 | * This module supports the following SHA hash functions:
41 | *
42 | * - SHA-1: 160 bits
43 | * - SHA-224: 224 bits, as a variant of SHA-2
44 | * - SHA-256: 256 bits, as a variant of SHA-2
45 | *
46 | * @see For SHA-384, SHA-512, and variants thereof, see @ref lavu_sha512.
47 | *
48 | * @{
49 | */
50 |
51 | extern const int av_sha_size;
52 |
53 | struct AVSHA;
54 |
55 | /**
56 | * Allocate an AVSHA context.
57 | */
58 | struct AVSHA *av_sha_alloc(void);
59 |
60 | /**
61 | * Initialize SHA-1 or SHA-2 hashing.
62 | *
63 | * @param context pointer to the function context (of size av_sha_size)
64 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits)
65 | * @return zero if initialization succeeded, -1 otherwise
66 | */
67 | int av_sha_init(struct AVSHA* context, int bits);
68 |
69 | /**
70 | * Update hash value.
71 | *
72 | * @param context hash function context
73 | * @param data input data to update hash with
74 | * @param len input data length
75 | */
76 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len);
77 |
78 | /**
79 | * Finish hashing and output digest value.
80 | *
81 | * @param context hash function context
82 | * @param digest buffer where output digest value is stored
83 | */
84 | void av_sha_final(struct AVSHA* context, uint8_t *digest);
85 |
86 | /**
87 | * @}
88 | */
89 |
90 | #endif /* AVUTIL_SHA_H */
91 |
--------------------------------------------------------------------------------
/libyuv/include/libyuv/scale_argb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_SCALE_ARGB_H_
12 | #define INCLUDE_LIBYUV_SCALE_ARGB_H_
13 |
14 | #include "libyuv/basic_types.h"
15 | #include "libyuv/scale.h" // For FilterMode
16 |
17 | #ifdef __cplusplus
18 | namespace libyuv {
19 | extern "C" {
20 | #endif
21 |
22 | LIBYUV_API
23 | int ARGBScale(const uint8_t* src_argb,
24 | int src_stride_argb,
25 | int src_width,
26 | int src_height,
27 | uint8_t* dst_argb,
28 | int dst_stride_argb,
29 | int dst_width,
30 | int dst_height,
31 | enum FilterMode filtering);
32 |
33 | // Clipped scale takes destination rectangle coordinates for clip values.
34 | LIBYUV_API
35 | int ARGBScaleClip(const uint8_t* src_argb,
36 | int src_stride_argb,
37 | int src_width,
38 | int src_height,
39 | uint8_t* dst_argb,
40 | int dst_stride_argb,
41 | int dst_width,
42 | int dst_height,
43 | int clip_x,
44 | int clip_y,
45 | int clip_width,
46 | int clip_height,
47 | enum FilterMode filtering);
48 |
49 | // Scale with YUV conversion to ARGB and clipping.
50 | LIBYUV_API
51 | int YUVToARGBScaleClip(const uint8_t* src_y,
52 | int src_stride_y,
53 | const uint8_t* src_u,
54 | int src_stride_u,
55 | const uint8_t* src_v,
56 | int src_stride_v,
57 | uint32_t src_fourcc,
58 | int src_width,
59 | int src_height,
60 | uint8_t* dst_argb,
61 | int dst_stride_argb,
62 | uint32_t dst_fourcc,
63 | int dst_width,
64 | int dst_height,
65 | int clip_x,
66 | int clip_y,
67 | int clip_width,
68 | int clip_height,
69 | enum FilterMode filtering);
70 |
71 | #ifdef __cplusplus
72 | } // extern "C"
73 | } // namespace libyuv
74 | #endif
75 |
76 | #endif // INCLUDE_LIBYUV_SCALE_ARGB_H_
77 |
--------------------------------------------------------------------------------
/inc_header/libavutil/sha512.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Michael Niedermayer
3 | * Copyright (C) 2013 James Almer
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | /**
23 | * @file
24 | * @ingroup lavu_sha512
25 | * Public header for SHA-512 implementation.
26 | */
27 |
28 | #ifndef AVUTIL_SHA512_H
29 | #define AVUTIL_SHA512_H
30 |
31 | #include
32 |
33 | #include "attributes.h"
34 | #include "version.h"
35 |
36 | /**
37 | * @defgroup lavu_sha512 SHA-512
38 | * @ingroup lavu_hash
39 | * SHA-512 (Secure Hash Algorithm) hash function implementations.
40 | *
41 | * This module supports the following SHA-2 hash functions:
42 | *
43 | * - SHA-512/224: 224 bits
44 | * - SHA-512/256: 256 bits
45 | * - SHA-384: 384 bits
46 | * - SHA-512: 512 bits
47 | *
48 | * @see For SHA-1, SHA-256, and variants thereof, see @ref lavu_sha.
49 | *
50 | * @{
51 | */
52 |
53 | extern const int av_sha512_size;
54 |
55 | struct AVSHA512;
56 |
57 | /**
58 | * Allocate an AVSHA512 context.
59 | */
60 | struct AVSHA512 *av_sha512_alloc(void);
61 |
62 | /**
63 | * Initialize SHA-2 512 hashing.
64 | *
65 | * @param context pointer to the function context (of size av_sha512_size)
66 | * @param bits number of bits in digest (224, 256, 384 or 512 bits)
67 | * @return zero if initialization succeeded, -1 otherwise
68 | */
69 | int av_sha512_init(struct AVSHA512* context, int bits);
70 |
71 | /**
72 | * Update hash value.
73 | *
74 | * @param context hash function context
75 | * @param data input data to update hash with
76 | * @param len input data length
77 | */
78 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len);
79 |
80 | /**
81 | * Finish hashing and output digest value.
82 | *
83 | * @param context hash function context
84 | * @param digest buffer where output digest value is stored
85 | */
86 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest);
87 |
88 | /**
89 | * @}
90 | */
91 |
92 | #endif /* AVUTIL_SHA512_H */
93 |
--------------------------------------------------------------------------------
/inc_header/libavutil/file.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_FILE_H
20 | #define AVUTIL_FILE_H
21 |
22 | #include
23 |
24 | #include "avutil.h"
25 |
26 | /**
27 | * @file
28 | * Misc file utilities.
29 | */
30 |
31 | /**
32 | * Read the file with name filename, and put its content in a newly
33 | * allocated buffer or map it with mmap() when available.
34 | * In case of success set *bufptr to the read or mmapped buffer, and
35 | * *size to the size in bytes of the buffer in *bufptr.
36 | * The returned buffer must be released with av_file_unmap().
37 | *
38 | * @param log_offset loglevel offset used for logging
39 | * @param log_ctx context used for logging
40 | * @return a non negative number in case of success, a negative value
41 | * corresponding to an AVERROR error code in case of failure
42 | */
43 | av_warn_unused_result
44 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
45 | int log_offset, void *log_ctx);
46 |
47 | /**
48 | * Unmap or free the buffer bufptr created by av_file_map().
49 | *
50 | * @param size size in bytes of bufptr, must be the same as returned
51 | * by av_file_map()
52 | */
53 | void av_file_unmap(uint8_t *bufptr, size_t size);
54 |
55 | /**
56 | * Wrapper to work around the lack of mkstemp() on mingw.
57 | * Also, tries to create file in /tmp first, if possible.
58 | * *prefix can be a character constant; *filename will be allocated internally.
59 | * @return file descriptor of opened file (or negative value corresponding to an
60 | * AVERROR code on error)
61 | * and opened file name in **filename.
62 | * @note On very old libcs it is necessary to set a secure umask before
63 | * calling this, av_tempfile() can't call umask itself as it is used in
64 | * libraries and could interfere with the calling application.
65 | * @deprecated as fd numbers cannot be passed saftely between libs on some platforms
66 | */
67 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
68 |
69 | #endif /* AVUTIL_FILE_H */
70 |
--------------------------------------------------------------------------------
/inc_header/libavutil/cast5.h:
--------------------------------------------------------------------------------
1 | /*
2 | * An implementation of the CAST128 algorithm as mentioned in RFC2144
3 | * Copyright (c) 2014 Supraja Meedinti
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_CAST5_H
23 | #define AVUTIL_CAST5_H
24 |
25 | #include
26 |
27 |
28 | /**
29 | * @file
30 | * @brief Public header for libavutil CAST5 algorithm
31 | * @defgroup lavu_cast5 CAST5
32 | * @ingroup lavu_crypto
33 | * @{
34 | */
35 |
36 | extern const int av_cast5_size;
37 |
38 | struct AVCAST5;
39 |
40 | /**
41 | * Allocate an AVCAST5 context
42 | * To free the struct: av_free(ptr)
43 | */
44 | struct AVCAST5 *av_cast5_alloc(void);
45 | /**
46 | * Initialize an AVCAST5 context.
47 | *
48 | * @param ctx an AVCAST5 context
49 | * @param key a key of 5,6,...16 bytes used for encryption/decryption
50 | * @param key_bits number of keybits: possible are 40,48,...,128
51 | * @return 0 on success, less than 0 on failure
52 | */
53 | int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits);
54 |
55 | /**
56 | * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only
57 | *
58 | * @param ctx an AVCAST5 context
59 | * @param dst destination array, can be equal to src
60 | * @param src source array, can be equal to dst
61 | * @param count number of 8 byte blocks
62 | * @param decrypt 0 for encryption, 1 for decryption
63 | */
64 | void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt);
65 |
66 | /**
67 | * Encrypt or decrypt a buffer using a previously initialized context
68 | *
69 | * @param ctx an AVCAST5 context
70 | * @param dst destination array, can be equal to src
71 | * @param src source array, can be equal to dst
72 | * @param count number of 8 byte blocks
73 | * @param iv initialization vector for CBC mode, NULL for ECB mode
74 | * @param decrypt 0 for encryption, 1 for decryption
75 | */
76 | void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
77 | /**
78 | * @}
79 | */
80 | #endif /* AVUTIL_CAST5_H */
81 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/avdct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVCODEC_AVDCT_H
20 | #define AVCODEC_AVDCT_H
21 |
22 | #include "libavutil/opt.h"
23 |
24 | /**
25 | * AVDCT context.
26 | * @note function pointers can be NULL if the specific features have been
27 | * disabled at build time.
28 | */
29 | typedef struct AVDCT {
30 | const AVClass *av_class;
31 |
32 | void (*idct)(int16_t *block /* align 16 */);
33 |
34 | /**
35 | * IDCT input permutation.
36 | * Several optimized IDCTs need a permutated input (relative to the
37 | * normal order of the reference IDCT).
38 | * This permutation must be performed before the idct_put/add.
39 | * Note, normally this can be merged with the zigzag/alternate scan
40 | * An example to avoid confusion:
41 | * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
42 | * - (x -> reference DCT -> reference IDCT -> x)
43 | * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
44 | * -> simple_idct_mmx -> x)
45 | * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
46 | * -> simple_idct_mmx -> ...)
47 | */
48 | uint8_t idct_permutation[64];
49 |
50 | void (*fdct)(int16_t *block /* align 16 */);
51 |
52 |
53 | /**
54 | * DCT algorithm.
55 | * must use AVOptions to set this field.
56 | */
57 | int dct_algo;
58 |
59 | /**
60 | * IDCT algorithm.
61 | * must use AVOptions to set this field.
62 | */
63 | int idct_algo;
64 |
65 | void (*get_pixels)(int16_t *block /* align 16 */,
66 | const uint8_t *pixels /* align 8 */,
67 | ptrdiff_t line_size);
68 |
69 | int bits_per_sample;
70 | } AVDCT;
71 |
72 | /**
73 | * Allocates a AVDCT context.
74 | * This needs to be initialized with avcodec_dct_init() after optionally
75 | * configuring it with AVOptions.
76 | *
77 | * To free it use av_free()
78 | */
79 | AVDCT *avcodec_dct_alloc(void);
80 | int avcodec_dct_init(AVDCT *);
81 |
82 | const AVClass *avcodec_dct_get_class(void);
83 |
84 | #endif /* AVCODEC_AVDCT_H */
85 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/inc_header/libavfilter/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version macros.
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVFILTER_VERSION_H
22 | #define AVFILTER_VERSION_H
23 |
24 | /**
25 | * @file
26 | * @ingroup lavfi
27 | * Libavfilter version macros
28 | */
29 |
30 | #include "libavutil/version.h"
31 |
32 | #define LIBAVFILTER_VERSION_MAJOR 6
33 | #define LIBAVFILTER_VERSION_MINOR 82
34 | #define LIBAVFILTER_VERSION_MICRO 100
35 |
36 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
37 | LIBAVFILTER_VERSION_MINOR, \
38 | LIBAVFILTER_VERSION_MICRO)
39 | #define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \
40 | LIBAVFILTER_VERSION_MINOR, \
41 | LIBAVFILTER_VERSION_MICRO)
42 | #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT
43 |
44 | #define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION)
45 |
46 | /**
47 | * FF_API_* defines may be placed below to indicate public API that will be
48 | * dropped at a future version bump. The defines themselves are not part of
49 | * the public API and may change, break or disappear at any time.
50 | */
51 |
52 | #ifndef FF_API_OLD_FILTER_OPTS
53 | #define FF_API_OLD_FILTER_OPTS (LIBAVFILTER_VERSION_MAJOR < 7)
54 | #endif
55 | #ifndef FF_API_OLD_FILTER_OPTS_ERROR
56 | #define FF_API_OLD_FILTER_OPTS_ERROR (LIBAVFILTER_VERSION_MAJOR < 7)
57 | #endif
58 | #ifndef FF_API_AVFILTER_OPEN
59 | #define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 7)
60 | #endif
61 | #ifndef FF_API_AVFILTER_INIT_FILTER
62 | #define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 7)
63 | #endif
64 | #ifndef FF_API_OLD_FILTER_REGISTER
65 | #define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 7)
66 | #endif
67 | #ifndef FF_API_NOCONST_GET_NAME
68 | #define FF_API_NOCONST_GET_NAME (LIBAVFILTER_VERSION_MAJOR < 7)
69 | #endif
70 | #ifndef FF_API_LAVR_OPTS
71 | #define FF_API_LAVR_OPTS (LIBAVFILTER_VERSION_MAJOR < 7)
72 | #endif
73 |
74 | #endif /* AVFILTER_VERSION_H */
75 |
--------------------------------------------------------------------------------
/libyuv/source/compare_common.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/basic_types.h"
12 |
13 | #include "libyuv/compare_row.h"
14 |
15 | #ifdef __cplusplus
16 | namespace libyuv {
17 | extern "C" {
18 | #endif
19 |
20 | #if ORIGINAL_OPT
21 | uint32_t HammingDistance_C1(const uint8_t* src_a,
22 | const uint8_t* src_b,
23 | int count) {
24 | uint32_t diff = 0u;
25 |
26 | int i;
27 | for (i = 0; i < count; ++i) {
28 | int x = src_a[i] ^ src_b[i];
29 | if (x & 1)
30 | ++diff;
31 | if (x & 2)
32 | ++diff;
33 | if (x & 4)
34 | ++diff;
35 | if (x & 8)
36 | ++diff;
37 | if (x & 16)
38 | ++diff;
39 | if (x & 32)
40 | ++diff;
41 | if (x & 64)
42 | ++diff;
43 | if (x & 128)
44 | ++diff;
45 | }
46 | return diff;
47 | }
48 | #endif
49 |
50 | // Hakmem method for hamming distance.
51 | uint32_t HammingDistance_C(const uint8_t* src_a,
52 | const uint8_t* src_b,
53 | int count) {
54 | uint32_t diff = 0u;
55 |
56 | int i;
57 | for (i = 0; i < count - 3; i += 4) {
58 | uint32_t x = *((const uint32_t*)src_a) ^ *((const uint32_t*)src_b);
59 | uint32_t u = x - ((x >> 1) & 0x55555555);
60 | u = ((u >> 2) & 0x33333333) + (u & 0x33333333);
61 | diff += ((((u + (u >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24);
62 | src_a += 4;
63 | src_b += 4;
64 | }
65 |
66 | for (; i < count; ++i) {
67 | uint32_t x = *src_a ^ *src_b;
68 | uint32_t u = x - ((x >> 1) & 0x55);
69 | u = ((u >> 2) & 0x33) + (u & 0x33);
70 | diff += (u + (u >> 4)) & 0x0f;
71 | src_a += 1;
72 | src_b += 1;
73 | }
74 |
75 | return diff;
76 | }
77 |
78 | uint32_t SumSquareError_C(const uint8_t* src_a,
79 | const uint8_t* src_b,
80 | int count) {
81 | uint32_t sse = 0u;
82 | int i;
83 | for (i = 0; i < count; ++i) {
84 | int diff = src_a[i] - src_b[i];
85 | sse += (uint32_t)(diff * diff);
86 | }
87 | return sse;
88 | }
89 |
90 | // hash seed of 5381 recommended.
91 | // Internal C version of HashDjb2 with int sized count for efficiency.
92 | uint32_t HashDjb2_C(const uint8_t* src, int count, uint32_t seed) {
93 | uint32_t hash = seed;
94 | int i;
95 | for (i = 0; i < count; ++i) {
96 | hash += (hash << 5) + src[i];
97 | }
98 | return hash;
99 | }
100 |
101 | #ifdef __cplusplus
102 | } // extern "C"
103 | } // namespace libyuv
104 | #endif
105 |
--------------------------------------------------------------------------------
/inc_header/libavutil/mastering_display_metadata.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 Neil Birkbeck
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H
22 | #define AVUTIL_MASTERING_DISPLAY_METADATA_H
23 |
24 | #include "frame.h"
25 | #include "rational.h"
26 |
27 |
28 | /**
29 | * Mastering display metadata capable of representing the color volume of
30 | * the display used to master the content (SMPTE 2086:2014).
31 | *
32 | * To be used as payload of a AVFrameSideData or AVPacketSideData with the
33 | * appropriate type.
34 | *
35 | * @note The struct should be allocated with av_mastering_display_metadata_alloc()
36 | * and its size is not a part of the public ABI.
37 | */
38 | typedef struct AVMasteringDisplayMetadata {
39 | /**
40 | * CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
41 | */
42 | AVRational display_primaries[3][2];
43 |
44 | /**
45 | * CIE 1931 xy chromaticity coords of white point.
46 | */
47 | AVRational white_point[2];
48 |
49 | /**
50 | * Min luminance of mastering display (cd/m^2).
51 | */
52 | AVRational min_luminance;
53 |
54 | /**
55 | * Max luminance of mastering display (cd/m^2).
56 | */
57 | AVRational max_luminance;
58 |
59 | /**
60 | * Flag indicating whether the display primaries (and white point) are set.
61 | */
62 | int has_primaries;
63 |
64 | /**
65 | * Flag indicating whether the luminance (min_ and max_) have been set.
66 | */
67 | int has_luminance;
68 |
69 | } AVMasteringDisplayMetadata;
70 |
71 | /**
72 | * Allocate an AVMasteringDisplayMetadata structure and set its fields to
73 | * default values. The resulting struct can be freed using av_freep().
74 | *
75 | * @return An AVMasteringDisplayMetadata filled with default values or NULL
76 | * on failure.
77 | */
78 | AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
79 |
80 | /**
81 | * Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
82 | *
83 | * @param frame The frame which side data is added to.
84 | *
85 | * @return The AVMasteringDisplayMetadata structure to be filled by caller.
86 | */
87 | AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame);
88 |
89 | #endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */
90 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/mediacodec.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Android MediaCodec public API
3 | *
4 | * Copyright (c) 2016 Matthieu Bouron
5 | *
6 | * This file is part of FFmpeg.
7 | *
8 | * FFmpeg is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * FFmpeg is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with FFmpeg; if not, write to the Free Software
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 | */
22 |
23 | #ifndef AVCODEC_MEDIACODEC_H
24 | #define AVCODEC_MEDIACODEC_H
25 |
26 | #include "libavcodec/avcodec.h"
27 |
28 | /**
29 | * This structure holds a reference to a android/view/Surface object that will
30 | * be used as output by the decoder.
31 | *
32 | */
33 | typedef struct AVMediaCodecContext {
34 |
35 | /**
36 | * android/view/Surface object reference.
37 | */
38 | void *surface;
39 |
40 | } AVMediaCodecContext;
41 |
42 | /**
43 | * Allocate and initialize a MediaCodec context.
44 | *
45 | * When decoding with MediaCodec is finished, the caller must free the
46 | * MediaCodec context with av_mediacodec_default_free.
47 | *
48 | * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise
49 | */
50 | AVMediaCodecContext *av_mediacodec_alloc_context(void);
51 |
52 | /**
53 | * Convenience function that sets up the MediaCodec context.
54 | *
55 | * @param avctx codec context
56 | * @param ctx MediaCodec context to initialize
57 | * @param surface reference to an android/view/Surface
58 | * @return 0 on success, < 0 otherwise
59 | */
60 | int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface);
61 |
62 | /**
63 | * This function must be called to free the MediaCodec context initialized with
64 | * av_mediacodec_default_init().
65 | *
66 | * @param avctx codec context
67 | */
68 | void av_mediacodec_default_free(AVCodecContext *avctx);
69 |
70 | /**
71 | * Opaque structure representing a MediaCodec buffer to render.
72 | */
73 | typedef struct MediaCodecBuffer AVMediaCodecBuffer;
74 |
75 | /**
76 | * Release a MediaCodec buffer and render it to the surface that is associated
77 | * with the decoder. This function should only be called once on a given
78 | * buffer, once released the underlying buffer returns to the codec, thus
79 | * subsequent calls to this function will have no effect.
80 | *
81 | * @param buffer the buffer to render
82 | * @param render 1 to release and render the buffer to the surface or 0 to
83 | * discard the buffer
84 | * @return 0 on success, < 0 otherwise
85 | */
86 | int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
87 |
88 | #endif /* AVCODEC_MEDIACODEC_H */
89 |
--------------------------------------------------------------------------------
/inc_header/libavutil/xtea.h:
--------------------------------------------------------------------------------
1 | /*
2 | * A 32-bit implementation of the XTEA algorithm
3 | * Copyright (c) 2012 Samuel Pitoiset
4 | *
5 | * This file is part of FFmpeg.
6 | *
7 | * FFmpeg is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * FFmpeg is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with FFmpeg; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef AVUTIL_XTEA_H
23 | #define AVUTIL_XTEA_H
24 |
25 | #include
26 |
27 | /**
28 | * @file
29 | * @brief Public header for libavutil XTEA algorithm
30 | * @defgroup lavu_xtea XTEA
31 | * @ingroup lavu_crypto
32 | * @{
33 | */
34 |
35 | typedef struct AVXTEA {
36 | uint32_t key[16];
37 | } AVXTEA;
38 |
39 | /**
40 | * Allocate an AVXTEA context.
41 | */
42 | AVXTEA *av_xtea_alloc(void);
43 |
44 | /**
45 | * Initialize an AVXTEA context.
46 | *
47 | * @param ctx an AVXTEA context
48 | * @param key a key of 16 bytes used for encryption/decryption,
49 | * interpreted as big endian 32 bit numbers
50 | */
51 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]);
52 |
53 | /**
54 | * Initialize an AVXTEA context.
55 | *
56 | * @param ctx an AVXTEA context
57 | * @param key a key of 16 bytes used for encryption/decryption,
58 | * interpreted as little endian 32 bit numbers
59 | */
60 | void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]);
61 |
62 | /**
63 | * Encrypt or decrypt a buffer using a previously initialized context,
64 | * in big endian format.
65 | *
66 | * @param ctx an AVXTEA context
67 | * @param dst destination array, can be equal to src
68 | * @param src source array, can be equal to dst
69 | * @param count number of 8 byte blocks
70 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used
71 | * @param decrypt 0 for encryption, 1 for decryption
72 | */
73 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
74 | int count, uint8_t *iv, int decrypt);
75 |
76 | /**
77 | * Encrypt or decrypt a buffer using a previously initialized context,
78 | * in little endian format.
79 | *
80 | * @param ctx an AVXTEA context
81 | * @param dst destination array, can be equal to src
82 | * @param src source array, can be equal to dst
83 | * @param count number of 8 byte blocks
84 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used
85 | * @param decrypt 0 for encryption, 1 for decryption
86 | */
87 | void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
88 | int count, uint8_t *iv, int decrypt);
89 |
90 | /**
91 | * @}
92 | */
93 |
94 | #endif /* AVUTIL_XTEA_H */
95 |
--------------------------------------------------------------------------------
/libyuv/source/compare_msa.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/basic_types.h"
12 |
13 | #include "libyuv/compare_row.h"
14 | #include "libyuv/row.h"
15 |
16 | // This module is for GCC MSA
17 | #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
18 | #include "libyuv/macros_msa.h"
19 |
20 | #ifdef __cplusplus
21 | namespace libyuv {
22 | extern "C" {
23 | #endif
24 |
25 | uint32_t HammingDistance_MSA(const uint8_t* src_a,
26 | const uint8_t* src_b,
27 | int count) {
28 | uint32_t diff = 0u;
29 | int i;
30 | v16u8 src0, src1, src2, src3;
31 | v2i64 vec0 = {0}, vec1 = {0};
32 |
33 | for (i = 0; i < count; i += 32) {
34 | src0 = (v16u8)__msa_ld_b((v16i8*)src_a, 0);
35 | src1 = (v16u8)__msa_ld_b((v16i8*)src_a, 16);
36 | src2 = (v16u8)__msa_ld_b((v16i8*)src_b, 0);
37 | src3 = (v16u8)__msa_ld_b((v16i8*)src_b, 16);
38 | src0 ^= src2;
39 | src1 ^= src3;
40 | vec0 += __msa_pcnt_d((v2i64)src0);
41 | vec1 += __msa_pcnt_d((v2i64)src1);
42 | src_a += 32;
43 | src_b += 32;
44 | }
45 |
46 | vec0 += vec1;
47 | diff = (uint32_t)__msa_copy_u_w((v4i32)vec0, 0);
48 | diff += (uint32_t)__msa_copy_u_w((v4i32)vec0, 2);
49 | return diff;
50 | }
51 |
52 | uint32_t SumSquareError_MSA(const uint8_t* src_a,
53 | const uint8_t* src_b,
54 | int count) {
55 | uint32_t sse = 0u;
56 | int i;
57 | v16u8 src0, src1, src2, src3;
58 | v8i16 vec0, vec1, vec2, vec3;
59 | v4i32 reg0 = {0}, reg1 = {0}, reg2 = {0}, reg3 = {0};
60 | v2i64 tmp0;
61 |
62 | for (i = 0; i < count; i += 32) {
63 | src0 = (v16u8)__msa_ld_b((v16i8*)src_a, 0);
64 | src1 = (v16u8)__msa_ld_b((v16i8*)src_a, 16);
65 | src2 = (v16u8)__msa_ld_b((v16i8*)src_b, 0);
66 | src3 = (v16u8)__msa_ld_b((v16i8*)src_b, 16);
67 | vec0 = (v8i16)__msa_ilvr_b((v16i8)src2, (v16i8)src0);
68 | vec1 = (v8i16)__msa_ilvl_b((v16i8)src2, (v16i8)src0);
69 | vec2 = (v8i16)__msa_ilvr_b((v16i8)src3, (v16i8)src1);
70 | vec3 = (v8i16)__msa_ilvl_b((v16i8)src3, (v16i8)src1);
71 | vec0 = __msa_hsub_u_h((v16u8)vec0, (v16u8)vec0);
72 | vec1 = __msa_hsub_u_h((v16u8)vec1, (v16u8)vec1);
73 | vec2 = __msa_hsub_u_h((v16u8)vec2, (v16u8)vec2);
74 | vec3 = __msa_hsub_u_h((v16u8)vec3, (v16u8)vec3);
75 | reg0 = __msa_dpadd_s_w(reg0, vec0, vec0);
76 | reg1 = __msa_dpadd_s_w(reg1, vec1, vec1);
77 | reg2 = __msa_dpadd_s_w(reg2, vec2, vec2);
78 | reg3 = __msa_dpadd_s_w(reg3, vec3, vec3);
79 | src_a += 32;
80 | src_b += 32;
81 | }
82 |
83 | reg0 += reg1;
84 | reg2 += reg3;
85 | reg0 += reg2;
86 | tmp0 = __msa_hadd_s_d(reg0, reg0);
87 | sse = (uint32_t)__msa_copy_u_w((v4i32)tmp0, 0);
88 | sse += (uint32_t)__msa_copy_u_w((v4i32)tmp0, 2);
89 | return sse;
90 | }
91 |
92 | #ifdef __cplusplus
93 | } // extern "C"
94 | } // namespace libyuv
95 | #endif
96 |
97 | #endif // !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
98 |
--------------------------------------------------------------------------------
/inc_header/libavutil/hmac.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Martin Storsjo
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_HMAC_H
22 | #define AVUTIL_HMAC_H
23 |
24 | #include
25 |
26 | #include "version.h"
27 | /**
28 | * @defgroup lavu_hmac HMAC
29 | * @ingroup lavu_crypto
30 | * @{
31 | */
32 |
33 | enum AVHMACType {
34 | AV_HMAC_MD5,
35 | AV_HMAC_SHA1,
36 | AV_HMAC_SHA224,
37 | AV_HMAC_SHA256,
38 | AV_HMAC_SHA384 = 12,
39 | AV_HMAC_SHA512,
40 | };
41 |
42 | typedef struct AVHMAC AVHMAC;
43 |
44 | /**
45 | * Allocate an AVHMAC context.
46 | * @param type The hash function used for the HMAC.
47 | */
48 | AVHMAC *av_hmac_alloc(enum AVHMACType type);
49 |
50 | /**
51 | * Free an AVHMAC context.
52 | * @param ctx The context to free, may be NULL
53 | */
54 | void av_hmac_free(AVHMAC *ctx);
55 |
56 | /**
57 | * Initialize an AVHMAC context with an authentication key.
58 | * @param ctx The HMAC context
59 | * @param key The authentication key
60 | * @param keylen The length of the key, in bytes
61 | */
62 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen);
63 |
64 | /**
65 | * Hash data with the HMAC.
66 | * @param ctx The HMAC context
67 | * @param data The data to hash
68 | * @param len The length of the data, in bytes
69 | */
70 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len);
71 |
72 | /**
73 | * Finish hashing and output the HMAC digest.
74 | * @param ctx The HMAC context
75 | * @param out The output buffer to write the digest into
76 | * @param outlen The length of the out buffer, in bytes
77 | * @return The number of bytes written to out, or a negative error code.
78 | */
79 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen);
80 |
81 | /**
82 | * Hash an array of data with a key.
83 | * @param ctx The HMAC context
84 | * @param data The data to hash
85 | * @param len The length of the data, in bytes
86 | * @param key The authentication key
87 | * @param keylen The length of the key, in bytes
88 | * @param out The output buffer to write the digest into
89 | * @param outlen The length of the out buffer, in bytes
90 | * @return The number of bytes written to out, or a negative error code.
91 | */
92 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len,
93 | const uint8_t *key, unsigned int keylen,
94 | uint8_t *out, unsigned int outlen);
95 |
96 | /**
97 | * @}
98 | */
99 |
100 | #endif /* AVUTIL_HMAC_H */
101 |
--------------------------------------------------------------------------------
/libyuv/source/rotate_any.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/rotate.h"
12 | #include "libyuv/rotate_row.h"
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #define TANY(NAMEANY, TPOS_SIMD, MASK) \
22 | void NAMEANY(const uint8_t* src, int src_stride, uint8_t* dst, \
23 | int dst_stride, int width) { \
24 | int r = width & MASK; \
25 | int n = width - r; \
26 | if (n > 0) { \
27 | TPOS_SIMD(src, src_stride, dst, dst_stride, n); \
28 | } \
29 | TransposeWx8_C(src + n, src_stride, dst + n * dst_stride, dst_stride, r); \
30 | }
31 |
32 | #ifdef HAS_TRANSPOSEWX8_NEON
33 | TANY(TransposeWx8_Any_NEON, TransposeWx8_NEON, 7)
34 | #endif
35 | #ifdef HAS_TRANSPOSEWX8_SSSE3
36 | TANY(TransposeWx8_Any_SSSE3, TransposeWx8_SSSE3, 7)
37 | #endif
38 | #ifdef HAS_TRANSPOSEWX8_MMI
39 | TANY(TransposeWx8_Any_MMI, TransposeWx8_MMI, 7)
40 | #endif
41 | #ifdef HAS_TRANSPOSEWX8_FAST_SSSE3
42 | TANY(TransposeWx8_Fast_Any_SSSE3, TransposeWx8_Fast_SSSE3, 15)
43 | #endif
44 | #ifdef HAS_TRANSPOSEWX16_MSA
45 | TANY(TransposeWx16_Any_MSA, TransposeWx16_MSA, 15)
46 | #endif
47 | #undef TANY
48 |
49 | #define TUVANY(NAMEANY, TPOS_SIMD, MASK) \
50 | void NAMEANY(const uint8_t* src, int src_stride, uint8_t* dst_a, \
51 | int dst_stride_a, uint8_t* dst_b, int dst_stride_b, \
52 | int width) { \
53 | int r = width & MASK; \
54 | int n = width - r; \
55 | if (n > 0) { \
56 | TPOS_SIMD(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b, n); \
57 | } \
58 | TransposeUVWx8_C(src + n * 2, src_stride, dst_a + n * dst_stride_a, \
59 | dst_stride_a, dst_b + n * dst_stride_b, dst_stride_b, r); \
60 | }
61 |
62 | #ifdef HAS_TRANSPOSEUVWX8_NEON
63 | TUVANY(TransposeUVWx8_Any_NEON, TransposeUVWx8_NEON, 7)
64 | #endif
65 | #ifdef HAS_TRANSPOSEUVWX8_SSE2
66 | TUVANY(TransposeUVWx8_Any_SSE2, TransposeUVWx8_SSE2, 7)
67 | #endif
68 | #ifdef HAS_TRANSPOSEUVWX8_MMI
69 | TUVANY(TransposeUVWx8_Any_MMI, TransposeUVWx8_MMI, 7)
70 | #endif
71 | #ifdef HAS_TRANSPOSEUVWX16_MSA
72 | TUVANY(TransposeUVWx16_Any_MSA, TransposeUVWx16_MSA, 7)
73 | #endif
74 | #undef TUVANY
75 |
76 | #ifdef __cplusplus
77 | } // extern "C"
78 | } // namespace libyuv
79 | #endif
80 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/d3d11va.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Direct3D11 HW acceleration
3 | *
4 | * copyright (c) 2009 Laurent Aimar
5 | * copyright (c) 2015 Steve Lhomme
6 | *
7 | * This file is part of FFmpeg.
8 | *
9 | * FFmpeg is free software; you can redistribute it and/or
10 | * modify it under the terms of the GNU Lesser General Public
11 | * License as published by the Free Software Foundation; either
12 | * version 2.1 of the License, or (at your option) any later version.
13 | *
14 | * FFmpeg is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | * Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public
20 | * License along with FFmpeg; if not, write to the Free Software
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 | */
23 |
24 | #ifndef AVCODEC_D3D11VA_H
25 | #define AVCODEC_D3D11VA_H
26 |
27 | /**
28 | * @file
29 | * @ingroup lavc_codec_hwaccel_d3d11va
30 | * Public libavcodec D3D11VA header.
31 | */
32 |
33 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
34 | #undef _WIN32_WINNT
35 | #define _WIN32_WINNT 0x0602
36 | #endif
37 |
38 | #include
39 | #include
40 |
41 | /**
42 | * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11
43 | * @ingroup lavc_codec_hwaccel
44 | *
45 | * @{
46 | */
47 |
48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards
49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface
50 |
51 | /**
52 | * This structure is used to provides the necessary configurations and data
53 | * to the Direct3D11 FFmpeg HWAccel implementation.
54 | *
55 | * The application must make it available as AVCodecContext.hwaccel_context.
56 | *
57 | * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext.
58 | */
59 | typedef struct AVD3D11VAContext {
60 | /**
61 | * D3D11 decoder object
62 | */
63 | ID3D11VideoDecoder *decoder;
64 |
65 | /**
66 | * D3D11 VideoContext
67 | */
68 | ID3D11VideoContext *video_context;
69 |
70 | /**
71 | * D3D11 configuration used to create the decoder
72 | */
73 | D3D11_VIDEO_DECODER_CONFIG *cfg;
74 |
75 | /**
76 | * The number of surface in the surface array
77 | */
78 | unsigned surface_count;
79 |
80 | /**
81 | * The array of Direct3D surfaces used to create the decoder
82 | */
83 | ID3D11VideoDecoderOutputView **surface;
84 |
85 | /**
86 | * A bit field configuring the workarounds needed for using the decoder
87 | */
88 | uint64_t workaround;
89 |
90 | /**
91 | * Private to the FFmpeg AVHWAccel implementation
92 | */
93 | unsigned report_id;
94 |
95 | /**
96 | * Mutex to access video_context
97 | */
98 | HANDLE context_mutex;
99 | } AVD3D11VAContext;
100 |
101 | /**
102 | * Allocate an AVD3D11VAContext.
103 | *
104 | * @return Newly-allocated AVD3D11VAContext or NULL on failure.
105 | */
106 | AVD3D11VAContext *av_d3d11va_alloc_context(void);
107 |
108 | /**
109 | * @}
110 | */
111 |
112 | #endif /* AVCODEC_D3D11VA_H */
113 |
--------------------------------------------------------------------------------
/inc_header/libavutil/display.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 Vittorio Giovara
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVUTIL_DISPLAY_H
22 | #define AVUTIL_DISPLAY_H
23 |
24 | #include
25 | #include "common.h"
26 |
27 | /**
28 | * The display transformation matrix specifies an affine transformation that
29 | * should be applied to video frames for correct presentation. It is compatible
30 | * with the matrices stored in the ISO/IEC 14496-12 container format.
31 | *
32 | * The data is a 3x3 matrix represented as a 9-element array:
33 | *
34 | * | a b u |
35 | * (a, b, u, c, d, v, x, y, w) -> | c d v |
36 | * | x y w |
37 | *
38 | * All numbers are stored in native endianness, as 16.16 fixed-point values,
39 | * except for u, v and w, which are stored as 2.30 fixed-point values.
40 | *
41 | * The transformation maps a point (p, q) in the source (pre-transformation)
42 | * frame to the point (p', q') in the destination (post-transformation) frame as
43 | * follows:
44 | * | a b u |
45 | * (p, q, 1) . | c d v | = z * (p', q', 1)
46 | * | x y w |
47 | *
48 | * The transformation can also be more explicitly written in components as
49 | * follows:
50 | * p' = (a * p + c * q + x) / z;
51 | * q' = (b * p + d * q + y) / z;
52 | * z = u * p + v * q + w
53 | */
54 |
55 | /**
56 | * Extract the rotation component of the transformation matrix.
57 | *
58 | * @param matrix the transformation matrix
59 | * @return the angle (in degrees) by which the transformation rotates the frame
60 | * counterclockwise. The angle will be in range [-180.0, 180.0],
61 | * or NaN if the matrix is singular.
62 | *
63 | * @note floating point numbers are inherently inexact, so callers are
64 | * recommended to round the return value to nearest integer before use.
65 | */
66 | double av_display_rotation_get(const int32_t matrix[9]);
67 |
68 | /**
69 | * Initialize a transformation matrix describing a pure counterclockwise
70 | * rotation by the specified angle (in degrees).
71 | *
72 | * @param matrix an allocated transformation matrix (will be fully overwritten
73 | * by this function)
74 | * @param angle rotation angle in degrees.
75 | */
76 | void av_display_rotation_set(int32_t matrix[9], double angle);
77 |
78 | /**
79 | * Flip the input matrix horizontally and/or vertically.
80 | *
81 | * @param matrix an allocated transformation matrix
82 | * @param hflip whether the matrix should be flipped horizontally
83 | * @param vflip whether the matrix should be flipped vertically
84 | */
85 | void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip);
86 |
87 | #endif /* AVUTIL_DISPLAY_H */
88 |
--------------------------------------------------------------------------------
/inc_header/libpostproc/postprocess.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at)
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2 of the License, or
9 | * (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
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * 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 POSTPROC_POSTPROCESS_H
22 | #define POSTPROC_POSTPROCESS_H
23 |
24 | /**
25 | * @file
26 | * @ingroup lpp
27 | * external API header
28 | */
29 |
30 | /**
31 | * @defgroup lpp libpostproc
32 | * Video postprocessing library.
33 | *
34 | * @{
35 | */
36 |
37 | #include "libpostproc/version.h"
38 |
39 | /**
40 | * Return the LIBPOSTPROC_VERSION_INT constant.
41 | */
42 | unsigned postproc_version(void);
43 |
44 | /**
45 | * Return the libpostproc build-time configuration.
46 | */
47 | const char *postproc_configuration(void);
48 |
49 | /**
50 | * Return the libpostproc license.
51 | */
52 | const char *postproc_license(void);
53 |
54 | #define PP_QUALITY_MAX 6
55 |
56 | #if FF_API_QP_TYPE
57 | #define QP_STORE_T int8_t //deprecated
58 | #endif
59 |
60 | #include
61 |
62 | typedef void pp_context;
63 | typedef void pp_mode;
64 |
65 | #if LIBPOSTPROC_VERSION_INT < (52<<16)
66 | typedef pp_context pp_context_t;
67 | typedef pp_mode pp_mode_t;
68 | extern const char *const pp_help; ///< a simple help text
69 | #else
70 | extern const char pp_help[]; ///< a simple help text
71 | #endif
72 |
73 | void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
74 | uint8_t * dst[3], const int dstStride[3],
75 | int horizontalSize, int verticalSize,
76 | const int8_t *QP_store, int QP_stride,
77 | pp_mode *mode, pp_context *ppContext, int pict_type);
78 |
79 |
80 | /**
81 | * Return a pp_mode or NULL if an error occurred.
82 | *
83 | * @param name the string after "-pp" on the command line
84 | * @param quality a number from 0 to PP_QUALITY_MAX
85 | */
86 | pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality);
87 | void pp_free_mode(pp_mode *mode);
88 |
89 | pp_context *pp_get_context(int width, int height, int flags);
90 | void pp_free_context(pp_context *ppContext);
91 |
92 | #define PP_CPU_CAPS_MMX 0x80000000
93 | #define PP_CPU_CAPS_MMX2 0x20000000
94 | #define PP_CPU_CAPS_3DNOW 0x40000000
95 | #define PP_CPU_CAPS_ALTIVEC 0x10000000
96 | #define PP_CPU_CAPS_AUTO 0x00080000
97 |
98 | #define PP_FORMAT 0x00000008
99 | #define PP_FORMAT_420 (0x00000011|PP_FORMAT)
100 | #define PP_FORMAT_422 (0x00000001|PP_FORMAT)
101 | #define PP_FORMAT_411 (0x00000002|PP_FORMAT)
102 | #define PP_FORMAT_444 (0x00000000|PP_FORMAT)
103 | #define PP_FORMAT_440 (0x00000010|PP_FORMAT)
104 |
105 | #define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | #endif /* POSTPROC_POSTPROCESS_H */
112 |
--------------------------------------------------------------------------------
/libyuv/source/rotate_common.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/rotate_row.h"
12 | #include "libyuv/row.h"
13 |
14 | #ifdef __cplusplus
15 | namespace libyuv {
16 | extern "C" {
17 | #endif
18 |
19 | void TransposeWx8_C(const uint8_t* src,
20 | int src_stride,
21 | uint8_t* dst,
22 | int dst_stride,
23 | int width) {
24 | int i;
25 | for (i = 0; i < width; ++i) {
26 | dst[0] = src[0 * src_stride];
27 | dst[1] = src[1 * src_stride];
28 | dst[2] = src[2 * src_stride];
29 | dst[3] = src[3 * src_stride];
30 | dst[4] = src[4 * src_stride];
31 | dst[5] = src[5 * src_stride];
32 | dst[6] = src[6 * src_stride];
33 | dst[7] = src[7 * src_stride];
34 | ++src;
35 | dst += dst_stride;
36 | }
37 | }
38 |
39 | void TransposeUVWx8_C(const uint8_t* src,
40 | int src_stride,
41 | uint8_t* dst_a,
42 | int dst_stride_a,
43 | uint8_t* dst_b,
44 | int dst_stride_b,
45 | int width) {
46 | int i;
47 | for (i = 0; i < width; ++i) {
48 | dst_a[0] = src[0 * src_stride + 0];
49 | dst_b[0] = src[0 * src_stride + 1];
50 | dst_a[1] = src[1 * src_stride + 0];
51 | dst_b[1] = src[1 * src_stride + 1];
52 | dst_a[2] = src[2 * src_stride + 0];
53 | dst_b[2] = src[2 * src_stride + 1];
54 | dst_a[3] = src[3 * src_stride + 0];
55 | dst_b[3] = src[3 * src_stride + 1];
56 | dst_a[4] = src[4 * src_stride + 0];
57 | dst_b[4] = src[4 * src_stride + 1];
58 | dst_a[5] = src[5 * src_stride + 0];
59 | dst_b[5] = src[5 * src_stride + 1];
60 | dst_a[6] = src[6 * src_stride + 0];
61 | dst_b[6] = src[6 * src_stride + 1];
62 | dst_a[7] = src[7 * src_stride + 0];
63 | dst_b[7] = src[7 * src_stride + 1];
64 | src += 2;
65 | dst_a += dst_stride_a;
66 | dst_b += dst_stride_b;
67 | }
68 | }
69 |
70 | void TransposeWxH_C(const uint8_t* src,
71 | int src_stride,
72 | uint8_t* dst,
73 | int dst_stride,
74 | int width,
75 | int height) {
76 | int i;
77 | for (i = 0; i < width; ++i) {
78 | int j;
79 | for (j = 0; j < height; ++j) {
80 | dst[i * dst_stride + j] = src[j * src_stride + i];
81 | }
82 | }
83 | }
84 |
85 | void TransposeUVWxH_C(const uint8_t* src,
86 | int src_stride,
87 | uint8_t* dst_a,
88 | int dst_stride_a,
89 | uint8_t* dst_b,
90 | int dst_stride_b,
91 | int width,
92 | int height) {
93 | int i;
94 | for (i = 0; i < width * 2; i += 2) {
95 | int j;
96 | for (j = 0; j < height; ++j) {
97 | dst_a[j + ((i >> 1) * dst_stride_a)] = src[i + (j * src_stride)];
98 | dst_b[j + ((i >> 1) * dst_stride_b)] = src[i + (j * src_stride) + 1];
99 | }
100 | }
101 | }
102 |
103 | #ifdef __cplusplus
104 | } // extern "C"
105 | } // namespace libyuv
106 | #endif
107 |
--------------------------------------------------------------------------------
/libyuv/source/compare_neon64.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/basic_types.h"
12 |
13 | #include "libyuv/compare_row.h"
14 | #include "libyuv/row.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
22 |
23 | // 256 bits at a time
24 | // uses short accumulator which restricts count to 131 KB
25 | uint32_t HammingDistance_NEON(const uint8_t* src_a,
26 | const uint8_t* src_b,
27 | int count) {
28 | uint32_t diff;
29 | asm volatile(
30 | "movi v4.8h, #0 \n"
31 |
32 | "1: \n"
33 | "ld1 {v0.16b, v1.16b}, [%0], #32 \n"
34 | "ld1 {v2.16b, v3.16b}, [%1], #32 \n"
35 | "eor v0.16b, v0.16b, v2.16b \n"
36 | "eor v1.16b, v1.16b, v3.16b \n"
37 | "cnt v0.16b, v0.16b \n"
38 | "cnt v1.16b, v1.16b \n"
39 | "subs %w2, %w2, #32 \n"
40 | "add v0.16b, v0.16b, v1.16b \n"
41 | "uadalp v4.8h, v0.16b \n"
42 | "b.gt 1b \n"
43 |
44 | "uaddlv s4, v4.8h \n"
45 | "fmov %w3, s4 \n"
46 | : "+r"(src_a), "+r"(src_b), "+r"(count), "=r"(diff)
47 | :
48 | : "cc", "v0", "v1", "v2", "v3", "v4");
49 | return diff;
50 | }
51 |
52 | uint32_t SumSquareError_NEON(const uint8_t* src_a,
53 | const uint8_t* src_b,
54 | int count) {
55 | uint32_t sse;
56 | asm volatile(
57 | "eor v16.16b, v16.16b, v16.16b \n"
58 | "eor v18.16b, v18.16b, v18.16b \n"
59 | "eor v17.16b, v17.16b, v17.16b \n"
60 | "eor v19.16b, v19.16b, v19.16b \n"
61 |
62 | "1: \n"
63 | "ld1 {v0.16b}, [%0], #16 \n"
64 | "ld1 {v1.16b}, [%1], #16 \n"
65 | "subs %w2, %w2, #16 \n"
66 | "usubl v2.8h, v0.8b, v1.8b \n"
67 | "usubl2 v3.8h, v0.16b, v1.16b \n"
68 | "smlal v16.4s, v2.4h, v2.4h \n"
69 | "smlal v17.4s, v3.4h, v3.4h \n"
70 | "smlal2 v18.4s, v2.8h, v2.8h \n"
71 | "smlal2 v19.4s, v3.8h, v3.8h \n"
72 | "b.gt 1b \n"
73 |
74 | "add v16.4s, v16.4s, v17.4s \n"
75 | "add v18.4s, v18.4s, v19.4s \n"
76 | "add v19.4s, v16.4s, v18.4s \n"
77 | "addv s0, v19.4s \n"
78 | "fmov %w3, s0 \n"
79 | : "+r"(src_a), "+r"(src_b), "+r"(count), "=r"(sse)
80 | :
81 | : "cc", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19");
82 | return sse;
83 | }
84 |
85 | #endif // !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
86 |
87 | #ifdef __cplusplus
88 | } // extern "C"
89 | } // namespace libyuv
90 | #endif
91 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/inc_header/libavutil/crc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * copyright (c) 2006 Michael Niedermayer
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | /**
22 | * @file
23 | * @ingroup lavu_crc32
24 | * Public header for CRC hash function implementation.
25 | */
26 |
27 | #ifndef AVUTIL_CRC_H
28 | #define AVUTIL_CRC_H
29 |
30 | #include
31 | #include
32 | #include "attributes.h"
33 | #include "version.h"
34 |
35 | /**
36 | * @defgroup lavu_crc32 CRC
37 | * @ingroup lavu_hash
38 | * CRC (Cyclic Redundancy Check) hash function implementation.
39 | *
40 | * This module supports numerous CRC polynomials, in addition to the most
41 | * widely used CRC-32-IEEE. See @ref AVCRCId for a list of available
42 | * polynomials.
43 | *
44 | * @{
45 | */
46 |
47 | typedef uint32_t AVCRC;
48 |
49 | typedef enum {
50 | AV_CRC_8_ATM,
51 | AV_CRC_16_ANSI,
52 | AV_CRC_16_CCITT,
53 | AV_CRC_32_IEEE,
54 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
55 | AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */
56 | #if FF_API_CRC_BIG_TABLE
57 | AV_CRC_24_IEEE = 12,
58 | #else
59 | AV_CRC_24_IEEE,
60 | #endif /* FF_API_CRC_BIG_TABLE */
61 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
62 | }AVCRCId;
63 |
64 | /**
65 | * Initialize a CRC table.
66 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
67 | * @param le If 1, the lowest bit represents the coefficient for the highest
68 | * exponent of the corresponding polynomial (both for poly and
69 | * actual CRC).
70 | * If 0, you must swap the CRC parameter and the result of av_crc
71 | * if you need the standard representation (can be simplified in
72 | * most cases to e.g. bswap16):
73 | * av_bswap32(crc << (32-bits))
74 | * @param bits number of bits for the CRC
75 | * @param poly generator polynomial without the x**bits coefficient, in the
76 | * representation as specified by le
77 | * @param ctx_size size of ctx in bytes
78 | * @return <0 on failure
79 | */
80 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
81 |
82 | /**
83 | * Get an initialized standard CRC table.
84 | * @param crc_id ID of a standard CRC
85 | * @return a pointer to the CRC table or NULL on failure
86 | */
87 | const AVCRC *av_crc_get_table(AVCRCId crc_id);
88 |
89 | /**
90 | * Calculate the CRC of a block.
91 | * @param crc CRC of previous blocks if any or initial value for CRC
92 | * @return CRC updated with the data from the given block
93 | *
94 | * @see av_crc_init() "le" parameter
95 | */
96 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
97 | const uint8_t *buffer, size_t length) av_pure;
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | #endif /* AVUTIL_CRC_H */
104 |
--------------------------------------------------------------------------------
/inc_header/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 |
--------------------------------------------------------------------------------
/libyuv/source/compare_neon.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #include "libyuv/basic_types.h"
12 |
13 | #include "libyuv/compare_row.h"
14 | #include "libyuv/row.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | #if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) && \
22 | !defined(__aarch64__)
23 |
24 | // 256 bits at a time
25 | // uses short accumulator which restricts count to 131 KB
26 | uint32_t HammingDistance_NEON(const uint8_t* src_a,
27 | const uint8_t* src_b,
28 | int count) {
29 | uint32_t diff;
30 |
31 | asm volatile(
32 | "vmov.u16 q4, #0 \n" // accumulator
33 |
34 | "1: \n"
35 | "vld1.8 {q0, q1}, [%0]! \n"
36 | "vld1.8 {q2, q3}, [%1]! \n"
37 | "veor.32 q0, q0, q2 \n"
38 | "veor.32 q1, q1, q3 \n"
39 | "vcnt.i8 q0, q0 \n"
40 | "vcnt.i8 q1, q1 \n"
41 | "subs %2, %2, #32 \n"
42 | "vadd.u8 q0, q0, q1 \n" // 16 byte counts
43 | "vpadal.u8 q4, q0 \n" // 8 shorts
44 | "bgt 1b \n"
45 |
46 | "vpaddl.u16 q0, q4 \n" // 4 ints
47 | "vpadd.u32 d0, d0, d1 \n"
48 | "vpadd.u32 d0, d0, d0 \n"
49 | "vmov.32 %3, d0[0] \n"
50 |
51 | : "+r"(src_a), "+r"(src_b), "+r"(count), "=r"(diff)
52 | :
53 | : "cc", "q0", "q1", "q2", "q3", "q4");
54 | return diff;
55 | }
56 |
57 | uint32_t SumSquareError_NEON(const uint8_t* src_a,
58 | const uint8_t* src_b,
59 | int count) {
60 | uint32_t sse;
61 | asm volatile(
62 | "vmov.u8 q8, #0 \n"
63 | "vmov.u8 q10, #0 \n"
64 | "vmov.u8 q9, #0 \n"
65 | "vmov.u8 q11, #0 \n"
66 |
67 | "1: \n"
68 | "vld1.8 {q0}, [%0]! \n"
69 | "vld1.8 {q1}, [%1]! \n"
70 | "subs %2, %2, #16 \n"
71 | "vsubl.u8 q2, d0, d2 \n"
72 | "vsubl.u8 q3, d1, d3 \n"
73 | "vmlal.s16 q8, d4, d4 \n"
74 | "vmlal.s16 q9, d6, d6 \n"
75 | "vmlal.s16 q10, d5, d5 \n"
76 | "vmlal.s16 q11, d7, d7 \n"
77 | "bgt 1b \n"
78 |
79 | "vadd.u32 q8, q8, q9 \n"
80 | "vadd.u32 q10, q10, q11 \n"
81 | "vadd.u32 q11, q8, q10 \n"
82 | "vpaddl.u32 q1, q11 \n"
83 | "vadd.u64 d0, d2, d3 \n"
84 | "vmov.32 %3, d0[0] \n"
85 | : "+r"(src_a), "+r"(src_b), "+r"(count), "=r"(sse)
86 | :
87 | : "memory", "cc", "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11");
88 | return sse;
89 | }
90 |
91 | #endif // defined(__ARM_NEON__) && !defined(__aarch64__)
92 |
93 | #ifdef __cplusplus
94 | } // extern "C"
95 | } // namespace libyuv
96 | #endif
97 |
--------------------------------------------------------------------------------
/libyuv/include/libyuv/compare.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef INCLUDE_LIBYUV_COMPARE_H_
12 | #define INCLUDE_LIBYUV_COMPARE_H_
13 |
14 | #include "libyuv/basic_types.h"
15 |
16 | #ifdef __cplusplus
17 | namespace libyuv {
18 | extern "C" {
19 | #endif
20 |
21 | // Compute a hash for specified memory. Seed of 5381 recommended.
22 | LIBYUV_API
23 | uint32_t HashDjb2(const uint8_t* src, uint64_t count, uint32_t seed);
24 |
25 | // Hamming Distance
26 | LIBYUV_API
27 | uint64_t ComputeHammingDistance(const uint8_t* src_a,
28 | const uint8_t* src_b,
29 | int count);
30 |
31 | // Scan an opaque argb image and return fourcc based on alpha offset.
32 | // Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown.
33 | LIBYUV_API
34 | uint32_t ARGBDetect(const uint8_t* argb,
35 | int stride_argb,
36 | int width,
37 | int height);
38 |
39 | // Sum Square Error - used to compute Mean Square Error or PSNR.
40 | LIBYUV_API
41 | uint64_t ComputeSumSquareError(const uint8_t* src_a,
42 | const uint8_t* src_b,
43 | int count);
44 |
45 | LIBYUV_API
46 | uint64_t ComputeSumSquareErrorPlane(const uint8_t* src_a,
47 | int stride_a,
48 | const uint8_t* src_b,
49 | int stride_b,
50 | int width,
51 | int height);
52 |
53 | static const int kMaxPsnr = 128;
54 |
55 | LIBYUV_API
56 | double SumSquareErrorToPsnr(uint64_t sse, uint64_t count);
57 |
58 | LIBYUV_API
59 | double CalcFramePsnr(const uint8_t* src_a,
60 | int stride_a,
61 | const uint8_t* src_b,
62 | int stride_b,
63 | int width,
64 | int height);
65 |
66 | LIBYUV_API
67 | double I420Psnr(const uint8_t* src_y_a,
68 | int stride_y_a,
69 | const uint8_t* src_u_a,
70 | int stride_u_a,
71 | const uint8_t* src_v_a,
72 | int stride_v_a,
73 | const uint8_t* src_y_b,
74 | int stride_y_b,
75 | const uint8_t* src_u_b,
76 | int stride_u_b,
77 | const uint8_t* src_v_b,
78 | int stride_v_b,
79 | int width,
80 | int height);
81 |
82 | LIBYUV_API
83 | double CalcFrameSsim(const uint8_t* src_a,
84 | int stride_a,
85 | const uint8_t* src_b,
86 | int stride_b,
87 | int width,
88 | int height);
89 |
90 | LIBYUV_API
91 | double I420Ssim(const uint8_t* src_y_a,
92 | int stride_y_a,
93 | const uint8_t* src_u_a,
94 | int stride_u_a,
95 | const uint8_t* src_v_a,
96 | int stride_v_a,
97 | const uint8_t* src_y_b,
98 | int stride_y_b,
99 | const uint8_t* src_u_b,
100 | int stride_u_b,
101 | const uint8_t* src_v_b,
102 | int stride_v_b,
103 | int width,
104 | int height);
105 |
106 | #ifdef __cplusplus
107 | } // extern "C"
108 | } // namespace libyuv
109 | #endif
110 |
111 | #endif // INCLUDE_LIBYUV_COMPARE_H_
112 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/dv_profile.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVCODEC_DV_PROFILE_H
20 | #define AVCODEC_DV_PROFILE_H
21 |
22 | #include
23 |
24 | #include "libavutil/pixfmt.h"
25 | #include "libavutil/rational.h"
26 | #include "avcodec.h"
27 |
28 | /* minimum number of bytes to read from a DV stream in order to
29 | * determine the profile */
30 | #define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */
31 |
32 |
33 | /*
34 | * AVDVProfile is used to express the differences between various
35 | * DV flavors. For now it's primarily used for differentiating
36 | * 525/60 and 625/50, but the plans are to use it for various
37 | * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
38 | */
39 | typedef struct AVDVProfile {
40 | int dsf; /* value of the dsf in the DV header */
41 | int video_stype; /* stype for VAUX source pack */
42 | int frame_size; /* total size of one frame in bytes */
43 | int difseg_size; /* number of DIF segments per DIF channel */
44 | int n_difchan; /* number of DIF channels per frame */
45 | AVRational time_base; /* 1/framerate */
46 | int ltc_divisor; /* FPS from the LTS standpoint */
47 | int height; /* picture height in pixels */
48 | int width; /* picture width in pixels */
49 | AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
50 | enum AVPixelFormat pix_fmt; /* picture pixel format */
51 | int bpm; /* blocks per macroblock */
52 | const uint8_t *block_sizes; /* AC block sizes, in bits */
53 | int audio_stride; /* size of audio_shuffle table */
54 | int audio_min_samples[3]; /* min amount of audio samples */
55 | /* for 48kHz, 44.1kHz and 32kHz */
56 | int audio_samples_dist[5]; /* how many samples are supposed to be */
57 | /* in each frame in a 5 frames window */
58 | const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
59 | } AVDVProfile;
60 |
61 | /**
62 | * Get a DV profile for the provided compressed frame.
63 | *
64 | * @param sys the profile used for the previous frame, may be NULL
65 | * @param frame the compressed data buffer
66 | * @param buf_size size of the buffer in bytes
67 | * @return the DV profile for the supplied data or NULL on failure
68 | */
69 | const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
70 | const uint8_t *frame, unsigned buf_size);
71 |
72 | /**
73 | * Get a DV profile for the provided stream parameters.
74 | */
75 | const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt);
76 |
77 | /**
78 | * Get a DV profile for the provided stream parameters.
79 | * The frame rate is used as a best-effort parameter.
80 | */
81 | const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate);
82 |
83 | #endif /* AVCODEC_DV_PROFILE_H */
84 |
--------------------------------------------------------------------------------
/inc_header/libavutil/hwcontext_vaapi.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with FFmpeg; if not, write to the Free Software
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_HWCONTEXT_VAAPI_H
20 | #define AVUTIL_HWCONTEXT_VAAPI_H
21 |
22 | #include
23 |
24 | /**
25 | * @file
26 | * API-specific header for AV_HWDEVICE_TYPE_VAAPI.
27 | *
28 | * Dynamic frame pools are supported, but note that any pool used as a render
29 | * target is required to be of fixed size in order to be be usable as an
30 | * argument to vaCreateContext().
31 | *
32 | * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
33 | * with the data pointer set to a VASurfaceID.
34 | */
35 |
36 | enum {
37 | /**
38 | * The quirks field has been set by the user and should not be detected
39 | * automatically by av_hwdevice_ctx_init().
40 | */
41 | AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0),
42 | /**
43 | * The driver does not destroy parameter buffers when they are used by
44 | * vaRenderPicture(). Additional code will be required to destroy them
45 | * separately afterwards.
46 | */
47 | AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1),
48 |
49 | /**
50 | * The driver does not support the VASurfaceAttribMemoryType attribute,
51 | * so the surface allocation code will not try to use it.
52 | */
53 | AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2),
54 | };
55 |
56 | /**
57 | * VAAPI connection details.
58 | *
59 | * Allocated as AVHWDeviceContext.hwctx
60 | */
61 | typedef struct AVVAAPIDeviceContext {
62 | /**
63 | * The VADisplay handle, to be filled by the user.
64 | */
65 | VADisplay display;
66 | /**
67 | * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
68 | * with reference to a table of known drivers, unless the
69 | * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
70 | * may need to refer to this field when performing any later
71 | * operations using VAAPI with the same VADisplay.
72 | */
73 | unsigned int driver_quirks;
74 | } AVVAAPIDeviceContext;
75 |
76 | /**
77 | * VAAPI-specific data associated with a frame pool.
78 | *
79 | * Allocated as AVHWFramesContext.hwctx.
80 | */
81 | typedef struct AVVAAPIFramesContext {
82 | /**
83 | * Set by the user to apply surface attributes to all surfaces in
84 | * the frame pool. If null, default settings are used.
85 | */
86 | VASurfaceAttrib *attributes;
87 | int nb_attributes;
88 | /**
89 | * The surfaces IDs of all surfaces in the pool after creation.
90 | * Only valid if AVHWFramesContext.initial_pool_size was positive.
91 | * These are intended to be used as the render_targets arguments to
92 | * vaCreateContext().
93 | */
94 | VASurfaceID *surface_ids;
95 | int nb_surfaces;
96 | } AVVAAPIFramesContext;
97 |
98 | /**
99 | * VAAPI hardware pipeline configuration details.
100 | *
101 | * Allocated with av_hwdevice_hwconfig_alloc().
102 | */
103 | typedef struct AVVAAPIHWConfig {
104 | /**
105 | * ID of a VAAPI pipeline configuration.
106 | */
107 | VAConfigID config_id;
108 | } AVVAAPIHWConfig;
109 |
110 | #endif /* AVUTIL_HWCONTEXT_VAAPI_H */
111 |
--------------------------------------------------------------------------------
/inc_header/libavutil/murmur3.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Reimar Döffinger
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | /**
22 | * @file
23 | * @ingroup lavu_murmur3
24 | * Public header for MurmurHash3 hash function implementation.
25 | */
26 |
27 | #ifndef AVUTIL_MURMUR3_H
28 | #define AVUTIL_MURMUR3_H
29 |
30 | #include
31 |
32 | /**
33 | * @defgroup lavu_murmur3 Murmur3
34 | * @ingroup lavu_hash
35 | * MurmurHash3 hash function implementation.
36 | *
37 | * MurmurHash3 is a non-cryptographic hash function, of which three
38 | * incompatible versions were created by its inventor Austin Appleby:
39 | *
40 | * - 32-bit output
41 | * - 128-bit output for 32-bit platforms
42 | * - 128-bit output for 64-bit platforms
43 | *
44 | * FFmpeg only implements the last variant: 128-bit output designed for 64-bit
45 | * platforms. Even though the hash function was designed for 64-bit platforms,
46 | * the function in reality works on 32-bit systems too, only with reduced
47 | * performance.
48 | *
49 | * @anchor lavu_murmur3_seedinfo
50 | * By design, MurmurHash3 requires a seed to operate. In response to this,
51 | * libavutil provides two functions for hash initiation, one that requires a
52 | * seed (av_murmur3_init_seeded()) and one that uses a fixed arbitrary integer
53 | * as the seed, and therefore does not (av_murmur3_init()).
54 | *
55 | * To make hashes comparable, you should provide the same seed for all calls to
56 | * this hash function -- if you are supplying one yourself, that is.
57 | *
58 | * @{
59 | */
60 |
61 | /**
62 | * Allocate an AVMurMur3 hash context.
63 | *
64 | * @return Uninitialized hash context or `NULL` in case of error
65 | */
66 | struct AVMurMur3 *av_murmur3_alloc(void);
67 |
68 | /**
69 | * Initialize or reinitialize an AVMurMur3 hash context with a seed.
70 | *
71 | * @param[out] c Hash context
72 | * @param[in] seed Random seed
73 | *
74 | * @see av_murmur3_init()
75 | * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of
76 | * seeds for MurmurHash3.
77 | */
78 | void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed);
79 |
80 | /**
81 | * Initialize or reinitialize an AVMurMur3 hash context.
82 | *
83 | * Equivalent to av_murmur3_init_seeded() with a built-in seed.
84 | *
85 | * @param[out] c Hash context
86 | *
87 | * @see av_murmur3_init_seeded()
88 | * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of
89 | * seeds for MurmurHash3.
90 | */
91 | void av_murmur3_init(struct AVMurMur3 *c);
92 |
93 | /**
94 | * Update hash context with new data.
95 | *
96 | * @param[out] c Hash context
97 | * @param[in] src Input data to update hash with
98 | * @param[in] len Number of bytes to read from `src`
99 | */
100 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len);
101 |
102 | /**
103 | * Finish hashing and output digest value.
104 | *
105 | * @param[in,out] c Hash context
106 | * @param[out] dst Buffer where output digest value is stored
107 | */
108 | void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]);
109 |
110 | /**
111 | * @}
112 | */
113 |
114 | #endif /* AVUTIL_MURMUR3_H */
115 |
--------------------------------------------------------------------------------
/inc_header/libavutil/threadmessage.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of FFmpeg.
3 | *
4 | * FFmpeg is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public License
6 | * as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * FFmpeg is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef AVUTIL_THREADMESSAGE_H
20 | #define AVUTIL_THREADMESSAGE_H
21 |
22 | typedef struct AVThreadMessageQueue AVThreadMessageQueue;
23 |
24 | typedef enum AVThreadMessageFlags {
25 |
26 | /**
27 | * Perform non-blocking operation.
28 | * If this flag is set, send and recv operations are non-blocking and
29 | * return AVERROR(EAGAIN) immediately if they can not proceed.
30 | */
31 | AV_THREAD_MESSAGE_NONBLOCK = 1,
32 |
33 | } AVThreadMessageFlags;
34 |
35 | /**
36 | * Allocate a new message queue.
37 | *
38 | * @param mq pointer to the message queue
39 | * @param nelem maximum number of elements in the queue
40 | * @param elsize size of each element in the queue
41 | * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if
42 | * lavu was built without thread support
43 | */
44 | int av_thread_message_queue_alloc(AVThreadMessageQueue **mq,
45 | unsigned nelem,
46 | unsigned elsize);
47 |
48 | /**
49 | * Free a message queue.
50 | *
51 | * The message queue must no longer be in use by another thread.
52 | */
53 | void av_thread_message_queue_free(AVThreadMessageQueue **mq);
54 |
55 | /**
56 | * Send a message on the queue.
57 | */
58 | int av_thread_message_queue_send(AVThreadMessageQueue *mq,
59 | void *msg,
60 | unsigned flags);
61 |
62 | /**
63 | * Receive a message from the queue.
64 | */
65 | int av_thread_message_queue_recv(AVThreadMessageQueue *mq,
66 | void *msg,
67 | unsigned flags);
68 |
69 | /**
70 | * Set the sending error code.
71 | *
72 | * If the error code is set to non-zero, av_thread_message_queue_send() will
73 | * return it immediately. Conventional values, such as AVERROR_EOF or
74 | * AVERROR(EAGAIN), can be used to cause the sending thread to stop or
75 | * suspend its operation.
76 | */
77 | void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
78 | int err);
79 |
80 | /**
81 | * Set the receiving error code.
82 | *
83 | * If the error code is set to non-zero, av_thread_message_queue_recv() will
84 | * return it immediately when there are no longer available messages.
85 | * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
86 | * to cause the receiving thread to stop or suspend its operation.
87 | */
88 | void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
89 | int err);
90 |
91 | /**
92 | * Set the optional free message callback function which will be called if an
93 | * operation is removing messages from the queue.
94 | */
95 | void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq,
96 | void (*free_func)(void *msg));
97 |
98 | /**
99 | * Flush the message queue
100 | *
101 | * This function is mostly equivalent to reading and free-ing every message
102 | * except that it will be done in a single operation (no lock/unlock between
103 | * reads).
104 | */
105 | void av_thread_message_flush(AVThreadMessageQueue *mq);
106 |
107 | #endif /* AVUTIL_THREADMESSAGE_H */
108 |
--------------------------------------------------------------------------------
/inc_header/libavcodec/qsv.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Intel MediaSDK QSV public API
3 | *
4 | * This file is part of FFmpeg.
5 | *
6 | * FFmpeg is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * FFmpeg is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with FFmpeg; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | */
20 |
21 | #ifndef AVCODEC_QSV_H
22 | #define AVCODEC_QSV_H
23 |
24 | #include
25 |
26 | #include "libavutil/buffer.h"
27 |
28 | /**
29 | * This struct is used for communicating QSV parameters between libavcodec and
30 | * the caller. It is managed by the caller and must be assigned to
31 | * AVCodecContext.hwaccel_context.
32 | * - decoding: hwaccel_context must be set on return from the get_format()
33 | * callback
34 | * - encoding: hwaccel_context must be set before avcodec_open2()
35 | */
36 | typedef struct AVQSVContext {
37 | /**
38 | * If non-NULL, the session to use for encoding or decoding.
39 | * Otherwise, libavcodec will try to create an internal session.
40 | */
41 | mfxSession session;
42 |
43 | /**
44 | * The IO pattern to use.
45 | */
46 | int iopattern;
47 |
48 | /**
49 | * Extra buffers to pass to encoder or decoder initialization.
50 | */
51 | mfxExtBuffer **ext_buffers;
52 | int nb_ext_buffers;
53 |
54 | /**
55 | * Encoding only. If this field is set to non-zero by the caller, libavcodec
56 | * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to
57 | * the encoder initialization. This only makes sense if iopattern is also
58 | * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY.
59 | *
60 | * The number of allocated opaque surfaces will be the sum of the number
61 | * required by the encoder and the user-provided value nb_opaque_surfaces.
62 | * The array of the opaque surfaces will be exported to the caller through
63 | * the opaque_surfaces field.
64 | */
65 | int opaque_alloc;
66 |
67 | /**
68 | * Encoding only, and only if opaque_alloc is set to non-zero. Before
69 | * calling avcodec_open2(), the caller should set this field to the number
70 | * of extra opaque surfaces to allocate beyond what is required by the
71 | * encoder.
72 | *
73 | * On return from avcodec_open2(), this field will be set by libavcodec to
74 | * the total number of allocated opaque surfaces.
75 | */
76 | int nb_opaque_surfaces;
77 |
78 | /**
79 | * Encoding only, and only if opaque_alloc is set to non-zero. On return
80 | * from avcodec_open2(), this field will be used by libavcodec to export the
81 | * array of the allocated opaque surfaces to the caller, so they can be
82 | * passed to other parts of the pipeline.
83 | *
84 | * The buffer reference exported here is owned and managed by libavcodec,
85 | * the callers should make their own reference with av_buffer_ref() and free
86 | * it with av_buffer_unref() when it is no longer needed.
87 | *
88 | * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1.
89 | */
90 | AVBufferRef *opaque_surfaces;
91 |
92 | /**
93 | * Encoding only, and only if opaque_alloc is set to non-zero. On return
94 | * from avcodec_open2(), this field will be set to the surface type used in
95 | * the opaque allocation request.
96 | */
97 | int opaque_alloc_type;
98 | } AVQSVContext;
99 |
100 | /**
101 | * Allocate a new context.
102 | *
103 | * It must be freed by the caller with av_free().
104 | */
105 | AVQSVContext *av_qsv_alloc_context(void);
106 |
107 | #endif /* AVCODEC_QSV_H */
108 |
--------------------------------------------------------------------------------