diff --git a/doc/man/man1/ncplayer.1.md b/doc/man/man1/ncplayer.1.md index 40ec3a153..a46d07266 100644 --- a/doc/man/man1/ncplayer.1.md +++ b/doc/man/man1/ncplayer.1.md @@ -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 diff --git a/src/player/play.cpp b/src/player/play.cpp index 5a9322497..418bfefd8 100644 --- a/src/player/play.cpp +++ b/src/player/play.cpp @@ -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(a); + vopts.flags = NCVISUAL_OPTION_HORALIGNED; + if(dm.streamfile(argv[i], perframe_direct, &vopts, NULL)){ + failed = true; + } } return failed ? -1 : 0; }