dankamongmen / notcurses

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

Add dependency on libavdevice #2706

Closed cjtenny closed 1 year ago

cjtenny commented 1 year ago

Thanks to adding a call to avdevice_register_all(), ncvisuals for e.g. v4l2 device "/dev/video0" allow me to have my ugly mug looking right back at me from my terminal; that is to say, this adds webcam support to notcurses visuals.

If you'd rather not add another dependency to notcurses when building with multimedia support, then a note for anybody else who wishes to use a webcam: merely calling libavdevice's avdevice_register_all() once in your program, sometime before creating the ncvisual, will still allow this to work.

Pro: webcam support Con: banner line now awkwardly longer than other lines in notcurses-info.

dankamongmen commented 1 year ago

nice work! =] i'm really glad you were able to get this working.

dankamongmen commented 1 year ago

so this functionality will be unavailable when using OIIO as the backend, right? that seems pretty sure.

i'm happy to merge this. i'd like a note in the appropriate man page. you seem to have studied the package fairly thoroughly -- is there a logical place to document this?

dankamongmen commented 1 year ago

the other thing that worries me is that there might be distributions where ffmpeg is readily available, but libavdevice is not. in that case, we'd need some kind of build guard on this. let me go ahead and worry about that, though.

when you add a note to the documentation, could you perhaps also update the autobuilder scripts to install libavdevice-dev along with other necessary deps? linux for sure, mac if you can, windows if you're feeling lucky. i'd like to see at least one build green before merging.

cjtenny commented 1 year ago

Sure thing! I'll take care of both docs & builders some evening soon. If I find more time I'll also dig into OIIO to see if there's a way to add something similar, but yeah, I don't expect this to have any effect on the existing level of functionality for OIIO - didn't try an OIIO build to see if it worked before.

cjtenny commented 1 year ago

Sorry about that, was mostly afk for a few weeks. Looks like the windows & mac build failures had nothing to do with it, took a stab at fixing the first mac build error anyway - along with the rest of the small change.

With this change this functionality remains unavailable with OIIO; I only mentioned it being supported in ffmpeg in notcurses_visual.3 to be safe. However, it's pretty likely adding the same avdevice initialization - either to notcurses, the host process, or to OIIO - would actually allow support because of https://github.com/OpenImageIO/oiio/blob/master/src/ffmpeg.imageio/ffmpeginput.cpp#L239 's call , but I didn't want to touch the builds for that today.

dankamongmen commented 1 year ago

enabled test runs. let me refresh myself on this and look at it once more! thanks for the ping; i'd forgotten all about this.

dankamongmen commented 1 year ago

please make the three requested changes, and this is good to go!

dankamongmen commented 1 year ago

imma just merge it and i'll do the deb cleanups on my side. thank you @cjtenny !

cjtenny commented 1 year ago

Thanks! Sorry, I was out of the country :eyes:

dankamongmen commented 1 year ago

Thanks! Sorry, I was out of the country eyes

no problem at all, hack on