From 01bc5433998aa4cb89eb610bb2650946c7ecff0b Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 5 Feb 2020 10:41:13 -0500 Subject: [PATCH] tag demos requiring ffmpeg --- doc/man/man1/notcurses-demo.1.md | 10 ++++--- src/demo/demo.c | 45 +++++++++++++++++++++++--------- src/lib/internal.h | 2 ++ src/lib/libav.c | 5 ++-- src/lib/notcurses.c | 4 +++ 5 files changed, 47 insertions(+), 19 deletions(-) diff --git a/doc/man/man1/notcurses-demo.1.md b/doc/man/man1/notcurses-demo.1.md index 0e252b6f9..63eafe403 100644 --- a/doc/man/man1/notcurses-demo.1.md +++ b/doc/man/man1/notcurses-demo.1.md @@ -61,6 +61,7 @@ At any time, press 'q' to quit. The demo is best run in at least a 80x45 termina demospec: Select which demos to run, and what order to run them in. The default is **ixetbcgpwuvlfsjo**. See above for a list of demos. # NOTES + Proper display requires: * A terminal advertising the **rgb** terminfo(5) capability, or that the environment variable **COLORTERM** is defined to **24bit** (and that the terminal honors this variable), @@ -72,10 +73,10 @@ non-free under the Debian Free Software Guidelines. As a result, the **chunli**, **eagle**, **fallin'**, **jungle**, **luigi**, and **view** demos are unavailable through the Debian package. -# BUGS +If notcurses is built without FFmpeg, the **chunli**, **eagle**, **fallin'**, +**outro**, **view**, and **xray** demos will be unavailable. -If notcurses is built without FFmpeg, the following demos will fail immedaitely when specified: **xray**, -**eagle**, **chunli**, **fallin'**, **view**, **outro**. +# BUGS # AUTHORS @@ -83,7 +84,8 @@ If notcurses is built without FFmpeg, the following demos will fail immedaitely * Images from Street Fighter II and Mega Man 2 copyright Capcom of America. * Images from Super Mario Bros. copyright Nintendo of America. * Images from Ninja Gaiden copyright Koei Tecmo America. -* "Jungle with Rain" and "Ruins with Rain" copyright Mark Ferrari. +* Images from Final Fantasy copyright Square Enix Co Ltd. +* "Jungle with Rain" and "Ruins with Rain" copyright Mark Ferrari/Living Worlds. # SEE ALSO notcurses(3notcurses), ncurses(3ncurses), terminfo(5) diff --git a/src/demo/demo.c b/src/demo/demo.c index 4e9da3b7b..23f219331 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -21,10 +21,14 @@ static demoresult* results; static char datadir[PATH_MAX]; static atomic_bool interrupted = ATOMIC_VAR_INIT(false); -#ifndef DFSG_BUILD -static const char DEFAULT_DEMO[] = "ixetbcgpwuvlfsjo"; +#ifdef DISABLE_FFMPEG +static const char DEFAULT_DEMO[] = "itbgpwus"; #else +#ifdef DFSG_BUILD static const char DEFAULT_DEMO[] = "ixtbgpwuso"; +#else +static const char DEFAULT_DEMO[] = "ixetbcgpwuvlfsjo"; +#endif #endif void interrupt_demo(void){ @@ -71,40 +75,53 @@ struct timespec demodelay = { .tv_nsec = 0, }; +// anything that's dfsg non-free requires ncvisual (i.e. it's all multimedia), +// so also check for FFMPEG_DISABLE here in DFSG_BUILD #ifndef DFSG_BUILD -#define NONFREE(name, fxn) { name, fxn, }, +#ifndef DISABLE_FFMPEG +#define NONFREE(name, fxn) { name, fxn, } +#endif +#endif +#ifndef NONFREE +#define NONFREE(name, fxn) { NULL, NULL, } +#endif + +#ifndef DISABLE_FFMPEG +#define FREEFFMPEG(name, fxn) { name, fxn, } #else -#define NONFREE(name, fxn) { NULL, NULL, }, +#define FREEFFMPEG(name, fxn) { NULL, NULL, } #endif +// define with NONFREE() to exempt from any DFSG or non-FFmpeg build. define +// with FREEFFMPEG() to exempt from any non-FFmpeg build. static struct { const char* name; int (*fxn)(struct notcurses*); } demos[26] = { { NULL, NULL, }, { "box", box_demo, }, - NONFREE("chunli", chunli_demo) + NONFREE("chunli", chunli_demo), { NULL, NULL, }, - NONFREE("eagle", eagle_demo) - NONFREE("fallin'", fallin_demo) + NONFREE("eagle", eagle_demo), + NONFREE("fallin'", fallin_demo), { "grid", grid_demo, }, { NULL, NULL, }, { "intro", intro, }, - NONFREE("jungle", jungle_demo) + NONFREE("jungle", jungle_demo), { NULL, NULL, }, - NONFREE("luigi", luigi_demo) + NONFREE("luigi", luigi_demo), { NULL, NULL, }, { NULL, NULL, }, - { "outro", outro, }, + FREEFFMPEG("outro", outro), { "panelreel", panelreel_demo, }, { NULL, NULL, }, { NULL, NULL, }, { "sliders", sliding_puzzle_demo, }, { "trans", trans_demo, }, { "uniblock", unicodeblocks_demo, }, - NONFREE("view", view_demo) + NONFREE("view", view_demo), { "whiteout", witherworm_demo, }, - { "xray", xray_demo, }, + FREEFFMPEG("xray", xray_demo), { NULL, NULL, }, { NULL, NULL, }, }; @@ -359,7 +376,9 @@ summary_table(struct ncdirect* nc, const char* spec){ fprintf(stderr, "\nError running demo. Is \"%s\" the correct data path?\n", datadir); } #ifdef DFSG_BUILD - fprintf(stderr, "DFSG version. Some demos are missing.\n"); + ncdirect_fg_rgb8(nc, 0xfe, 0x20, 0x76); // PANTONE Strong Red C + 3x0x20 + fflush(stdout); // in case we print to stderr below, we want color from above + fprintf(stderr, "\nDFSG version. Some demos are missing.\n"); #endif return failed; } diff --git a/src/lib/internal.h b/src/lib/internal.h index d8bd5cb8a..674d55e7c 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -94,7 +94,9 @@ typedef struct ncvisual { int placex, placey; ncscale_e style; // none, scale, or stretch struct notcurses* ncobj; // set iff this ncvisual "owns" its ncplane +#ifndef DISABLE_FFMPEG AVSubtitle subtitle; +#endif } ncvisual; // current presentation state of the terminal. it is carried across render diff --git a/src/lib/libav.c b/src/lib/libav.c index 1dff7f2fa..db954959f 100644 --- a/src/lib/libav.c +++ b/src/lib/libav.c @@ -570,11 +570,12 @@ int ncvisual_render(const ncvisual* ncv, int begy, int begx, int leny, int lenx) return -1; } -int ncvisual_stream(notcurses* nc, ncvisual* ncv, int* averr, - streamcb streamer, void* curry){ +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; diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 7f7c2ec0b..542ba5133 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -744,6 +744,7 @@ void notcurses_reset_stats(notcurses* nc, ncstats* stats){ // Convert a notcurses log level to its ffmpeg equivalent. static int ffmpeg_log_level(ncloglevel_e level){ +#ifndef DISABLE_FFMPEG switch(level){ case NCLOGLEVEL_SILENT: return AV_LOG_QUIET; case NCLOGLEVEL_PANIC: return AV_LOG_PANIC; @@ -758,6 +759,9 @@ ffmpeg_log_level(ncloglevel_e level){ } fprintf(stderr, "Invalid log level: %d\n", level); return AV_LOG_TRACE; +#else + return level; +#endif } ncdirect* notcurses_directmode(const char* termtype, FILE* outfp){