Skip to content

Commit

Permalink
jack sources: fixed includes+year, enum
Browse files Browse the repository at this point in the history
- removed config*.h (not needed)
- moved system headers prior user-defined
- fixed copyright year to 2024
- replaced numeric macros with enum (cppcoreguidelines-macro-to-enum)
  • Loading branch information
MartinPulec committed Feb 7, 2024
1 parent 408febd commit 1cb9d0a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 36 deletions.
23 changes: 10 additions & 13 deletions src/audio/capture/jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Martin Pulec <[email protected]>
*/
/*
* Copyright (c) 2012-2023 CESNET z.s.p.o.
* Copyright (c) 2012-2024 CESNET z.s.p.o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -35,11 +35,10 @@
* 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 <jack/jack.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "audio/audio_capture.h"
#include "audio/types.h"
Expand All @@ -49,17 +48,15 @@
#include "host.h"
#include "jack_common.h"
#include "lib_common.h"
#include "utils/ring_buffer.h"
#include "utils/macros.h"
#include "utils/ring_buffer.h"

#include <jack/jack.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_PORTS 64
#define MOD_NAME "[JACK capture] "

enum {
MAX_PORTS = 64,
};

static int jack_samplerate_changed_callback(jack_nframes_t nframes, void *arg);
static int jack_process_callback(jack_nframes_t nframes, void *arg);

Expand Down
10 changes: 2 additions & 8 deletions src/audio/jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Martin Pulec <[email protected]>
*/
/*
* Copyright (c) 2011-2021 CESNET, z. s. p. o.
* Copyright (c) 2011-2024 CESNET, z. s. p. o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -40,12 +40,6 @@
* It looks like there is no jack_stop()?
*/

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

#include <jack/jack.h>
#include <limits.h>
#include <stdio.h>
Expand All @@ -56,8 +50,8 @@
#include "audio/types.h"
#include "jack_common.h"
#include "pthread.h"
#include "rtp/rtp.h"
#include "rtp/pbuf.h"
#include "rtp/rtp.h"

#define CLIENT_NAME "UltraGrid Transport"
#define BUFF_ELEM (1<<16)
Expand Down
27 changes: 12 additions & 15 deletions src/audio/playback/jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Martin Pulec <[email protected]>
*/
/*
* Copyright (c) 2012-2023 CESNET z.s.p.o.
* Copyright (c) 2012-2024 CESNET z.s.p.o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -35,33 +35,30 @@
* 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 <jack/jack.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "audio/audio_playback.h"
#include "audio/types.h"
#include "audio/utils.h"
#include "debug.h"
#include "host.h"
#include "jack_common.h"
#include "lib_common.h"
#include "utils/audio_buffer.h"
#include "utils/macros.h"
#include "utils/ring_buffer.h"
#include "jack_common.h"

#include <jack/jack.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define DEFAULT_AUDIO_BUF_LEN_MS 50
#define MAX_LEN_MS 1000
#define MAX_PORTS 64
#define MOD_NAME "[JACK playback] "

enum {
DEFAULT_AUDIO_BUF_LEN_MS = 50,
MAX_LEN_MS = 1000,
MAX_PORTS = 64,
};

struct state_jack_playback {
struct libjack_connection *libjack;

Expand Down
4 changes: 4 additions & 0 deletions src/jack_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
#define JACK_COMMON_H

#ifdef __cplusplus
#include <cassert>
#include <cerrno>
#include <cstring>
#else
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
#endif // ! defined __cplusplus
Expand Down

0 comments on commit 1cb9d0a

Please sign in to comment.