libav: pass AVFrame back through #61

This commit is contained in:
nick black 2019-11-27 15:51:40 -05:00 committed by Nick Black
parent d423978e1b
commit 45697d54f9
2 changed files with 4 additions and 3 deletions

View File

@ -40,8 +40,7 @@ AVFrame* ncvisual_decode(struct ncvisual* nc){
do{
ret = avcodec_receive_frame(nc->codecctx, nc->frame);
if(ret == AVERROR(EAGAIN) || ret == AVERROR_EOF){
// FIXME can we still use nc->frame?
return NULL;
return nc->frame; // FIXME is this safe? could it have been blown away?
}else if(ret < 0){
fprintf(stderr, "Error decoding AVPacket (%s)\n", av_err2str(ret));
return NULL;

View File

@ -12,7 +12,9 @@ void usage(std::ostream& o, const char* name, int exitcode){
}
int ncview(struct ncvisual* ncv, const notcurses_options* opts){
ncvisual_decode(ncv);
if(ncvisual_decode(ncv) == nullptr){
return -1;
}
auto nc = notcurses_init(opts);
if(nc == nullptr){
return -1;