ref: 8863dabe0a500c9c641f546cd1ae3ac97b6312a1
dir: /src/av19.c/
#include "dav1d.h" #include "tools/input/input.h" int mainstacksize = 65536*8; void threadmain(int argc, char **argv) { Dav1dSettings av1s; Dav1dContext *c; Dav1dPicture p; Dav1dData data; DemuxerContext *dc; unsigned fps[2], timebase[2], total; int res; if(argc != 2) sysfatal("usage"); dav1d_default_settings(&av1s); c = nil; if(input_open(&dc, "ivf", argv[1], fps, &total, timebase) < 0) sysfatal("input_open"); av1s.n_frame_threads = 1; av1s.n_tile_threads = 1; if(dav1d_open(&c, &av1s) != 0) sysfatal("dav1d_open"); if(input_read(dc, &data) < 0) sysfatal("input_read"); do{ fprint(2, "data.sz: %zd\n", data.sz); memset(&p, 0, sizeof(p)); res = dav1d_send_data(c, &data); if(res < 0 && res != DAV1D_ERR(EAGAIN)) sysfatal("dav1d_send_data: %d", res); fprint(2, "dav1d_send_data: %d\n", res); if((res = dav1d_get_picture(c, &p)) < 0){ if(res != DAV1D_ERR(EAGAIN)) sysfatal("dav1d_get_picture"); } fprint(2, "dav1d_get_picture: %d\n", res); }while(data.sz > 0 || input_read(dc, &data) == 0); if(data.sz > 0) dav1d_data_unref(&data); /* get more pics here? */ threadexitsall(nil); }