├── src ├── third_party │ ├── adb │ │ ├── mac │ │ │ └── adb │ │ ├── linux │ │ │ └── adb │ │ └── win │ │ │ ├── adb.exe │ │ │ ├── AdbWinApi.dll │ │ │ └── AdbWinUsbApi.dll │ ├── scrcpy-server │ └── ffmpeg │ │ ├── lib │ │ ├── libavcodec.a │ │ ├── libavdevice.a │ │ ├── libavfilter.a │ │ ├── libavformat.a │ │ ├── libavutil.a │ │ ├── libswscale.a │ │ ├── libswresample.a │ │ ├── x64 │ │ │ ├── avcodec.lib │ │ │ ├── avutil.lib │ │ │ ├── swscale.lib │ │ │ ├── avdevice.lib │ │ │ ├── avfilter.lib │ │ │ ├── avformat.lib │ │ │ ├── swresample.lib │ │ │ ├── libavcodec.58.dylib │ │ │ ├── libavfilter.7.dylib │ │ │ ├── libavutil.56.dylib │ │ │ ├── libswscale.5.dylib │ │ │ ├── libavdevice.58.dylib │ │ │ ├── libavformat.58.dylib │ │ │ └── libswresample.3.dylib │ │ ├── x86 │ │ │ ├── avcodec.lib │ │ │ ├── avutil.lib │ │ │ ├── swscale.lib │ │ │ ├── avdevice.lib │ │ │ ├── avfilter.lib │ │ │ ├── avformat.lib │ │ │ └── swresample.lib │ │ └── arm64 │ │ │ ├── libavcodec.58.dylib │ │ │ ├── libavfilter.7.dylib │ │ │ ├── libavutil.56.dylib │ │ │ ├── libswscale.5.dylib │ │ │ ├── libavdevice.58.dylib │ │ │ ├── libavformat.58.dylib │ │ │ └── libswresample.3.dylib │ │ ├── bin │ │ ├── x64 │ │ │ ├── avcodec-58.dll │ │ │ ├── avfilter-7.dll │ │ │ ├── avutil-56.dll │ │ │ ├── swscale-5.dll │ │ │ ├── avdevice-58.dll │ │ │ ├── avformat-58.dll │ │ │ └── swresample-3.dll │ │ └── x86 │ │ │ ├── avcodec-58.dll │ │ │ ├── avfilter-7.dll │ │ │ ├── avutil-56.dll │ │ │ ├── swscale-5.dll │ │ │ ├── avdevice-58.dll │ │ │ ├── avformat-58.dll │ │ │ └── swresample-3.dll │ │ └── include │ │ ├── libavutil │ │ ├── avconfig.h │ │ ├── ffversion.h │ │ ├── hwcontext_mediacodec.h │ │ ├── macros.h │ │ ├── hwcontext_vdpau.h │ │ ├── random_seed.h │ │ ├── hwcontext_qsv.h │ │ ├── replaygain.h │ │ ├── motion_vector.h │ │ ├── time.h │ │ ├── hwcontext_cuda.h │ │ ├── intfloat.h │ │ ├── aes.h │ │ ├── rc4.h │ │ ├── adler32.h │ │ ├── pixelutils.h │ │ ├── tea.h │ │ ├── hwcontext_videotoolbox.h │ │ ├── camellia.h │ │ ├── twofish.h │ │ ├── dovi_meta.h │ │ ├── base64.h │ │ ├── aes_ctr.h │ │ ├── des.h │ │ ├── avassert.h │ │ ├── ripemd.h │ │ ├── hwcontext_dxva2.h │ │ ├── blowfish.h │ │ ├── md5.h │ │ ├── lfg.h │ │ ├── cast5.h │ │ ├── sha.h │ │ ├── timestamp.h │ │ ├── sha512.h │ │ ├── file.h │ │ ├── xtea.h │ │ ├── hmac.h │ │ ├── bswap.h │ │ ├── hwcontext_opencl.h │ │ ├── crc.h │ │ ├── downmix_info.h │ │ ├── display.h │ │ └── murmur3.h │ │ ├── libavcodec │ │ ├── ac3_parser.h │ │ ├── adts_parser.h │ │ ├── jni.h │ │ ├── vorbis_parser.h │ │ ├── vaapi.h │ │ ├── dxva2.h │ │ ├── avdct.h │ │ ├── d3d11va.h │ │ ├── avfft.h │ │ ├── mediacodec.h │ │ ├── dv_profile.h │ │ └── qsv.h │ │ ├── libswresample │ │ └── version.h │ │ ├── libswscale │ │ └── version.h │ │ ├── libavdevice │ │ └── version.h │ │ └── libavfilter │ │ └── version.h ├── device │ ├── controller │ │ ├── receiver │ │ │ ├── receiver.h │ │ │ ├── receiver.cpp │ │ │ ├── devicemsg.h │ │ │ └── devicemsg.cpp │ │ ├── inputconvert │ │ │ ├── inputconvertbase.cpp │ │ │ ├── inputconvertnormal.h │ │ │ └── inputconvertbase.h │ │ ├── bufferutil.h │ │ ├── bufferutil.cpp │ │ └── controller.h │ ├── server │ │ ├── videosocket.h │ │ ├── tcpserver.h │ │ ├── tcpserver.cpp │ │ ├── videosocket.cpp │ │ └── server.h │ ├── decoder │ │ ├── fpscounter.h │ │ ├── decoder.h │ │ ├── avframeconvert.h │ │ ├── fpscounter.cpp │ │ ├── videobuffer.h │ │ └── avframeconvert.cpp │ ├── filehandler │ │ ├── filehandler.h │ │ └── filehandler.cpp │ ├── demuxer │ │ └── demuxer.h │ ├── compat.h │ ├── recorder │ │ └── recorder.h │ └── device.h ├── common │ └── qscrcpyevent.h ├── devicemanage │ ├── devicemanage.h │ └── devicemanage.cpp └── adb │ ├── adbprocessimpl.h │ └── adbprocess.cpp ├── README.md ├── .gitignore └── include ├── adbprocess.h └── QtScrcpyCoreDef.h /src/third_party/adb/mac/adb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/adb/mac/adb -------------------------------------------------------------------------------- /src/third_party/adb/linux/adb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/adb/linux/adb -------------------------------------------------------------------------------- /src/third_party/scrcpy-server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/scrcpy-server -------------------------------------------------------------------------------- /src/third_party/adb/win/adb.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/adb/win/adb.exe -------------------------------------------------------------------------------- /src/third_party/adb/win/AdbWinApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/adb/win/AdbWinApi.dll -------------------------------------------------------------------------------- /src/third_party/adb/win/AdbWinUsbApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/adb/win/AdbWinUsbApi.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/libavcodec.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/libavcodec.a -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/libavdevice.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/libavdevice.a -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/libavfilter.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/libavfilter.a -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/libavformat.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/libavformat.a -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/libavutil.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/libavutil.a -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/libswscale.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/libswscale.a -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/libswresample.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/libswresample.a -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/avcodec.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/avcodec.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/avutil.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/avutil.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/swscale.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/swscale.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x86/avcodec.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x86/avcodec.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x86/avutil.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x86/avutil.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x86/swscale.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x86/swscale.lib -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QtScrcpyCore 2 | Android real-time display control library 3 | 4 | Dependent by [QtScrcpy](https://github.com/barry-ran/QtScrcpy) 5 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x64/avcodec-58.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x64/avcodec-58.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x64/avfilter-7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x64/avfilter-7.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x64/avutil-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x64/avutil-56.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x64/swscale-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x64/swscale-5.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x86/avcodec-58.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x86/avcodec-58.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x86/avfilter-7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x86/avfilter-7.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x86/avutil-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x86/avutil-56.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x86/swscale-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x86/swscale-5.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/avdevice.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/avdevice.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/avfilter.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/avfilter.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/avformat.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/avformat.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/swresample.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/swresample.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x86/avdevice.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x86/avdevice.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x86/avfilter.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x86/avfilter.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x86/avformat.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x86/avformat.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x86/swresample.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x86/swresample.lib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x64/avdevice-58.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x64/avdevice-58.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x64/avformat-58.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x64/avformat-58.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x64/swresample-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x64/swresample-3.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x86/avdevice-58.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x86/avdevice-58.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x86/avformat-58.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x86/avformat-58.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/bin/x86/swresample-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/bin/x86/swresample-3.dll -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/libavcodec.58.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/libavcodec.58.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/libavfilter.7.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/libavfilter.7.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/libavutil.56.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/libavutil.56.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/libswscale.5.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/libswscale.5.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/arm64/libavcodec.58.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/arm64/libavcodec.58.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/arm64/libavfilter.7.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/arm64/libavfilter.7.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/arm64/libavutil.56.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/arm64/libavutil.56.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/arm64/libswscale.5.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/arm64/libswscale.5.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/libavdevice.58.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/libavdevice.58.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/libavformat.58.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/libavformat.58.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/x64/libswresample.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/x64/libswresample.3.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/arm64/libavdevice.58.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/arm64/libavdevice.58.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/arm64/libavformat.58.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/arm64/libavformat.58.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/lib/arm64/libswresample.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barry-ran/QtScrcpyCore/HEAD/src/third_party/ffmpeg/lib/arm64/libswresample.3.dylib -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffmpeg configure */ 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 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | /* Automatically generated by version.sh, do not manually edit! */ 2 | #ifndef AVUTIL_FFVERSION_H 3 | #define AVUTIL_FFVERSION_H 4 | #define FFMPEG_VERSION "n4.4.2" 5 | #endif /* AVUTIL_FFVERSION_H */ 6 | -------------------------------------------------------------------------------- /src/device/controller/receiver/receiver.h: -------------------------------------------------------------------------------- 1 | #ifndef RECEIVER_H 2 | #define RECEIVER_H 3 | 4 | #include 5 | 6 | class DeviceMsg; 7 | class Receiver : public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit Receiver(QObject *parent = Q_NULLPTR); 12 | virtual ~Receiver(); 13 | 14 | void recvDeviceMsg(DeviceMsg *deviceMsg); 15 | }; 16 | 17 | #endif // RECEIVER_H 18 | -------------------------------------------------------------------------------- /src/device/server/videosocket.h: -------------------------------------------------------------------------------- 1 | #ifndef VIDEOSOCKET_H 2 | #define VIDEOSOCKET_H 3 | 4 | #include 5 | 6 | class VideoSocket : public QTcpSocket 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit VideoSocket(QObject *parent = nullptr); 11 | virtual ~VideoSocket(); 12 | 13 | qint32 subThreadRecvData(quint8 *buf, qint32 bufSize); 14 | }; 15 | 16 | #endif // VIDEOSOCKET_H 17 | -------------------------------------------------------------------------------- /src/device/server/tcpserver.h: -------------------------------------------------------------------------------- 1 | #ifndef TCPSERVER_H 2 | #define TCPSERVER_H 3 | 4 | #include 5 | 6 | class TcpServer : public QTcpServer 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit TcpServer(QObject *parent = nullptr); 11 | virtual ~TcpServer(); 12 | 13 | protected: 14 | virtual void incomingConnection(qintptr handle); 15 | 16 | private: 17 | bool m_isVideoSocket = true; 18 | }; 19 | 20 | #endif // TCPSERVER_H 21 | -------------------------------------------------------------------------------- /src/device/controller/inputconvert/inputconvertbase.cpp: -------------------------------------------------------------------------------- 1 | #include "inputconvertbase.h" 2 | #include "controller.h" 3 | 4 | InputConvertBase::InputConvertBase(Controller *controller) : QObject(controller), m_controller(controller) 5 | { 6 | Q_ASSERT(controller); 7 | } 8 | 9 | InputConvertBase::~InputConvertBase() {} 10 | 11 | void InputConvertBase::sendControlMsg(ControlMsg *msg) 12 | { 13 | if (msg && m_controller) { 14 | m_controller->postControlMsg(msg); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/device/controller/bufferutil.h: -------------------------------------------------------------------------------- 1 | #ifndef BUFFERUTIL_H 2 | #define BUFFERUTIL_H 3 | #include 4 | 5 | class BufferUtil 6 | { 7 | public: 8 | static void write16(QBuffer &buffer, quint16 value); 9 | static void write32(QBuffer &buffer, quint32 value); 10 | static void write64(QBuffer &buffer, quint64 value); 11 | static quint16 read16(QBuffer &buffer); 12 | static quint32 read32(QBuffer &buffer); 13 | static quint64 read64(QBuffer &buffer); 14 | }; 15 | 16 | #endif // BUFFERUTIL_H 17 | -------------------------------------------------------------------------------- /src/common/qscrcpyevent.h: -------------------------------------------------------------------------------- 1 | #ifndef QSCRCPYEVENT_H 2 | #define QSCRCPYEVENT_H 3 | #include 4 | 5 | class QScrcpyEvent : public QEvent 6 | { 7 | public: 8 | enum Type 9 | { 10 | VideoSocket = QEvent::User + 1, 11 | Control, 12 | }; 13 | QScrcpyEvent(Type type) : QEvent(QEvent::Type(type)) {} 14 | }; 15 | 16 | // VideoSocketEvent 17 | class VideoSocketEvent : public QScrcpyEvent 18 | { 19 | public: 20 | VideoSocketEvent() : QScrcpyEvent(VideoSocket) {} 21 | }; 22 | #endif // QSCRCPYEVENT_H 23 | -------------------------------------------------------------------------------- /src/device/server/tcpserver.cpp: -------------------------------------------------------------------------------- 1 | #include "tcpserver.h" 2 | #include "videosocket.h" 3 | 4 | TcpServer::TcpServer(QObject *parent) : QTcpServer(parent) {} 5 | 6 | TcpServer::~TcpServer() {} 7 | 8 | void TcpServer::incomingConnection(qintptr handle) 9 | { 10 | if (m_isVideoSocket) { 11 | VideoSocket *socket = new VideoSocket(); 12 | socket->setSocketDescriptor(handle); 13 | addPendingConnection(socket); 14 | 15 | // next is control socket 16 | m_isVideoSocket = false; 17 | } else { 18 | QTcpSocket *socket = new QTcpSocket(); 19 | socket->setSocketDescriptor(handle); 20 | addPendingConnection(socket); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Qt-es 2 | object_script.*.Release 3 | object_script.*.Debug 4 | *_plugin_import.cpp 5 | /.qmake.cache 6 | /.qmake.stash 7 | *.pro.user 8 | *.pro.user.* 9 | *.qbs.user 10 | *.qbs.user.* 11 | *.moc 12 | moc_*.cpp 13 | moc_*.h 14 | qrc_*.cpp 15 | ui_*.h 16 | *.qmlc 17 | *.jsc 18 | Makefile* 19 | *build-* 20 | *.qm 21 | *.prl 22 | 23 | *.DS_Store 24 | 25 | # Qt unit tests 26 | target_wrapper.* 27 | 28 | # QtCreator 29 | *.autosave 30 | 31 | # QtCreator Qml 32 | *.qmlproject.user 33 | *.qmlproject.user.* 34 | 35 | # QtCreator CMake 36 | CMakeLists.txt.user* 37 | 38 | # QtCreator 4.8< compilation database 39 | compile_commands.json 40 | 41 | # QtCreator local machine specific files for imported projects 42 | *creator.user* 43 | -------------------------------------------------------------------------------- /src/device/server/videosocket.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "videosocket.h" 6 | 7 | VideoSocket::VideoSocket(QObject *parent) : QTcpSocket(parent) 8 | { 9 | } 10 | 11 | VideoSocket::~VideoSocket() 12 | { 13 | } 14 | 15 | qint32 VideoSocket::subThreadRecvData(quint8 *buf, qint32 bufSize) 16 | { 17 | if (!buf) { 18 | return 0; 19 | } 20 | // this function cant call in main thread 21 | Q_ASSERT(QCoreApplication::instance()->thread() != QThread::currentThread()); 22 | 23 | while (bytesAvailable() < bufSize) { 24 | if (!waitForReadyRead(-1)) { 25 | return 0; 26 | } 27 | } 28 | 29 | // recv data 30 | return read((char *)buf, bufSize); 31 | } 32 | -------------------------------------------------------------------------------- /src/device/controller/receiver/receiver.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "devicemsg.h" 5 | #include "receiver.h" 6 | 7 | Receiver::Receiver(QObject *parent) : QObject(parent) {} 8 | 9 | Receiver::~Receiver() {} 10 | 11 | void Receiver::recvDeviceMsg(DeviceMsg *deviceMsg) 12 | { 13 | switch (deviceMsg->type()) { 14 | case DeviceMsg::DMT_GET_CLIPBOARD: { 15 | qInfo("Device clipboard copied"); 16 | QClipboard *board = QApplication::clipboard(); 17 | QString text; 18 | deviceMsg->getClipboardMsgData(text); 19 | 20 | if (board->text() == text) { 21 | qDebug("Computer clipboard unchanged"); 22 | break; 23 | } 24 | board->setText(text); 25 | break; 26 | } 27 | default: 28 | break; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/device/decoder/fpscounter.h: -------------------------------------------------------------------------------- 1 | #ifndef FPSCOUNTER_H 2 | #define FPSCOUNTER_H 3 | #include 4 | 5 | class FpsCounter : public QObject 6 | { 7 | Q_OBJECT 8 | public: 9 | FpsCounter(QObject *parent = Q_NULLPTR); 10 | virtual ~FpsCounter(); 11 | 12 | void start(); 13 | void stop(); 14 | bool isStarted(); 15 | void addRenderedFrame(); 16 | void addSkippedFrame(); 17 | 18 | signals: 19 | void updateFPS(quint32 fps); 20 | 21 | protected: 22 | virtual void timerEvent(QTimerEvent *event); 23 | 24 | private: 25 | void startCounterTimer(); 26 | void stopCounterTimer(); 27 | void resetCounter(); 28 | 29 | private: 30 | qint32 m_counterTimer = 0; 31 | quint32 m_curRendered = 0; 32 | quint32 m_curSkipped = 0; 33 | 34 | quint32 m_rendered = 0; 35 | quint32 m_skipped = 0; 36 | }; 37 | 38 | #endif // FPSCOUNTER_H 39 | -------------------------------------------------------------------------------- /src/device/filehandler/filehandler.h: -------------------------------------------------------------------------------- 1 | #ifndef FILEHANDLER_H 2 | #define FILEHANDLER_H 3 | #include 4 | 5 | #include "adbprocess.h" 6 | 7 | class FileHandler : public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | enum FILE_HANDLER_RESULT 12 | { 13 | FAR_IS_RUNNING, // 正在执行 14 | FAR_SUCCESS_EXEC, // 执行成功 15 | FAR_ERROR_EXEC, // 执行失败 16 | }; 17 | 18 | FileHandler(QObject *parent = nullptr); 19 | virtual ~FileHandler(); 20 | 21 | const QString &getDevicePath(); 22 | 23 | public slots: 24 | void onPushFileRequest(const QString &serial, const QString &file, const QString &devicePath = ""); 25 | void onInstallApkRequest(const QString &serial, const QString &apkFile); 26 | 27 | protected: 28 | void onAdbProcessResult(qsc::AdbProcess* adb, bool isApk, qsc::AdbProcess::ADB_EXEC_RESULT processResult); 29 | 30 | signals: 31 | void fileHandlerResult(FILE_HANDLER_RESULT processResult, bool isApk = false); 32 | }; 33 | 34 | #endif // FILEHANDLER_H 35 | -------------------------------------------------------------------------------- /src/device/controller/inputconvert/inputconvertnormal.h: -------------------------------------------------------------------------------- 1 | #ifndef INPUTCONVERT_H 2 | #define INPUTCONVERT_H 3 | 4 | #include "inputconvertbase.h" 5 | 6 | class InputConvertNormal : public InputConvertBase 7 | { 8 | Q_OBJECT 9 | public: 10 | InputConvertNormal(Controller *controller); 11 | virtual ~InputConvertNormal(); 12 | 13 | virtual void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize); 14 | virtual void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize); 15 | virtual void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize); 16 | 17 | private: 18 | AndroidMotioneventButtons convertMouseButtons(Qt::MouseButtons buttonState); 19 | AndroidMotioneventButtons convertMouseButton(Qt::MouseButton button); 20 | AndroidKeycode convertKeyCode(int key, Qt::KeyboardModifiers modifiers); 21 | AndroidMetastate convertMetastate(Qt::KeyboardModifiers modifiers); 22 | }; 23 | 24 | #endif // INPUTCONVERT_H 25 | -------------------------------------------------------------------------------- /src/devicemanage/devicemanage.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICEMANAGE_H 2 | #define DEVICEMANAGE_H 3 | 4 | #include 5 | 6 | #include "../../include/QtScrcpyCore.h" 7 | 8 | namespace qsc { 9 | 10 | class DeviceManage : public IDeviceManage 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit DeviceManage(); 15 | virtual ~DeviceManage(); 16 | 17 | virtual QPointer getDevice(const QString& serial) override; 18 | 19 | bool connectDevice(qsc::DeviceParams params) override; 20 | bool disconnectDevice(const QString &serial) override; 21 | void disconnectAllDevice() override; 22 | 23 | protected slots: 24 | void onDeviceConnected(bool success, const QString& serial, const QString& deviceName, const QSize& size); 25 | void onDeviceDisconnected(QString serial); 26 | 27 | private: 28 | quint16 getFreePort(); 29 | void removeDevice(const QString& serial); 30 | 31 | private: 32 | QMap> m_devices; 33 | quint16 m_localPortStart = 27183; 34 | QString m_script; 35 | }; 36 | 37 | } 38 | #endif // DEVICEMANAGE_H 39 | -------------------------------------------------------------------------------- /src/device/controller/receiver/devicemsg.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICEMSG_H 2 | #define DEVICEMSG_H 3 | 4 | #include 5 | 6 | #define DEVICE_MSG_MAX_SIZE (1 << 18) // 256k 7 | // type: 1 byte; length: 4 bytes 8 | #define DEVICE_MSG_TEXT_MAX_LENGTH (DEVICE_MSG_MAX_SIZE - 5) 9 | 10 | class DeviceMsg : public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | enum DeviceMsgType 15 | { 16 | DMT_NULL = -1, 17 | // 和服务端对应 18 | DMT_GET_CLIPBOARD = 0, 19 | }; 20 | explicit DeviceMsg(QObject *parent = nullptr); 21 | virtual ~DeviceMsg(); 22 | 23 | DeviceMsg::DeviceMsgType type(); 24 | void getClipboardMsgData(QString &text); 25 | 26 | qint32 deserialize(QByteArray &byteArray); 27 | 28 | private: 29 | struct DeviceMsgData 30 | { 31 | DeviceMsgType type = DMT_NULL; 32 | union 33 | { 34 | struct 35 | { 36 | char *text = Q_NULLPTR; 37 | } clipboardMsg; 38 | }; 39 | DeviceMsgData() {} 40 | ~DeviceMsgData() {} 41 | }; 42 | 43 | DeviceMsgData m_data; 44 | }; 45 | 46 | #endif // DEVICEMSG_H 47 | -------------------------------------------------------------------------------- /src/device/decoder/decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef DECODER_H 2 | #define DECODER_H 3 | #include 4 | 5 | extern "C" 6 | { 7 | #include "libavcodec/avcodec.h" 8 | } 9 | 10 | #include 11 | 12 | class VideoBuffer; 13 | class Decoder : public QObject 14 | { 15 | Q_OBJECT 16 | public: 17 | Decoder(std::function onFrame, QObject *parent = Q_NULLPTR); 18 | virtual ~Decoder(); 19 | 20 | bool open(); 21 | void close(); 22 | bool push(const AVPacket *packet); 23 | void peekFrame(std::function onFrame); 24 | 25 | signals: 26 | void updateFPS(quint32 fps); 27 | 28 | private slots: 29 | void onNewFrame(); 30 | 31 | signals: 32 | void newFrame(); 33 | 34 | private: 35 | void pushFrame(); 36 | 37 | private: 38 | VideoBuffer *m_vb = Q_NULLPTR; 39 | AVCodecContext *m_codecCtx = Q_NULLPTR; 40 | bool m_isCodecCtxOpen = false; 41 | std::function m_onFrame = Q_NULLPTR; 42 | }; 43 | 44 | #endif // DECODER_H 45 | -------------------------------------------------------------------------------- /src/device/decoder/avframeconvert.h: -------------------------------------------------------------------------------- 1 | #ifndef AVFRAMECONVERT_H 2 | #define AVFRAMECONVERT_H 3 | #include 4 | 5 | extern "C" 6 | { 7 | #include "libavcodec/avcodec.h" 8 | #include "libavutil/frame.h" 9 | #include "libswscale/swscale.h" 10 | } 11 | 12 | class AVFrameConvert 13 | { 14 | public: 15 | AVFrameConvert(); 16 | virtual ~AVFrameConvert(); 17 | 18 | public: 19 | void setSrcFrameInfo(int srcWidth, int srcHeight, AVPixelFormat srcFormat); 20 | void getSrcFrameInfo(int &srcWidth, int &srcHeight, AVPixelFormat &srcFormat); 21 | void setDstFrameInfo(int dstWidth, int dstHeight, AVPixelFormat dstFormat); 22 | void getDstFrameInfo(int &dstWidth, int &dstHeight, AVPixelFormat &dstFormat); 23 | 24 | bool init(); 25 | bool isInit(); 26 | void deInit(); 27 | bool convert(const AVFrame *srcFrame, AVFrame *dstFrame); 28 | 29 | private: 30 | int m_srcWidth = 0; 31 | int m_srcHeight = 0; 32 | AVPixelFormat m_srcFormat = AV_PIX_FMT_NONE; 33 | int m_dstWidth = 0; 34 | int m_dstHeight = 0; 35 | AVPixelFormat m_dstFormat = AV_PIX_FMT_NONE; 36 | 37 | struct SwsContext *m_convertCtx = Q_NULLPTR; 38 | }; 39 | 40 | #endif // AVFRAMECONVERT_H 41 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/ac3_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AC-3 parser prototypes 3 | * Copyright (c) 2003 Fabrice Bellard 4 | * Copyright (c) 2003 Michael Niedermayer 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_AC3_PARSER_H 24 | #define AVCODEC_AC3_PARSER_H 25 | 26 | #include 27 | #include 28 | 29 | /** 30 | * Extract the bitstream ID and the frame size from AC-3 data. 31 | */ 32 | int av_ac3_parse_header(const uint8_t *buf, size_t size, 33 | uint8_t *bitstream_id, uint16_t *frame_size); 34 | 35 | 36 | #endif /* AVCODEC_AC3_PARSER_H */ 37 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hwcontext_mediacodec.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_MEDIACODEC_H 20 | #define AVUTIL_HWCONTEXT_MEDIACODEC_H 21 | 22 | /** 23 | * MediaCodec details. 24 | * 25 | * Allocated as AVHWDeviceContext.hwctx 26 | */ 27 | typedef struct AVMediaCodecDeviceContext { 28 | /** 29 | * android/view/Surface handle, to be filled by the user. 30 | * 31 | * This is the default surface used by decoders on this device. 32 | */ 33 | void *surface; 34 | } AVMediaCodecDeviceContext; 35 | 36 | #endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */ 37 | -------------------------------------------------------------------------------- /src/device/controller/inputconvert/inputconvertbase.h: -------------------------------------------------------------------------------- 1 | #ifndef INPUTCONVERTBASE_H 2 | #define INPUTCONVERTBASE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "controlmsg.h" 10 | 11 | class Controller; 12 | class InputConvertBase : public QObject 13 | { 14 | Q_OBJECT 15 | public: 16 | InputConvertBase(Controller *controller); 17 | virtual ~InputConvertBase(); 18 | 19 | // the frame size may be different from the real device size, so we need the size 20 | // to which the absolute position apply, to scale it accordingly 21 | virtual void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize) = 0; 22 | virtual void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize) = 0; 23 | virtual void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize) = 0; 24 | virtual bool isCurrentCustomKeymap() 25 | { 26 | return false; 27 | } 28 | 29 | signals: 30 | void grabCursor(bool grab); 31 | 32 | protected: 33 | void sendControlMsg(ControlMsg *msg); 34 | 35 | QPointer m_controller; 36 | // Qt reports repeated events as a boolean, but Android expects the actual 37 | // number of repetitions. This variable keeps track of the count. 38 | unsigned m_repeat = 0; 39 | }; 40 | 41 | #endif // INPUTCONVERTBASE_H 42 | -------------------------------------------------------------------------------- /src/device/decoder/fpscounter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "fpscounter.h" 5 | 6 | FpsCounter::FpsCounter(QObject *parent) : QObject(parent) {} 7 | 8 | FpsCounter::~FpsCounter() {} 9 | 10 | void FpsCounter::start() 11 | { 12 | resetCounter(); 13 | startCounterTimer(); 14 | } 15 | 16 | void FpsCounter::stop() 17 | { 18 | stopCounterTimer(); 19 | resetCounter(); 20 | } 21 | 22 | bool FpsCounter::isStarted() 23 | { 24 | return m_counterTimer; 25 | } 26 | 27 | void FpsCounter::addRenderedFrame() 28 | { 29 | m_rendered++; 30 | } 31 | 32 | void FpsCounter::addSkippedFrame() 33 | { 34 | m_skipped++; 35 | } 36 | 37 | void FpsCounter::timerEvent(QTimerEvent *event) 38 | { 39 | if (event && m_counterTimer == event->timerId()) { 40 | m_curRendered = m_rendered; 41 | m_curSkipped = m_skipped; 42 | resetCounter(); 43 | emit updateFPS(m_curRendered); 44 | //qInfo("FPS:%d Discard:%d", m_curRendered, m_skipped); 45 | } 46 | } 47 | 48 | void FpsCounter::startCounterTimer() 49 | { 50 | stopCounterTimer(); 51 | m_counterTimer = startTimer(1000); 52 | } 53 | 54 | void FpsCounter::stopCounterTimer() 55 | { 56 | if (m_counterTimer) { 57 | killTimer(m_counterTimer); 58 | m_counterTimer = 0; 59 | } 60 | } 61 | 62 | void FpsCounter::resetCounter() 63 | { 64 | m_rendered = 0; 65 | m_skipped = 0; 66 | } 67 | -------------------------------------------------------------------------------- /src/device/demuxer/demuxer.h: -------------------------------------------------------------------------------- 1 | #ifndef STREAM_H 2 | #define STREAM_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern "C" 9 | { 10 | #include "libavcodec/avcodec.h" 11 | #include "libavformat/avformat.h" 12 | } 13 | 14 | class VideoSocket; 15 | class Demuxer : public QThread 16 | { 17 | Q_OBJECT 18 | public: 19 | Demuxer(QObject *parent = Q_NULLPTR); 20 | virtual ~Demuxer(); 21 | 22 | public: 23 | static bool init(); 24 | static void deInit(); 25 | 26 | void installVideoSocket(VideoSocket* videoSocket); 27 | void setFrameSize(const QSize &frameSize); 28 | bool startDecode(); 29 | void stopDecode(); 30 | 31 | signals: 32 | void onStreamStop(); 33 | void getFrame(AVPacket* packet); 34 | void getConfigFrame(AVPacket* packet); 35 | 36 | protected: 37 | void run(); 38 | bool recvPacket(AVPacket *packet); 39 | bool pushPacket(AVPacket *packet); 40 | bool processConfigPacket(AVPacket *packet); 41 | bool parse(AVPacket *packet); 42 | bool processFrame(AVPacket *packet); 43 | qint32 recvData(quint8 *buf, qint32 bufSize); 44 | 45 | private: 46 | QPointer m_videoSocket; 47 | QSize m_frameSize; 48 | 49 | AVCodecContext *m_codecCtx = Q_NULLPTR; 50 | AVCodecParserContext *m_parser = Q_NULLPTR; 51 | // successive packets may need to be concatenated, until a non-config 52 | // packet is available 53 | AVPacket* m_pending = Q_NULLPTR; 54 | }; 55 | 56 | #endif // STREAM_H 57 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * @ingroup lavu 22 | * Utility Preprocessor macros 23 | */ 24 | 25 | #ifndef AVUTIL_MACROS_H 26 | #define AVUTIL_MACROS_H 27 | 28 | /** 29 | * @addtogroup preproc_misc Preprocessor String Macros 30 | * 31 | * String manipulation macros 32 | * 33 | * @{ 34 | */ 35 | 36 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 37 | #define AV_TOSTRING(s) #s 38 | 39 | #define AV_GLUE(a, b) a ## b 40 | #define AV_JOIN(a, b) AV_GLUE(a, b) 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | #define AV_PRAGMA(s) _Pragma(#s) 47 | 48 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) 49 | 50 | #endif /* AVUTIL_MACROS_H */ 51 | -------------------------------------------------------------------------------- /src/device/controller/bufferutil.cpp: -------------------------------------------------------------------------------- 1 | #include "bufferutil.h" 2 | 3 | void BufferUtil::write32(QBuffer &buffer, quint32 value) 4 | { 5 | buffer.putChar(value >> 24); 6 | buffer.putChar(value >> 16); 7 | buffer.putChar(value >> 8); 8 | buffer.putChar(value); 9 | } 10 | 11 | void BufferUtil::write64(QBuffer &buffer, quint64 value) 12 | { 13 | write32(buffer, value >> 32); 14 | write32(buffer, (quint32)value); 15 | } 16 | 17 | void BufferUtil::write16(QBuffer &buffer, quint16 value) 18 | { 19 | buffer.putChar(value >> 8); 20 | buffer.putChar(value); 21 | } 22 | 23 | quint16 BufferUtil::read16(QBuffer &buffer) 24 | { 25 | uchar c; 26 | quint16 ret = 0; 27 | buffer.getChar(reinterpret_cast(&c)); 28 | ret |= (c << 8); 29 | buffer.getChar(reinterpret_cast(&c)); 30 | ret |= c; 31 | 32 | return ret; 33 | } 34 | 35 | quint32 BufferUtil::read32(QBuffer &buffer) 36 | { 37 | uchar c; 38 | quint32 ret = 0; 39 | buffer.getChar(reinterpret_cast(&c)); 40 | ret |= (c << 24); 41 | buffer.getChar(reinterpret_cast(&c)); 42 | ret |= (c << 16); 43 | buffer.getChar(reinterpret_cast(&c)); 44 | ret |= (c << 8); 45 | buffer.getChar(reinterpret_cast(&c)); 46 | ret |= c; 47 | 48 | return ret; 49 | } 50 | 51 | quint64 BufferUtil::read64(QBuffer &buffer) 52 | { 53 | quint32 msb = read32(buffer); 54 | quint32 lsb = read32(buffer); 55 | 56 | return ((quint64)msb << 32) | lsb; 57 | ; 58 | } 59 | -------------------------------------------------------------------------------- /src/adb/adbprocessimpl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "adbprocess.h" 5 | 6 | class AdbProcessImpl : public QProcess 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit AdbProcessImpl(QObject *parent = nullptr); 12 | virtual ~AdbProcessImpl(); 13 | 14 | void execute(const QString &serial, const QStringList &args); 15 | void forward(const QString &serial, quint16 localPort, const QString &deviceSocketName); 16 | void forwardRemove(const QString &serial, quint16 localPort); 17 | void reverse(const QString &serial, const QString &deviceSocketName, quint16 localPort); 18 | void reverseRemove(const QString &serial, const QString &deviceSocketName); 19 | void push(const QString &serial, const QString &local, const QString &remote); 20 | void install(const QString &serial, const QString &local); 21 | void removePath(const QString &serial, const QString &path); 22 | bool isRuning(); 23 | void setShowTouchesEnabled(const QString &serial, bool enabled); 24 | QStringList getDevicesSerialFromStdOut(); 25 | QString getDeviceIPFromStdOut(); 26 | QString getDeviceIPByIpFromStdOut(); 27 | QString getStdOut(); 28 | QString getErrorOut(); 29 | 30 | static const QString &getAdbPath(); 31 | 32 | signals: 33 | void adbProcessImplResult(qsc::AdbProcess::ADB_EXEC_RESULT processResult); 34 | 35 | private: 36 | void initSignals(); 37 | 38 | private: 39 | QString m_standardOutput = ""; 40 | QString m_errorOutput = ""; 41 | static QString s_adbPath; 42 | }; 43 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/adts_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 | #ifndef AVCODEC_ADTS_PARSER_H 20 | #define AVCODEC_ADTS_PARSER_H 21 | 22 | #include 23 | #include 24 | 25 | #define AV_AAC_ADTS_HEADER_SIZE 7 26 | 27 | /** 28 | * Extract the number of samples and frames from AAC data. 29 | * @param[in] buf pointer to AAC data buffer 30 | * @param[out] samples Pointer to where number of samples is written 31 | * @param[out] frames Pointer to where number of frames is written 32 | * @return Returns 0 on success, error code on failure. 33 | */ 34 | int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, 35 | uint8_t *frames); 36 | 37 | #endif /* AVCODEC_ADTS_PARSER_H */ 38 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hwcontext_vdpau.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_VDPAU_H 20 | #define AVUTIL_HWCONTEXT_VDPAU_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. 27 | * 28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 29 | * AVBufferRefs whose data pointer is a VdpVideoSurface. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVVDPAUDeviceContext { 36 | VdpDevice device; 37 | VdpGetProcAddress *get_proc_address; 38 | } AVVDPAUDeviceContext; 39 | 40 | /** 41 | * AVHWFramesContext.hwctx is currently not used 42 | */ 43 | 44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */ 45 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/random_seed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Baptiste Coudurier 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get a seed to use in conjunction with random functions. 32 | * This function tries to provide a good seed at a best effort bases. 33 | * Its possible to call this function multiple times if more bits are needed. 34 | * It can be quite slow, which is why it should only be used as seed for a faster 35 | * PRNG. The quality of the seed depends on the platform. 36 | */ 37 | uint32_t av_get_random_seed(void); 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | #endif /* AVUTIL_RANDOM_SEED_H */ 44 | -------------------------------------------------------------------------------- /src/device/compat.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPAT_H 2 | #define COMPAT_H 3 | #include "libavcodec/version.h" 4 | #include "libavformat/version.h" 5 | 6 | // In ffmpeg/doc/APIchanges: 7 | // 2016-04-11 - 6f69f7a / 9200514 - lavf 57.33.100 / 57.5.0 - avformat.h 8 | // Add AVStream.codecpar, deprecate AVStream.codec. 9 | #if (LIBAVFORMAT_VERSION_MICRO >= 100 /* FFmpeg */ && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)) \ 10 | || (LIBAVFORMAT_VERSION_MICRO < 100 && /* Libav */ \ 11 | LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 5, 0)) 12 | #define QTSCRCPY_LAVF_HAS_NEW_CODEC_PARAMS_API 13 | #endif 14 | 15 | // In ffmpeg/doc/APIchanges: 16 | // 2018-02-06 - 0694d87024 - lavf 58.9.100 - avformat.h 17 | // Deprecate use of av_register_input_format(), av_register_output_format(), 18 | // av_register_all(), av_iformat_next(), av_oformat_next(). 19 | // Add av_demuxer_iterate(), and av_muxer_iterate(). 20 | #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 9, 100) 21 | #define QTSCRCPY_LAVF_HAS_NEW_MUXER_ITERATOR_API 22 | #else 23 | #define QTSCRCPY_LAVF_REQUIRES_REGISTER_ALL 24 | #endif 25 | 26 | // In ffmpeg/doc/APIchanges: 27 | // 2016-04-21 - 7fc329e - lavc 57.37.100 - avcodec.h 28 | // Add a new audio/video encoding and decoding API with decoupled input 29 | // and output -- avcodec_send_packet(), avcodec_receive_frame(), 30 | // avcodec_send_frame() and avcodec_receive_packet(). 31 | #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 100) 32 | #define QTSCRCPY_LAVF_HAS_NEW_ENCODING_DECODING_API 33 | #endif 34 | 35 | #endif // COMPAT_H 36 | -------------------------------------------------------------------------------- /src/device/filehandler/filehandler.cpp: -------------------------------------------------------------------------------- 1 | #include "filehandler.h" 2 | 3 | FileHandler::FileHandler(QObject *parent) : QObject(parent) 4 | { 5 | } 6 | 7 | FileHandler::~FileHandler() {} 8 | 9 | void FileHandler::onPushFileRequest(const QString &serial, const QString &file, const QString &devicePath) 10 | { 11 | qsc::AdbProcess* adb = new qsc::AdbProcess; 12 | bool isApk = false; 13 | connect(adb, &qsc::AdbProcess::adbProcessResult, this, [this, adb, isApk](qsc::AdbProcess::ADB_EXEC_RESULT processResult) { 14 | onAdbProcessResult(adb, isApk, processResult); 15 | }); 16 | 17 | adb->push(serial, file, devicePath); 18 | } 19 | 20 | void FileHandler::onInstallApkRequest(const QString &serial, const QString &apkFile) 21 | { 22 | qsc::AdbProcess* adb = new qsc::AdbProcess; 23 | bool isApk = true; 24 | connect(adb, &qsc::AdbProcess::adbProcessResult, this, [this, adb, isApk](qsc::AdbProcess::ADB_EXEC_RESULT processResult) { 25 | onAdbProcessResult(adb, isApk, processResult); 26 | }); 27 | 28 | adb->install(serial, apkFile); 29 | } 30 | 31 | void FileHandler::onAdbProcessResult(qsc::AdbProcess *adb, bool isApk, qsc::AdbProcess::ADB_EXEC_RESULT processResult) 32 | { 33 | switch (processResult) { 34 | case qsc::AdbProcess::AER_ERROR_START: 35 | case qsc::AdbProcess::AER_ERROR_EXEC: 36 | case qsc::AdbProcess::AER_ERROR_MISSING_BINARY: 37 | emit fileHandlerResult(FAR_ERROR_EXEC, isApk); 38 | adb->deleteLater(); 39 | break; 40 | case qsc::AdbProcess::AER_SUCCESS_EXEC: 41 | emit fileHandlerResult(FAR_SUCCESS_EXEC, isApk); 42 | adb->deleteLater(); 43 | break; 44 | default: 45 | break; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hwcontext_qsv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_QSV_H 20 | #define AVUTIL_HWCONTEXT_QSV_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV. 27 | * 28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must 29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVQSVDeviceContext { 36 | mfxSession session; 37 | } AVQSVDeviceContext; 38 | 39 | /** 40 | * This struct is allocated as AVHWFramesContext.hwctx 41 | */ 42 | typedef struct AVQSVFramesContext { 43 | mfxFrameSurface1 *surfaces; 44 | int nb_surfaces; 45 | 46 | /** 47 | * A combination of MFX_MEMTYPE_* describing the frame pool. 48 | */ 49 | int frame_type; 50 | } AVQSVFramesContext; 51 | 52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */ 53 | 54 | -------------------------------------------------------------------------------- /include/adbprocess.h: -------------------------------------------------------------------------------- 1 | #ifndef ADBPROCESS_H 2 | #define ADBPROCESS_H 3 | 4 | #include 5 | 6 | class AdbProcessImpl; 7 | namespace qsc { 8 | 9 | class AdbProcess : public QObject 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | enum ADB_EXEC_RESULT 15 | { 16 | AER_SUCCESS_START, // 启动成功 17 | AER_ERROR_START, // 启动失败 18 | AER_SUCCESS_EXEC, // 执行成功 19 | AER_ERROR_EXEC, // 执行失败 20 | AER_ERROR_MISSING_BINARY, // 找不到文件 21 | }; 22 | 23 | explicit AdbProcess(QObject *parent = nullptr); 24 | virtual ~AdbProcess(); 25 | 26 | static void setAdbPath(const QString& adbPath); 27 | 28 | void execute(const QString &serial, const QStringList &args); 29 | void forward(const QString &serial, quint16 localPort, const QString &deviceSocketName); 30 | void forwardRemove(const QString &serial, quint16 localPort); 31 | void reverse(const QString &serial, const QString &deviceSocketName, quint16 localPort); 32 | void reverseRemove(const QString &serial, const QString &deviceSocketName); 33 | void push(const QString &serial, const QString &local, const QString &remote); 34 | void install(const QString &serial, const QString &local); 35 | void removePath(const QString &serial, const QString &path); 36 | bool isRuning(); 37 | void setShowTouchesEnabled(const QString &serial, bool enabled); 38 | void kill(); 39 | QStringList arguments(); 40 | QStringList getDevicesSerialFromStdOut(); 41 | QString getDeviceIPFromStdOut(); 42 | QString getDeviceIPByIpFromStdOut(); 43 | QString getStdOut(); 44 | QString getErrorOut(); 45 | 46 | signals: 47 | void adbProcessResult(ADB_EXEC_RESULT processResult); 48 | 49 | private: 50 | AdbProcessImpl* m_adbImpl = nullptr; 51 | }; 52 | 53 | } 54 | #endif // ADBPROCESS_H 55 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/replaygain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_REPLAYGAIN_H 20 | #define AVUTIL_REPLAYGAIN_H 21 | 22 | #include 23 | 24 | /** 25 | * ReplayGain information (see 26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). 27 | * The size of this struct is a part of the public ABI. 28 | */ 29 | typedef struct AVReplayGain { 30 | /** 31 | * Track replay gain in microbels (divide by 100000 to get the value in dB). 32 | * Should be set to INT32_MIN when unknown. 33 | */ 34 | int32_t track_gain; 35 | /** 36 | * Peak track amplitude, with 100000 representing full scale (but values 37 | * may overflow). 0 when unknown. 38 | */ 39 | uint32_t track_peak; 40 | /** 41 | * Same as track_gain, but for the whole album. 42 | */ 43 | int32_t album_gain; 44 | /** 45 | * Same as track_peak, but for the whole album, 46 | */ 47 | uint32_t album_peak; 48 | } AVReplayGain; 49 | 50 | #endif /* AVUTIL_REPLAYGAIN_H */ 51 | -------------------------------------------------------------------------------- /include/QtScrcpyCoreDef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace qsc { 5 | 6 | struct DeviceParams { 7 | // necessary 8 | QString serial = ""; // 设备序列号 9 | QString serverLocalPath = ""; // 本地安卓server路径 10 | 11 | // optional 12 | QString serverRemotePath = "/data/local/tmp/scrcpy-server.jar"; // 要推送到远端设备的server路径 13 | quint16 localPort = 27183; // reverse时本地监听端口 14 | quint16 maxSize = 720; // 视频分辨率 15 | quint32 bitRate = 2000000; // 视频比特率 16 | quint32 maxFps = 0; // 视频最大帧率 17 | bool useReverse = true; // true:先使用adb reverse,失败后自动使用adb forward;false:直接使用adb forward 18 | int captureOrientationLock = 0; // 是否锁定采集方向 0不锁定 1锁定指定方向 2锁定原始方向 19 | int captureOrientation = 0; // 采集方向 0 90 180 270 20 | bool stayAwake = false; // 是否保持唤醒 21 | QString serverVersion = "3.3.3"; // server版本 22 | QString logLevel = "debug"; // log级别 verbose/debug/info/warn/error 23 | // 编码选项 ""表示默认 24 | // 例如 CodecOptions="profile=1,level=2" 25 | // 更多编码选项参考 https://d.android.com/reference/android/media/MediaFormat 26 | QString codecOptions = ""; 27 | // 指定编码器名称(必须是H.264编码器),""表示默认 28 | // 例如 CodecName="OMX.qcom.video.encoder.avc" 29 | QString codecName = ""; 30 | quint32 scid = -1; // 随机数,作为localsocket名字后缀,方便同时连接同一个设备多次 31 | 32 | QString recordPath = ""; // 视频保存路径 33 | QString recordFileFormat = "mp4"; // 视频保存格式 mp4/mkv 34 | bool recordFile = false; // 录制到文件 35 | 36 | QString pushFilePath = "/sdcard/"; // 推送到安卓设备的文件保存路径(必须以/结尾) 37 | 38 | bool closeScreen = false; // 启动时自动息屏 39 | bool display = true; // 是否显示画面(或者仅仅后台录制) 40 | bool renderExpiredFrames = false; // 是否渲染延迟视频帧 41 | QString gameScript = ""; // 游戏映射脚本 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/jni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JNI public API functions 3 | * 4 | * Copyright (c) 2015-2016 Matthieu Bouron 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_JNI_H 24 | #define AVCODEC_JNI_H 25 | 26 | /* 27 | * Manually set a Java virtual machine which will be used to retrieve the JNI 28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning 29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer 30 | * however it will error out if you try to set a different Java VM. 31 | * 32 | * @param vm Java virtual machine 33 | * @param log_ctx context used for logging, can be NULL 34 | * @return 0 on success, < 0 otherwise 35 | */ 36 | int av_jni_set_java_vm(void *vm, void *log_ctx); 37 | 38 | /* 39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm. 40 | * 41 | * @param vm Java virtual machine 42 | * @return a pointer to the Java virtual machine 43 | */ 44 | void *av_jni_get_java_vm(void *log_ctx); 45 | 46 | #endif /* AVCODEC_JNI_H */ 47 | -------------------------------------------------------------------------------- /src/device/controller/receiver/devicemsg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bufferutil.h" 4 | #include "devicemsg.h" 5 | 6 | DeviceMsg::DeviceMsg(QObject *parent) : QObject(parent) {} 7 | 8 | DeviceMsg::~DeviceMsg() 9 | { 10 | if (DMT_GET_CLIPBOARD == m_data.type && Q_NULLPTR != m_data.clipboardMsg.text) { 11 | delete m_data.clipboardMsg.text; 12 | m_data.clipboardMsg.text = Q_NULLPTR; 13 | } 14 | } 15 | 16 | DeviceMsg::DeviceMsgType DeviceMsg::type() 17 | { 18 | return m_data.type; 19 | } 20 | 21 | void DeviceMsg::getClipboardMsgData(QString &text) 22 | { 23 | text = QString::fromUtf8(m_data.clipboardMsg.text); 24 | } 25 | 26 | qint32 DeviceMsg::deserialize(QByteArray &byteArray) 27 | { 28 | QBuffer buf(&byteArray); 29 | buf.open(QBuffer::ReadOnly); 30 | 31 | qint64 len = buf.size(); 32 | char c = 0; 33 | qint32 ret = 0; 34 | 35 | if (len < 5) { 36 | // at least type + empty string length 37 | return 0; // not available 38 | } 39 | 40 | buf.getChar(&c); 41 | m_data.type = (DeviceMsgType)c; 42 | switch (m_data.type) { 43 | case DMT_GET_CLIPBOARD: { 44 | m_data.clipboardMsg.text = Q_NULLPTR; 45 | quint16 clipboardLen = BufferUtil::read32(buf); 46 | if (clipboardLen > len - 5) { 47 | ret = 0; // not available 48 | break; 49 | } 50 | 51 | QByteArray text = buf.readAll(); 52 | m_data.clipboardMsg.text = new char[text.length() + 1]; 53 | memcpy(m_data.clipboardMsg.text, text.data(), text.length()); 54 | m_data.clipboardMsg.text[text.length()] = '\0'; 55 | 56 | ret = 5 + clipboardLen; 57 | break; 58 | } 59 | default: 60 | qWarning("Unsupported device msg type: %d", (int)m_data.type); 61 | ret = -1; // error, we cannot recover 62 | } 63 | 64 | buf.close(); 65 | return ret; 66 | } 67 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libswresample/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of libswresample 5 | * 6 | * libswresample is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * libswresample is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with libswresample; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SWRESAMPLE_VERSION_H 22 | #define SWRESAMPLE_VERSION_H 23 | 24 | /** 25 | * @file 26 | * Libswresample version macros 27 | */ 28 | 29 | #include "libavutil/avutil.h" 30 | 31 | #define LIBSWRESAMPLE_VERSION_MAJOR 3 32 | #define LIBSWRESAMPLE_VERSION_MINOR 9 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 | -------------------------------------------------------------------------------- /src/device/decoder/videobuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef VIDEO_BUFFER_H 2 | #define VIDEO_BUFFER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include "fpscounter.h" 10 | 11 | // forward declarations 12 | typedef struct AVFrame AVFrame; 13 | 14 | class VideoBuffer : public QObject 15 | { 16 | Q_OBJECT 17 | public: 18 | VideoBuffer(QObject *parent = Q_NULLPTR); 19 | virtual ~VideoBuffer(); 20 | 21 | bool init(); 22 | void deInit(); 23 | void lock(); 24 | void unLock(); 25 | void setRenderExpiredFrames(bool renderExpiredFrames); 26 | 27 | AVFrame *decodingFrame(); 28 | // set the decoder frame as ready for rendering 29 | // this function locks m_mutex during its execution 30 | // returns true if the previous frame had been consumed 31 | void offerDecodedFrame(bool &previousFrameSkipped); 32 | 33 | // mark the rendering frame as consumed and return it 34 | // MUST be called with m_mutex locked!!! 35 | // the caller is expected to render the returned frame to some texture before 36 | // unlocking m_mutex 37 | const AVFrame *consumeRenderedFrame(); 38 | 39 | void peekRenderedFrame(std::function onFrame); 40 | 41 | // wake up and avoid any blocking call 42 | void interrupt(); 43 | 44 | signals: 45 | void updateFPS(quint32 fps); 46 | 47 | private: 48 | void swap(); 49 | 50 | private: 51 | AVFrame *m_decodingFrame = Q_NULLPTR; 52 | AVFrame *m_renderingframe = Q_NULLPTR; 53 | QMutex m_mutex; 54 | bool m_renderingFrameConsumed = true; 55 | FpsCounter m_fpsCounter; 56 | 57 | bool m_renderExpiredFrames = false; 58 | QWaitCondition m_renderingFrameConsumedCond; 59 | 60 | // interrupted is not used if expired frames are not rendered 61 | // since offering a frame will never block 62 | bool m_interrupted = false; 63 | }; 64 | 65 | #endif // VIDEO_BUFFER_H 66 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/motion_vector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_MOTION_VECTOR_H 20 | #define AVUTIL_MOTION_VECTOR_H 21 | 22 | #include 23 | 24 | typedef struct AVMotionVector { 25 | /** 26 | * Where the current macroblock comes from; negative value when it comes 27 | * from the past, positive value when it comes from the future. 28 | * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". 29 | */ 30 | int32_t source; 31 | /** 32 | * Width and height of the block. 33 | */ 34 | uint8_t w, h; 35 | /** 36 | * Absolute source position. Can be outside the frame area. 37 | */ 38 | int16_t src_x, src_y; 39 | /** 40 | * Absolute destination position. Can be outside the frame area. 41 | */ 42 | int16_t dst_x, dst_y; 43 | /** 44 | * Extra flag information. 45 | * Currently unused. 46 | */ 47 | uint64_t flags; 48 | /** 49 | * Motion vector 50 | * src_x = dst_x + motion_x / motion_scale 51 | * src_y = dst_y + motion_y / motion_scale 52 | */ 53 | int32_t motion_x, motion_y; 54 | uint16_t motion_scale; 55 | } AVMotionVector; 56 | 57 | #endif /* AVUTIL_MOTION_VECTOR_H */ 58 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_TIME_H 22 | #define AVUTIL_TIME_H 23 | 24 | #include 25 | 26 | /** 27 | * Get the current time in microseconds. 28 | */ 29 | int64_t av_gettime(void); 30 | 31 | /** 32 | * Get the current time in microseconds since some unspecified starting point. 33 | * On platforms that support it, the time comes from a monotonic clock 34 | * This property makes this time source ideal for measuring relative time. 35 | * The returned values may not be monotonic on platforms where a monotonic 36 | * clock is not available. 37 | */ 38 | int64_t av_gettime_relative(void); 39 | 40 | /** 41 | * Indicates with a boolean result if the av_gettime_relative() time source 42 | * is monotonic. 43 | */ 44 | int av_gettime_relative_is_monotonic(void); 45 | 46 | /** 47 | * Sleep for a period of time. Although the duration is expressed in 48 | * microseconds, the actual delay may be rounded to the precision of the 49 | * system timer. 50 | * 51 | * @param usec Number of microseconds to sleep. 52 | * @return zero on success or (negative) error code. 53 | */ 54 | int av_usleep(unsigned usec); 55 | 56 | #endif /* AVUTIL_TIME_H */ 57 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hwcontext_cuda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef AVUTIL_HWCONTEXT_CUDA_H 21 | #define AVUTIL_HWCONTEXT_CUDA_H 22 | 23 | #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 | CUstream stream; 45 | AVCUDADeviceContextInternal *internal; 46 | } AVCUDADeviceContext; 47 | 48 | /** 49 | * AVHWFramesContext.hwctx is currently not used 50 | */ 51 | 52 | /** 53 | * @defgroup hwcontext_cuda Device context creation flags 54 | * 55 | * Flags for av_hwdevice_ctx_create. 56 | * 57 | * @{ 58 | */ 59 | 60 | /** 61 | * Use primary device context instead of creating a new one. 62 | */ 63 | #define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0) 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */ 70 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/intfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_H 22 | #define AVUTIL_INTFLOAT_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | union av_intfloat32 { 28 | uint32_t i; 29 | float f; 30 | }; 31 | 32 | union av_intfloat64 { 33 | uint64_t i; 34 | double f; 35 | }; 36 | 37 | /** 38 | * Reinterpret a 32-bit integer as a float. 39 | */ 40 | static av_always_inline float av_int2float(uint32_t i) 41 | { 42 | union av_intfloat32 v; 43 | v.i = i; 44 | return v.f; 45 | } 46 | 47 | /** 48 | * Reinterpret a float as a 32-bit integer. 49 | */ 50 | static av_always_inline uint32_t av_float2int(float f) 51 | { 52 | union av_intfloat32 v; 53 | v.f = f; 54 | return v.i; 55 | } 56 | 57 | /** 58 | * Reinterpret a 64-bit integer as a double. 59 | */ 60 | static av_always_inline double av_int2double(uint64_t i) 61 | { 62 | union av_intfloat64 v; 63 | v.i = i; 64 | return v.f; 65 | } 66 | 67 | /** 68 | * Reinterpret a double as a 64-bit integer. 69 | */ 70 | static av_always_inline uint64_t av_double2int(double f) 71 | { 72 | union av_intfloat64 v; 73 | v.f = f; 74 | return v.i; 75 | } 76 | 77 | #endif /* AVUTIL_INTFLOAT_H */ 78 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AES_H 22 | #define AVUTIL_AES_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_aes AES 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_aes_size; 36 | 37 | struct AVAES; 38 | 39 | /** 40 | * Allocate an AVAES context. 41 | */ 42 | struct AVAES *av_aes_alloc(void); 43 | 44 | /** 45 | * Initialize an AVAES context. 46 | * @param key_bits 128, 192 or 256 47 | * @param decrypt 0 for encryption, 1 for decryption 48 | */ 49 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * Encrypt or decrypt a buffer using a previously initialized context. 53 | * @param count number of 16 byte blocks 54 | * @param dst destination array, can be equal to src 55 | * @param src source array, can be equal to dst 56 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 57 | * @param decrypt 0 for encryption, 1 for decryption 58 | */ 59 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | #endif /* AVUTIL_AES_H */ 66 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libswscale/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SWSCALE_VERSION_H 20 | #define SWSCALE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * swscale version macros 25 | */ 26 | 27 | #include "libavutil/version.h" 28 | 29 | #define LIBSWSCALE_VERSION_MAJOR 5 30 | #define LIBSWSCALE_VERSION_MINOR 9 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 | -------------------------------------------------------------------------------- /src/device/decoder/avframeconvert.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "avframeconvert.h" 4 | 5 | AVFrameConvert::AVFrameConvert() {} 6 | 7 | AVFrameConvert::~AVFrameConvert() {} 8 | 9 | void AVFrameConvert::setSrcFrameInfo(int srcWidth, int srcHeight, AVPixelFormat srcFormat) 10 | { 11 | m_srcWidth = srcWidth; 12 | m_srcHeight = srcHeight; 13 | m_srcFormat = srcFormat; 14 | qDebug() << "Convert::src frame info " << srcWidth << "x" << srcHeight; 15 | } 16 | 17 | void AVFrameConvert::getSrcFrameInfo(int &srcWidth, int &srcHeight, AVPixelFormat &srcFormat) 18 | { 19 | srcWidth = m_srcWidth; 20 | srcHeight = m_srcHeight; 21 | srcFormat = m_srcFormat; 22 | } 23 | 24 | void AVFrameConvert::setDstFrameInfo(int dstWidth, int dstHeight, AVPixelFormat dstFormat) 25 | { 26 | m_dstWidth = dstWidth; 27 | m_dstHeight = dstHeight; 28 | m_dstFormat = dstFormat; 29 | } 30 | 31 | void AVFrameConvert::getDstFrameInfo(int &dstWidth, int &dstHeight, AVPixelFormat &dstFormat) 32 | { 33 | dstWidth = m_dstWidth; 34 | dstHeight = m_dstHeight; 35 | dstFormat = m_dstFormat; 36 | } 37 | 38 | bool AVFrameConvert::init() 39 | { 40 | if (m_convertCtx) { 41 | return true; 42 | } 43 | m_convertCtx = sws_getContext(m_srcWidth, m_srcHeight, m_srcFormat, m_dstWidth, m_dstHeight, m_dstFormat, SWS_BICUBIC, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR); 44 | if (!m_convertCtx) { 45 | return false; 46 | } 47 | return true; 48 | } 49 | 50 | bool AVFrameConvert::isInit() 51 | { 52 | return m_convertCtx ? true : false; 53 | } 54 | 55 | void AVFrameConvert::deInit() 56 | { 57 | if (m_convertCtx) { 58 | sws_freeContext(m_convertCtx); 59 | m_convertCtx = Q_NULLPTR; 60 | } 61 | } 62 | 63 | bool AVFrameConvert::convert(const AVFrame *srcFrame, AVFrame *dstFrame) 64 | { 65 | if (!m_convertCtx || !srcFrame || !dstFrame) { 66 | return false; 67 | } 68 | qint32 ret 69 | = sws_scale(m_convertCtx, static_cast(srcFrame->data), srcFrame->linesize, 0, m_srcHeight, dstFrame->data, dstFrame->linesize); 70 | if (0 == ret) { 71 | return false; 72 | } 73 | return true; 74 | } 75 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RC4 encryption/decryption/pseudo-random number generator 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RC4_H 22 | #define AVUTIL_RC4_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_rc4 RC4 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | typedef struct AVRC4 { 33 | uint8_t state[256]; 34 | int x, y; 35 | } AVRC4; 36 | 37 | /** 38 | * Allocate an AVRC4 context. 39 | */ 40 | AVRC4 *av_rc4_alloc(void); 41 | 42 | /** 43 | * @brief Initializes an AVRC4 context. 44 | * 45 | * @param key_bits must be a multiple of 8 46 | * @param decrypt 0 for encryption, 1 for decryption, currently has no effect 47 | * @return zero on success, negative value otherwise 48 | */ 49 | int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * @brief Encrypts / decrypts using the RC4 algorithm. 53 | * 54 | * @param count number of bytes 55 | * @param dst destination array, can be equal to src 56 | * @param src source array, can be equal to dst, may be NULL 57 | * @param iv not (yet) used for RC4, should be NULL 58 | * @param decrypt 0 for encryption, 1 for decryption, not (yet) used 59 | */ 60 | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_RC4_H */ 67 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_adler32 24 | * Public header for Adler-32 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_ADLER32_H 28 | #define AVUTIL_ADLER32_H 29 | 30 | #include 31 | #include 32 | #include "attributes.h" 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_adler32 Adler-32 37 | * @ingroup lavu_hash 38 | * Adler-32 hash function implementation. 39 | * 40 | * @{ 41 | */ 42 | 43 | #if FF_API_CRYPTO_SIZE_T 44 | typedef unsigned long AVAdler; 45 | #else 46 | typedef uint32_t AVAdler; 47 | #endif 48 | 49 | /** 50 | * Calculate the Adler32 checksum of a buffer. 51 | * 52 | * Passing the return value to a subsequent av_adler32_update() call 53 | * allows the checksum of multiple buffers to be calculated as though 54 | * they were concatenated. 55 | * 56 | * @param adler initial checksum value 57 | * @param buf pointer to input buffer 58 | * @param len size of input buffer 59 | * @return updated checksum 60 | */ 61 | AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, 62 | #if FF_API_CRYPTO_SIZE_T 63 | unsigned int len) av_pure; 64 | #else 65 | size_t len) av_pure; 66 | #endif 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | #endif /* AVUTIL_ADLER32_H */ 73 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavdevice/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVDEVICE_VERSION_H 20 | #define AVDEVICE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavd 25 | * Libavdevice version macros 26 | */ 27 | 28 | #include "libavutil/version.h" 29 | 30 | #define LIBAVDEVICE_VERSION_MAJOR 58 31 | #define LIBAVDEVICE_VERSION_MINOR 13 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 | #ifndef FF_API_DEVICE_CAPABILITIES 50 | #define FF_API_DEVICE_CAPABILITIES (LIBAVDEVICE_VERSION_MAJOR < 60) 51 | #endif 52 | 53 | #endif /* AVDEVICE_VERSION_H */ 54 | -------------------------------------------------------------------------------- /src/device/recorder/recorder.h: -------------------------------------------------------------------------------- 1 | #ifndef RECORDER_H 2 | #define RECORDER_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | extern "C" 11 | { 12 | #include "libavformat/avformat.h" 13 | } 14 | 15 | class Recorder : public QThread 16 | { 17 | Q_OBJECT 18 | public: 19 | enum RecorderFormat 20 | { 21 | RECORDER_FORMAT_NULL = 0, 22 | RECORDER_FORMAT_MP4, 23 | RECORDER_FORMAT_MKV, 24 | }; 25 | 26 | Recorder(const QString &fileName, QObject *parent = Q_NULLPTR); 27 | virtual ~Recorder(); 28 | 29 | void setFrameSize(const QSize &declaredFrameSize); 30 | void setFormat(Recorder::RecorderFormat format); 31 | bool open(); 32 | void close(); 33 | bool write(AVPacket *packet); 34 | bool startRecorder(); 35 | void stopRecorder(); 36 | bool push(const AVPacket *packet); 37 | 38 | private: 39 | const AVOutputFormat *findMuxer(const char *name); 40 | bool recorderWriteHeader(const AVPacket *packet); 41 | void recorderRescalePacket(AVPacket *packet); 42 | QString recorderGetFormatName(Recorder::RecorderFormat format); 43 | RecorderFormat guessRecordFormat(const QString &fileName); 44 | 45 | private: 46 | AVPacket *packetNew(const AVPacket *packet); 47 | void packetDelete(AVPacket *packet); 48 | void queueClear(); 49 | 50 | protected: 51 | void run(); 52 | 53 | private: 54 | QString m_fileName = ""; 55 | AVFormatContext *m_formatCtx = Q_NULLPTR; 56 | QSize m_declaredFrameSize; 57 | bool m_headerWritten = false; 58 | RecorderFormat m_format = RECORDER_FORMAT_NULL; 59 | QMutex m_mutex; 60 | QWaitCondition m_recvDataCond; 61 | bool m_stopped = false; // set on recorder_stop() by the stream reader 62 | bool m_failed = false; // set on packet write failure 63 | QQueue m_queue; 64 | // we can write a packet only once we received the next one so that we can 65 | // set its duration (next_pts - current_pts) 66 | // "previous" is only accessed from the recorder thread, so it does not 67 | // need to be protected by the mutex 68 | AVPacket *m_previous = Q_NULLPTR; 69 | }; 70 | 71 | #endif // RECORDER_H 72 | -------------------------------------------------------------------------------- /src/device/controller/controller.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CONTROLLER_H 3 | #define CONTROLLER_H 4 | 5 | #include 6 | #include 7 | 8 | #include "inputconvertbase.h" 9 | 10 | class QTcpSocket; 11 | class Receiver; 12 | class InputConvertBase; 13 | class DeviceMsg; 14 | class Controller : public QObject 15 | { 16 | Q_OBJECT 17 | public: 18 | Controller(std::function sendData, QString gameScript = "", QObject *parent = Q_NULLPTR); 19 | virtual ~Controller(); 20 | 21 | void postControlMsg(ControlMsg *controlMsg); 22 | void recvDeviceMsg(DeviceMsg *deviceMsg); 23 | void test(QRect rc); 24 | 25 | void updateScript(QString gameScript = ""); 26 | bool isCurrentCustomKeymap(); 27 | 28 | void postGoBack(); 29 | void postGoHome(); 30 | void postGoMenu(); 31 | void postAppSwitch(); 32 | void postPower(); 33 | void postVolumeUp(); 34 | void postVolumeDown(); 35 | void copy(); 36 | void cut(); 37 | void expandNotificationPanel(); 38 | void collapsePanel(); 39 | void setDisplayPower(bool on); 40 | 41 | // for input convert 42 | void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize); 43 | void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize); 44 | void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize); 45 | 46 | // turn the screen on if it was off, press BACK otherwise 47 | // If the screen is off, it is turned on only on down 48 | void postBackOrScreenOn(bool down); 49 | void requestDeviceClipboard(); 50 | void getDeviceClipboard(bool cut = false); 51 | void setDeviceClipboard(bool pause = true); 52 | void clipboardPaste(); 53 | void postTextInput(QString &text); 54 | 55 | signals: 56 | void grabCursor(bool grab); 57 | 58 | protected: 59 | bool event(QEvent *event); 60 | 61 | private: 62 | bool sendControl(const QByteArray &buffer); 63 | void postKeyCodeClick(AndroidKeycode keycode); 64 | 65 | private: 66 | QPointer m_receiver; 67 | QPointer m_inputConvert; 68 | std::function m_sendData = Q_NULLPTR; 69 | }; 70 | 71 | #endif // CONTROLLER_H 72 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/pixelutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_PIXELUTILS_H 20 | #define AVUTIL_PIXELUTILS_H 21 | 22 | #include 23 | #include 24 | #include "common.h" 25 | 26 | /** 27 | * Sum of abs(src1[x] - src2[x]) 28 | */ 29 | typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, 30 | const uint8_t *src2, ptrdiff_t stride2); 31 | 32 | /** 33 | * Get a potentially optimized pointer to a Sum-of-absolute-differences 34 | * function (see the av_pixelutils_sad_fn prototype). 35 | * 36 | * @param w_bits 1< 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 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hwcontext_videotoolbox.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_VIDEOTOOLBOX_H 20 | #define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H 21 | 22 | #include 23 | 24 | #include 25 | 26 | #include "pixfmt.h" 27 | 28 | /** 29 | * @file 30 | * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. 31 | * 32 | * This API currently does not support frame allocation, as the raw VideoToolbox 33 | * API does allocation, and FFmpeg itself never has the need to allocate frames. 34 | * 35 | * If the API user sets a custom pool, AVHWFramesContext.pool must return 36 | * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. 37 | * 38 | * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always 39 | * NULL. 40 | */ 41 | 42 | /** 43 | * Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. 44 | * Returns AV_PIX_FMT_NONE if no known equivalent was found. 45 | */ 46 | enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt); 47 | 48 | /** 49 | * Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format. 50 | * Returns 0 if no known equivalent was found. 51 | */ 52 | uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); 53 | 54 | /** 55 | * Same as av_map_videotoolbox_format_from_pixfmt function, but can map and 56 | * return full range pixel formats via a flag. 57 | */ 58 | uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range); 59 | 60 | #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ 61 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/camellia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 3 | * Copyright (c) 2014 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_CAMELLIA_H 23 | #define AVUTIL_CAMELLIA_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAMELLIA algorithm 31 | * @defgroup lavu_camellia CAMELLIA 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_camellia_size; 37 | 38 | struct AVCAMELLIA; 39 | 40 | /** 41 | * Allocate an AVCAMELLIA context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAMELLIA *av_camellia_alloc(void); 45 | 46 | /** 47 | * Initialize an AVCAMELLIA context. 48 | * 49 | * @param ctx an AVCAMELLIA context 50 | * @param key a key of 16, 24, 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: possible are 128, 192, 256 52 | */ 53 | int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVCAMELLIA context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_CAMELLIA_H */ 71 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/twofish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the TwoFish algorithm 3 | * Copyright (c) 2015 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_TWOFISH_H 23 | #define AVUTIL_TWOFISH_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil TWOFISH algorithm 31 | * @defgroup lavu_twofish TWOFISH 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_twofish_size; 37 | 38 | struct AVTWOFISH; 39 | 40 | /** 41 | * Allocate an AVTWOFISH context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVTWOFISH *av_twofish_alloc(void); 45 | 46 | /** 47 | * Initialize an AVTWOFISH context. 48 | * 49 | * @param ctx an AVTWOFISH context 50 | * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise 52 | */ 53 | int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVTWOFISH context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_TWOFISH_H */ 71 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/dovi_meta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Vacing Fang 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 | * DOVI configuration 24 | */ 25 | 26 | 27 | #ifndef AVUTIL_DOVI_META_H 28 | #define AVUTIL_DOVI_META_H 29 | 30 | #include 31 | #include 32 | 33 | /* 34 | * DOVI configuration 35 | * ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2 36 | dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2 37 | * @code 38 | * uint8_t dv_version_major, the major version number that the stream complies with 39 | * uint8_t dv_version_minor, the minor version number that the stream complies with 40 | * uint8_t dv_profile, the Dolby Vision profile 41 | * uint8_t dv_level, the Dolby Vision level 42 | * uint8_t rpu_present_flag 43 | * uint8_t el_present_flag 44 | * uint8_t bl_present_flag 45 | * uint8_t dv_bl_signal_compatibility_id 46 | * @endcode 47 | * 48 | * @note The struct must be allocated with av_dovi_alloc() and 49 | * its size is not a part of the public ABI. 50 | */ 51 | typedef struct AVDOVIDecoderConfigurationRecord { 52 | uint8_t dv_version_major; 53 | uint8_t dv_version_minor; 54 | uint8_t dv_profile; 55 | uint8_t dv_level; 56 | uint8_t rpu_present_flag; 57 | uint8_t el_present_flag; 58 | uint8_t bl_present_flag; 59 | uint8_t dv_bl_signal_compatibility_id; 60 | } AVDOVIDecoderConfigurationRecord; 61 | 62 | /** 63 | * Allocate a AVDOVIDecoderConfigurationRecord structure and initialize its 64 | * fields to default values. 65 | * 66 | * @return the newly allocated struct or NULL on failure 67 | */ 68 | AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size); 69 | 70 | #endif /* AVUTIL_DOVI_META_H */ 71 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | /** 33 | * Decode a base64-encoded string. 34 | * 35 | * @param out buffer for decoded data 36 | * @param in null-terminated input string 37 | * @param out_size size in bytes of the out buffer, must be at 38 | * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in)) 39 | * @return number of bytes written, or a negative value in case of 40 | * invalid input 41 | */ 42 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 43 | 44 | /** 45 | * Calculate the output size in bytes needed to decode a base64 string 46 | * with length x to a data buffer. 47 | */ 48 | #define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) 49 | 50 | /** 51 | * Encode data to base64 and null-terminate. 52 | * 53 | * @param out buffer for encoded data 54 | * @param out_size size in bytes of the out buffer (including the 55 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 56 | * @param in input buffer containing the data to encode 57 | * @param in_size size in bytes of the in buffer 58 | * @return out or NULL in case of error 59 | */ 60 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 61 | 62 | /** 63 | * Calculate the output size needed to base64-encode x bytes to a 64 | * null-terminated string. 65 | */ 66 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | #endif /* AVUTIL_BASE64_H */ 73 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/vorbis_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * A public API for Vorbis parsing 22 | * 23 | * Determines the duration for each packet. 24 | */ 25 | 26 | #ifndef AVCODEC_VORBIS_PARSER_H 27 | #define AVCODEC_VORBIS_PARSER_H 28 | 29 | #include 30 | 31 | typedef struct AVVorbisParseContext AVVorbisParseContext; 32 | 33 | /** 34 | * Allocate and initialize the Vorbis parser using headers in the extradata. 35 | */ 36 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, 37 | int extradata_size); 38 | 39 | /** 40 | * Free the parser and everything associated with it. 41 | */ 42 | void av_vorbis_parse_free(AVVorbisParseContext **s); 43 | 44 | #define VORBIS_FLAG_HEADER 0x00000001 45 | #define VORBIS_FLAG_COMMENT 0x00000002 46 | #define VORBIS_FLAG_SETUP 0x00000004 47 | 48 | /** 49 | * Get the duration for a Vorbis packet. 50 | * 51 | * If @p flags is @c NULL, 52 | * special frames are considered invalid. 53 | * 54 | * @param s Vorbis parser context 55 | * @param buf buffer containing a Vorbis frame 56 | * @param buf_size size of the buffer 57 | * @param flags flags for special frames 58 | */ 59 | int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, 60 | int buf_size, int *flags); 61 | 62 | /** 63 | * Get the duration for a Vorbis packet. 64 | * 65 | * @param s Vorbis parser context 66 | * @param buf buffer containing a Vorbis frame 67 | * @param buf_size size of the buffer 68 | */ 69 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, 70 | int buf_size); 71 | 72 | void av_vorbis_parse_reset(AVVorbisParseContext *s); 73 | 74 | #endif /* AVCODEC_VORBIS_PARSER_H */ 75 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/aes_ctr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-CTR cipher 3 | * Copyright (c) 2015 Eran Kornblau 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_AES_CTR_H 23 | #define AVUTIL_AES_CTR_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | #define AES_CTR_KEY_SIZE (16) 31 | #define AES_CTR_IV_SIZE (8) 32 | 33 | struct AVAESCTR; 34 | 35 | /** 36 | * Allocate an AVAESCTR context. 37 | */ 38 | struct AVAESCTR *av_aes_ctr_alloc(void); 39 | 40 | /** 41 | * Initialize an AVAESCTR context. 42 | * @param key encryption key, must have a length of AES_CTR_KEY_SIZE 43 | */ 44 | int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); 45 | 46 | /** 47 | * Release an AVAESCTR context. 48 | */ 49 | void av_aes_ctr_free(struct AVAESCTR *a); 50 | 51 | /** 52 | * Process a buffer using a previously initialized context. 53 | * @param dst destination array, can be equal to src 54 | * @param src source array, can be equal to dst 55 | * @param size the size of src and dst 56 | */ 57 | void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); 58 | 59 | /** 60 | * Get the current iv 61 | */ 62 | const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); 63 | 64 | /** 65 | * Generate a random iv 66 | */ 67 | void av_aes_ctr_set_random_iv(struct AVAESCTR *a); 68 | 69 | /** 70 | * Forcefully change the 8-byte iv 71 | */ 72 | void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); 73 | 74 | /** 75 | * Forcefully change the "full" 16-byte iv, including the counter 76 | */ 77 | void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv); 78 | 79 | /** 80 | * Increment the top 64 bit of the iv (performed after each frame) 81 | */ 82 | void av_aes_ctr_increment_iv(struct AVAESCTR *a); 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | #endif /* AVUTIL_AES_CTR_H */ 89 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/des.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DES encryption/decryption 3 | * Copyright (c) 2007 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_DES_H 23 | #define AVUTIL_DES_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_des DES 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | typedef struct AVDES { 34 | uint64_t round_keys[3][16]; 35 | int triple_des; 36 | } AVDES; 37 | 38 | /** 39 | * Allocate an AVDES context. 40 | */ 41 | AVDES *av_des_alloc(void); 42 | 43 | /** 44 | * @brief Initializes an AVDES context. 45 | * 46 | * @param key_bits must be 64 or 192 47 | * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption 48 | * @return zero on success, negative value otherwise 49 | */ 50 | int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); 51 | 52 | /** 53 | * @brief Encrypts / decrypts using the DES algorithm. 54 | * 55 | * @param count number of 8 byte blocks 56 | * @param dst destination array, can be equal to src, must be 8-byte aligned 57 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 58 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used, 59 | * must be 8-byte aligned 60 | * @param decrypt 0 for encryption, 1 for decryption 61 | */ 62 | void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 63 | 64 | /** 65 | * @brief Calculates CBC-MAC using the DES algorithm. 66 | * 67 | * @param count number of 8 byte blocks 68 | * @param dst destination array, can be equal to src, must be 8-byte aligned 69 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 70 | */ 71 | void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* AVUTIL_DES_H */ 78 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/vaapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Video Acceleration API (shared data between FFmpeg and the video player) 3 | * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 4 | * 5 | * Copyright (C) 2008-2009 Splitted-Desktop Systems 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVCODEC_VAAPI_H 25 | #define AVCODEC_VAAPI_H 26 | 27 | /** 28 | * @file 29 | * @ingroup lavc_codec_hwaccel_vaapi 30 | * Public libavcodec VA API header. 31 | */ 32 | 33 | #include 34 | #include "libavutil/attributes.h" 35 | #include "version.h" 36 | 37 | #if FF_API_STRUCT_VAAPI_CONTEXT 38 | 39 | /** 40 | * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding 41 | * @ingroup lavc_codec_hwaccel 42 | * @{ 43 | */ 44 | 45 | /** 46 | * This structure is used to share data between the FFmpeg library and 47 | * the client video application. 48 | * This shall be zero-allocated and available as 49 | * AVCodecContext.hwaccel_context. All user members can be set once 50 | * during initialization or through each AVCodecContext.get_buffer() 51 | * function call. In any case, they must be valid prior to calling 52 | * decoding functions. 53 | * 54 | * Deprecated: use AVCodecContext.hw_frames_ctx instead. 55 | */ 56 | struct attribute_deprecated vaapi_context { 57 | /** 58 | * Window system dependent data 59 | * 60 | * - encoding: unused 61 | * - decoding: Set by user 62 | */ 63 | void *display; 64 | 65 | /** 66 | * Configuration ID 67 | * 68 | * - encoding: unused 69 | * - decoding: Set by user 70 | */ 71 | uint32_t config_id; 72 | 73 | /** 74 | * Context ID (video decode pipeline) 75 | * 76 | * - encoding: unused 77 | * - decoding: Set by user 78 | */ 79 | uint32_t context_id; 80 | }; 81 | 82 | /* @} */ 83 | 84 | #endif /* FF_API_STRUCT_VAAPI_CONTEXT */ 85 | 86 | #endif /* AVCODEC_VAAPI_H */ 87 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/avassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple assert() macros that are a bit more flexible than ISO C assert(). 24 | * @author Michael Niedermayer 25 | */ 26 | 27 | #ifndef AVUTIL_AVASSERT_H 28 | #define AVUTIL_AVASSERT_H 29 | 30 | #include 31 | #include "avutil.h" 32 | #include "log.h" 33 | 34 | /** 35 | * assert() equivalent, that is always enabled. 36 | */ 37 | #define av_assert0(cond) do { \ 38 | if (!(cond)) { \ 39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ 40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \ 41 | abort(); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /** 47 | * assert() equivalent, that does not lie in speed critical code. 48 | * These asserts() thus can be enabled without fearing speed loss. 49 | */ 50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 51 | #define av_assert1(cond) av_assert0(cond) 52 | #else 53 | #define av_assert1(cond) ((void)0) 54 | #endif 55 | 56 | 57 | /** 58 | * assert() equivalent, that does lie in speed critical code. 59 | */ 60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 61 | #define av_assert2(cond) av_assert0(cond) 62 | #define av_assert2_fpu() av_assert0_fpu() 63 | #else 64 | #define av_assert2(cond) ((void)0) 65 | #define av_assert2_fpu() ((void)0) 66 | #endif 67 | 68 | /** 69 | * Assert that floating point operations 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 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * @ingroup lavu_ripemd 25 | * Public header for RIPEMD hash function implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_RIPEMD_H 29 | #define AVUTIL_RIPEMD_H 30 | 31 | #include 32 | #include 33 | 34 | #include "attributes.h" 35 | #include "version.h" 36 | 37 | /** 38 | * @defgroup lavu_ripemd RIPEMD 39 | * @ingroup lavu_hash 40 | * RIPEMD hash function implementation. 41 | * 42 | * @{ 43 | */ 44 | 45 | extern const int av_ripemd_size; 46 | 47 | struct AVRIPEMD; 48 | 49 | /** 50 | * Allocate an AVRIPEMD context. 51 | */ 52 | struct AVRIPEMD *av_ripemd_alloc(void); 53 | 54 | /** 55 | * Initialize RIPEMD hashing. 56 | * 57 | * @param context pointer to the function context (of size av_ripemd_size) 58 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 59 | * @return zero if initialization succeeded, -1 otherwise 60 | */ 61 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 62 | 63 | /** 64 | * Update hash value. 65 | * 66 | * @param context hash function context 67 | * @param data input data to update hash with 68 | * @param len input data length 69 | */ 70 | #if FF_API_CRYPTO_SIZE_T 71 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); 72 | #else 73 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); 74 | #endif 75 | 76 | /** 77 | * Finish hashing and output digest value. 78 | * 79 | * @param context hash function context 80 | * @param digest buffer where output digest value is stored 81 | */ 82 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | #endif /* AVUTIL_RIPEMD_H */ 89 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hwcontext_dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef AVUTIL_HWCONTEXT_DXVA2_H 21 | #define AVUTIL_HWCONTEXT_DXVA2_H 22 | 23 | /** 24 | * @file 25 | * An API-specific header for AV_HWDEVICE_TYPE_DXVA2. 26 | * 27 | * Only fixed-size pools are supported. 28 | * 29 | * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs 30 | * with the data pointer set to a pointer to IDirect3DSurface9. 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | * This struct is allocated as AVHWDeviceContext.hwctx 38 | */ 39 | typedef struct AVDXVA2DeviceContext { 40 | IDirect3DDeviceManager9 *devmgr; 41 | } AVDXVA2DeviceContext; 42 | 43 | /** 44 | * This struct is allocated as AVHWFramesContext.hwctx 45 | */ 46 | typedef struct AVDXVA2FramesContext { 47 | /** 48 | * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or 49 | * DXVA2_VideoDecoderRenderTarget). Must be set by the caller. 50 | */ 51 | DWORD surface_type; 52 | 53 | /** 54 | * The surface pool. When an external pool is not provided by the caller, 55 | * this will be managed (allocated and filled on init, freed on uninit) by 56 | * libavutil. 57 | */ 58 | IDirect3DSurface9 **surfaces; 59 | int nb_surfaces; 60 | 61 | /** 62 | * Certain drivers require the decoder to be destroyed before the surfaces. 63 | * To allow internally managed pools to work properly in such cases, this 64 | * field is provided. 65 | * 66 | * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on 67 | * it just before the internal surface pool is freed. 68 | * 69 | * This is for convenience only. Some code uses other methods to manage the 70 | * decoder reference. 71 | */ 72 | IDirectXVideoDecoder *decoder_to_release; 73 | } AVDXVA2FramesContext; 74 | 75 | #endif /* AVUTIL_HWCONTEXT_DXVA2_H */ 76 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Blowfish algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_BLOWFISH_H 23 | #define AVUTIL_BLOWFISH_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_blowfish Blowfish 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | #define AV_BF_ROUNDS 16 34 | 35 | typedef struct AVBlowfish { 36 | uint32_t p[AV_BF_ROUNDS + 2]; 37 | uint32_t s[4][256]; 38 | } AVBlowfish; 39 | 40 | /** 41 | * Allocate an AVBlowfish context. 42 | */ 43 | AVBlowfish *av_blowfish_alloc(void); 44 | 45 | /** 46 | * Initialize an AVBlowfish context. 47 | * 48 | * @param ctx an AVBlowfish context 49 | * @param key a key 50 | * @param key_len length of the key 51 | */ 52 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context. 56 | * 57 | * @param ctx an AVBlowfish context 58 | * @param xl left four bytes halves of input to be encrypted 59 | * @param xr right four bytes halves of input to be encrypted 60 | * @param decrypt 0 for encryption, 1 for decryption 61 | */ 62 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, 63 | int decrypt); 64 | 65 | /** 66 | * Encrypt or decrypt a buffer using a previously initialized context. 67 | * 68 | * @param ctx an AVBlowfish context 69 | * @param dst destination array, can be equal to src 70 | * @param src source array, can be equal to dst 71 | * @param count number of 8 byte blocks 72 | * @param iv initialization vector for CBC mode, if NULL ECB will be used 73 | * @param decrypt 0 for encryption, 1 for decryption 74 | */ 75 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, 76 | int count, uint8_t *iv, int decrypt); 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | #endif /* AVUTIL_BLOWFISH_H */ 83 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_md5 24 | * Public header for MD5 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_MD5_H 28 | #define AVUTIL_MD5_H 29 | 30 | #include 31 | #include 32 | 33 | #include "attributes.h" 34 | #include "version.h" 35 | 36 | /** 37 | * @defgroup lavu_md5 MD5 38 | * @ingroup lavu_hash 39 | * MD5 hash function implementation. 40 | * 41 | * @{ 42 | */ 43 | 44 | extern const int av_md5_size; 45 | 46 | struct AVMD5; 47 | 48 | /** 49 | * Allocate an AVMD5 context. 50 | */ 51 | struct AVMD5 *av_md5_alloc(void); 52 | 53 | /** 54 | * Initialize MD5 hashing. 55 | * 56 | * @param ctx pointer to the function context (of size av_md5_size) 57 | */ 58 | void av_md5_init(struct AVMD5 *ctx); 59 | 60 | /** 61 | * Update hash value. 62 | * 63 | * @param ctx hash function context 64 | * @param src input data to update hash with 65 | * @param len input data length 66 | */ 67 | #if FF_API_CRYPTO_SIZE_T 68 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); 69 | #else 70 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); 71 | #endif 72 | 73 | /** 74 | * Finish hashing and output digest value. 75 | * 76 | * @param ctx hash function context 77 | * @param dst buffer where output digest value is stored 78 | */ 79 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 80 | 81 | /** 82 | * Hash an array of data. 83 | * 84 | * @param dst The output buffer to write the digest into 85 | * @param src The data to hash 86 | * @param len The length of the data, in bytes 87 | */ 88 | #if FF_API_CRYPTO_SIZE_T 89 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 90 | #else 91 | void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); 92 | #endif 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | #endif /* AVUTIL_MD5_H */ 99 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DXVA2 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_DXVA2_H 24 | #define AVCODEC_DXVA2_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_dxva2 29 | * Public libavcodec DXVA2 header. 30 | */ 31 | 32 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 33 | #undef _WIN32_WINNT 34 | #define _WIN32_WINNT 0x0602 35 | #endif 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | /** 42 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 43 | * @ingroup lavc_codec_hwaccel 44 | * 45 | * @{ 46 | */ 47 | 48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards 49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface 50 | 51 | /** 52 | * This structure is used to provides the necessary configurations and data 53 | * to the DXVA2 FFmpeg HWAccel implementation. 54 | * 55 | * The application must make it available as AVCodecContext.hwaccel_context. 56 | */ 57 | struct dxva_context { 58 | /** 59 | * DXVA2 decoder object 60 | */ 61 | IDirectXVideoDecoder *decoder; 62 | 63 | /** 64 | * DXVA2 configuration used to create the decoder 65 | */ 66 | const DXVA2_ConfigPictureDecode *cfg; 67 | 68 | /** 69 | * The number of surface in the surface array 70 | */ 71 | unsigned surface_count; 72 | 73 | /** 74 | * The array of Direct3D surfaces used to create the decoder 75 | */ 76 | LPDIRECT3DSURFACE9 *surface; 77 | 78 | /** 79 | * A bit field configuring the workarounds needed for using the decoder 80 | */ 81 | uint64_t workaround; 82 | 83 | /** 84 | * Private to the FFmpeg AVHWAccel implementation 85 | */ 86 | unsigned report_id; 87 | }; 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | #endif /* AVCODEC_DXVA2_H */ 94 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/lfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lagged Fibonacci PRNG 3 | * Copyright (c) 2008 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LFG_H 23 | #define AVUTIL_LFG_H 24 | 25 | #include 26 | 27 | /** 28 | * Context structure for the Lagged Fibonacci PRNG. 29 | * The exact layout, types and content of this struct may change and should 30 | * not be accessed directly. Only its sizeof() is guranteed to stay the same 31 | * to allow easy instanciation. 32 | */ 33 | typedef struct AVLFG { 34 | unsigned int state[64]; 35 | int index; 36 | } AVLFG; 37 | 38 | void av_lfg_init(AVLFG *c, unsigned int seed); 39 | 40 | /** 41 | * Seed the state of the ALFG using binary data. 42 | * 43 | * Return value: 0 on success, negative value (AVERROR) on failure. 44 | */ 45 | int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length); 46 | 47 | /** 48 | * Get the next random unsigned 32-bit number using an ALFG. 49 | * 50 | * Please also consider a simple LCG like state= state*1664525+1013904223, 51 | * it may be good enough and faster for your specific use case. 52 | */ 53 | static inline unsigned int av_lfg_get(AVLFG *c){ 54 | unsigned a = c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 55 | c->index += 1U; 56 | return a; 57 | } 58 | 59 | /** 60 | * Get the next random unsigned 32-bit number using a MLFG. 61 | * 62 | * Please also consider av_lfg_get() above, it is faster. 63 | */ 64 | static inline unsigned int av_mlfg_get(AVLFG *c){ 65 | unsigned int a= c->state[(c->index-55) & 63]; 66 | unsigned int b= c->state[(c->index-24) & 63]; 67 | a = c->state[c->index & 63] = 2*a*b+a+b; 68 | c->index += 1U; 69 | return a; 70 | } 71 | 72 | /** 73 | * Get the next two numbers generated by a Box-Muller Gaussian 74 | * generator using the random numbers issued by lfg. 75 | * 76 | * @param out array where the two generated numbers are placed 77 | */ 78 | void av_bmg_get(AVLFG *lfg, double out[2]); 79 | 80 | #endif /* AVUTIL_LFG_H */ 81 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/cast5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAST128 algorithm as mentioned in RFC2144 3 | * Copyright (c) 2014 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_CAST5_H 23 | #define AVUTIL_CAST5_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAST5 algorithm 31 | * @defgroup lavu_cast5 CAST5 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_cast5_size; 37 | 38 | struct AVCAST5; 39 | 40 | /** 41 | * Allocate an AVCAST5 context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAST5 *av_cast5_alloc(void); 45 | /** 46 | * Initialize an AVCAST5 context. 47 | * 48 | * @param ctx an AVCAST5 context 49 | * @param key a key of 5,6,...16 bytes used for encryption/decryption 50 | * @param key_bits number of keybits: possible are 40,48,...,128 51 | * @return 0 on success, less than 0 on failure 52 | */ 53 | int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only 57 | * 58 | * @param ctx an AVCAST5 context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 8 byte blocks 62 | * @param decrypt 0 for encryption, 1 for decryption 63 | */ 64 | void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); 65 | 66 | /** 67 | * Encrypt or decrypt a buffer using a previously initialized context 68 | * 69 | * @param ctx an AVCAST5 context 70 | * @param dst destination array, can be equal to src 71 | * @param src source array, can be equal to dst 72 | * @param count number of 8 byte blocks 73 | * @param iv initialization vector for CBC mode, NULL for ECB mode 74 | * @param decrypt 0 for encryption, 1 for decryption 75 | */ 76 | void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 77 | /** 78 | * @} 79 | */ 80 | #endif /* AVUTIL_CAST5_H */ 81 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_sha 24 | * Public header for SHA-1 & SHA-256 hash function implementations. 25 | */ 26 | 27 | #ifndef AVUTIL_SHA_H 28 | #define AVUTIL_SHA_H 29 | 30 | #include 31 | #include 32 | 33 | #include "attributes.h" 34 | #include "version.h" 35 | 36 | /** 37 | * @defgroup lavu_sha SHA 38 | * @ingroup lavu_hash 39 | * SHA-1 and SHA-256 (Secure Hash Algorithm) hash function implementations. 40 | * 41 | * This module supports the following SHA hash functions: 42 | * 43 | * - SHA-1: 160 bits 44 | * - SHA-224: 224 bits, as a variant of SHA-2 45 | * - SHA-256: 256 bits, as a variant of SHA-2 46 | * 47 | * @see For SHA-384, SHA-512, and variants thereof, see @ref lavu_sha512. 48 | * 49 | * @{ 50 | */ 51 | 52 | extern const int av_sha_size; 53 | 54 | struct AVSHA; 55 | 56 | /** 57 | * Allocate an AVSHA context. 58 | */ 59 | struct AVSHA *av_sha_alloc(void); 60 | 61 | /** 62 | * Initialize SHA-1 or SHA-2 hashing. 63 | * 64 | * @param context pointer to the function context (of size av_sha_size) 65 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) 66 | * @return zero if initialization succeeded, -1 otherwise 67 | */ 68 | int av_sha_init(struct AVSHA* context, int bits); 69 | 70 | /** 71 | * Update hash value. 72 | * 73 | * @param ctx hash function context 74 | * @param data input data to update hash with 75 | * @param len input data length 76 | */ 77 | #if FF_API_CRYPTO_SIZE_T 78 | void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len); 79 | #else 80 | void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len); 81 | #endif 82 | 83 | /** 84 | * Finish hashing and output digest value. 85 | * 86 | * @param context hash function context 87 | * @param digest buffer where output digest value is stored 88 | */ 89 | void av_sha_final(struct AVSHA* context, uint8_t *digest); 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | #endif /* AVUTIL_SHA_H */ 96 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/timestamp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * timestamp utils, mostly useful for debugging/logging purposes 22 | */ 23 | 24 | #ifndef AVUTIL_TIMESTAMP_H 25 | #define AVUTIL_TIMESTAMP_H 26 | 27 | #include "common.h" 28 | 29 | #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) 30 | #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS 31 | #endif 32 | 33 | #define AV_TS_MAX_STRING_SIZE 32 34 | 35 | /** 36 | * Fill the provided buffer with a string containing a timestamp 37 | * representation. 38 | * 39 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 40 | * @param ts the timestamp to represent 41 | * @return the buffer in input 42 | */ 43 | static inline char *av_ts_make_string(char *buf, int64_t ts) 44 | { 45 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 46 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts); 47 | return buf; 48 | } 49 | 50 | /** 51 | * Convenience macro, the return value should be used only directly in 52 | * function arguments but never stand-alone. 53 | */ 54 | #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) 55 | 56 | /** 57 | * Fill the provided buffer with a string containing a timestamp time 58 | * representation. 59 | * 60 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 61 | * @param ts the timestamp to represent 62 | * @param tb the timebase of the timestamp 63 | * @return the buffer in input 64 | */ 65 | static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) 66 | { 67 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 68 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); 69 | return buf; 70 | } 71 | 72 | /** 73 | * Convenience macro, the return value should be used only directly in 74 | * function arguments but never stand-alone. 75 | */ 76 | #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) 77 | 78 | #endif /* AVUTIL_TIMESTAMP_H */ 79 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/sha512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * @ingroup lavu_sha512 25 | * Public header for SHA-512 implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_SHA512_H 29 | #define AVUTIL_SHA512_H 30 | 31 | #include 32 | #include 33 | 34 | #include "attributes.h" 35 | #include "version.h" 36 | 37 | /** 38 | * @defgroup lavu_sha512 SHA-512 39 | * @ingroup lavu_hash 40 | * SHA-512 (Secure Hash Algorithm) hash function implementations. 41 | * 42 | * This module supports the following SHA-2 hash functions: 43 | * 44 | * - SHA-512/224: 224 bits 45 | * - SHA-512/256: 256 bits 46 | * - SHA-384: 384 bits 47 | * - SHA-512: 512 bits 48 | * 49 | * @see For SHA-1, SHA-256, and variants thereof, see @ref lavu_sha. 50 | * 51 | * @{ 52 | */ 53 | 54 | extern const int av_sha512_size; 55 | 56 | struct AVSHA512; 57 | 58 | /** 59 | * Allocate an AVSHA512 context. 60 | */ 61 | struct AVSHA512 *av_sha512_alloc(void); 62 | 63 | /** 64 | * Initialize SHA-2 512 hashing. 65 | * 66 | * @param context pointer to the function context (of size av_sha512_size) 67 | * @param bits number of bits in digest (224, 256, 384 or 512 bits) 68 | * @return zero if initialization succeeded, -1 otherwise 69 | */ 70 | int av_sha512_init(struct AVSHA512* context, int bits); 71 | 72 | /** 73 | * Update hash value. 74 | * 75 | * @param context hash function context 76 | * @param data input data to update hash with 77 | * @param len input data length 78 | */ 79 | #if FF_API_CRYPTO_SIZE_T 80 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); 81 | #else 82 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len); 83 | #endif 84 | 85 | /** 86 | * Finish hashing and output digest value. 87 | * 88 | * @param context hash function context 89 | * @param digest buffer where output digest value is stored 90 | */ 91 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest); 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif /* AVUTIL_SHA512_H */ 98 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_FILE_H 20 | #define AVUTIL_FILE_H 21 | 22 | #include 23 | 24 | #include "avutil.h" 25 | 26 | /** 27 | * @file 28 | * Misc file utilities. 29 | */ 30 | 31 | /** 32 | * Read the file with name filename, and put its content in a newly 33 | * allocated buffer or map it with mmap() when available. 34 | * In case of success set *bufptr to the read or mmapped buffer, and 35 | * *size to the size in bytes of the buffer in *bufptr. 36 | * Unlike mmap this function succeeds with zero sized files, in this 37 | * case *bufptr will be set to NULL and *size will be set to 0. 38 | * The returned buffer must be released with av_file_unmap(). 39 | * 40 | * @param log_offset loglevel offset used for logging 41 | * @param log_ctx context used for logging 42 | * @return a non negative number in case of success, a negative value 43 | * corresponding to an AVERROR error code in case of failure 44 | */ 45 | av_warn_unused_result 46 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 47 | int log_offset, void *log_ctx); 48 | 49 | /** 50 | * Unmap or free the buffer bufptr created by av_file_map(). 51 | * 52 | * @param size size in bytes of bufptr, must be the same as returned 53 | * by av_file_map() 54 | */ 55 | void av_file_unmap(uint8_t *bufptr, size_t size); 56 | 57 | /** 58 | * Wrapper to work around the lack of mkstemp() on mingw. 59 | * Also, tries to create file in /tmp first, if possible. 60 | * *prefix can be a character constant; *filename will be allocated internally. 61 | * @return file descriptor of opened file (or negative value corresponding to an 62 | * AVERROR code on error) 63 | * and opened file name in **filename. 64 | * @note On very old libcs it is necessary to set a secure umask before 65 | * calling this, av_tempfile() can't call umask itself as it is used in 66 | * libraries and could interfere with the calling application. 67 | * @deprecated as fd numbers cannot be passed saftely between libs on some platforms 68 | */ 69 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); 70 | 71 | #endif /* AVUTIL_FILE_H */ 72 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavfilter/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFILTER_VERSION_H 22 | #define AVFILTER_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup lavfi 27 | * Libavfilter version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #define LIBAVFILTER_VERSION_MAJOR 7 33 | #define LIBAVFILTER_VERSION_MINOR 110 34 | #define LIBAVFILTER_VERSION_MICRO 100 35 | 36 | 37 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ 38 | LIBAVFILTER_VERSION_MINOR, \ 39 | LIBAVFILTER_VERSION_MICRO) 40 | #define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ 41 | LIBAVFILTER_VERSION_MINOR, \ 42 | LIBAVFILTER_VERSION_MICRO) 43 | #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT 44 | 45 | #define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) 46 | 47 | /** 48 | * FF_API_* defines may be placed below to indicate public API that will be 49 | * dropped at a future version bump. The defines themselves are not part of 50 | * the public API and may change, break or disappear at any time. 51 | */ 52 | 53 | #ifndef FF_API_OLD_FILTER_OPTS_ERROR 54 | #define FF_API_OLD_FILTER_OPTS_ERROR (LIBAVFILTER_VERSION_MAJOR < 8) 55 | #endif 56 | #ifndef FF_API_LAVR_OPTS 57 | #define FF_API_LAVR_OPTS (LIBAVFILTER_VERSION_MAJOR < 8) 58 | #endif 59 | #ifndef FF_API_FILTER_GET_SET 60 | #define FF_API_FILTER_GET_SET (LIBAVFILTER_VERSION_MAJOR < 8) 61 | #endif 62 | #ifndef FF_API_SWS_PARAM_OPTION 63 | #define FF_API_SWS_PARAM_OPTION (LIBAVFILTER_VERSION_MAJOR < 8) 64 | #endif 65 | #ifndef FF_API_NEXT 66 | #define FF_API_NEXT (LIBAVFILTER_VERSION_MAJOR < 8) 67 | #endif 68 | #ifndef FF_API_FILTER_LINK_SET_CLOSED 69 | #define FF_API_FILTER_LINK_SET_CLOSED (LIBAVFILTER_VERSION_MAJOR < 8) 70 | #endif 71 | #ifndef FF_API_BUFFERSINK_ALLOC 72 | #define FF_API_BUFFERSINK_ALLOC (LIBAVFILTER_VERSION_MAJOR < 9) 73 | #endif 74 | 75 | #endif /* AVFILTER_VERSION_H */ 76 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/avdct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_AVDCT_H 20 | #define AVCODEC_AVDCT_H 21 | 22 | #include "libavutil/opt.h" 23 | 24 | /** 25 | * AVDCT context. 26 | * @note function pointers can be NULL if the specific features have been 27 | * disabled at build time. 28 | */ 29 | typedef struct AVDCT { 30 | const AVClass *av_class; 31 | 32 | void (*idct)(int16_t *block /* align 16 */); 33 | 34 | /** 35 | * IDCT input permutation. 36 | * Several optimized IDCTs need a permutated input (relative to the 37 | * normal order of the reference IDCT). 38 | * This permutation must be performed before the idct_put/add. 39 | * Note, normally this can be merged with the zigzag/alternate scan
40 | * An example to avoid confusion: 41 | * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) 42 | * - (x -> reference DCT -> reference IDCT -> x) 43 | * - (x -> reference DCT -> simple_mmx_perm = idct_permutation 44 | * -> simple_idct_mmx -> x) 45 | * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant 46 | * -> simple_idct_mmx -> ...) 47 | */ 48 | uint8_t idct_permutation[64]; 49 | 50 | void (*fdct)(int16_t *block /* align 16 */); 51 | 52 | 53 | /** 54 | * DCT algorithm. 55 | * must use AVOptions to set this field. 56 | */ 57 | int dct_algo; 58 | 59 | /** 60 | * IDCT algorithm. 61 | * must use AVOptions to set this field. 62 | */ 63 | int idct_algo; 64 | 65 | void (*get_pixels)(int16_t *block /* align 16 */, 66 | const uint8_t *pixels /* align 8 */, 67 | ptrdiff_t line_size); 68 | 69 | int bits_per_sample; 70 | 71 | void (*get_pixels_unaligned)(int16_t *block /* align 16 */, 72 | const uint8_t *pixels, 73 | ptrdiff_t line_size); 74 | } AVDCT; 75 | 76 | /** 77 | * Allocates a AVDCT context. 78 | * This needs to be initialized with avcodec_dct_init() after optionally 79 | * configuring it with AVOptions. 80 | * 81 | * To free it use av_free() 82 | */ 83 | AVDCT *avcodec_dct_alloc(void); 84 | int avcodec_dct_init(AVDCT *); 85 | 86 | const AVClass *avcodec_dct_get_class(void); 87 | 88 | #endif /* AVCODEC_AVDCT_H */ 89 | -------------------------------------------------------------------------------- /src/adb/adbprocess.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "adbprocess.h" 8 | #include "adbprocessimpl.h" 9 | 10 | QString g_adbPath; 11 | 12 | namespace qsc { 13 | 14 | AdbProcess::AdbProcess(QObject *parent) 15 | : QObject(parent) 16 | , m_adbImpl(new AdbProcessImpl()) 17 | { 18 | connect(m_adbImpl, &AdbProcessImpl::adbProcessImplResult, this, &qsc::AdbProcess::adbProcessResult); 19 | } 20 | 21 | AdbProcess::~AdbProcess() 22 | { 23 | if (m_adbImpl->isRuning()) { 24 | m_adbImpl->kill(); 25 | } 26 | delete m_adbImpl; 27 | } 28 | 29 | void AdbProcess::setAdbPath(const QString &adbPath) 30 | { 31 | g_adbPath = adbPath; 32 | } 33 | 34 | void AdbProcess::execute(const QString &serial, const QStringList &args) 35 | { 36 | m_adbImpl->execute(serial, args); 37 | } 38 | 39 | bool AdbProcess::isRuning() 40 | { 41 | return m_adbImpl->isRuning(); 42 | } 43 | 44 | void AdbProcess::setShowTouchesEnabled(const QString &serial, bool enabled) 45 | { 46 | m_adbImpl->setShowTouchesEnabled(serial, enabled); 47 | } 48 | 49 | void AdbProcess::kill() 50 | { 51 | m_adbImpl->kill(); 52 | } 53 | 54 | QStringList AdbProcess::arguments() 55 | { 56 | return m_adbImpl->arguments(); 57 | } 58 | 59 | QStringList AdbProcess::getDevicesSerialFromStdOut() 60 | { 61 | return m_adbImpl->getDevicesSerialFromStdOut(); 62 | } 63 | 64 | QString AdbProcess::getDeviceIPFromStdOut() 65 | { 66 | return m_adbImpl->getDeviceIPFromStdOut(); 67 | } 68 | 69 | QString AdbProcess::getDeviceIPByIpFromStdOut() 70 | { 71 | return m_adbImpl->getDeviceIPByIpFromStdOut(); 72 | } 73 | 74 | QString AdbProcess::getStdOut() 75 | { 76 | return m_adbImpl->getStdOut(); 77 | } 78 | 79 | QString AdbProcess::getErrorOut() 80 | { 81 | return m_adbImpl->getErrorOut(); 82 | } 83 | 84 | void AdbProcess::forward(const QString &serial, quint16 localPort, const QString &deviceSocketName) 85 | { 86 | m_adbImpl->forward(serial, localPort, deviceSocketName); 87 | } 88 | 89 | void AdbProcess::forwardRemove(const QString &serial, quint16 localPort) 90 | { 91 | m_adbImpl->forwardRemove(serial, localPort); 92 | } 93 | 94 | void AdbProcess::reverse(const QString &serial, const QString &deviceSocketName, quint16 localPort) 95 | { 96 | m_adbImpl->reverse(serial, deviceSocketName, localPort); 97 | } 98 | 99 | void AdbProcess::reverseRemove(const QString &serial, const QString &deviceSocketName) 100 | { 101 | m_adbImpl->reverseRemove(serial, deviceSocketName); 102 | } 103 | 104 | void AdbProcess::push(const QString &serial, const QString &local, const QString &remote) 105 | { 106 | m_adbImpl->push(serial, local, remote); 107 | } 108 | 109 | void AdbProcess::install(const QString &serial, const QString &local) 110 | { 111 | m_adbImpl->install(serial, local); 112 | } 113 | 114 | void AdbProcess::removePath(const QString &serial, const QString &path) 115 | { 116 | m_adbImpl->removePath(serial, path); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/device/device.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_H 2 | #define DEVICE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "../../include/QtScrcpyCore.h" 10 | 11 | class QMouseEvent; 12 | class QWheelEvent; 13 | class QKeyEvent; 14 | class Recorder; 15 | class Server; 16 | class VideoBuffer; 17 | class Decoder; 18 | class FileHandler; 19 | class Demuxer; 20 | class VideoForm; 21 | class Controller; 22 | struct AVFrame; 23 | 24 | namespace qsc { 25 | 26 | class Device : public IDevice 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit Device(DeviceParams params, QObject *parent = nullptr); 31 | virtual ~Device(); 32 | 33 | void setUserData(void* data) override; 34 | void* getUserData() override; 35 | 36 | void registerDeviceObserver(DeviceObserver* observer) override; 37 | void deRegisterDeviceObserver(DeviceObserver* observer) override; 38 | 39 | bool connectDevice() override; 40 | void disconnectDevice() override; 41 | 42 | // key map 43 | void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize) override; 44 | void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize) override; 45 | void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize) override; 46 | 47 | void postGoBack() override; 48 | void postGoHome() override; 49 | void postGoMenu() override; 50 | void postAppSwitch() override; 51 | void postPower() override; 52 | void postVolumeUp() override; 53 | void postVolumeDown() override; 54 | void postCopy() override; 55 | void postCut() override; 56 | void setDisplayPower(bool on) override; 57 | void expandNotificationPanel() override; 58 | void collapsePanel() override; 59 | void postBackOrScreenOn(bool down) override; 60 | void postTextInput(QString &text) override; 61 | void requestDeviceClipboard() override; 62 | void setDeviceClipboard(bool pause = true) override; 63 | void clipboardPaste() override; 64 | void pushFileRequest(const QString &file, const QString &devicePath = "") override; 65 | void installApkRequest(const QString &apkFile) override; 66 | 67 | void screenshot() override; 68 | void showTouch(bool show) override; 69 | 70 | bool isReversePort(quint16 port) override; 71 | const QString &getSerial() override; 72 | 73 | void updateScript(QString script) override; 74 | bool isCurrentCustomKeymap() override; 75 | 76 | private: 77 | void initSignals(); 78 | bool saveFrame(int width, int height, uint8_t* dataRGB32); 79 | 80 | private: 81 | // server relevant 82 | QPointer m_server; 83 | bool m_serverStartSuccess = false; 84 | QPointer m_decoder; 85 | QPointer m_controller; 86 | QPointer m_fileHandler; 87 | QPointer m_stream; 88 | QPointer m_recorder; 89 | 90 | QElapsedTimer m_startTimeCount; 91 | DeviceParams m_params; 92 | std::set m_deviceObservers; 93 | void* m_userData = nullptr; 94 | }; 95 | 96 | } 97 | 98 | #endif // DEVICE_H 99 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/xtea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the XTEA algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_XTEA_H 23 | #define AVUTIL_XTEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil XTEA algorithm 30 | * @defgroup lavu_xtea XTEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | typedef struct AVXTEA { 36 | uint32_t key[16]; 37 | } AVXTEA; 38 | 39 | /** 40 | * Allocate an AVXTEA context. 41 | */ 42 | AVXTEA *av_xtea_alloc(void); 43 | 44 | /** 45 | * Initialize an AVXTEA context. 46 | * 47 | * @param ctx an AVXTEA context 48 | * @param key a key of 16 bytes used for encryption/decryption, 49 | * interpreted as big endian 32 bit numbers 50 | */ 51 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); 52 | 53 | /** 54 | * Initialize an AVXTEA context. 55 | * 56 | * @param ctx an AVXTEA context 57 | * @param key a key of 16 bytes used for encryption/decryption, 58 | * interpreted as little endian 32 bit numbers 59 | */ 60 | void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]); 61 | 62 | /** 63 | * Encrypt or decrypt a buffer using a previously initialized context, 64 | * in big endian format. 65 | * 66 | * @param ctx an AVXTEA context 67 | * @param dst destination array, can be equal to src 68 | * @param src source array, can be equal to dst 69 | * @param count number of 8 byte blocks 70 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 71 | * @param decrypt 0 for encryption, 1 for decryption 72 | */ 73 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 74 | int count, uint8_t *iv, int decrypt); 75 | 76 | /** 77 | * Encrypt or decrypt a buffer using a previously initialized context, 78 | * in little endian format. 79 | * 80 | * @param ctx an AVXTEA context 81 | * @param dst destination array, can be equal to src 82 | * @param src source array, can be equal to dst 83 | * @param count number of 8 byte blocks 84 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 85 | * @param decrypt 0 for encryption, 1 for decryption 86 | */ 87 | void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 88 | int count, uint8_t *iv, int decrypt); 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | #endif /* AVUTIL_XTEA_H */ 95 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Martin Storsjo 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_HMAC_H 22 | #define AVUTIL_HMAC_H 23 | 24 | #include 25 | 26 | #include "version.h" 27 | /** 28 | * @defgroup lavu_hmac HMAC 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | enum AVHMACType { 34 | AV_HMAC_MD5, 35 | AV_HMAC_SHA1, 36 | AV_HMAC_SHA224, 37 | AV_HMAC_SHA256, 38 | AV_HMAC_SHA384, 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 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/bswap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * byte swapping routines 24 | */ 25 | 26 | #ifndef AVUTIL_BSWAP_H 27 | #define AVUTIL_BSWAP_H 28 | 29 | #include 30 | #include "libavutil/avconfig.h" 31 | #include "attributes.h" 32 | 33 | #ifdef HAVE_AV_CONFIG_H 34 | 35 | #include "config.h" 36 | 37 | #if ARCH_AARCH64 38 | # include "aarch64/bswap.h" 39 | #elif ARCH_ARM 40 | # include "arm/bswap.h" 41 | #elif ARCH_AVR32 42 | # include "avr32/bswap.h" 43 | #elif ARCH_SH4 44 | # include "sh4/bswap.h" 45 | #elif ARCH_X86 46 | # include "x86/bswap.h" 47 | #endif 48 | 49 | #endif /* HAVE_AV_CONFIG_H */ 50 | 51 | #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) 52 | #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) 53 | #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) 54 | 55 | #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) 56 | 57 | #ifndef av_bswap16 58 | static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 59 | { 60 | x= (x>>8) | (x<<8); 61 | return x; 62 | } 63 | #endif 64 | 65 | #ifndef av_bswap32 66 | static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67 | { 68 | return AV_BSWAP32C(x); 69 | } 70 | #endif 71 | 72 | #ifndef av_bswap64 73 | static inline uint64_t av_const av_bswap64(uint64_t x) 74 | { 75 | return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); 76 | } 77 | #endif 78 | 79 | // be2ne ... big-endian to native-endian 80 | // le2ne ... little-endian to native-endian 81 | 82 | #if AV_HAVE_BIGENDIAN 83 | #define av_be2ne16(x) (x) 84 | #define av_be2ne32(x) (x) 85 | #define av_be2ne64(x) (x) 86 | #define av_le2ne16(x) av_bswap16(x) 87 | #define av_le2ne32(x) av_bswap32(x) 88 | #define av_le2ne64(x) av_bswap64(x) 89 | #define AV_BE2NEC(s, x) (x) 90 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x) 91 | #else 92 | #define av_be2ne16(x) av_bswap16(x) 93 | #define av_be2ne32(x) av_bswap32(x) 94 | #define av_be2ne64(x) av_bswap64(x) 95 | #define av_le2ne16(x) (x) 96 | #define av_le2ne32(x) (x) 97 | #define av_le2ne64(x) (x) 98 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x) 99 | #define AV_LE2NEC(s, x) (x) 100 | #endif 101 | 102 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x) 103 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x) 104 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x) 105 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x) 106 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x) 107 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x) 108 | 109 | #endif /* AVUTIL_BSWAP_H */ 110 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/d3d11va.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Direct3D11 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * copyright (c) 2015 Steve Lhomme 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVCODEC_D3D11VA_H 25 | #define AVCODEC_D3D11VA_H 26 | 27 | /** 28 | * @file 29 | * @ingroup lavc_codec_hwaccel_d3d11va 30 | * Public libavcodec D3D11VA header. 31 | */ 32 | 33 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 34 | #undef _WIN32_WINNT 35 | #define _WIN32_WINNT 0x0602 36 | #endif 37 | 38 | #include 39 | #include 40 | 41 | /** 42 | * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11 43 | * @ingroup lavc_codec_hwaccel 44 | * 45 | * @{ 46 | */ 47 | 48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards 49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface 50 | 51 | /** 52 | * This structure is used to provides the necessary configurations and data 53 | * to the Direct3D11 FFmpeg HWAccel implementation. 54 | * 55 | * The application must make it available as AVCodecContext.hwaccel_context. 56 | * 57 | * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. 58 | */ 59 | typedef struct AVD3D11VAContext { 60 | /** 61 | * D3D11 decoder object 62 | */ 63 | ID3D11VideoDecoder *decoder; 64 | 65 | /** 66 | * D3D11 VideoContext 67 | */ 68 | ID3D11VideoContext *video_context; 69 | 70 | /** 71 | * D3D11 configuration used to create the decoder 72 | */ 73 | D3D11_VIDEO_DECODER_CONFIG *cfg; 74 | 75 | /** 76 | * The number of surface in the surface array 77 | */ 78 | unsigned surface_count; 79 | 80 | /** 81 | * The array of Direct3D surfaces used to create the decoder 82 | */ 83 | ID3D11VideoDecoderOutputView **surface; 84 | 85 | /** 86 | * A bit field configuring the workarounds needed for using the decoder 87 | */ 88 | uint64_t workaround; 89 | 90 | /** 91 | * Private to the FFmpeg AVHWAccel implementation 92 | */ 93 | unsigned report_id; 94 | 95 | /** 96 | * Mutex to access video_context 97 | */ 98 | HANDLE context_mutex; 99 | } AVD3D11VAContext; 100 | 101 | /** 102 | * Allocate an AVD3D11VAContext. 103 | * 104 | * @return Newly-allocated AVD3D11VAContext or NULL on failure. 105 | */ 106 | AVD3D11VAContext *av_d3d11va_alloc_context(void); 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | #endif /* AVCODEC_D3D11VA_H */ 113 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/hwcontext_opencl.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_OPENCL_H 20 | #define AVUTIL_HWCONTEXT_OPENCL_H 21 | 22 | #ifdef __APPLE__ 23 | #include 24 | #else 25 | #include 26 | #endif 27 | 28 | #include "frame.h" 29 | 30 | /** 31 | * @file 32 | * API-specific header for AV_HWDEVICE_TYPE_OPENCL. 33 | * 34 | * Pools allocated internally are always dynamic, and are primarily intended 35 | * to be used in OpenCL-only cases. If interoperation is required, it is 36 | * typically required to allocate frames in the other API and then map the 37 | * frames context to OpenCL with av_hwframe_ctx_create_derived(). 38 | */ 39 | 40 | /** 41 | * OpenCL frame descriptor for pool allocation. 42 | * 43 | * In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs 44 | * with the data pointer pointing at an object of this type describing the 45 | * planes of the frame. 46 | */ 47 | typedef struct AVOpenCLFrameDescriptor { 48 | /** 49 | * Number of planes in the frame. 50 | */ 51 | int nb_planes; 52 | /** 53 | * OpenCL image2d objects for each plane of the frame. 54 | */ 55 | cl_mem planes[AV_NUM_DATA_POINTERS]; 56 | } AVOpenCLFrameDescriptor; 57 | 58 | /** 59 | * OpenCL device details. 60 | * 61 | * Allocated as AVHWDeviceContext.hwctx 62 | */ 63 | typedef struct AVOpenCLDeviceContext { 64 | /** 65 | * The primary device ID of the device. If multiple OpenCL devices 66 | * are associated with the context then this is the one which will 67 | * be used for all operations internal to FFmpeg. 68 | */ 69 | cl_device_id device_id; 70 | /** 71 | * The OpenCL context which will contain all operations and frames on 72 | * this device. 73 | */ 74 | cl_context context; 75 | /** 76 | * The default command queue for this device, which will be used by all 77 | * frames contexts which do not have their own command queue. If not 78 | * intialised by the user, a default queue will be created on the 79 | * primary device. 80 | */ 81 | cl_command_queue command_queue; 82 | } AVOpenCLDeviceContext; 83 | 84 | /** 85 | * OpenCL-specific data associated with a frame pool. 86 | * 87 | * Allocated as AVHWFramesContext.hwctx. 88 | */ 89 | typedef struct AVOpenCLFramesContext { 90 | /** 91 | * The command queue used for internal asynchronous operations on this 92 | * device (av_hwframe_transfer_data(), av_hwframe_map()). 93 | * 94 | * If this is not set, the command queue from the associated device is 95 | * used instead. 96 | */ 97 | cl_command_queue command_queue; 98 | } AVOpenCLFramesContext; 99 | 100 | #endif /* AVUTIL_HWCONTEXT_OPENCL_H */ 101 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_crc32 24 | * Public header for CRC hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_CRC_H 28 | #define AVUTIL_CRC_H 29 | 30 | #include 31 | #include 32 | #include "attributes.h" 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_crc32 CRC 37 | * @ingroup lavu_hash 38 | * CRC (Cyclic Redundancy Check) hash function implementation. 39 | * 40 | * This module supports numerous CRC polynomials, in addition to the most 41 | * widely used CRC-32-IEEE. See @ref AVCRCId for a list of available 42 | * polynomials. 43 | * 44 | * @{ 45 | */ 46 | 47 | typedef uint32_t AVCRC; 48 | 49 | typedef enum { 50 | AV_CRC_8_ATM, 51 | AV_CRC_16_ANSI, 52 | AV_CRC_16_CCITT, 53 | AV_CRC_32_IEEE, 54 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ 55 | AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ 56 | AV_CRC_24_IEEE, 57 | AV_CRC_8_EBU, 58 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ 59 | }AVCRCId; 60 | 61 | /** 62 | * Initialize a CRC table. 63 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 64 | * @param le If 1, the lowest bit represents the coefficient for the highest 65 | * exponent of the corresponding polynomial (both for poly and 66 | * actual CRC). 67 | * If 0, you must swap the CRC parameter and the result of av_crc 68 | * if you need the standard representation (can be simplified in 69 | * most cases to e.g. bswap16): 70 | * av_bswap32(crc << (32-bits)) 71 | * @param bits number of bits for the CRC 72 | * @param poly generator polynomial without the x**bits coefficient, in the 73 | * representation as specified by le 74 | * @param ctx_size size of ctx in bytes 75 | * @return <0 on failure 76 | */ 77 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); 78 | 79 | /** 80 | * Get an initialized standard CRC table. 81 | * @param crc_id ID of a standard CRC 82 | * @return a pointer to the CRC table or NULL on failure 83 | */ 84 | const AVCRC *av_crc_get_table(AVCRCId crc_id); 85 | 86 | /** 87 | * Calculate the CRC of a block. 88 | * @param crc CRC of previous blocks if any or initial value for CRC 89 | * @return CRC updated with the data from the given block 90 | * 91 | * @see av_crc_init() "le" parameter 92 | */ 93 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc, 94 | const uint8_t *buffer, size_t length) av_pure; 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | #endif /* AVUTIL_CRC_H */ 101 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/avfft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_AVFFT_H 20 | #define AVCODEC_AVFFT_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavc_fft 25 | * FFT functions 26 | */ 27 | 28 | /** 29 | * @defgroup lavc_fft FFT functions 30 | * @ingroup lavc_misc 31 | * 32 | * @{ 33 | */ 34 | 35 | typedef float FFTSample; 36 | 37 | typedef struct FFTComplex { 38 | FFTSample re, im; 39 | } FFTComplex; 40 | 41 | typedef struct FFTContext FFTContext; 42 | 43 | /** 44 | * Set up a complex FFT. 45 | * @param nbits log2 of the length of the input array 46 | * @param inverse if 0 perform the forward transform, if 1 perform the inverse 47 | */ 48 | FFTContext *av_fft_init(int nbits, int inverse); 49 | 50 | /** 51 | * Do the permutation needed BEFORE calling ff_fft_calc(). 52 | */ 53 | void av_fft_permute(FFTContext *s, FFTComplex *z); 54 | 55 | /** 56 | * Do a complex FFT with the parameters defined in av_fft_init(). The 57 | * input data must be permuted before. No 1.0/sqrt(n) normalization is done. 58 | */ 59 | void av_fft_calc(FFTContext *s, FFTComplex *z); 60 | 61 | void av_fft_end(FFTContext *s); 62 | 63 | FFTContext *av_mdct_init(int nbits, int inverse, double scale); 64 | void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 65 | void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); 66 | void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 67 | void av_mdct_end(FFTContext *s); 68 | 69 | /* Real Discrete Fourier Transform */ 70 | 71 | enum RDFTransformType { 72 | DFT_R2C, 73 | IDFT_C2R, 74 | IDFT_R2C, 75 | DFT_C2R, 76 | }; 77 | 78 | typedef struct RDFTContext RDFTContext; 79 | 80 | /** 81 | * Set up a real FFT. 82 | * @param nbits log2 of the length of the input array 83 | * @param trans the type of transform 84 | */ 85 | RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); 86 | void av_rdft_calc(RDFTContext *s, FFTSample *data); 87 | void av_rdft_end(RDFTContext *s); 88 | 89 | /* Discrete Cosine Transform */ 90 | 91 | typedef struct DCTContext DCTContext; 92 | 93 | enum DCTTransformType { 94 | DCT_II = 0, 95 | DCT_III, 96 | DCT_I, 97 | DST_I, 98 | }; 99 | 100 | /** 101 | * Set up DCT. 102 | * 103 | * @param nbits size of the input array: 104 | * (1 << nbits) for DCT-II, DCT-III and DST-I 105 | * (1 << nbits) + 1 for DCT-I 106 | * @param type the type of transform 107 | * 108 | * @note the first element of the input of DST-I is ignored 109 | */ 110 | DCTContext *av_dct_init(int nbits, enum DCTTransformType type); 111 | void av_dct_calc(DCTContext *s, FFTSample *data); 112 | void av_dct_end (DCTContext *s); 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | #endif /* AVCODEC_AVFFT_H */ 119 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/downmix_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Tim Walker 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_DOWNMIX_INFO_H 22 | #define AVUTIL_DOWNMIX_INFO_H 23 | 24 | #include "frame.h" 25 | 26 | /** 27 | * @file 28 | * audio downmix medatata 29 | */ 30 | 31 | /** 32 | * @addtogroup lavu_audio 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @defgroup downmix_info Audio downmix metadata 38 | * @{ 39 | */ 40 | 41 | /** 42 | * Possible downmix types. 43 | */ 44 | enum AVDownmixType { 45 | AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ 46 | AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ 47 | AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ 48 | AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ 49 | AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ 50 | }; 51 | 52 | /** 53 | * This structure describes optional metadata relevant to a downmix procedure. 54 | * 55 | * All fields are set by the decoder to the value indicated in the audio 56 | * bitstream (if present), or to a "sane" default otherwise. 57 | */ 58 | typedef struct AVDownmixInfo { 59 | /** 60 | * Type of downmix preferred by the mastering engineer. 61 | */ 62 | enum AVDownmixType preferred_downmix_type; 63 | 64 | /** 65 | * Absolute scale factor representing the nominal level of the center 66 | * channel during a regular downmix. 67 | */ 68 | double center_mix_level; 69 | 70 | /** 71 | * Absolute scale factor representing the nominal level of the center 72 | * channel during an Lt/Rt compatible downmix. 73 | */ 74 | double center_mix_level_ltrt; 75 | 76 | /** 77 | * Absolute scale factor representing the nominal level of the surround 78 | * channels during a regular downmix. 79 | */ 80 | double surround_mix_level; 81 | 82 | /** 83 | * Absolute scale factor representing the nominal level of the surround 84 | * channels during an Lt/Rt compatible downmix. 85 | */ 86 | double surround_mix_level_ltrt; 87 | 88 | /** 89 | * Absolute scale factor representing the level at which the LFE data is 90 | * mixed into L/R channels during downmixing. 91 | */ 92 | double lfe_mix_level; 93 | } AVDownmixInfo; 94 | 95 | /** 96 | * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. 97 | * 98 | * If the side data is absent, it is created and added to the frame. 99 | * 100 | * @param frame the frame for which the side data is to be obtained or created 101 | * 102 | * @return the AVDownmixInfo structure to be edited by the caller, or NULL if 103 | * the structure cannot be allocated. 104 | */ 105 | AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | #endif /* AVUTIL_DOWNMIX_INFO_H */ 116 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/mediacodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Android MediaCodec public API 3 | * 4 | * Copyright (c) 2016 Matthieu Bouron 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_MEDIACODEC_H 24 | #define AVCODEC_MEDIACODEC_H 25 | 26 | #include "libavcodec/avcodec.h" 27 | 28 | /** 29 | * This structure holds a reference to a android/view/Surface object that will 30 | * be used as output by the decoder. 31 | * 32 | */ 33 | typedef struct AVMediaCodecContext { 34 | 35 | /** 36 | * android/view/Surface object reference. 37 | */ 38 | void *surface; 39 | 40 | } AVMediaCodecContext; 41 | 42 | /** 43 | * Allocate and initialize a MediaCodec context. 44 | * 45 | * When decoding with MediaCodec is finished, the caller must free the 46 | * MediaCodec context with av_mediacodec_default_free. 47 | * 48 | * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise 49 | */ 50 | AVMediaCodecContext *av_mediacodec_alloc_context(void); 51 | 52 | /** 53 | * Convenience function that sets up the MediaCodec context. 54 | * 55 | * @param avctx codec context 56 | * @param ctx MediaCodec context to initialize 57 | * @param surface reference to an android/view/Surface 58 | * @return 0 on success, < 0 otherwise 59 | */ 60 | int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface); 61 | 62 | /** 63 | * This function must be called to free the MediaCodec context initialized with 64 | * av_mediacodec_default_init(). 65 | * 66 | * @param avctx codec context 67 | */ 68 | void av_mediacodec_default_free(AVCodecContext *avctx); 69 | 70 | /** 71 | * Opaque structure representing a MediaCodec buffer to render. 72 | */ 73 | typedef struct MediaCodecBuffer AVMediaCodecBuffer; 74 | 75 | /** 76 | * Release a MediaCodec buffer and render it to the surface that is associated 77 | * with the decoder. This function should only be called once on a given 78 | * buffer, once released the underlying buffer returns to the codec, thus 79 | * subsequent calls to this function will have no effect. 80 | * 81 | * @param buffer the buffer to render 82 | * @param render 1 to release and render the buffer to the surface or 0 to 83 | * discard the buffer 84 | * @return 0 on success, < 0 otherwise 85 | */ 86 | int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render); 87 | 88 | /** 89 | * Release a MediaCodec buffer and render it at the given time to the surface 90 | * that is associated with the decoder. The timestamp must be within one second 91 | * of the current java/lang/System#nanoTime() (which is implemented using 92 | * CLOCK_MONOTONIC on Android). See the Android MediaCodec documentation 93 | * of android/media/MediaCodec#releaseOutputBuffer(int,long) for more details. 94 | * 95 | * @param buffer the buffer to render 96 | * @param time timestamp in nanoseconds of when to render the buffer 97 | * @return 0 on success, < 0 otherwise 98 | */ 99 | int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer *buffer, int64_t time); 100 | 101 | #endif /* AVCODEC_MEDIACODEC_H */ 102 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/dv_profile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_DV_PROFILE_H 20 | #define AVCODEC_DV_PROFILE_H 21 | 22 | #include 23 | 24 | #include "libavutil/pixfmt.h" 25 | #include "libavutil/rational.h" 26 | #include "avcodec.h" 27 | 28 | /* minimum number of bytes to read from a DV stream in order to 29 | * determine the profile */ 30 | #define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */ 31 | 32 | 33 | /* 34 | * AVDVProfile is used to express the differences between various 35 | * DV flavors. For now it's primarily used for differentiating 36 | * 525/60 and 625/50, but the plans are to use it for various 37 | * DV specs as well (e.g. SMPTE314M vs. IEC 61834). 38 | */ 39 | typedef struct AVDVProfile { 40 | int dsf; /* value of the dsf in the DV header */ 41 | int video_stype; /* stype for VAUX source pack */ 42 | int frame_size; /* total size of one frame in bytes */ 43 | int difseg_size; /* number of DIF segments per DIF channel */ 44 | int n_difchan; /* number of DIF channels per frame */ 45 | AVRational time_base; /* 1/framerate */ 46 | int ltc_divisor; /* FPS from the LTS standpoint */ 47 | int height; /* picture height in pixels */ 48 | int width; /* picture width in pixels */ 49 | AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */ 50 | enum AVPixelFormat pix_fmt; /* picture pixel format */ 51 | int bpm; /* blocks per macroblock */ 52 | const uint8_t *block_sizes; /* AC block sizes, in bits */ 53 | int audio_stride; /* size of audio_shuffle table */ 54 | int audio_min_samples[3]; /* min amount of audio samples */ 55 | /* for 48kHz, 44.1kHz and 32kHz */ 56 | int audio_samples_dist[5]; /* how many samples are supposed to be */ 57 | /* in each frame in a 5 frames window */ 58 | const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ 59 | } AVDVProfile; 60 | 61 | /** 62 | * Get a DV profile for the provided compressed frame. 63 | * 64 | * @param sys the profile used for the previous frame, may be NULL 65 | * @param frame the compressed data buffer 66 | * @param buf_size size of the buffer in bytes 67 | * @return the DV profile for the supplied data or NULL on failure 68 | */ 69 | const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, 70 | const uint8_t *frame, unsigned buf_size); 71 | 72 | /** 73 | * Get a DV profile for the provided stream parameters. 74 | */ 75 | const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt); 76 | 77 | /** 78 | * Get a DV profile for the provided stream parameters. 79 | * The frame rate is used as a best-effort parameter. 80 | */ 81 | const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate); 82 | 83 | #endif /* AVCODEC_DV_PROFILE_H */ 84 | -------------------------------------------------------------------------------- /src/devicemanage/devicemanage.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "devicemanage.h" 7 | #include "device.h" 8 | #include "demuxer.h" 9 | 10 | namespace qsc { 11 | 12 | #define DM_MAX_DEVICES_NUM 1000 13 | 14 | IDeviceManage& IDeviceManage::getInstance() { 15 | static DeviceManage dm; 16 | return dm; 17 | } 18 | 19 | DeviceManage::DeviceManage() { 20 | Demuxer::init(); 21 | } 22 | 23 | DeviceManage::~DeviceManage() { 24 | Demuxer::deInit(); 25 | } 26 | 27 | QPointer DeviceManage::getDevice(const QString &serial) 28 | { 29 | if (!m_devices.contains(serial)) { 30 | return QPointer(); 31 | } 32 | return m_devices[serial]; 33 | } 34 | 35 | bool DeviceManage::connectDevice(qsc::DeviceParams params) 36 | { 37 | if (params.serial.trimmed().isEmpty()) { 38 | return false; 39 | } 40 | if (m_devices.contains(params.serial)) { 41 | return false; 42 | } 43 | if (DM_MAX_DEVICES_NUM < m_devices.size()) { 44 | qInfo("over the maximum number of connections"); 45 | return false; 46 | } 47 | /* 48 | // 没有必要分配端口,都用27183即可,连接建立以后server会释放监听的 49 | quint16 port = 0; 50 | if (params.useReverse) { 51 | port = getFreePort(); 52 | if (0 == port) { 53 | qInfo("no port available, automatically switch to forward"); 54 | params.useReverse = false; 55 | } else { 56 | params.localPort = port; 57 | qInfo("free port %d", port); 58 | } 59 | } 60 | */ 61 | IDevice *device = new Device(params); 62 | connect(device, &Device::deviceConnected, this, &DeviceManage::onDeviceConnected); 63 | connect(device, &Device::deviceDisconnected, this, &DeviceManage::onDeviceDisconnected); 64 | if (!device->connectDevice()) { 65 | delete device; 66 | return false; 67 | } 68 | m_devices[params.serial] = device; 69 | return true; 70 | } 71 | 72 | bool DeviceManage::disconnectDevice(const QString &serial) 73 | { 74 | bool ret = false; 75 | if (!serial.isEmpty() && m_devices.contains(serial)) { 76 | auto it = m_devices.find(serial); 77 | if (it->data()) { 78 | delete it->data(); 79 | ret = true; 80 | } 81 | } 82 | return ret; 83 | } 84 | 85 | void DeviceManage::disconnectAllDevice() 86 | { 87 | QMapIterator> i(m_devices); 88 | while (i.hasNext()) { 89 | i.next(); 90 | if (i.value()) { 91 | delete i.value(); 92 | } 93 | } 94 | } 95 | 96 | void DeviceManage::onDeviceConnected(bool success, const QString &serial, const QString &deviceName, const QSize &size) 97 | { 98 | emit deviceConnected(success, serial, deviceName, size); 99 | if (!success) { 100 | removeDevice(serial); 101 | } 102 | } 103 | 104 | void DeviceManage::onDeviceDisconnected(QString serial) 105 | { 106 | emit deviceDisconnected(serial); 107 | removeDevice(serial); 108 | } 109 | 110 | quint16 DeviceManage::getFreePort() 111 | { 112 | quint16 port = m_localPortStart; 113 | while (port < m_localPortStart + DM_MAX_DEVICES_NUM) { 114 | bool used = false; 115 | QMapIterator> i(m_devices); 116 | while (i.hasNext()) { 117 | i.next(); 118 | auto device = i.value(); 119 | if (device && device->isReversePort(port)) { 120 | used = true; 121 | break; 122 | } 123 | } 124 | if (!used) { 125 | return port; 126 | } 127 | port++; 128 | } 129 | return 0; 130 | } 131 | 132 | void DeviceManage::removeDevice(const QString &serial) 133 | { 134 | if (!serial.isEmpty() && m_devices.contains(serial)) { 135 | m_devices[serial]->deleteLater(); 136 | m_devices.remove(serial); 137 | } 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /src/device/server/server.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVER_H 2 | #define SERVER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "adbprocess.h" 9 | #include "tcpserver.h" 10 | #include "videosocket.h" 11 | 12 | class Server : public QObject 13 | { 14 | Q_OBJECT 15 | 16 | enum SERVER_START_STEP 17 | { 18 | SSS_NULL, 19 | SSS_PUSH, 20 | SSS_ENABLE_TUNNEL_REVERSE, 21 | SSS_ENABLE_TUNNEL_FORWARD, 22 | SSS_EXECUTE_SERVER, 23 | SSS_RUNNING, 24 | }; 25 | 26 | public: 27 | struct ServerParams 28 | { 29 | // necessary 30 | QString serial = ""; // 设备序列号 31 | QString serverLocalPath = ""; // 本地安卓server路径 32 | 33 | // optional 34 | QString serverRemotePath = "/data/local/tmp/scrcpy-server.jar"; // 要推送到远端设备的server路径 35 | quint16 localPort = 27183; // reverse时本地监听端口 36 | quint16 maxSize = 720; // 视频分辨率 37 | quint32 bitRate = 8000000; // 视频比特率 38 | quint32 maxFps = 0; // 视频最大帧率 39 | bool useReverse = true; // true:先使用adb reverse,失败后自动使用adb forward;false:直接使用adb forward 40 | int captureOrientationLock = 0; // 是否锁定采集方向 0不锁定 1锁定指定方向 2锁定原始方向 41 | int captureOrientation = 0; // 采集方向 0 90 180 270 42 | int stayAwake = false; // 是否保持唤醒 43 | QString serverVersion = "3.3.3"; // server版本 44 | QString logLevel = "debug"; // log级别 verbose/debug/info/warn/error 45 | // 编码选项 ""表示默认 46 | // 例如 CodecOptions="profile=1,level=2" 47 | // 更多编码选项参考 https://d.android.com/reference/android/media/MediaFormat 48 | QString codecOptions = ""; 49 | // 指定编码器名称(必须是H.264编码器),""表示默认 50 | // 例如 CodecName="OMX.qcom.video.encoder.avc" 51 | QString codecName = ""; 52 | 53 | QString crop = ""; // 视频裁剪 54 | bool control = true; // 安卓端是否接收键鼠控制 55 | qint32 scid = -1; // 随机数,作为localsocket名字后缀,方便同时连接同一个设备多次 56 | }; 57 | 58 | explicit Server(QObject *parent = nullptr); 59 | virtual ~Server(); 60 | 61 | bool start(Server::ServerParams params); 62 | void stop(); 63 | bool isReverse(); 64 | Server::ServerParams getParams(); 65 | VideoSocket *removeVideoSocket(); 66 | QTcpSocket *getControlSocket(); 67 | 68 | signals: 69 | void serverStarted(bool success, const QString &deviceName = "", const QSize &size = QSize()); 70 | void serverStoped(); 71 | 72 | private slots: 73 | void onWorkProcessResult(qsc::AdbProcess::ADB_EXEC_RESULT processResult); 74 | 75 | protected: 76 | void timerEvent(QTimerEvent *event); 77 | 78 | private: 79 | bool pushServer(); 80 | bool enableTunnelReverse(); 81 | bool disableTunnelReverse(); 82 | bool enableTunnelForward(); 83 | bool disableTunnelForward(); 84 | bool execute(); 85 | bool connectTo(); 86 | bool startServerByStep(); 87 | bool readInfo(VideoSocket *videoSocket, QString &deviceName, QSize &size); 88 | void startAcceptTimeoutTimer(); 89 | void stopAcceptTimeoutTimer(); 90 | void startConnectTimeoutTimer(); 91 | void stopConnectTimeoutTimer(); 92 | void onConnectTimer(); 93 | 94 | private: 95 | qsc::AdbProcess m_workProcess; 96 | qsc::AdbProcess m_serverProcess; 97 | TcpServer m_serverSocket; // only used if !tunnel_forward 98 | QPointer m_videoSocket = Q_NULLPTR; 99 | QPointer m_controlSocket = Q_NULLPTR; 100 | bool m_tunnelEnabled = false; 101 | bool m_tunnelForward = false; // use "adb forward" instead of "adb reverse" 102 | int m_acceptTimeoutTimer = 0; 103 | int m_connectTimeoutTimer = 0; 104 | quint32 m_connectCount = 0; 105 | quint32 m_restartCount = 0; 106 | QString m_deviceName = ""; 107 | QSize m_deviceSize = QSize(); 108 | ServerParams m_params; 109 | 110 | SERVER_START_STEP m_serverStartStep = SSS_NULL; 111 | }; 112 | 113 | #endif // SERVER_H 114 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/display.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Vittorio Giovara 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * Display matrix 24 | */ 25 | 26 | #ifndef AVUTIL_DISPLAY_H 27 | #define AVUTIL_DISPLAY_H 28 | 29 | #include 30 | #include "common.h" 31 | 32 | /** 33 | * @addtogroup lavu_video 34 | * @{ 35 | * 36 | * @defgroup lavu_video_display Display transformation matrix functions 37 | * @{ 38 | */ 39 | 40 | /** 41 | * @addtogroup lavu_video_display 42 | * The display transformation matrix specifies an affine transformation that 43 | * should be applied to video frames for correct presentation. It is compatible 44 | * with the matrices stored in the ISO/IEC 14496-12 container format. 45 | * 46 | * The data is a 3x3 matrix represented as a 9-element array: 47 | * 48 | * @code{.unparsed} 49 | * | a b u | 50 | * (a, b, u, c, d, v, x, y, w) -> | c d v | 51 | * | x y w | 52 | * @endcode 53 | * 54 | * All numbers are stored in native endianness, as 16.16 fixed-point values, 55 | * except for u, v and w, which are stored as 2.30 fixed-point values. 56 | * 57 | * The transformation maps a point (p, q) in the source (pre-transformation) 58 | * frame to the point (p', q') in the destination (post-transformation) frame as 59 | * follows: 60 | * 61 | * @code{.unparsed} 62 | * | a b u | 63 | * (p, q, 1) . | c d v | = z * (p', q', 1) 64 | * | x y w | 65 | * @endcode 66 | * 67 | * The transformation can also be more explicitly written in components as 68 | * follows: 69 | * 70 | * @code{.unparsed} 71 | * p' = (a * p + c * q + x) / z; 72 | * q' = (b * p + d * q + y) / z; 73 | * z = u * p + v * q + w 74 | * @endcode 75 | */ 76 | 77 | /** 78 | * Extract the rotation component of the transformation matrix. 79 | * 80 | * @param matrix the transformation matrix 81 | * @return the angle (in degrees) by which the transformation rotates the frame 82 | * counterclockwise. The angle will be in range [-180.0, 180.0], 83 | * or NaN if the matrix is singular. 84 | * 85 | * @note floating point numbers are inherently inexact, so callers are 86 | * recommended to round the return value to nearest integer before use. 87 | */ 88 | double av_display_rotation_get(const int32_t matrix[9]); 89 | 90 | /** 91 | * Initialize a transformation matrix describing a pure counterclockwise 92 | * rotation by the specified angle (in degrees). 93 | * 94 | * @param matrix an allocated transformation matrix (will be fully overwritten 95 | * by this function) 96 | * @param angle rotation angle in degrees. 97 | */ 98 | void av_display_rotation_set(int32_t matrix[9], double angle); 99 | 100 | /** 101 | * Flip the input matrix horizontally and/or vertically. 102 | * 103 | * @param matrix an allocated transformation matrix 104 | * @param hflip whether the matrix should be flipped horizontally 105 | * @param vflip whether the matrix should be flipped vertically 106 | */ 107 | void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); 108 | 109 | /** 110 | * @} 111 | * @} 112 | */ 113 | 114 | #endif /* AVUTIL_DISPLAY_H */ 115 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavutil/murmur3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Reimar Döffinger 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_murmur3 24 | * Public header for MurmurHash3 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_MURMUR3_H 28 | #define AVUTIL_MURMUR3_H 29 | 30 | #include 31 | #include 32 | 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_murmur3 Murmur3 37 | * @ingroup lavu_hash 38 | * MurmurHash3 hash function implementation. 39 | * 40 | * MurmurHash3 is a non-cryptographic hash function, of which three 41 | * incompatible versions were created by its inventor Austin Appleby: 42 | * 43 | * - 32-bit output 44 | * - 128-bit output for 32-bit platforms 45 | * - 128-bit output for 64-bit platforms 46 | * 47 | * FFmpeg only implements the last variant: 128-bit output designed for 64-bit 48 | * platforms. Even though the hash function was designed for 64-bit platforms, 49 | * the function in reality works on 32-bit systems too, only with reduced 50 | * performance. 51 | * 52 | * @anchor lavu_murmur3_seedinfo 53 | * By design, MurmurHash3 requires a seed to operate. In response to this, 54 | * libavutil provides two functions for hash initiation, one that requires a 55 | * seed (av_murmur3_init_seeded()) and one that uses a fixed arbitrary integer 56 | * as the seed, and therefore does not (av_murmur3_init()). 57 | * 58 | * To make hashes comparable, you should provide the same seed for all calls to 59 | * this hash function -- if you are supplying one yourself, that is. 60 | * 61 | * @{ 62 | */ 63 | 64 | /** 65 | * Allocate an AVMurMur3 hash context. 66 | * 67 | * @return Uninitialized hash context or `NULL` in case of error 68 | */ 69 | struct AVMurMur3 *av_murmur3_alloc(void); 70 | 71 | /** 72 | * Initialize or reinitialize an AVMurMur3 hash context with a seed. 73 | * 74 | * @param[out] c Hash context 75 | * @param[in] seed Random seed 76 | * 77 | * @see av_murmur3_init() 78 | * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of 79 | * seeds for MurmurHash3. 80 | */ 81 | void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); 82 | 83 | /** 84 | * Initialize or reinitialize an AVMurMur3 hash context. 85 | * 86 | * Equivalent to av_murmur3_init_seeded() with a built-in seed. 87 | * 88 | * @param[out] c Hash context 89 | * 90 | * @see av_murmur3_init_seeded() 91 | * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of 92 | * seeds for MurmurHash3. 93 | */ 94 | void av_murmur3_init(struct AVMurMur3 *c); 95 | 96 | /** 97 | * Update hash context with new data. 98 | * 99 | * @param[out] c Hash context 100 | * @param[in] src Input data to update hash with 101 | * @param[in] len Number of bytes to read from `src` 102 | */ 103 | #if FF_API_CRYPTO_SIZE_T 104 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); 105 | #else 106 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len); 107 | #endif 108 | 109 | /** 110 | * Finish hashing and output digest value. 111 | * 112 | * @param[in,out] c Hash context 113 | * @param[out] dst Buffer where output digest value is stored 114 | */ 115 | void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | #endif /* AVUTIL_MURMUR3_H */ 122 | -------------------------------------------------------------------------------- /src/third_party/ffmpeg/include/libavcodec/qsv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Intel MediaSDK QSV public API 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVCODEC_QSV_H 22 | #define AVCODEC_QSV_H 23 | 24 | #include 25 | 26 | #include "libavutil/buffer.h" 27 | 28 | /** 29 | * This struct is used for communicating QSV parameters between libavcodec and 30 | * the caller. It is managed by the caller and must be assigned to 31 | * AVCodecContext.hwaccel_context. 32 | * - decoding: hwaccel_context must be set on return from the get_format() 33 | * callback 34 | * - encoding: hwaccel_context must be set before avcodec_open2() 35 | */ 36 | typedef struct AVQSVContext { 37 | /** 38 | * If non-NULL, the session to use for encoding or decoding. 39 | * Otherwise, libavcodec will try to create an internal session. 40 | */ 41 | mfxSession session; 42 | 43 | /** 44 | * The IO pattern to use. 45 | */ 46 | int iopattern; 47 | 48 | /** 49 | * Extra buffers to pass to encoder or decoder initialization. 50 | */ 51 | mfxExtBuffer **ext_buffers; 52 | int nb_ext_buffers; 53 | 54 | /** 55 | * Encoding only. If this field is set to non-zero by the caller, libavcodec 56 | * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to 57 | * the encoder initialization. This only makes sense if iopattern is also 58 | * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY. 59 | * 60 | * The number of allocated opaque surfaces will be the sum of the number 61 | * required by the encoder and the user-provided value nb_opaque_surfaces. 62 | * The array of the opaque surfaces will be exported to the caller through 63 | * the opaque_surfaces field. 64 | */ 65 | int opaque_alloc; 66 | 67 | /** 68 | * Encoding only, and only if opaque_alloc is set to non-zero. Before 69 | * calling avcodec_open2(), the caller should set this field to the number 70 | * of extra opaque surfaces to allocate beyond what is required by the 71 | * encoder. 72 | * 73 | * On return from avcodec_open2(), this field will be set by libavcodec to 74 | * the total number of allocated opaque surfaces. 75 | */ 76 | int nb_opaque_surfaces; 77 | 78 | /** 79 | * Encoding only, and only if opaque_alloc is set to non-zero. On return 80 | * from avcodec_open2(), this field will be used by libavcodec to export the 81 | * array of the allocated opaque surfaces to the caller, so they can be 82 | * passed to other parts of the pipeline. 83 | * 84 | * The buffer reference exported here is owned and managed by libavcodec, 85 | * the callers should make their own reference with av_buffer_ref() and free 86 | * it with av_buffer_unref() when it is no longer needed. 87 | * 88 | * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1. 89 | */ 90 | AVBufferRef *opaque_surfaces; 91 | 92 | /** 93 | * Encoding only, and only if opaque_alloc is set to non-zero. On return 94 | * from avcodec_open2(), this field will be set to the surface type used in 95 | * the opaque allocation request. 96 | */ 97 | int opaque_alloc_type; 98 | } AVQSVContext; 99 | 100 | /** 101 | * Allocate a new context. 102 | * 103 | * It must be freed by the caller with av_free(). 104 | */ 105 | AVQSVContext *av_qsv_alloc_context(void); 106 | 107 | #endif /* AVCODEC_QSV_H */ 108 | --------------------------------------------------------------------------------