dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.58k stars 112 forks source link

add directmode streaming to ncplayer #1515

Closed dankamongmen closed 3 years ago

dankamongmen commented 3 years ago

We supposedly added direct mode streaming support in #1346, but we haven't yet extended ncplayer to stream when -k is provided. It ought be thus augmented.

dankamongmen commented 3 years ago

we should probably disable the cursor when doing this.

dankamongmen commented 3 years ago

I've got initial support for ncplayer -k with multiframe media using the new streamfile function. Some problems:

so don't go merging that branch just yet.

dankamongmen commented 3 years ago

using sc and rc, we correctly return to the origin after each frame, when we're high enough that the entire graphic fits. otherwise, we return to a position mid-graphic. we can probably deal with this pretty easily if we know the graphic height.

dankamongmen commented 3 years ago

seems to work fine on sixel, btw.

dankamongmen commented 3 years ago

we should probably handle input now in perframe_direct(), certainly at least 'q' to exit.

dankamongmen commented 3 years ago

I think I've got margins fixed back up, huzzah. Just need to handle the multiframe-at-bottom case, and this ought be ready to merge.

dankamongmen commented 3 years ago

So to handle the bottom case, I think it would be sufficient to figure out the number of rows and columns we printed, and undo those with moves. We then don't even require cursor push/pop support. That information ought be available from ncvisual_blitter_geom() if nothing else; we just need hit it from the directmode context.

dankamongmen commented 3 years ago

yeah we can get the columns+rows from the ncdirectv, which is just a neutered ncplane.

dankamongmen commented 3 years ago

Yep, that works, at least for bitmaps which span the viewing area. Need test with a short one.