From c9558d5ab45b0fda3ae8de25e09bc5c3fa423bc8 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 3 Nov 2012 19:32:45 +0000 Subject: [PATCH] VPX: print determined frame rate to the log. Currently, the FPS determination is based on libvpx's vpxdec.c code, which uses the FPS provided in the IVF file in one case, and simply sets it to 30 FPS in the other. For the first case, a "correction" is carried out for something which the comments suggest to originate from other (old?) VPX encoder versions. git-svn-id: https://svn.eduke32.com/eduke32@3110 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/animvpx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/animvpx.c b/polymer/eduke32/source/animvpx.c index 836d17394..c3583115f 100644 --- a/polymer/eduke32/source/animvpx.c +++ b/polymer/eduke32/source/animvpx.c @@ -53,7 +53,7 @@ int32_t animvpx_read_ivf_header(int32_t inhandle, animvpx_ivf_header_t *hdr) hdr->numframes = B_LITTLE32(hdr->numframes); - // the rest is snatched from vpxdec.c (except 0 check for fps) + // the rest is based on vpxdec.c --> file_is_ivf() /* Some versions of vpxenc used 1/(2*fps) for the timebase, so * we can guess the framerate using only the timebase in this @@ -72,9 +72,17 @@ int32_t animvpx_read_ivf_header(int32_t inhandle, animvpx_ivf_header_t *hdr) if (hdr->fpsdenom==0 || hdr->fpsnumer==0) return 5; // "invalid framerate numerator or denominator" + + initprintf("animvpx: rate is %d frames / %d seconds (%.03f fps) after 1/(2*fps) correction.\n", + hdr->fpsnumer, hdr->fpsdenom, (double)hdr->fpsnumer/hdr->fpsdenom); } else { + double fps = (hdr->fpsdenom==0) ? 0.0 : hdr->fpsnumer/hdr->fpsdenom; + + initprintf("animvpx: set rate to 30 fps (header says %d frames / %d seconds = %.03f fps).\n", + hdr->fpsnumer, hdr->fpsdenom, fps); + /* Don't know FPS for sure, and don't have readahead code * (yet?), so just default to 30fps. */