[FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

jon morley jon at tweaksoftware.com
Fri Jan 23 17:03:05 CET 2015


Currently check_fps has the following logic:

static int check_fps(int fps)
{
     int i;
     static const int supported_fps[] = {24, 25, 30, 48, 50, 60};

     for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++)
         if (fps == supported_fps[i])
             return 0;
     return -1;
}

I am starting to see more and more movies with fps rates in excess of 
this list from modified GoPro files and other raw camera sources.

I was originally adding more entries as the sources came rolling in 
because I could not see any issue in how this was getting called later 
with that approach.

I still don't see the drawback of adding more, but I am tired of adding 
a new rate every time I encounter one in the wild. I was curious if it 
wouldn't make more sense to change the logic to the following:

static int check_fps(int fps)
{
     int i;
     static const int supported_fps_bases[] = {24, 25, 30};

     for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
         if (fps % supported_fps_bases[i] == 0)
             return 0;
     return -1;
}

If that makes sense to you, then I will submit a patch. Please let me 
know if I have overlooked some other usage/meaning of check_fps that I 
am overlooking.

Thanks,
Jon


More information about the ffmpeg-devel mailing list