mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
start factoring out FFMpeg for OIIO plug #453
This commit is contained in:
parent
40aa5853c9
commit
d81b3ef0cf
@ -14,14 +14,23 @@ include(GNUInstallDirs)
|
|||||||
###################### USER-SELECTABLE OPTIONS ###########################
|
###################### USER-SELECTABLE OPTIONS ###########################
|
||||||
option(DFSG_BUILD "DFSG build (no non-free media/code)" OFF)
|
option(DFSG_BUILD "DFSG build (no non-free media/code)" OFF)
|
||||||
option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
|
option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
|
||||||
option(USE_FFMPEG "Disable FFmpeg image/video support" ON)
|
|
||||||
option(USE_NETWORK "Allow cargo to use the network" OFF)
|
option(USE_NETWORK "Allow cargo to use the network" OFF)
|
||||||
option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
|
option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
|
||||||
option(USE_PYTHON "Build Python wrappers" ON)
|
option(USE_PYTHON "Build Python wrappers" ON)
|
||||||
option(USE_QRCODEGEN "Disable libqrcodegen QR code support" ON)
|
option(USE_QRCODEGEN "Disable libqrcodegen QR code support" ON)
|
||||||
option(USE_RUST "Build Rust wrappers (experimental)" OFF)
|
option(USE_RUST "Build Rust wrappers (experimental)" OFF)
|
||||||
option(USE_TESTS "Build doctest unit tests" ON)
|
option(USE_TESTS "Build doctest unit tests" ON)
|
||||||
|
set(USE_MULTIMEDIA "ffmpeg" CACHE STRING "Multimedia engine, one of 'ffmpeg', 'oiio', or 'none'")
|
||||||
|
set_property(CACHE USE_MULTIMEDIA PROPERTY STRINGS ffmpeg oiio none)
|
||||||
|
message(STATUS "Requested multimedia engine: ${USE_MULTIMEDIA}")
|
||||||
############## END (additional) USER-SELECTABLE OPTIONS ##################
|
############## END (additional) USER-SELECTABLE OPTIONS ##################
|
||||||
|
set(USE_FFMPEG OFF)
|
||||||
|
set(USE_OIIO OFF)
|
||||||
|
if(${USE_MULTIMEDIA} STREQUAL "ffmpeg")
|
||||||
|
set(USE_FFMPEG ON)
|
||||||
|
elseif(${USE_MULTIMEDIA} STREQUAL "oiio")
|
||||||
|
set(USE_OIIO ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
@ -113,29 +122,33 @@ target_link_libraries(notcurses
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
"${AVCODEC_LIBRARIES}"
|
"${AVCODEC_LIBRARIES}"
|
||||||
"${AVFORMAT_LIBRARIES}"
|
"${AVFORMAT_LIBRARIES}"
|
||||||
"${AVUTIL_LIBRARIES}"
|
|
||||||
"${SWSCALE_LIBRARIES}"
|
"${SWSCALE_LIBRARIES}"
|
||||||
|
PUBLIC
|
||||||
|
"${AVUTIL_LIBRARIES}"
|
||||||
)
|
)
|
||||||
target_link_libraries(notcurses-static
|
target_link_libraries(notcurses-static
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${AVCODEC_STATIC_LIBRARIES}"
|
"${AVCODEC_STATIC_LIBRARIES}"
|
||||||
"${AVFORMAT_STATIC_LIBRARIES}"
|
"${AVFORMAT_STATIC_LIBRARIES}"
|
||||||
"${AVUTIL_STATIC_LIBRARIES}"
|
|
||||||
"${SWSCALE_STATIC_LIBRARIES}"
|
"${SWSCALE_STATIC_LIBRARIES}"
|
||||||
|
PUBLIC
|
||||||
|
"${AVUTIL_STATIC_LIBRARIES}"
|
||||||
)
|
)
|
||||||
target_link_directories(notcurses
|
target_link_directories(notcurses
|
||||||
PUBLIC
|
PRIVATE
|
||||||
"${AVCODEC_LIBRARY_DIRS}"
|
"${AVCODEC_LIBRARY_DIRS}"
|
||||||
"${AVFORMAT_LIBRARY_DIRS}"
|
"${AVFORMAT_LIBRARY_DIRS}"
|
||||||
"${AVUTIL_LIBRARY_DIRS}"
|
|
||||||
"${SWSCALE_LIBRARY_DIRS}"
|
"${SWSCALE_LIBRARY_DIRS}"
|
||||||
|
PUBLIC
|
||||||
|
"${AVUTIL_LIBRARY_DIRS}"
|
||||||
)
|
)
|
||||||
target_link_directories(notcurses-static
|
target_link_directories(notcurses-static
|
||||||
PUBLIC
|
PRIVATE
|
||||||
"${AVCODEC_STATIC_LIBRARY_DIRS}"
|
"${AVCODEC_STATIC_LIBRARY_DIRS}"
|
||||||
"${AVFORMAT_STATIC_LIBRARY_DIRS}"
|
"${AVFORMAT_STATIC_LIBRARY_DIRS}"
|
||||||
"${AVUTIL_STATIC_LIBRARY_DIRS}"
|
|
||||||
"${SWSCALE_STATIC_LIBRARY_DIRS}"
|
"${SWSCALE_STATIC_LIBRARY_DIRS}"
|
||||||
|
PUBLIC
|
||||||
|
"${AVUTIL_STATIC_LIBRARY_DIRS}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -277,17 +290,17 @@ target_compile_definitions(notcurses++-static
|
|||||||
file(GLOB NOTCURSES_HEADERS
|
file(GLOB NOTCURSES_HEADERS
|
||||||
CONFIGURE_DEPENDS
|
CONFIGURE_DEPENDS
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
${CMAKE_SOURCE_DIR}/include/notcurses/*.h)
|
${PROJECT_SOURCE_DIR}/include/notcurses/*.h)
|
||||||
|
|
||||||
file(GLOB NCPP_HEADERS
|
file(GLOB NCPP_HEADERS
|
||||||
CONFIGURE_DEPENDS
|
CONFIGURE_DEPENDS
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
${CMAKE_SOURCE_DIR}/include/ncpp/*.hh)
|
${PROJECT_SOURCE_DIR}/include/ncpp/*.hh)
|
||||||
|
|
||||||
file(GLOB NCPP_INTERNAL_HEADERS
|
file(GLOB NCPP_INTERNAL_HEADERS
|
||||||
CONFIGURE_DEPENDS
|
CONFIGURE_DEPENDS
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
${CMAKE_SOURCE_DIR}/include/ncpp/internal/*.hh)
|
${PROJECT_SOURCE_DIR}/include/ncpp/internal/*.hh)
|
||||||
|
|
||||||
install(FILES ${NOTCURSES_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/notcurses)
|
install(FILES ${NOTCURSES_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/notcurses)
|
||||||
install(FILES ${NCPP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ncpp)
|
install(FILES ${NCPP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ncpp)
|
||||||
@ -388,11 +401,11 @@ if(USE_PANDOC)
|
|||||||
endforeach()
|
endforeach()
|
||||||
foreach(m ${MANSOURCE3})
|
foreach(m ${MANSOURCE3})
|
||||||
get_filename_component(me ${m} NAME_WLE)
|
get_filename_component(me ${m} NAME_WLE)
|
||||||
set(MANPAGES3 ${MANPAGES3} ${CMAKE_CURRENT_BINARY_DIR}/${me})
|
LIST(APPEND MANPAGES3 ${CMAKE_CURRENT_BINARY_DIR}/${me})
|
||||||
endforeach()
|
endforeach()
|
||||||
foreach(m ${MANSOURCE1})
|
foreach(m ${MANSOURCE1})
|
||||||
get_filename_component(me ${m} NAME_WLE)
|
get_filename_component(me ${m} NAME_WLE)
|
||||||
set(MANPAGES1 ${MANPAGES1} ${CMAKE_CURRENT_BINARY_DIR}/${me})
|
LIST(APPEND MANPAGES1 ${CMAKE_CURRENT_BINARY_DIR}/${me})
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -553,8 +553,8 @@ int ncvisual_init(int loglevel){
|
|||||||
// FIXME could also use av_log_set_callback() and capture the message...
|
// FIXME could also use av_log_set_callback() and capture the message...
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else // built without ffmpeg
|
||||||
// built without ffmpeg
|
#ifndef USE_OIIO // built without ffmpeg or oiio
|
||||||
bool notcurses_canopen(const notcurses* nc __attribute__ ((unused))){
|
bool notcurses_canopen(const notcurses* nc __attribute__ ((unused))){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -612,5 +612,5 @@ int ncvisual_init(int loglevel){
|
|||||||
(void)loglevel;
|
(void)loglevel;
|
||||||
return 0; // allow success here
|
return 0; // allow success here
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
61
src/lib/oiio.cpp
Normal file
61
src/lib/oiio.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
#ifdef USE_OIIO
|
||||||
|
bool notcurses_canopen(const notcurses* nc __attribute__ ((unused))){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AVFrame* ncvisual_decode(ncvisual* nc, int* averr){
|
||||||
|
(void)nc;
|
||||||
|
(void)averr;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ncvisual_render(const ncvisual* ncv, int begy, int begx, int leny, int lenx){
|
||||||
|
(void)ncv;
|
||||||
|
(void)begy;
|
||||||
|
(void)begx;
|
||||||
|
(void)leny;
|
||||||
|
(void)lenx;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ncvisual_stream(struct notcurses* nc, struct ncvisual* ncv, int* averr,
|
||||||
|
float timespec, streamcb streamer, void* curry){
|
||||||
|
(void)nc;
|
||||||
|
(void)ncv;
|
||||||
|
(void)averr;
|
||||||
|
(void)timespec;
|
||||||
|
(void)streamer;
|
||||||
|
(void)curry;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ncvisual* ncplane_visual_open(ncplane* nc, const char* filename, int* averr){
|
||||||
|
(void)nc;
|
||||||
|
(void)filename;
|
||||||
|
(void)averr;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ncvisual* ncvisual_open_plane(notcurses* nc, const char* filename,
|
||||||
|
int* averr, int y, int x, ncscale_e style){
|
||||||
|
(void)nc;
|
||||||
|
(void)filename;
|
||||||
|
(void)averr;
|
||||||
|
(void)y;
|
||||||
|
(void)x;
|
||||||
|
(void)style;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* ncvisual_subtitle(const ncvisual* ncv){
|
||||||
|
(void)ncv;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ncvisual_init(int loglevel){
|
||||||
|
(void)loglevel;
|
||||||
|
return 0; // allow success here
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,5 +1,5 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#ifdef USE_FFMPEG
|
#ifdef USE_MULTIMEDIA
|
||||||
#include <libavutil/pixdesc.h>
|
#include <libavutil/pixdesc.h>
|
||||||
#include <libavutil/avconfig.h>
|
#include <libavutil/avconfig.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
@ -19,7 +19,7 @@ TEST_CASE("Multimedia") {
|
|||||||
ncplane* ncp_ = notcurses_stdplane(nc_);
|
ncplane* ncp_ = notcurses_stdplane(nc_);
|
||||||
REQUIRE(ncp_);
|
REQUIRE(ncp_);
|
||||||
|
|
||||||
#ifndef USE_FFMPEG
|
#ifndef USE_MULTIMEDIA
|
||||||
SUBCASE("LibavDisabled"){
|
SUBCASE("LibavDisabled"){
|
||||||
REQUIRE(!notcurses_canopen(nc_));
|
REQUIRE(!notcurses_canopen(nc_));
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
#define notcurses_VERSION_MINOR "@notcurses_VERSION_MINOR@"
|
#define notcurses_VERSION_MINOR "@notcurses_VERSION_MINOR@"
|
||||||
#define notcurses_VERSION_PATCH "@notcurses_VERSION_PATCH@"
|
#define notcurses_VERSION_PATCH "@notcurses_VERSION_PATCH@"
|
||||||
#cmakedefine DFSG_BUILD
|
#cmakedefine DFSG_BUILD
|
||||||
#cmakedefine USE_FFMPEG
|
|
||||||
#cmakedefine USE_QRCODEGEN
|
#cmakedefine USE_QRCODEGEN
|
||||||
|
// exclusive with USE_OIIO
|
||||||
|
#cmakedefine USE_FFMPEG
|
||||||
|
// exclusive with USE_FFMPEG
|
||||||
|
#cmakedefine USE_OIIO
|
||||||
|
// set if either USE_FFMPEG || USE_OIIO
|
||||||
|
#cmakedefine USE_MULTIMEDIA
|
||||||
#define NOTCURSES_SHARE "@CMAKE_INSTALL_FULL_DATADIR@/notcurses"
|
#define NOTCURSES_SHARE "@CMAKE_INSTALL_FULL_DATADIR@/notcurses"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user