Skip to content

Commit 0f47917

Browse files
committed
testcard: fixed mode/size=4k
Since 6154417 (2024-10-10), _4k_ (and similar) modes were not accepted because lacking FPS specification, which was unintended change in that commit.
1 parent 200b420 commit 0f47917

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/video.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,24 @@ const char *video_desc_to_string(struct video_desc d)
245245
return desc_str.c_str();
246246
}
247247

248+
/**
249+
* @retval 0.0 FPS not specified
250+
* @retval <0.0 wrong FPS specification
251+
*/
248252
static double
249253
parse_fps(const char *string, bool interlaced)
250254
{
251255
const char *fps_str = strpbrk(string, "DKdikp");
252256
assert(fps_str != nullptr);
253257
fps_str += 1;
258+
if (strlen(fps_str) == 0) {
259+
return 0.0;
260+
}
254261
char *endptr = nullptr;
255262
const long fps_l = strtol(fps_str, &endptr, 10);
256263
if (fps_l <= 0 || fps_l > FPS_MAX || *endptr != '\0') {
257-
MSG(ERROR, "Wrong mode specification: %s\n", string);
258-
return 0.0;
264+
MSG(ERROR, "Wrong mode FPS specification: %s\n", string);
265+
return -1;
259266
}
260267
double fps = 0;
261268
// adjust FPS (Hi29 has FPS 29.97)
@@ -355,7 +362,7 @@ struct video_desc get_video_desc_from_string(const char *string)
355362
return {};
356363
}
357364
ret.fps = parse_fps(string, ret.interlacing == INTERLACED_MERGED);
358-
if (ret.fps == 0.0) {
365+
if (ret.fps < .0) {
359366
return {};
360367
}
361368

0 commit comments

Comments
 (0)