Skip to content

Commit d15d4c6

Browse files
committed
Display: honor preciseRefreshRate in custom format
Fix #1211
1 parent 788cad3 commit d15d4c6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/modules/display/display.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,21 @@ void ffPrintDisplay(FFDisplayOptions* options)
140140
{
141141
double ppi = sqrt(result->width * result->width + result->height * result->height) / inch;
142142

143+
char refreshRate[16];
144+
if(result->refreshRate > 0)
145+
{
146+
if(options->preciseRefreshRate)
147+
snprintf(refreshRate, sizeof(refreshRate), "%g", ((int) (result->refreshRate * 1000 + 0.5)) / 1000.0);
148+
else
149+
snprintf(refreshRate, sizeof(refreshRate), "%i", (uint32_t) (result->refreshRate + 0.5));
150+
}
151+
else
152+
refreshRate[0] = 0;
153+
143154
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISPLAY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
144155
{FF_FORMAT_ARG_TYPE_UINT, &result->width, "width"},
145156
{FF_FORMAT_ARG_TYPE_UINT, &result->height, "height"},
146-
{FF_FORMAT_ARG_TYPE_DOUBLE, &result->refreshRate, "refresh-rate"},
157+
{FF_FORMAT_ARG_TYPE_STRING, refreshRate, "refresh-rate"},
147158
{FF_FORMAT_ARG_TYPE_UINT, &result->scaledWidth, "scaled-width"},
148159
{FF_FORMAT_ARG_TYPE_UINT, &result->scaledHeight, "scaled-height"},
149160
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"},

0 commit comments

Comments
 (0)