restore compatibility ncvisual_subtitle()

This commit is contained in:
nick black 2021-07-27 15:16:31 -04:00 committed by nick black
parent 3d1d3794cd
commit 6162ba3943
5 changed files with 22 additions and 11 deletions

View File

@ -16,10 +16,10 @@ rearrangements of Notcurses.
* Added `nccell_cols()`, which is just `nccell_width()` except it doesn't
require the first `const ncplane*` argument, and it's `static inline`.
`nccell_width()` has been deprecated, and will be removed in ABI3.
* `ncvisual_subtitles()` now handles Type-1 DVB subtitles when found in
the media of an `ncvisual`. As a result, it now returns a `ncplane*`
rather than `char*`. I don't think anyone was using this, so hopefully
that's ok.
* `ncvisual_subtitle_plane()` now handles all LibAV subtitle types,
including Type-1 DVB (bitmap subtitles), so long as a pixel blitter is
available. `ncvisual_subtitle()` has been deprecated, and will be
removed in ABI3.
* Add `ncvisual_from_palidx()`, which does what you would think.
* 2.3.11 (2021-07-20)

View File

@ -76,10 +76,10 @@ namespace ncpp
return error_guard<int> (ncvisual_stream (get_notcurses (), visual, timescale, streamer, vopts, curry), -1);
}
ncplane* subtitle (Plane& p) const noexcept
/*char* subtitle () const noexcept
{
return ncvisual_subtitle (p, visual);
}
return ncvisual_subtitle (visual);
}*/
bool rotate (double rads) const NOEXCEPT_MAYBE
{

View File

@ -2762,7 +2762,8 @@ ncvisualplane_create(struct ncplane* n, const struct ncplane_options* opts,
// If a subtitle ought be displayed at this time, return a new plane (bound
// to 'parent' containing the subtitle, which might be text or graphics
// (depending on the input format).
API ALLOC struct ncplane* ncvisual_subtitle(struct ncplane* parent, const struct ncvisual* ncv)
API ALLOC struct ncplane* ncvisual_subtitle_plane(struct ncplane* parent,
const struct ncvisual* ncv)
__attribute__ ((nonnull (1, 2)));
// Get the default *media* (not plot) blitter for this environment when using
@ -4425,6 +4426,9 @@ API uint32_t notcurses_getc(struct notcurses* n, const struct timespec* ts,
__attribute__ ((deprecated)) API int nccell_width(const struct ncplane* n, const nccell* c);
API ALLOC char* ncvisual_subtitle(const struct ncvisual* ncv)
__attribute__ ((nonnull (1))) __attribute__ ((deprecated));
#define CELL_ALPHA_HIGHCONTRAST NCALPHA_HIGHCONTRAST
#define CELL_ALPHA_TRANSPARENT NCALPHA_TRANSPARENT
#define CELL_ALPHA_BLEND NCALPHA_BLEND

View File

@ -63,13 +63,18 @@ int ncvisual_stream(notcurses* nc, ncvisual* ncv, float timescale,
return visual_implementation.visual_stream(nc, ncv, timescale, streamer, vopts, curry);
}
ncplane* ncvisual_subtitle(ncplane* parent, const ncvisual* ncv){
ncplane* ncvisual_subtitle_plane(ncplane* parent, const ncvisual* ncv){
if(!visual_implementation.visual_subtitle){
return NULL;
}
return visual_implementation.visual_subtitle(parent, ncv);
}
char* ncvisual_subtitle(const ncvisual* ncv){
(void)ncv; // FIXME remove for abi3
return NULL;
}
int ncvisual_blit(ncvisual* ncv, int rows, int cols, ncplane* n,
const struct blitset* bset, const blitterargs* barg){
if(!(barg->flags & NCVISUAL_OPTION_NOINTERPOLATE)){
@ -1135,6 +1140,7 @@ int ncvisual_simple_streamer(ncvisual* ncv, struct ncvisual_options* vopts,
if(notcurses_render(ncplane_notcurses(vopts->n))){
return -1;
}
struct ncplane* subtitle = NULL;
int ret = 0;
if(curry){
// FIXME improve this hrmmmmm
@ -1143,9 +1149,10 @@ int ncvisual_simple_streamer(ncvisual* ncv, struct ncvisual_options* vopts,
ncplane_destroy(subncp->blist);
subncp->blist = NULL;
}
struct ncplane* subtitle = ncvisual_subtitle(subncp, ncv);
subtitle = ncvisual_subtitle_plane(subncp, ncv);
}
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, tspec, NULL);
ncplane_destroy(subtitle);
return ret;
}

View File

@ -73,7 +73,7 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
stdn->printf(0, NCAlign::Left, "frame %06d (%s)", marsh->framecount,
notcurses_str_blitter(vopts->blitter));
}
struct ncplane* subp = ncvisual_subtitle(*stdn, ncv);
struct ncplane* subp = ncvisual_subtitle_plane(*stdn, ncv);
const int64_t h = ns / (60 * 60 * NANOSECS_IN_SEC);
ns -= h * (60 * 60 * NANOSECS_IN_SEC);
const int64_t m = ns / (60 * NANOSECS_IN_SEC);