Skip to content

Commit

Permalink
spout cap.: improvements
Browse files Browse the repository at this point in the history
- removed inclusion of config*.h

- use Sleep instead of usleep

- subsequent improves in gl_common.h (removed config*.h)
  • Loading branch information
MartinPulec committed Nov 8, 2023
1 parent 1867c0c commit 687bcfb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
14 changes: 4 additions & 10 deletions src/gl_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Martin Pulec <[email protected]>
*/
/*
* Copyright (c) 2012-2013 CESNET, z. s. p. o.
* Copyright (c) 2012-2023 CESNET, z. s. p. o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -38,27 +38,21 @@
#ifndef _GL_CONTEXT_H_
#define _GL_CONTEXT_H_

#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config_win32.h"
#include "config_unix.h"
#endif // HAVE_CONFIG_H

#if defined HAVE_LINUX || defined WIN32
#if defined __linux__ || defined _WIN32
#include <GL/glew.h>
#else
#include <OpenGL/GL.h>
#endif /* HAVE_LINUX */

#ifdef HAVE_MACOSX
#ifdef __APPLE__
#include <Availability.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

#if defined HAVE_MACOSX && ! defined __MAC_10_8
#if defined __APPLE__ && ! defined __MAC_10_8
#define glGenFramebuffers glGenFramebuffersEXT
#define glBindFramebuffer glBindFramebufferEXT
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
Expand Down
14 changes: 5 additions & 9 deletions src/video_capture/spout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,18 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config_unix.h"
#include "config_win32.h"
#endif

#include "gl_context.h" // it looks like it needs to be included prior to Spout.h

#include <array>
#include <cctype>
#include <chrono>
#include <iostream>
#include <memory>
#include <SpoutLibrary.h>
#include <synchapi.h>
#include <string>

#include "debug.h"
#include "gl_context.h"
#include "host.h"
#include "lib_common.h"
#include "spout_sender.h" // spout_set_log_level
Expand Down Expand Up @@ -214,7 +210,7 @@ static void vidcap_spout_done(void *state)
static struct video_frame *vidcap_spout_grab(void *state, struct audio_frame **audio)
{
enum {
MS100_IN_US = 100 * 1000,
MS100 = 100,
};
state_vidcap_spout *s = (state_vidcap_spout *) state;

Expand All @@ -227,7 +223,7 @@ static struct video_frame *vidcap_spout_grab(void *state, struct audio_frame **a
vf_free(out);
gl_context_make_current(NULL);
MSG(WARNING, "No signal detected...\n");
usleep(MS100_IN_US);
Sleep(MS100);
return NULL;
}
if (s->spout_state->IsUpdated()) {
Expand Down

0 comments on commit 687bcfb

Please sign in to comment.