Skip to content

Commit 4e35a37

Browse files
authored
Update video_processor_v4l2.c replaced/fixed list_resolutions function with code from pstef
1 parent 2ab3087 commit 4e35a37

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

cores/libretro-video-processor/video_processor_v4l2.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ struct v4l2_resolution v4l2_resolutions[] =
9191
{1440,1050},
9292
{1440,1080},
9393
{1600,1200},
94+
{1920,1440},
9495
//16:9
9596
{640,360},
9697
{960,540},
@@ -328,18 +329,11 @@ static void enumerate_audio_devices(char *s, size_t len)
328329

329330
static void list_resolutions(char *capture_resolutions, size_t len)
330331
{
331-
memset(capture_resolutions, 0, len);
332-
char resolution[len];
333-
appendstr(capture_resolutions, "Capture resolution; ", len);
334-
for(int i =0; i < sizeof(v4l2_resolutions)/sizeof(v4l2_resolutions[0]) ;i++)
335-
{
336-
snprintf(resolution, 1024 * sizeof(char), "%dx%d",v4l2_resolutions[i].width,v4l2_resolutions[i].height);
337-
338-
if(i > 0)
339-
appendstr(capture_resolutions, "|", len);
340-
appendstr(capture_resolutions, resolution, len);
341-
342-
}
332+
size_t i, written;
333+
written = snprintf(capture_resolutions, len, "Capture resolution; ");
334+
for (i = 0; i < sizeof(v4l2_resolutions) / sizeof(v4l2_resolutions[0]); i++)
335+
written += snprintf(capture_resolutions + written, len - written, "%s%dx%d", i > 0 ? "|" : "",
336+
v4l2_resolutions[i].width,v4l2_resolutions[i].height);
343337
}
344338
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
345339
{

0 commit comments

Comments
 (0)