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

Target

Select target project
  • nik/LibAVQt
1 result
Show changes
Commits on Source (84)
Showing with 345 additions and 249 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 "decoder/IDecoder.h"
#include "encoder/IEncoder.h"
#include "input/Demuxer.h" #include "input/Demuxer.h"
#include "input/IPacketSource.h"
#include "input/IFrameSource.h"
#include "input/IAudioSource.h" #include "input/IAudioSource.h"
#include "filter/IDecoder.h" #include "input/IFrameSource.h"
#include "filter/DecoderVAAPI.h" #include "input/IPacketSource.h"
#include "filter/DecoderQSV.h"
#include "filter/DecoderDXVA2.h"
#include "filter/DecoderMMAL.h"
#include "filter/AudioDecoder.h"
#include "filter/EncoderVAAPI.h"
#include "output/IPacketSink.h"
#include "output/IFrameSink.h"
#include "output/IAudioSink.h" #include "output/IAudioSink.h"
#include "output/OpenGLRenderer.h" #include "output/IFrameSink.h"
#include "output/OpenALAudioOutput.h" #include "output/IPacketSink.h"
#include "output/Muxer.h" #include "output/Muxer.h"
//#include "output/FrameFileSaver.h" #include "renderers/OpenALAudioOutput.h"
\ No newline at end of file #include "renderers/OpenGLRenderer.h"
#include "widgets/OpenGLWidgetRenderer.h"
#ifdef Q_OS_LINUX
#include "decoder/DecoderMMAL.h"
#include "decoder/DecoderVAAPI.h"
#include "encoder/EncoderVAAPI.h"
#elif defined(Q_OS_WIN)
#include "decoder/DecoderD3D11VA.h"
#include "decoder/DecoderDXVA2.h"
#endif
#include "decoder/AudioDecoder.h"
#include "decoder/DecoderQSV.h"
#include "encoder/EncoderQSV.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,8 +17,28 @@ set(CMAKE_AUTOUIC on) ...@@ -9,8 +17,28 @@ set(CMAKE_AUTOUIC on)
set(CMAKE_INCLUDE_CURRENT_DIR on) set(CMAKE_INCLUDE_CURRENT_DIR on)
#find_package(Qt6 COMPONENTS Core Gui Concurrent Widgets OpenGL OpenGLWidgets) if (WIN32)
find_package(Qt5 COMPONENTS Core Gui Concurrent Widgets OpenGL) 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")
set(REQUIRED_LIBS 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)
...@@ -20,9 +48,10 @@ find_package(Qt5 COMPONENTS Core Gui Concurrent Widgets OpenGL) ...@@ -20,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
...@@ -34,57 +63,92 @@ set(SOURCES ...@@ -34,57 +63,92 @@ 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
filter/DecoderVAAPI.h decoder/DecoderQSV.h
filter/private/DecoderVAAPI_p.h decoder/private/DecoderQSV_p.h
filter/DecoderVAAPI.cpp 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/DecoderDXVA2.h encoder/EncoderQSV.h
filter/private/DecoderDXVA2_p.h encoder/private/EncoderQSV_p.h
filter/DecoderDXVA2.cpp encoder/EncoderQSV.cpp
filter/DecoderMMAL.h renderers/RenderClock.h
filter/private/DecoderMMAL_p.h renderers/private/RenderClock_p.h
filter/DecoderMMAL.cpp renderers/RenderClock.cpp
filter/AudioDecoder.h renderers/OpenGLRenderer.h
filter/private/AudioDecoder_p.h renderers/private/OpenGLRenderer_p.h
filter/private/OpenALErrorHandler.h renderers/private/OpenGLRenderer_p.cpp
filter/AudioDecoder.cpp renderers/OpenGLRenderer.cpp
renderers/OpenALAudioOutput.h
renderers/private/OpenALAudioOutput_p.h
renderers/OpenALAudioOutput.cpp
widgets/OpenGLWidgetRenderer.h
widgets/private/OpenGLWidgetRenderer_p.h
widgets/OpenGLWidgetRenderer.cpp
output/Muxer.h
output/private/Muxer_p.h
output/Muxer.cpp
# output/FrameFileSaver.h # output/FrameFileSaver.h
# output/private/FrameFileSaver_p.h # output/private/FrameFileSaver_p.h
# output/FrameFileSaver.cpp # output/FrameFileSaver.cpp
)
set(SOURCES_LINUX
decoder/DecoderVAAPI.h
decoder/private/DecoderVAAPI_p.h
decoder/DecoderVAAPI.cpp
filter/EncoderVAAPI.h decoder/DecoderMMAL.h
filter/private/EncoderVAAPI_p.h decoder/private/DecoderMMAL_p.h
filter/EncoderVAAPI.cpp decoder/DecoderMMAL.cpp
output/RenderClock.h encoder/EncoderVAAPI.h
output/private/RenderClock_p.h encoder/private/EncoderVAAPI_p.h
output/RenderClock.cpp encoder/EncoderVAAPI.cpp
output/OpenGLRenderer.h renderers/private/unix/OpenGLRenderer_p.cpp
output/private/OpenGLRenderer_p.h renderers/unix/OpenGLRenderer.cpp
output/OpenGLRenderer.cpp )
set(SOURCES_WINDOWS
decoder/DecoderDXVA2.h
decoder/private/DecoderDXVA2_p.h
decoder/DecoderDXVA2.cpp
output/OpenALAudioOutput.h decoder/DecoderD3D11VA.h
output/private/OpenALAudioOutput_p.h decoder/private/DecoderD3D11VA_p.h
output/OpenALAudioOutput.cpp decoder/DecoderD3D11VA.cpp
output/Muxer.h renderers/private/windows/OpenGLRenderer_p.cpp
output/private/Muxer_p.h
output/Muxer.cpp
) )
add_library(AVQt SHARED ${SOURCES}) if (WIN32) # LibAVQt only supports Windows 10 1809 and above
add_library(AVQtStatic STATIC ${SOURCES}) 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(AVQtStatic STATIC ${SOURCES} ${SOURCES_WINDOWS})
else ()
message(FATAL_ERROR "LibAVQt supports only Windows 10 and up, Build 1809 and up")
endif ()
elseif (UNIX)
add_library(AVQt SHARED ${SOURCES} ${SOURCES_LINUX})
add_library(AVQtStatic STATIC ${SOURCES} ${SOURCES_LINUX})
else ()
message(FATAL_ERROR "LibAVQt doesn't support other platforms than Windows (10 and up, Build 1809 and up) and Linux")
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)
...@@ -137,6 +201,7 @@ if (!WIN32) ...@@ -137,6 +201,7 @@ if (!WIN32)
-Werror=all -Werror=all
-Werror=extra -Werror=extra
-Werror=pedantic -Werror=pedantic
-Wno-float-equal
-ansi -ansi
-Werror=init-self -Werror=init-self
-Werror=old-style-cast -Werror=old-style-cast
...@@ -177,15 +242,13 @@ if (!WIN32) ...@@ -177,15 +242,13 @@ 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) target_link_libraries(AVQt opengl32 OpenAL32 windowsapp user32 kernel32 Dwmapi psapi d3d9 glu32 dxguid)
target_link_libraries(AVQtStatic opengl32 OpenAL32) target_link_libraries(AVQtStatic opengl32 OpenAL32 windowsapp user32 kernel32 Dwmapi psapi d3d9 dxguid)
else () else ()
target_link_libraries(AVQt GL openal EGL GLU) target_link_libraries(AVQt GL openal EGL GLU va)
target_link_libraries(AVQtStatic GL openal EGL GLU) target_link_libraries(AVQtStatic GL openal EGL GLU va)
endif () endif ()
\ No newline at end of file
# 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"
...@@ -19,7 +32,7 @@ namespace AVQt { ...@@ -19,7 +32,7 @@ namespace AVQt {
[[maybe_unused]] AudioDecoder::AudioDecoder(AVQt::AudioDecoderPrivate &p) : d_ptr(&p) { [[maybe_unused]] AudioDecoder::AudioDecoder(AVQt::AudioDecoderPrivate &p) : d_ptr(&p) {
} }
AudioDecoder::AudioDecoder(AudioDecoder &&other) noexcept: d_ptr(other.d_ptr) { AudioDecoder::AudioDecoder(AudioDecoder &&other) noexcept : d_ptr(other.d_ptr) {
d_ptr->q_ptr = this; d_ptr->q_ptr = this;
other.d_ptr = nullptr; other.d_ptr = nullptr;
} }
...@@ -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;
} }
...@@ -67,12 +80,12 @@ namespace AVQt { ...@@ -67,12 +80,12 @@ namespace AVQt {
d->m_paused.store(false); d->m_paused.store(false);
paused(false); paused(false);
// { // {
// 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->start(this); // cb->start(this);
// } // }
// } // }
QThread::start(); QThread::start();
started(); started();
...@@ -86,12 +99,12 @@ namespace AVQt { ...@@ -86,12 +99,12 @@ namespace AVQt {
bool shouldBeCurrent = true; bool shouldBeCurrent = true;
if (d->m_running.compare_exchange_strong(shouldBeCurrent, false)) { if (d->m_running.compare_exchange_strong(shouldBeCurrent, false)) {
// { // {
// 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->stop(this); cb->stop(this);
} }
// } // }
{ {
QMutexLocker lock(&d->m_inputQueueMutex); QMutexLocker lock(&d->m_inputQueueMutex);
for (auto &packet : d->m_inputQueue) { for (auto &packet : d->m_inputQueue) {
...@@ -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;
} }
...@@ -174,8 +190,8 @@ namespace AVQt { ...@@ -174,8 +190,8 @@ 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);
...@@ -244,7 +260,7 @@ namespace AVQt { ...@@ -244,7 +260,7 @@ namespace AVQt {
qFatal("%d: Could not open audio decoder: %s", ret, av_make_error_string(strBuf, strBufSize, ret)); qFatal("%d: Could not open audio decoder: %s", ret, av_make_error_string(strBuf, strBufSize, ret));
} }
for (const auto &cb: d->m_cbList) { for (const auto &cb : d->m_cbList) {
cb->start(this); cb->start(this);
} }
} }
...@@ -281,10 +297,10 @@ namespace AVQt { ...@@ -281,10 +297,10 @@ namespace AVQt {
} }
QMutexLocker lock2(&d->m_cbListMutex); QMutexLocker lock2(&d->m_cbListMutex);
for (const auto &cb: d->m_cbList) { for (const auto &cb : d->m_cbList) {
AVFrame *cbFrame = av_frame_clone(frame); AVFrame *cbFrame = av_frame_clone(frame);
cbFrame->pts = av_rescale_q(frame->pts, d->m_timebase, cbFrame->pts = av_rescale_q(frame->pts, d->m_timebase,
av_make_q(1, 1000000)); // Rescale pts to microseconds for easier processing av_make_q(1, 1000000));// Rescale pts to microseconds for easier processing
qDebug("Calling audio frame callback for PTS: %lld, Timebase: %d/%d", static_cast<long long>(cbFrame->pts), qDebug("Calling audio frame callback for PTS: %lld, Timebase: %d/%d", static_cast<long long>(cbFrame->pts),
d->m_timebase.num, d->m_timebase.num,
d->m_timebase.den); d->m_timebase.den);
...@@ -301,10 +317,9 @@ namespace AVQt { ...@@ -301,10 +317,9 @@ 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
\ No newline at end of file
//
// Created by silas on 3/28/21.
//
#include "output/IPacketSink.h" #include "output/IPacketSink.h"
#include "input/IAudioSource.h" #include "input/IAudioSource.h"
...@@ -79,4 +75,4 @@ namespace AVQt { ...@@ -79,4 +75,4 @@ namespace AVQt {
}; };
} }
#endif //LIBAVQT_AUDIODECODER_H #endif //LIBAVQT_AUDIODECODER_H
\ No newline at end of file