view-demo: add video element

pull/100/head
nick black 5 years ago committed by Nick Black
parent 94e52d4acc
commit 957af8151e

@ -640,6 +640,10 @@ API struct AVFrame* ncvisual_decode(struct ncvisual* nc, int* averr);
// to the size of the ncplane at ncplane_visual_open() time.
API int ncvisual_render(const struct ncvisual* ncv);
// stream the entirety of the media, according to its own timing.
// blocking, obviously. pretty raw; beware.
API int ncvisual_stream(struct notcurses* nc, struct ncvisual* ncv, int* averr);
// A panelreel is an notcurses region devoted to displaying zero or more
// line-oriented, contained panels between which the user may navigate. If at
// least one panel exists, there is an active panel. As much of the active

@ -1,6 +1,19 @@
#include <notcurses.h>
#include "demo.h"
static int
view_video_demo(struct notcurses* nc){
struct ncplane* ncp = notcurses_stdplane(nc);
int dimy, dimx;
ncplane_dim_yx(ncp, &dimy, &dimx);
int averr;
struct ncvisual* ncv = ncplane_visual_open(ncp, "../tests/atliens.mkv", &averr);
if(ncvisual_stream(nc, ncv, &averr)){
return -1;
}
return 0;
}
int view_demo(struct notcurses* nc){
struct ncplane* ncp = notcurses_stdplane(nc);
int dimy, dimx;
@ -49,5 +62,8 @@ int view_demo(struct notcurses* nc){
return -1;
}
nanosleep(&demodelay, NULL);
if(view_video_demo(nc)){
return -1;
}
return 0;
}

Loading…
Cancel
Save