rather large commit, it now handles memory and threading properly.

---

more thorough commit message which was generated by the wonderful copilot AI tool:

Refactor and enhance audio encoding and decoding pipelines

- Introduced CodecUtils.h for utility functions related to audio codec selection, including sample format and bitrate clamping.
- Added DecoderPipeline.h to manage audio decoding, including opening files and retrieving audio stream information.
- Implemented EncoderPipeline.h to handle audio encoding, including encoder setup, resampling, and writing output files.
- Created OutputPathBuilder.h to generate output file paths based on reencode job specifications.
- Refactored SpectrogramWidget to improve OpenGL handling and ensure safe context usage.
- Updated ReencodeDialog.h to enhance code readability and maintainability.
- Improved error handling and logging throughout the audio processing components.
This commit is contained in:
2026-07-01 09:56:37 +02:00
parent 51421ffc2b
commit 1a00e98661
19 changed files with 984 additions and 1084 deletions
+15 -1
View File
@@ -4,6 +4,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# dependencies
find_package(Qt6 REQUIRED COMPONENTS
Core Widgets Multimedia OpenGL OpenGLWidgets
@@ -16,6 +17,7 @@ pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
libswresample
)
pkg_check_modules(FFTW REQUIRED IMPORTED_TARGET fftw3)
# sources
set(SOURCES
src/main.cpp
@@ -55,6 +57,7 @@ set(SOURCES
# reencode
src/gui/ReencodeDialog.cpp
)
set(HEADERS
src/config/Config.h
src/gui/CoverArtWidget.h
@@ -84,6 +87,10 @@ set(HEADERS
src/engine/encoder/StageBuffer.h
src/engine/encoder/FfmpegGuards.h
src/engine/encoder/SampleRateUtils.h
src/engine/encoder/CodecUtils.h # new: pickSampleFormat/pickChannelCount/clampBitrate/ChannelLayoutGuard
src/engine/encoder/OutputPathBuilder.h # new: buildOutputPath
src/engine/encoder/DecoderPipeline.h # new: input open + decoder context
src/engine/encoder/EncoderPipeline.h # new: encoder + muxer + SWR + encode frame
# ffmpeg wrapper
src/engine/ffmpeg/FormatContext.h
src/engine/ffmpeg/CodecContext.h
@@ -97,33 +104,39 @@ set(HEADERS
# reencode
src/gui/ReencodeDialog.h
)
# qrc resources
set(RESOURCES
src/shaders.qrc
src/application.qrc
)
# target
add_executable(SubWave ${SOURCES} ${HEADERS} ${RESOURCES})
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
endif()
if(MSVC)
target_compile_options(SubWave PRIVATE /O2 /fp:fast)
else()
target_compile_options(SubWave PRIVATE -O3 -ffast-math -march=native)
endif()
# headers
target_include_directories(SubWave PRIVATE
src
src/config
src/controllers
src/engine
src/engine/encoder
src/engine/encoder # covers CodecUtils.h, OutputPathBuilder.h, DecoderPipeline.h, EncoderPipeline.h
src/engine/ffmpeg
src/playlists
src/gui
)
# link to qt and ffmpeg and fftw
target_link_libraries(SubWave PRIVATE
Qt6::Core
@@ -134,6 +147,7 @@ target_link_libraries(SubWave PRIVATE
PkgConfig::FFMPEG
PkgConfig::FFTW
)
# For windows stupid ahh
if(WIN32)
set_target_properties(SubWave PROPERTIES WIN32_EXECUTABLE TRUE)