From 986b8e338782a4c8aab83e626949ed5457eb5b69 Mon Sep 17 00:00:00 2001 From: Bhalchandra Gajare Date: Wed, 4 Sep 2019 15:32:35 -0700 Subject: tinyalsa: add support for PCM plugins Update the pcm framework to support plugins. Resolve the pcm device node to be either kernel device or virtual device and setup function pointers accordingly. Implement framework functionality for pcm_plugin.c for ease of plugin development. Plugin itself is compiled as shared object (.so) and dynamically linked from pcm_plugin.c. Signed-off-by: Bhalchandra Gajare Signed-off-by: Rohit kumar --- CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index cb31c58..77227d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,24 +2,35 @@ cmake_minimum_required(VERSION 3.0.2) project("TinyALSA" C) +option(TINYALSA_USES_PLUGINS "Whether or not to build with plugin support" OFF) + +if (TINYALSA_USES_PLUGINS) + set (plugin_opt -DTINYALSA_USES_PLUGINS=1) +endif (TINYALSA_USES_PLUGINS) + set (HDRS "include/tinyalsa/attributes.h" "include/tinyalsa/version.h" "include/tinyalsa/asoundlib.h" "include/tinyalsa/pcm.h" + "include/tinyalsa/plugin.h" "include/tinyalsa/mixer.h") set (SRCS "src/pcm.c" + "src/pcm_hw.c" + "src/pcm_plugin.c" + "src/snd_card_plugin.c" "src/mixer.c") add_library("tinyalsa" ${HDRS} ${SRCS}) -target_compile_options("tinyalsa" PRIVATE -Wall -Wextra -Werror -Wfatal-errors) +target_compile_options("tinyalsa" PRIVATE -Wall -Wextra -Werror -Wfatal-errors ${plugin_opt}) target_include_directories("tinyalsa" PRIVATE "include") macro(ADD_EXAMPLE EXAMPLE) add_executable(${EXAMPLE} ${ARGN}) target_link_libraries(${EXAMPLE} "tinyalsa") + target_link_libraries(${EXAMPLE} "dl") target_include_directories(${EXAMPLE} PRIVATE "include") endmacro(ADD_EXAMPLE EXAMPLE) @@ -29,6 +40,7 @@ add_example("pcm-writei" "examples/pcm-writei.c") macro(ADD_UTIL UTIL) add_executable(${UTIL} ${ARGN}) target_link_libraries(${UTIL} "tinyalsa") + target_link_libraries(${UTIL} "dl") target_compile_options(${UTIL} PRIVATE -Wall -Wextra -Werror -Wfatal-errors) target_include_directories(${UTIL} PRIVATE "include") endmacro(ADD_UTIL UTIL) -- cgit v1.2.3