33 * @author Martin Piatka <piatka@cesnet.cz>
44 */
55/*
6- * Copyright (c) 2010-2023 CESNET, z. s. p. o.
6+ * Copyright (c) 2010-2026 CESNET, zájmové sdružení právnických osob
77 * All rights reserved.
88 *
99 * Redistribution and use in source and binary forms, with or without
4949#include " module.h"
5050#include " video.h"
5151#include " video_display.h"
52- #include " video_display/splashscreen.h"
5352
5453#include " opengl_utils.hpp"
5554#include " opengl_panorama.hpp"
@@ -65,11 +64,11 @@ struct state_vr{
6564 bool running = false ;
6665 bool fs = false ;
6766
68- unsigned sdl_frame_event;
69- unsigned sdl_redraw_event;
67+ unsigned sdl_frame_event{} ;
68+ unsigned sdl_redraw_event{} ;
7069
71- video_desc current_desc;
72- int buffered_frames_count;
70+ video_desc current_desc{} ;
71+ int buffered_frames_count{} ;
7372
7473 PanoramaScene scene;
7574
@@ -85,11 +84,8 @@ struct state_vr{
8584 std::queue<video_frame *> free_frame_queue;
8685};
8786
88- static void * display_panogl_init (struct module *parent, const char *fmt, unsigned int flags) {
89- UNUSED (parent);
90- UNUSED (fmt);
91- UNUSED (flags);
92- state_vr *s = new state_vr ();
87+ static void * display_panogl_init (module */*parent*/, const char */*fmt*/, unsigned int /*flags*/) {
88+ auto *s = new state_vr();
9389 s->sdl_frame_event = SDL_RegisterEvents(1 );
9490 s->sdl_redraw_event = SDL_RegisterEvents(1 );
9591
@@ -182,7 +178,7 @@ static void handle_user_event(state_vr *s, SDL_Event *event){
182178 lk.unlock ();
183179 s->frame_consumed_cv .notify_one ();
184180
185- video_frame *frame = static_cast <video_frame *>(event->user .data1 );
181+ auto *frame = static_cast <video_frame *>(event->user .data1 );
186182
187183 if (frame){
188184 s->scene .put_frame (frame);
@@ -209,7 +205,7 @@ static void handle_user_event(state_vr *s, SDL_Event *event){
209205}
210206
211207static void display_panogl_run (void *state) {
212- state_vr *s = static_cast <state_vr *>(state);
208+ auto *s = static_cast <state_vr *>(state);
213209
214210 draw (s);
215211
@@ -251,18 +247,18 @@ static void display_panogl_run(void *state) {
251247}
252248
253249static void display_panogl_done (void *state) {
254- state_vr *s = static_cast <state_vr *>(state);
250+ auto *s = static_cast <state_vr *>(state);
255251
256252 delete s;
257253}
258254
259255static struct video_frame * display_panogl_getf (void *state) {
260- struct state_vr *s = static_cast <state_vr *>(state);
256+ auto *s = static_cast <state_vr *>(state);
261257
262258 std::lock_guard<std::mutex> lock (s->lock );
263259
264- while (s->free_frame_queue .size () > 0 ) {
265- struct video_frame *buffer = s->free_frame_queue .front ();
260+ while (! s->free_frame_queue .empty () ) {
261+ video_frame *buffer = s->free_frame_queue .front ();
266262 s->free_frame_queue .pop ();
267263 if (video_desc_eq (video_desc_from_frame (buffer), s->current_desc )) {
268264 return buffer;
@@ -276,7 +272,7 @@ static struct video_frame * display_panogl_getf(void *state) {
276272
277273static bool display_panogl_putf (void *state, struct video_frame *frame, long long nonblock) {
278274 PROFILE_FUNC;
279- struct state_vr *s = static_cast <state_vr *>(state);
275+ auto *s = static_cast <state_vr *>(state);
280276
281277 if (nonblock == PUTF_DISCARD) {
282278 vf_free (frame);
@@ -285,7 +281,7 @@ static bool display_panogl_putf(void *state, struct video_frame *frame, long lon
285281
286282 std::unique_lock<std::mutex> lk (s->lock );
287283 if (s->buffered_frames_count >= MAX_BUFFER_SIZE && nonblock != PUTF_BLOCKING
288- && frame != NULL ) {
284+ && frame != nullptr ) {
289285 vf_free (frame);
290286 printf (" 1 frame(s) dropped!\n " );
291287 return false ;
@@ -303,15 +299,15 @@ static bool display_panogl_putf(void *state, struct video_frame *frame, long lon
303299}
304300
305301static bool display_panogl_reconfigure (void *state, struct video_desc desc) {
306- state_vr *s = static_cast <state_vr *>(state);
302+ auto *s = static_cast <state_vr *>(state);
307303
308304 s->current_desc = desc;
309305 return true ;
310306}
311307
312308static bool display_panogl_get_property (void *state, int property, void *val, size_t *len) {
313- struct state_vr *s = static_cast <state_vr *>(state);
314- enum interlacing_t supported_il_modes[] = {PROGRESSIVE};
309+ auto *s = static_cast <state_vr *>(state);
310+ interlacing_t supported_il_modes[] = {PROGRESSIVE};
315311 int rgb_shift[] = {0 , 8 , 16 };
316312
317313 switch (property) {
@@ -355,7 +351,7 @@ static bool display_panogl_get_property(void *state, int property, void *val, si
355351static void display_panogl_probe (struct device_info **available_cards, int *count, void (**deleter)(void *)) {
356352 UNUSED (deleter);
357353 *count = 1 ;
358- *available_cards = ( struct device_info *) calloc (1 , sizeof (struct device_info ));
354+ *available_cards = static_cast < device_info *>( calloc (1 , sizeof (device_info) ));
359355 strcpy ((*available_cards)[0 ].dev , " " );
360356 strcpy ((*available_cards)[0 ].name , " Panorama Gl SW display" );
361357 (*available_cards)[0 ].repeatable = true ;
@@ -370,8 +366,8 @@ static const struct video_display_info display_panogl_info = {
370366 display_panogl_putf,
371367 display_panogl_reconfigure,
372368 display_panogl_get_property,
373- NULL ,
374- NULL ,
369+ nullptr ,
370+ nullptr ,
375371 MOD_NAME,
376372};
377373
0 commit comments