mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
ncplayer: support multiframe in direct mode via streamfile #1515
This commit is contained in:
parent
3555257afb
commit
53f92760dd
@ -87,10 +87,8 @@ fixed-width font with good coverage of the Unicode Block Drawing Characters.
|
||||
|
||||
# BUGS
|
||||
|
||||
Direct mode (**-k**) does not yet support multiframe media. It'll read them
|
||||
just fine, but only show the first frame. This might or might not change in
|
||||
the future. Direct mode is kinda fundamentally suboptimal for multiframe
|
||||
media. Until that time, **-k** is exclusive with **-d** and **-L**.
|
||||
Direct mode is kinda fundamentally suboptimal for multiframe media, and
|
||||
is not yet supported with **-L** nor **-d**.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
|
@ -298,6 +298,16 @@ auto handle_opts(int argc, char** argv, notcurses_options& opts, bool* quiet,
|
||||
return optind;
|
||||
}
|
||||
|
||||
int perframe_direct(struct ncvisual* ncv, struct ncvisual_options* vopts,
|
||||
const struct timespec* abstime, void* vmarshal){
|
||||
// FIXME probably want to reset cursor here?
|
||||
(void)ncv;
|
||||
(void)vopts;
|
||||
(void)abstime;
|
||||
(void)vmarshal;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// argc/argv ought already be reduced to only the media arguments
|
||||
int direct_mode_player(int argc, char** argv, ncscale_e scalemode,
|
||||
ncblitter_e blitter, int lmargin, int rmargin){
|
||||
@ -313,15 +323,18 @@ int direct_mode_player(int argc, char** argv, ncscale_e scalemode,
|
||||
}
|
||||
}
|
||||
for(auto i = 0 ; i < argc ; ++i){
|
||||
/*
|
||||
auto faken = dm.prep_image(argv[i], blitter, scalemode, -1,
|
||||
dm.get_dim_x() - (lmargin + rmargin));
|
||||
if(!faken){
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
// FIXME we want to honor the different left and right margins, but that
|
||||
// would require raster_image() knowing how far over we were starting for
|
||||
// multiline cellular blittings...
|
||||
(void)rmargin;
|
||||
ncpp::NCAlign a;
|
||||
if(blitter == NCBLIT_PIXEL){
|
||||
printf("%*.*s", lmargin, lmargin, "");
|
||||
@ -329,15 +342,25 @@ int direct_mode_player(int argc, char** argv, ncscale_e scalemode,
|
||||
}else{
|
||||
a = NCAlign::Center;
|
||||
}
|
||||
/*
|
||||
if(dm.raster_image(faken, a)){
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
int y, x;
|
||||
dm.get_cursor_yx(&y, &x);
|
||||
if(x){
|
||||
std::cout << std::endl;
|
||||
}
|
||||
struct ncvisual_options vopts{};
|
||||
vopts.blitter = blitter;
|
||||
vopts.scaling = scalemode;
|
||||
vopts.x = static_cast<int>(a);
|
||||
vopts.flags = NCVISUAL_OPTION_HORALIGNED;
|
||||
if(dm.streamfile(argv[i], perframe_direct, &vopts, NULL)){
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
return failed ? -1 : 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user