ref: 265d0e6862eca0ac326208f67cfc7ef3682500b3
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"); //print("%d %d %d %d %d\n", fps[0], fps[1], timebase[0], timebase[1], total); if(input_read(dc, &data) < 0) sysfatal("input_read"); do{ fprint(2, "sending\n"); res = dav1d_send_data(c, &data); fprint(2, "sent, res is %d\n", res); if(res < 0 && res != DAV1D_ERR(EAGAIN)) sysfatal("dav1d_send_data: %d", res); fprint(2, "getting a picture\n"); p = calloc(1, sizeof(*p)); if((res = dav1d_get_picture(c, p)) < 0){ if(res != DAV1D_ERR(EAGAIN)) sysfatal("dav1d_get_picture"); } free(p); }while(data.sz > 0 || input_read(dc, &data) == 0); if(data.sz > 0) dav1d_data_unref(&data); /* get more pics here? */ threadexitsall(nil); }