Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • feature/migrate-frame-passing-to-libprocessinggraph
  • main
  • qt-legacy-pi
  • qt-legacy-support-rpi
4 results

Target

Select target project
  • nik/LibAVQt
1 result
Select Git revision
  • cmake-fixes
  • debian
  • feature/dxva2-d3d11va-ogl-interop
  • feature/gpu-specific-encoders
  • main
  • qt-legacy-pi
  • qt-legacy-support-rpi
7 results
Show changes

Commits on Source 68

Showing with 315 additions and 250 deletions
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
*.user *.user
build* build*
/cmake-build-*/
/.vs/
/.idea_/
/out/
/LibAVQt.code-workspace
/mfx_dispatch
build: default:
stage: build
image: image:
name: sdc0/manjaro-qt6-ffmpeg name: sdc0/manjaro-qt-ffmpeg:qt5
entrypoint: ["/bin/sh", "-c"] entrypoint: ["/bin/sh", "-c"]
build:
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
script: script:
- mkdir build - mkdir build
- cd build - cd build
- cmake -DCMAKE_BUILD_TYPE=Debug .. - cmake -DCMAKE_BUILD_TYPE=Debug -DQT_VERSION=5 ..
- cmake --build . -j4 - cmake --build . -j$(nproc)
- cd ..
- mkdir build-release
- cd build-release
- cmake -DCMAKE_BUILD_TYPE=Release -DQT_VERSION=5 ..
- cmake --build . -j$(nproc)
artifacts: artifacts:
paths: paths:
- build/AVQt/libAVQt_static.a - build/AVQt/libAVQt_static.a
......
[submodule "mfx_dispatch"]
path = mfx_dispatch
url = https://github.com/lu-zero/mfx_dispatch/
...@@ -9,3 +9,8 @@ ...@@ -9,3 +9,8 @@
# Editor-based HTTP Client requests # Editor-based HTTP Client requests
/httpRequests/ /httpRequests/
/discord.xml /discord.xml
/deployment.xml
/.name
/codeStyles/Project.xml
/codeStyles/codeStyleConfig.xml
/GrepConsole.xml
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
\ No newline at end of file
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright (c) &amp;#36;originalComment.match(&quot;Copyright \(c\) (\d+)&quot;, 1, &quot;-&quot;)&amp;#36;today.year.&#10;&#10;Permission is hereby granted, free of charge, to any person obtaining a copy of this software&#10;and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction,&#10;including without limitation the rights to use, copy, modify, merge, publish, distribute,&#10;sublicense, and/or sell copies of the Software, and to permit persons to whom the Software&#10;is furnished to do so, subject to the following conditions:&#10;&#10;The above copyright notice and this permission notice shall be included in all copies or&#10;substantial portions of the Software.&#10;&#10;THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,INCLUDING&#10;BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND&#10;NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM,&#10;DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORTOR OTHERWISE, ARISING&#10;FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OROTHER DEALINGS IN THE SOFTWARE." />
<option name="myName" value="MIT" />
</copyright>
</component>
\ No newline at end of file
<component name="CopyrightManager">
<settings default="MIT">
<module2copyright>
<element module="Project Source Files" copyright="MIT" />
</module2copyright>
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
<serverData>
<paths name="WSL (c1708843-4b65-4d0c-b958-d823944fbe2d)">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Clazy" enabled="true" level="WARNING" enabled_by_default="true">
<option name="clazyChecks" value="level0,no-qt-macros" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
...@@ -2,11 +2,8 @@ ...@@ -2,11 +2,8 @@
<project version="4"> <project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" /> <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration"> <component name="CidrRootsConfiguration">
<excludeRoots> <libraryRoots>
<file path="$PROJECT_DIR$/build-qt59" /> <file path="$PROJECT_DIR$/mfx_dispatch" />
</excludeRoots> </libraryRoots>
</component>
<component name="ProjectPlainTextFileTypeManager">
<file url="file://$PROJECT_DIR$/AVQt/mainpage.dox" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/LibAVQt.iml" filepath="$PROJECT_DIR$/.idea/LibAVQt.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/libAVQt.iml" filepath="$PROJECT_DIR$/.idea/libAVQt.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/libAVQt.iml" filepath="$PROJECT_DIR$/.idea/libAVQt.iml" />
</modules> </modules>
</component> </component>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="BodyLimit" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectBodySeparation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectLimit" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/mfx_dispatch" vcs="Git" />
</component> </component>
</project> </project>
\ No newline at end of file
// Copyright (c) 2021.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and t
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORTOR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OROTHER DEALINGS IN THE SOFTWARE.
#include <qglobal.h> #include <qglobal.h>
#include "input/IPacketSource.h" #include "decoder/IDecoder.h"
#include "input/IFrameSource.h" #include "encoder/IEncoder.h"
#include "input/Demuxer.h"
#include "input/IAudioSource.h" #include "input/IAudioSource.h"
#include "output/IPacketSink.h" #include "input/IFrameSource.h"
#include "output/IFrameSink.h" #include "input/IPacketSource.h"
#include "output/IAudioSink.h" #include "output/IAudioSink.h"
#include "filter/IDecoder.h" #include "output/IFrameSink.h"
#include "filter/IEncoder.h" #include "output/IPacketSink.h"
#include "input/Demuxer.h"
#include "output/Muxer.h" #include "output/Muxer.h"
#include "output/OpenGLRenderer.h" #include "renderers/OpenALAudioOutput.h"
#include "output/OpenALAudioOutput.h" #include "renderers/OpenGLRenderer.h"
#include "widgets/OpenGLWidgetRenderer.h"
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include "filter/DecoderVAAPI.h" #include "decoder/DecoderMMAL.h"
#include "filter/DecoderMMAL.h" #include "decoder/DecoderVAAPI.h"
#include "filter/EncoderVAAPI.h" #include "encoder/EncoderVAAPI.h"
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
#include "filter/DecoderDXVA2.h" #include "decoder/DecoderD3D11VA.h"
#include "decoder/DecoderDXVA2.h"
#endif #endif
#include "filter/AudioDecoder.h" #include "decoder/AudioDecoder.h"
#include "filter/DecoderQSV.h" #include "decoder/DecoderQSV.h"
#include "filter/EncoderQSV.h" #include "encoder/EncoderQSV.h"
//#include "output/FrameFileSaver.h" //#include "output/FrameFileSaver.h"
# Created by and for Qt Creator This file was created for editing the project sources only.
# You may attempt to use it for building too, by modifying this file here.
#TARGET = LibAVQt
TEMPLATE = lib
CONFIG += staticlib
QT = core gui widgets opengl concurrent
CONFIG += c++latest
HEADERS = \
$$PWD/filter/private/AudioDecoder_p.h \
$$PWD/filter/private/DecoderDXVA2_p.h \
$$PWD/filter/private/DecoderVAAPI_p.h \
$$PWD/filter/private/EncoderVAAPI_p.h \
$$PWD/filter/AudioDecoder.h \
$$PWD/filter/DecoderDXVA2.h \
$$PWD/filter/DecoderVAAPI.h \
$$PWD/filter/EncoderVAAPI.h \
$$PWD/filter/IDecoder.h \
$$PWD/input/private/Demuxer_p.h \
$$PWD/input/Demuxer.h \
$$PWD/input/IAudioSource.h \
$$PWD/input/IFrameSource.h \
$$PWD/input/IPacketSource.h \
$$PWD/output/private/OpenALAudioOutput_p.h \
$$PWD/output/private/OpenALErrorHandler.h \
$$PWD/output/private/OpenGLRenderer_p.h \
$$PWD/output/private/RenderClock_p.h \
$$PWD/output/IAudioSink.h \
$$PWD/output/IFrameSink.h \
$$PWD/output/IPacketSink.h \
$$PWD/output/OpenALAudioOutput.h \
$$PWD/output/OpenGLRenderer.h \
$$PWD/output/RenderClock.h \
$$PWD/AVQt
SOURCES = \
$$PWD/filter/AudioDecoder.cpp \
$$PWD/filter/DecoderDXVA2.cpp \
$$PWD/filter/DecoderVAAPI.cpp \
$$PWD/filter/EncoderVAAPI.cpp \
$$PWD/input/Demuxer.cpp \
$$PWD/output/OpenALAudioOutput.cpp \
$$PWD/output/OpenGLRenderer.cpp \
$$PWD/output/RenderClock.cpp
INCLUDEPATH = \
$$PWD/filter \
$$PWD/filter/private \
$$PWD/input \
$$PWD/input/private \
$$PWD/output \
$$PWD/output/private
RESOURCES += $$PWD/resources.qrc
LIBS += -lOpenAL32 -lopengl32 -lavformat -lavfilter -lavutil -lavcodec -lavdevice -lswscale -lswresample -lbluray -lxml2 -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lfreetype -lusp10 -lmsimg32 -lpixman-1 -lffi -lexpat -lbz2 -lpng16 -lharfbuzz_too -lfreetype_too -lglib-2.0 -lwinmm -lshlwapi -lpcre -lintl -lgdi32 -lgnutls -lhogweed -lnettle -ltasn1 -lidn2 -latomic -lcrypt32 -lgmp -lunistring -lcharset -lws2_32 -ldl -lavcodec -lvpx -lpthread -liconv -llzma -lopencore-amrwb -lz -lmp3lame -lopencore-amrnb -lopus -lspeex -ltheoraenc -ltheoradec -lvo-amrwbenc -lvorbisenc -lvorbis -logg -lx264 /data/Silas/MXE/usr/x86_64-w64-mingw32.static/lib/xvidcore.a -lole32 -lswresample -lavutil -lm -luser32 -lbcrypt
TARGET = ../AVQt
...@@ -5,8 +5,4 @@ ...@@ -5,8 +5,4 @@
<file>textureES.vsh</file> <file>textureES.vsh</file>
<file>textureES.fsh</file> <file>textureES.fsh</file>
</qresource> </qresource>
<qresource prefix="/images">
<file>frame.bmp</file>
<file>frame.yuv</file>
</qresource>
</RCC> </RCC>
\ No newline at end of file
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
project(libAVQt) function(list_transform_prepend var_out var_in prefix)
set(temp "")
foreach (f ${${var_in}})
list(APPEND temp "${prefix}${f}")
endforeach ()
set(${var_out} "${temp}" PARENT_SCOPE)
endfunction()
set(PROJECT_NAME AVQt)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC on) set(CMAKE_AUTOMOC on)
...@@ -9,10 +17,28 @@ set(CMAKE_AUTOUIC on) ...@@ -9,10 +17,28 @@ set(CMAKE_AUTOUIC on)
set(CMAKE_INCLUDE_CURRENT_DIR on) set(CMAKE_INCLUDE_CURRENT_DIR on)
include_directories(F:\\Dev\\mfx_dispatch-master) if (WIN32)
add_compile_options(/EHa)
string(FIND "${CMAKE_SYSTEM_VERSION}" "." FIRST_DOT)
string(FIND "${CMAKE_SYSTEM_VERSION}" "." LAST_DOT REVERSE)
math(EXPR LAST_DOT "${LAST_DOT}+1") # We don't want the dot in the build number
string(SUBSTRING "${CMAKE_SYSTEM_VERSION}" 0 ${FIRST_DOT} WINDOWS_VERSION)
string(SUBSTRING "${CMAKE_SYSTEM_VERSION}" ${LAST_DOT} -1 WINDOWS_BUILD)
message("Windows ${WINDOWS_VERSION} with build number: ${WINDOWS_BUILD}")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS on)
endif ()
set(QT_VERSION "5")
#find_package(Qt6 COMPONENTS Core Gui Concurrent Widgets OpenGL OpenGLWidgets) set(REQUIRED_LIBS Core Gui Concurrent Widgets OpenGL)
find_package(Qt5 COMPONENTS Core Gui Concurrent Widgets OpenGL) if (QT_VERSION EQUAL "6")
LIST(APPEND REQUIRED_LIBS OpenGLWidgets)
endif ()
set(REQUIRED_LIBS_QUALIFIED)
list_transform_prepend(REQUIRED_LIBS_QUALIFIED REQUIRED_LIBS "Qt${QT_VERSION}::")
find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)
#add_compile_options(-fsanitize=address) #add_compile_options(-fsanitize=address)
#add_link_options(-fsanitize=address) #add_link_options(-fsanitize=address)
...@@ -22,9 +48,10 @@ find_package(Qt5 COMPONENTS Core Gui Concurrent Widgets OpenGL) ...@@ -22,9 +48,10 @@ find_package(Qt5 COMPONENTS Core Gui Concurrent Widgets OpenGL)
#endif () #endif ()
set(SOURCES set(SOURCES
resources.qrc AVQtShader.qrc
AVQt AVQt
global.h
input/IPacketSource.h input/IPacketSource.h
input/IFrameSource.h input/IFrameSource.h
...@@ -36,33 +63,38 @@ set(SOURCES ...@@ -36,33 +63,38 @@ set(SOURCES
input/private/Demuxer_p.h input/private/Demuxer_p.h
input/Demuxer.cpp input/Demuxer.cpp
filter/IDecoder.h decoder/IDecoder.h
filter/IEncoder.h encoder/IEncoder.h
decoder/DecoderQSV.h
decoder/private/DecoderQSV_p.h
decoder/DecoderQSV.cpp
filter/DecoderQSV.h decoder/AudioDecoder.h
filter/private/DecoderQSV_p.h decoder/private/AudioDecoder_p.h
filter/DecoderQSV.cpp renderers/private/OpenALErrorHandler.h
decoder/AudioDecoder.cpp
filter/AudioDecoder.h encoder/EncoderQSV.h
filter/private/AudioDecoder_p.h encoder/private/EncoderQSV_p.h
filter/private/OpenALErrorHandler.h encoder/EncoderQSV.cpp
filter/AudioDecoder.cpp
filter/EncoderQSV.h renderers/RenderClock.h
filter/private/EncoderQSV_p.h renderers/private/RenderClock_p.h
filter/EncoderQSV.cpp renderers/RenderClock.cpp
output/RenderClock.h renderers/OpenGLRenderer.h
output/private/RenderClock_p.h renderers/private/OpenGLRenderer_p.h
output/RenderClock.cpp renderers/private/OpenGLRenderer_p.cpp
renderers/OpenGLRenderer.cpp
output/OpenGLRenderer.h renderers/OpenALAudioOutput.h
output/private/OpenGLRenderer_p.h renderers/private/OpenALAudioOutput_p.h
output/OpenGLRenderer.cpp renderers/OpenALAudioOutput.cpp
output/OpenALAudioOutput.h widgets/OpenGLWidgetRenderer.h
output/private/OpenALAudioOutput_p.h widgets/private/OpenGLWidgetRenderer_p.h
output/OpenALAudioOutput.cpp widgets/OpenGLWidgetRenderer.cpp
output/Muxer.h output/Muxer.h
output/private/Muxer_p.h output/private/Muxer_p.h
...@@ -73,27 +105,41 @@ set(SOURCES ...@@ -73,27 +105,41 @@ set(SOURCES
# output/FrameFileSaver.cpp # output/FrameFileSaver.cpp
) )
set(SOURCES_LINUX set(SOURCES_LINUX
filter/DecoderVAAPI.h decoder/DecoderVAAPI.h
filter/private/DecoderVAAPI_p.h decoder/private/DecoderVAAPI_p.h
filter/DecoderVAAPI.cpp decoder/DecoderVAAPI.cpp
filter/DecoderMMAL.h decoder/DecoderMMAL.h
filter/private/DecoderMMAL_p.h decoder/private/DecoderMMAL_p.h
filter/DecoderMMAL.cpp decoder/DecoderMMAL.cpp
filter/EncoderVAAPI.h encoder/EncoderVAAPI.h
filter/private/EncoderVAAPI_p.h encoder/private/EncoderVAAPI_p.h
filter/EncoderVAAPI.cpp encoder/EncoderVAAPI.cpp
renderers/private/unix/OpenGLRenderer_p.cpp
renderers/unix/OpenGLRenderer.cpp
) )
set(SOURCES_WINDOWS set(SOURCES_WINDOWS
filter/DecoderDXVA2.h decoder/DecoderDXVA2.h
filter/private/DecoderDXVA2_p.h decoder/private/DecoderDXVA2_p.h
filter/DecoderDXVA2.cpp decoder/DecoderDXVA2.cpp
decoder/DecoderD3D11VA.h
decoder/private/DecoderD3D11VA_p.h
decoder/DecoderD3D11VA.cpp
renderers/private/windows/OpenGLRenderer_p.cpp
) )
if (WIN32) if (WIN32) # LibAVQt only supports Windows 10 1809 and above
if (${WINDOWS_VERSION} GREATER_EQUAL 10 AND ${WINDOWS_BUILD} GREATER_EQUAL 17763)
# add_compile_options(/EHa)
add_library(AVQt SHARED ${SOURCES} ${SOURCES_WINDOWS}) add_library(AVQt SHARED ${SOURCES} ${SOURCES_WINDOWS})
add_library(AVQtStatic STATIC ${SOURCES} ${SOURCES_WINDOWS}) add_library(AVQtStatic STATIC ${SOURCES} ${SOURCES_WINDOWS})
else ()
message(FATAL_ERROR "LibAVQt supports only Windows 10 and up, Build 1809 and up")
endif ()
elseif (UNIX) elseif (UNIX)
add_library(AVQt SHARED ${SOURCES} ${SOURCES_LINUX}) add_library(AVQt SHARED ${SOURCES} ${SOURCES_LINUX})
add_library(AVQtStatic STATIC ${SOURCES} ${SOURCES_LINUX}) add_library(AVQtStatic STATIC ${SOURCES} ${SOURCES_LINUX})
...@@ -101,6 +147,8 @@ else () ...@@ -101,6 +147,8 @@ else ()
message(FATAL_ERROR "LibAVQt doesn't support other platforms than Windows (10 and up, Build 1809 and up) and Linux") message(FATAL_ERROR "LibAVQt doesn't support other platforms than Windows (10 and up, Build 1809 and up) and Linux")
endif () endif ()
target_compile_definitions(AVQt PRIVATE AVQT_LIBRARY_BUILD)
target_compile_definitions(AVQtStatic PRIVATE AVQT_LIBRARY_BUILD)
set_target_properties(AVQtStatic PROPERTIES OUTPUT_NAME AVQt_static) set_target_properties(AVQtStatic PROPERTIES OUTPUT_NAME AVQt_static)
if (!WIN32) if (!WIN32)
...@@ -194,13 +242,11 @@ if (!WIN32) ...@@ -194,13 +242,11 @@ if (!WIN32)
) )
endif () endif ()
#target_link_libraries(AVQt Qt6::Core Qt6::Gui Qt6::Concurrent Qt6::Widgets Qt6::OpenGL Qt6::OpenGLWidgets avformat avfilter avutil avcodec avdevice swscale swresample GL openal) target_link_libraries(AVQt ${REQUIRED_LIBS_QUALIFIED} avformat avfilter avutil avcodec avdevice swscale swresample)
#target_link_libraries(AVQtStatic Qt6::Core Qt6::Gui Qt6::Concurrent Qt6::Widgets Qt6::OpenGL Qt6::OpenGLWidgets avformat avfilter avutil avcodec avdevice swscale swresample GL openal) target_link_libraries(AVQtStatic ${REQUIRED_LIBS_QUALIFIED} avformat avfilter avutil avcodec avdevice swscale swresample)
target_link_libraries(AVQt Qt5::Core Qt5::Gui Qt5::Concurrent Qt5::Widgets Qt5::OpenGL avformat avfilter avutil avcodec avdevice swscale swresample)
target_link_libraries(AVQtStatic Qt5::Core Qt5::Gui Qt5::Concurrent Qt5::Widgets Qt5::OpenGL avformat avfilter avutil avcodec avdevice swscale swresample)
if (WIN32) if (WIN32)
target_link_libraries(AVQt opengl32 OpenAL32 d3d9 windowsapp user32 kernel32 Dwmapi psapi d3d9 dxguid) target_link_libraries(AVQt opengl32 OpenAL32 windowsapp user32 kernel32 Dwmapi psapi d3d9 glu32 dxguid)
target_link_libraries(AVQtStatic opengl32 OpenAL32 windowsapp user32 kernel32 Dwmapi psapi d3d9 dxguid) target_link_libraries(AVQtStatic opengl32 OpenAL32 windowsapp user32 kernel32 Dwmapi psapi d3d9 dxguid)
else () else ()
target_link_libraries(AVQt GL openal EGL GLU va) target_link_libraries(AVQt GL openal EGL GLU va)
......
# Created by and for Qt Creator This file was created for editing the project sources only.
# You may attempt to use it for building too, by modifying this file here.
#TARGET = LibAVQt
TEMPLATE = lib
CONFIG += staticlib
QT = core gui widgets opengl concurrent
CONFIG += c++latest
HEADERS = \
$$PWD/filter/private/AudioDecoder_p.h \
$$PWD/filter/private/DecoderDXVA2_p.h \
$$PWD/filter/private/DecoderVAAPI_p.h \
$$PWD/filter/private/EncoderVAAPI_p.h \
$$PWD/filter/AudioDecoder.h \
$$PWD/filter/DecoderDXVA2.h \
$$PWD/filter/DecoderVAAPI.h \
$$PWD/filter/EncoderVAAPI.h \
$$PWD/filter/IDecoder.h \
$$PWD/input/private/Demuxer_p.h \
$$PWD/input/Demuxer.h \
$$PWD/input/IAudioSource.h \
$$PWD/input/IFrameSource.h \
$$PWD/input/IPacketSource.h \
$$PWD/output/private/OpenALAudioOutput_p.h \
$$PWD/output/private/OpenALErrorHandler.h \
$$PWD/output/private/OpenGLRenderer_p.h \
$$PWD/output/private/RenderClock_p.h \
$$PWD/output/IAudioSink.h \
$$PWD/output/IFrameSink.h \
$$PWD/output/IPacketSink.h \
$$PWD/output/OpenALAudioOutput.h \
$$PWD/output/OpenGLRenderer.h \
$$PWD/output/RenderClock.h \
$$PWD/AVQt
SOURCES = \
$$PWD/filter/AudioDecoder.cpp \
$$PWD/filter/DecoderDXVA2.cpp \
$$PWD/filter/DecoderVAAPI.cpp \
$$PWD/filter/EncoderVAAPI.cpp \
$$PWD/input/Demuxer.cpp \
$$PWD/output/OpenALAudioOutput.cpp \
$$PWD/output/OpenGLRenderer.cpp \
$$PWD/output/RenderClock.cpp
INCLUDEPATH = \
$$PWD/filter \
$$PWD/filter/private \
$$PWD/input \
$$PWD/input/private \
$$PWD/output \
$$PWD/output/private
RESOURCES += $$PWD/resources.qrc
LIBS += -lOpenAL32 -lopengl32 -lavformat -lavfilter -lavutil -lavcodec -lavdevice -lswscale -lswresample -lbluray -lxml2 -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lfreetype -lusp10 -lmsimg32 -lpixman-1 -lffi -lexpat -lbz2 -lpng16 -lharfbuzz_too -lfreetype_too -lglib-2.0 -lwinmm -lshlwapi -lpcre -lintl -lgdi32 -lgnutls -lhogweed -lnettle -ltasn1 -lidn2 -latomic -lcrypt32 -lgmp -lunistring -lcharset -lws2_32 -ldl -lavcodec -lvpx -lpthread -liconv -llzma -lopencore-amrwb -lz -lmp3lame -lopencore-amrnb -lopus -lspeex -ltheoraenc -ltheoradec -lvo-amrwbenc -lvorbisenc -lvorbis -logg -lx264 /data/Silas/MXE/usr/x86_64-w64-mingw32.static/lib/xvidcore.a -lole32 -lswresample -lavutil -lm -luser32 -lbcrypt
#DEFINES =
// Copyright (c) 2021.
// //
// Created by silas on 3/28/21. // Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORTOR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OROTHER DEALINGS IN THE SOFTWARE.
#include "private/AudioDecoder_p.h"
#include "AudioDecoder.h" #include "AudioDecoder.h"
#include "decoder/private/AudioDecoder_p.h"
#include "input/IPacketSource.h" #include "input/IPacketSource.h"
#include "output/IAudioSink.h" #include "output/IAudioSink.h"
...@@ -32,12 +45,12 @@ namespace AVQt { ...@@ -32,12 +45,12 @@ namespace AVQt {
int AudioDecoder::init() { int AudioDecoder::init() {
Q_D(AVQt::AudioDecoder); Q_D(AVQt::AudioDecoder);
{ // {
QMutexLocker lock(&d->m_cbListMutex); // QMutexLocker lock(&d->m_cbListMutex);
for (const auto &cb: d->m_cbList) { // for (const auto &cb: d->m_cbList) {
cb->init(this, d->m_duration, 0); // cb->init(this, d->m_duration, 0, AV_SAMPLE_FMT_U8, 0);
} // }
} // }
return 0; return 0;
} }
...@@ -101,7 +114,6 @@ namespace AVQt { ...@@ -101,7 +114,6 @@ namespace AVQt {
d->m_inputQueue.clear(); d->m_inputQueue.clear();
} }
pause(true);
wait(); wait();
stopped(); stopped();
...@@ -119,6 +131,10 @@ namespace AVQt { ...@@ -119,6 +131,10 @@ namespace AVQt {
if (d->m_paused.compare_exchange_strong(shouldBeCurrent, pause)) { if (d->m_paused.compare_exchange_strong(shouldBeCurrent, pause)) {
paused(pause); paused(pause);
QMutexLocker lock(&d->m_cbListMutex);
for (const auto &cb : d->m_cbList) {
cb->pause(this, pause);
}
} }
} }
...@@ -135,7 +151,7 @@ namespace AVQt { ...@@ -135,7 +151,7 @@ namespace AVQt {
d->m_cbList.append(callback); d->m_cbList.append(callback);
if (d->m_pCodecCtx) { if (d->m_pCodecCtx) {
callback->init(this, d->m_duration, 0); callback->init(this, d->m_duration, d->m_pCodecParams->sample_rate, static_cast<AVSampleFormat>(d->m_pCodecParams->format), d->m_pCodecCtx->channel_layout);
} }
if (d->m_running) { if (d->m_running) {
...@@ -152,8 +168,8 @@ namespace AVQt { ...@@ -152,8 +168,8 @@ namespace AVQt {
QMutexLocker lock(&d->m_cbListMutex); QMutexLocker lock(&d->m_cbListMutex);
if (!d->m_cbList.contains(callback)) { if (!d->m_cbList.contains(callback)) {
d->m_cbList.append(callback); d->m_cbList.removeAll(callback);
return d->m_cbList.indexOf(callback); return 0;
} }
return -1; return -1;
} }
...@@ -175,7 +191,7 @@ namespace AVQt { ...@@ -175,7 +191,7 @@ namespace AVQt {
{ {
QMutexLocker lock(&d->m_cbListMutex); QMutexLocker lock(&d->m_cbListMutex);
for (const auto &cb : d->m_cbList) { for (const auto &cb : d->m_cbList) {
cb->init(this, duration, aParams->sample_rate); cb->init(this, duration, aParams->sample_rate, static_cast<AVSampleFormat>(aParams->format), aParams->channel_layout);
} }
} }
...@@ -206,8 +222,8 @@ namespace AVQt { ...@@ -206,8 +222,8 @@ namespace AVQt {
if (packetType == IPacketSource::CB_AUDIO) { if (packetType == IPacketSource::CB_AUDIO) {
AVPacket *queuePacket = av_packet_clone(packet); AVPacket *queuePacket = av_packet_clone(packet);
while (d->m_inputQueue.size() >= 50) { while (d->m_inputQueue.size() >= 100) {
QThread::msleep(4); QThread::usleep(10);
} }
QMutexLocker lock(&d->m_inputQueueMutex); QMutexLocker lock(&d->m_inputQueueMutex);
d->m_inputQueue.append(queuePacket); d->m_inputQueue.append(queuePacket);
...@@ -302,9 +318,8 @@ namespace AVQt { ...@@ -302,9 +318,8 @@ namespace AVQt {
av_frame_free(&frame); av_frame_free(&frame);
} else { } else {
// qDebug("Paused or queue empty. Sleeping..."); // qDebug("Paused or queue empty. Sleeping...");
msleep(4); usleep(10);
} }
} }
}
} }
}// namespace AVQt
//
// Created by silas on 3/28/21.
//
#include "output/IPacketSink.h" #include "output/IPacketSink.h"
#include "input/IAudioSource.h" #include "input/IAudioSource.h"
......