Skip to content

Commit 4c40a0a

Browse files
committed
display/sdl1: Use generic FPS indicator
1 parent c25f0cc commit 4c40a0a

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

src/video_display/sdl.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @author Martin Pulec <pulec@cesnet.cz>
66
*/
77
/*
8-
* Copyright (c) 2010-2025 CESNET
8+
* Copyright (c) 2010-2026 CESNET, zájmové sdružení právnických osob
99
* All rights reserved.
1010
*
1111
* Redistribution and use in source and binary forms, with or without
@@ -74,6 +74,7 @@ extern "C" void NSApplicationLoad();
7474
#define FOURCC_YUYV 0x32595559
7575

7676
#define MAX_BUFFER_SIZE 1
77+
#define MOD_NAME "[SDL] "
7778

7879
using namespace std;
7980

@@ -82,7 +83,6 @@ using namespace std;
8283
struct state_sdl {
8384
uint32_t magic;
8485

85-
struct timeval tv;
8686
int frames;
8787

8888
SDL_Overlay * yuv_image;
@@ -125,7 +125,6 @@ struct state_sdl {
125125
#endif
126126
sdl_flags_win(0), sdl_flags_fs(0)
127127
{
128-
gettimeofday(&tv, NULL);
129128
module_init_default(&mod);
130129
mod.cls = MODULE_CLASS_DATA;
131130
module_register(&mod, parent);
@@ -217,8 +216,6 @@ static bool update_size(struct state_sdl *s, int win_w, int win_h)
217216

218217
static void display_frame(struct state_sdl *s, struct video_frame *frame)
219218
{
220-
struct timeval tv;
221-
222219
if (s->deinterlace) {
223220
vc_deinterlace((unsigned char *) frame->tiles[0].data,
224221
vc_get_linesize(frame->tiles[0].width,
@@ -285,17 +282,6 @@ static void display_frame(struct state_sdl *s, struct video_frame *frame)
285282
s->lock.lock();
286283
s->free_frame_queue.push(frame);
287284
s->lock.unlock();
288-
289-
s->frames++;
290-
gettimeofday(&tv, NULL);
291-
double seconds = tv_diff(tv, s->tv);
292-
if (seconds > 5) {
293-
double fps = s->frames / seconds;
294-
log_msg(LOG_LEVEL_INFO, "[SDL] %d frames in %g seconds = %g FPS\n",
295-
s->frames, seconds, fps);
296-
s->tv = tv;
297-
s->frames = 0;
298-
}
299285
}
300286

301287
static void display_sdl_run(void *arg)
@@ -784,7 +770,7 @@ static const struct video_display_info display_sdl_info = {
784770
display_sdl_get_property,
785771
display_sdl_put_audio_frame,
786772
display_sdl_reconfigure_audio,
787-
DISPLAY_NO_GENERIC_FPS_INDICATOR,
773+
MOD_NAME,
788774
};
789775

790776
REGISTER_MODULE(sdl, &display_sdl_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION);

0 commit comments

Comments
 (0)