Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/build-distros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,36 @@ jobs:
sed -i 's/^Types: deb/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
DEBIAN_FRONTEND=noninteractive apt-get -qq update
DEBIAN_FRONTEND=noninteractive apt-get -yqq build-dep mlt
DEBIAN_FRONTEND=noninteractive apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev
DEBIAN_FRONTEND=noninteractive apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev libplacebo-dev
- name: ubuntu-22.04
image: ubuntu:22.04
setup_script: |
sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
DEBIAN_FRONTEND=noninteractive apt-get -qq update
DEBIAN_FRONTEND=noninteractive apt-get -yqq build-dep mlt
DEBIAN_FRONTEND=noninteractive apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev libqt6core5compat6-dev
DEBIAN_FRONTEND=noninteractive apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev libqt6core5compat6-dev libplacebo-dev
- name: debian-unstable
image: debian:unstable
setup_script: |
echo 'deb-src http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list
apt-get -qq update
apt-get -yqq build-dep mlt
apt-get -yqq install libplacebo-dev
- name: debian-testing
image: debian:testing
setup_script: |
echo 'deb-src http://deb.debian.org/debian testing main' >> /etc/apt/sources.list
apt-get -qq update
apt-get -yqq build-dep mlt
apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev
apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev libplacebo-dev
- name: debian-stable
image: debian:stable
setup_script: |
echo 'deb-src http://deb.debian.org/debian stable main\ndeb-src http://deb.debian.org/debian stable-updates main' >> /etc/apt/sources.list
echo 'deb http://deb.debian.org/debian bookworm-backports main' >> /etc/apt/sources.list
apt-get -qq update
apt-get -yqq build-dep mlt
apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev
apt-get -yqq install cmake qt6-base-dev libqt6svg6-dev libplacebo-dev
- name: fedora-42
image: fedora:42
setup_script: |
Expand All @@ -75,7 +76,8 @@ jobs:
libtheora-devel libvorbis-devel libvdpau-devel \
libsoup-devel liboil-devel python-devel alsa-lib \
pulseaudio-libs-devel gcc-c++ cmake ffmpeg-free-devel \
movit-devel rubberband-devel vid.stab-devel
movit-devel rubberband-devel vid.stab-devel \
libplacebo-devel
- name: fedora-38
image: fedora:38
setup_script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
sudo apt-get -qq update
sudo apt-get -yqq build-dep mlt
sudo apt-get -yqq install qt6-base-dev libqt6svg6-dev libqt6core5compat6-dev
sudo apt-get -yqq install cmake ninja-build kwalify
sudo apt-get -yqq install cmake ninja-build kwalify libplacebo-dev
cmake -D CMAKE_BUILD_TYPE=Debug -D BUILD_TESTING=ON -D SWIG_PYTHON=ON -S . -B build -G Ninja
cmake --build build
sudo cmake --install build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-msys2-mingw64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
mingw-w64-x86_64-x264
mingw-w64-x86_64-x265
mingw-w64-x86_64-zimg
mingw-w64-x86_64-libplacebo

- uses: actions/checkout@v4

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
--library=cppcheck.cfg
--suppress=ctuOneDefinitionRuleViolation
--suppress=syntaxError:src/modules/xml/common.c
--suppress=syntaxError:src/modules/placebo/filter_placebo_render.c
--suppress=syntaxError:src/modules/placebo/filter_placebo_shader.c
--suppress=syntaxError:src/modules/placebo/gpu_context.c
steps:
- uses: actions/checkout@v4
- name: Install Cppcheck
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ option(MOD_NORMALIZE "Enable Normalize module (GPL)" ON)
option(MOD_OLDFILM "Enable Oldfilm module" ON)
option(MOD_OPENCV "Enable OpenCV module" OFF)
option(MOD_MOVIT "Enable OpenGL module" ON)
option(MOD_PLACEBO "Enable libplacebo GPU module" ON)
option(MOD_PLUS "Enable Plus module" ON)
option(MOD_PLUSGPL "Enable PlusGPL module (GPL)" ON)
option(MOD_QT6 "Enable Qt6 module (GPL)" ON)
Expand Down Expand Up @@ -303,6 +304,15 @@ if(MOD_MOVIT)
list(APPEND MLT_SUPPORTED_COMPONENTS movit)
endif()

if(MOD_PLACEBO)
pkg_check_modules(libplacebo IMPORTED_TARGET libplacebo)
if(libplacebo_FOUND)
list(APPEND MLT_SUPPORTED_COMPONENTS placebo)
else()
set(MOD_PLACEBO OFF)
endif()
endif()

if(MOD_PLUS)
pkg_check_modules(libebur128 IMPORTED_TARGET libebur128)
list(APPEND MLT_SUPPORTED_COMPONENTS plus)
Expand Down Expand Up @@ -568,6 +578,7 @@ add_feature_info("Module: Normalize" MOD_NORMALIZE "")
add_feature_info("Module: Oldfilm" MOD_OLDFILM "")
add_feature_info("Module: OpenCV" MOD_OPENCV "")
add_feature_info("Module: Movit" MOD_MOVIT "")
add_feature_info("Module: Placebo" MOD_PLACEBO "")
add_feature_info("Module: Plus" MOD_PLUS "")
add_feature_info("Module: PlusGPL" MOD_PLUSGPL "")
add_feature_info("Module: Qt6" MOD_QT6 "")
Expand Down
4 changes: 4 additions & 0 deletions src/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ if(MOD_MOVIT)
add_subdirectory(movit)
endif()

if(MOD_PLACEBO)
add_subdirectory(placebo)
endif()

if(MOD_PLUS)
add_subdirectory(plus)
endif()
Expand Down
55 changes: 55 additions & 0 deletions src/modules/placebo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
find_package(PkgConfig REQUIRED)
pkg_check_modules(libplacebo IMPORTED_TARGET libplacebo>=5.229)
if(NOT libplacebo_FOUND)
return()
endif()

add_library(mltplacebo MODULE
factory.c
gpu_context.c gpu_context.h
filter_placebo_render.c
filter_placebo_shader.c
)

file(GLOB YML "*.yml")
add_custom_target(Other_placebo_Files SOURCES
${YML}
)

include(GenerateExportHeader)
generate_export_header(mltplacebo)
target_compile_options(mltplacebo PRIVATE ${MLT_COMPILE_OPTIONS})
target_include_directories(mltplacebo PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(mltplacebo PRIVATE mlt PkgConfig::libplacebo)

# Only link D3D11 if libplacebo was built with D3D11 support
include(CheckCSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES ${libplacebo_INCLUDE_DIRS})
check_c_source_compiles("
#include <libplacebo/config.h>
#if !defined(PL_HAVE_D3D11) || !PL_HAVE_D3D11
#error no d3d11
#endif
int main(void) { return 0; }
" PLACEBO_HAS_D3D11)
if(PLACEBO_HAS_D3D11)
target_link_libraries(mltplacebo PRIVATE d3d11 dxgi)
endif()
if(WIN32)
target_link_libraries(mltplacebo PRIVATE shell32 ole32)
endif()

if(MSVC)
target_link_libraries(mltplacebo PRIVATE PThreads4W::PThreads4W)
endif()

set_target_properties(mltplacebo PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${MLT_MODULE_OUTPUT_DIRECTORY}")

install(TARGETS mltplacebo LIBRARY DESTINATION ${MLT_INSTALL_MODULE_DIR})

install(FILES
filter_placebo_render.yml
filter_placebo_shader.yml
DESTINATION ${MLT_INSTALL_DATA_DIR}/placebo
)
53 changes: 53 additions & 0 deletions src/modules/placebo/factory.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* factory.c -- module registration for libplacebo filters
* Copyright (C) 2025 D-Ogi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "mltplacebo_export.h"
#include <framework/mlt.h>
#include <limits.h>
#include <string.h>

extern mlt_filter filter_placebo_render_init(mlt_profile profile,
mlt_service_type type,
const char *id,
char *arg);
extern mlt_filter filter_placebo_shader_init(mlt_profile profile,
mlt_service_type type,
const char *id,
char *arg);

static mlt_properties metadata(mlt_service_type type, const char *id, void *data)
{
char file[PATH_MAX];
snprintf(file, PATH_MAX, "%s/placebo/%s", mlt_environment("MLT_DATA"), (char *) data);
return mlt_properties_parse_yaml(file);
}

MLTPLACEBO_EXPORT MLT_REPOSITORY
{
MLT_REGISTER(mlt_service_filter_type, "placebo.render", filter_placebo_render_init);
MLT_REGISTER(mlt_service_filter_type, "placebo.shader", filter_placebo_shader_init);
MLT_REGISTER_METADATA(mlt_service_filter_type,
"placebo.render",
metadata,
"filter_placebo_render.yml");
MLT_REGISTER_METADATA(mlt_service_filter_type,
"placebo.shader",
metadata,
"filter_placebo_shader.yml");
}
Loading