From 33256f2ff251f0a69d15d60fd14adc9740f667e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 7 Nov 2021 17:09:00 +0100 Subject: [PATCH] cleanup c files. --- server/internal/gst/gst.c | 11 ------ server/internal/gst/gst.go | 1 - server/internal/gst/gst.h | 10 +---- server/internal/xorg/xorg.h | 75 +++++++++++++++++-------------------- 4 files changed, 36 insertions(+), 61 deletions(-) diff --git a/server/internal/gst/gst.c b/server/internal/gst/gst.c index 0c4c4ff3..78bfa9ee 100644 --- a/server/internal/gst/gst.c +++ b/server/internal/gst/gst.c @@ -1,7 +1,5 @@ #include "gst.h" -#include - typedef struct SampleHandlerUserData { int pipelineId; } SampleHandlerUserData; @@ -10,13 +8,6 @@ void gstreamer_init(void) { gst_init(NULL, NULL); } -GMainLoop *gstreamer_send_main_loop = NULL; -void gstreamer_send_start_mainloop(void) { - gstreamer_send_main_loop = g_main_loop_new(NULL, FALSE); - - g_main_loop_run(gstreamer_send_main_loop); -} - static gboolean gstreamer_send_bus_call(GstBus *bus, GstMessage *msg, gpointer data) { switch (GST_MESSAGE_TYPE(msg)) { @@ -90,5 +81,3 @@ void gstreamer_send_play_pipeline(GstElement *pipeline) { void gstreamer_send_stop_pipeline(GstElement *pipeline) { gst_element_set_state(pipeline, GST_STATE_NULL); } - - diff --git a/server/internal/gst/gst.go b/server/internal/gst/gst.go index ea5551d6..30b76eea 100644 --- a/server/internal/gst/gst.go +++ b/server/internal/gst/gst.go @@ -4,7 +4,6 @@ package gst #cgo pkg-config: gstreamer-1.0 gstreamer-app-1.0 #include "gst.h" - */ import "C" import ( diff --git a/server/internal/gst/gst.h b/server/internal/gst/gst.h index b07f3e8e..9b19ed29 100644 --- a/server/internal/gst/gst.h +++ b/server/internal/gst/gst.h @@ -1,10 +1,7 @@ -#ifndef GST_H -#define GST_H +#pragma once -#include #include -#include -#include +#include extern void goHandlePipelineBuffer(void *buffer, int bufferLen, int samples, int pipelineId); @@ -13,7 +10,4 @@ GstElement *gstreamer_send_create_pipeline(char *pipeline, GError **error); void gstreamer_send_start_pipeline(GstElement *pipeline, int pipelineId); void gstreamer_send_play_pipeline(GstElement *pipeline); void gstreamer_send_stop_pipeline(GstElement *pipeline); -void gstreamer_send_start_mainloop(void); void gstreamer_init(void); - -#endif diff --git a/server/internal/xorg/xorg.h b/server/internal/xorg/xorg.h index bdef5a5b..b4078adc 100644 --- a/server/internal/xorg/xorg.h +++ b/server/internal/xorg/xorg.h @@ -1,51 +1,44 @@ #pragma once -#ifndef XDISPLAY_H - #define XDISPLAY_H +#include +#include +#include +#include +#include /* For free() */ +#include /* For fputs() */ +#include /* For strdup() */ - #include - #include - #include - #include - #include - #include - #include - #include /* For fputs() */ - #include /* For strdup() */ +extern void goCreateScreenSize(int index, int width, int height, int mwidth, int mheight); +extern void goSetScreenRates(int index, int rate_index, short rate); - extern void goCreateScreenSize(int index, int width, int height, int mwidth, int mheight); - extern void goSetScreenRates(int index, int rate_index, short rate); +typedef struct xkeys_t { + KeySym keysym; + KeyCode keycode; + struct xkeys_t *next; +} xkeys_t; - typedef struct xkeys_t { - KeySym keysym; - KeyCode keycode; - struct xkeys_t *next; - } xkeys_t; +/* Returns the main display, closed either on exit or when closeMainDisplay() +* is invoked. This removes a bit of the overhead of calling XOpenDisplay() & +* XCloseDisplay() everytime the main display needs to be used. +* +* Note that this is almost certainly not thread safe. */ +Display *getXDisplay(void); +clipboard_c *getClipboard(void); - /* Returns the main display, closed either on exit or when closeMainDisplay() - * is invoked. This removes a bit of the overhead of calling XOpenDisplay() & - * XCloseDisplay() everytime the main display needs to be used. - * - * Note that this is almost certainly not thread safe. */ - Display *getXDisplay(void); - clipboard_c *getClipboard(void); +void XMove(int x, int y); +void XScroll(int x, int y); +void XButton(unsigned int button, int down); +void XKey(unsigned long key, int down); - void XMove(int x, int y); - void XScroll(int x, int y); - void XButton(unsigned int button, int down); - void XKey(unsigned long key, int down); +void XClipboardSet(char *src); +char *XClipboardGet(); - void XClipboardSet(char *src); - char *XClipboardGet(); +void XGetScreenConfigurations(); +void XSetScreenConfiguration(int index, short rate); +int XGetScreenSize(); +short XGetScreenRate(); - void XGetScreenConfigurations(); - void XSetScreenConfiguration(int index, short rate); - int XGetScreenSize(); - short XGetScreenRate(); - - void XDisplayClose(void); - void XDisplaySet(char *input); - - void SetKeyboardModifiers(int num_lock, int caps_lock, int scroll_lock); -#endif +void XDisplayClose(void); +void XDisplaySet(char *input); +void SetKeyboardModifiers(int num_lock, int caps_lock, int scroll_lock);