Skip to content
Snippets Groups Projects
Commit f3958649 authored by Martin Pulec's avatar Martin Pulec
Browse files

UltraGrid test: compile both

+ fixed warnings
parent 59eb5587
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
${CXX:-c++} -g ${1+"$@"} -DDEBUG -DWITH_MATH_STUB -DWITH_CLIENT_CUDA -DWITH_CLIENT_CESNET -I../renderengine/src/ -I../../source/blender/blenlib/ -I../../source/blender/makesdna/ ultragrid.cpp platform_ipc.c test.cpp -lcudart
COMMON_FLAGS="-g -Wall -Wextra -DDEBUG -DWITH_MATH_STUB -DWITH_CLIENT_CUDA -DWITH_CLIENT_CESNET -I../renderengine/src/ -I../../source/blender/blenlib/ -I../../source/blender/makesdna/ ultragrid.cpp platform_ipc.c test.cpp -lcudart"
${CXX:-c++} ${1+"$@"} $COMMON_FLAGS -o test_yuv
${CXX:-c++} ${1+"$@"} -DWITH_RGBA_FORMAT $COMMON_FLAGS -o test_rgba
......@@ -8,6 +8,7 @@
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <signal.h>
#include <vector>
......@@ -25,7 +26,11 @@ using std::vector;
bool should_exit = false;
static void signal_handler(int signal) {
char msg[] = "Signal caught... Exiting\n";
char msg[] = "Signal XXX caught... Exiting\n";
char *signum = strstr(msg, "XXX"); // allowed in POSIX.1-2016
signum[0] = '0' + ((signal / 100) % 10);
signum[1] = '0' + ((signal / 10) % 10);
signum[2] = '0' + (signal % 10);
write(2, msg, sizeof msg - 1);
should_exit = true;
}
......
......@@ -325,7 +325,7 @@ void cesnet_set_camera_data(cyclesphi::cyclesphi_data *cdata)
#define FRAME_READY 1
#define SHOULD_EXIT_LOCK 2
static bool initialize_shm(int width, int height, platform_ipc_shm_t *shm_id, struct cesnet_shm **cesnet_shm, platform_ipc_sem_t *sem, bool *post_should_exit)
static bool initialize_shm(platform_ipc_shm_t *shm_id, struct cesnet_shm **cesnet_shm, platform_ipc_sem_t *sem, bool *post_should_exit)
{
*shm_id = PLATFORM_IPC_ERR;
*cesnet_shm = (struct cesnet_shm *)PLATFORM_IPC_ERR;
......@@ -411,6 +411,7 @@ static bool post_should_exit = false;
static platform_ipc_shm_t shm_id = PLATFORM_IPC_ERR;
static platform_ipc_sem_t sem[3] = {PLATFORM_IPC_ERR, PLATFORM_IPC_ERR, PLATFORM_IPC_ERR};
#ifdef WITH_RGBA_FORMAT
static void shm_cleanup() {
#ifdef DEBUG
fprintf(stderr, "shm_cleanup() called\n");
......@@ -419,12 +420,11 @@ static void shm_cleanup() {
}
static bool shm_cleanup_registered_atexit = false;
#ifdef WITH_RGBA_FORMAT
static char scratch_buffer[MAX_BUF_LEN];
char* shared_pixels_buffer_rgba8888 = scratch_buffer;
// rendering buffer - results in RGBA format
void cesnet_set_render_buffer_rgba(unsigned char *rgba, int width, int height)
void cesnet_set_render_buffer_rgba(unsigned char * /* rgba */, int width, int height)
{
// printf("cesnet_set_render_buffer_rgba: %d %d %d %d\n", rgba[0], rgba[1], rgba[2], rgba[4]);
......@@ -438,7 +438,7 @@ void cesnet_set_render_buffer_rgba(unsigned char *rgba, int width, int height)
}
if (cesnet_shm == (struct cesnet_shm *) PLATFORM_IPC_ERR) {
if (!initialize_shm(width, height, &shm_id, &cesnet_shm, sem, &post_should_exit)) {
if (!initialize_shm(&shm_id, &cesnet_shm, sem, &post_should_exit)) {
done_shm(&shm_id, &cesnet_shm, sem, &post_should_exit);
return;
}
......@@ -615,7 +615,7 @@ void cesnet_set_render_buffer_yuv_i420(
cudaSetDevice(0);
# endif
if (!initialize_shm(width, height, &shm_id, &cesnet_shm, sem, &post_should_exit)) {
if (!initialize_shm(&shm_id, &cesnet_shm, sem, &post_should_exit)) {
done_shm(&shm_id, &cesnet_shm, sem, &post_should_exit);
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment