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
This commit is contained in:
helixhorned 2012-11-03 19:32:45 +00:00
parent ed0e73c84a
commit c9558d5ab4

View file

@ -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.
*/