Skip to content

Commit abd7582

Browse files
committed
debug: move some stuff to utils/debug
The rationale is to separate the config.h-dependent stuff to a separate file to eliminate the need to transitively include config.h. + fix the files that need config.h directly to include it
1 parent cac114d commit abd7582

File tree

20 files changed

+102
-19
lines changed

20 files changed

+102
-19
lines changed

src/audio/audio.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#include "audio/playback/sdi.h"
7171
#include "audio/resampler.hpp"
7272
#include "audio/utils.h"
73+
#include "config.h" // for HAVE_SPEEXDSP
7374
#include "debug.h"
7475
#include "host.h"
7576
#include "module.h"

src/audio/playback/jack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "audio/audio_playback.h"
4444
#include "audio/types.h"
4545
#include "audio/utils.h"
46+
#include "config.h" // for PACKAGE_NAME
4647
#include "debug.h"
4748
#include "host.h"
4849
#include "jack_common.h"

src/blackmagic_common.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include "host.h"
6666
#include "tv.h"
6767
#include "utils/color_out.h"
68+
#include "utils/debug.h" // for DEBUG_TIMER_*
6869
#include "utils/macros.h"
6970
#include "utils/windows.h"
7071
#include "utils/worker.h"

src/capture_filter/resize_utils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "capture_filter/resize_utils.h"
6565
#include "debug.h"
6666
#include "utils/color_out.h"
67+
#include "utils/debug.h" // for DEBUG_TIMER_*
6768
#include "video.h"
6869

6970
#define DEFAULT_ALGO INTER_LINEAR

src/debug.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
* SUCH DAMAGE.
4040
*/
4141

42+
#include "debug.h"
43+
#include "utils/debug.h"
44+
4245
#ifdef HAVE_CONFIG_H
4346
#include "config.h"
4447
#endif // defined HAVE_CONFIG_H
@@ -52,7 +55,6 @@
5255
#include <string_view>
5356
#include <unordered_map>
5457

55-
#include "debug.h"
5658
#include "host.h"
5759
#include "utils/color_out.h"
5860
#include "utils/string_view_utils.hpp"

src/debug.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
#include <stdio.h> // FILE
4848
#endif // defined __cplusplus
4949

50-
#ifdef HAVE_CONFIG_H
51-
#include "config.h" // DEBUG
52-
#endif // defined HAVE_CONFIG_H
5350
#include "tv.h"
5451

5552
#define UNUSED(x) (x=x)
@@ -80,11 +77,6 @@ extern "C" {
8077
#endif
8178

8279
void debug_dump(const void*lp, int len);
83-
#ifdef DEBUG
84-
void debug_file_dump(const char *key, void (*serialize)(const void *data, FILE *), void *data);
85-
#else
86-
#define debug_file_dump(key, serialize, data) (void) (key), (void) (serialize), (void) (data)
87-
#endif
8880

8981
#define error_msg(...) log_msg(LOG_LEVEL_ERROR, __VA_ARGS__)
9082
#define verbose_msg(...) log_msg(LOG_LEVEL_VERBOSE, __VA_ARGS__)
@@ -323,13 +315,4 @@ if ((level) <= log_level) Logger(level).Get()
323315

324316
#endif
325317

326-
#ifdef DEBUG
327-
#define DEBUG_TIMER_EVENT(name) time_ns_t name = get_time_in_ns()
328-
#define DEBUG_TIMER_START(name) DEBUG_TIMER_EVENT(name##_start);
329-
#define DEBUG_TIMER_STOP(name) DEBUG_TIMER_EVENT(name##_stop); log_msg(LOG_LEVEL_DEBUG2, "%s duration: %lf s\n", #name, (name##_stop - name##_start) / NS_IN_SEC_DBL) // NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg)
330-
#else
331-
#define DEBUG_TIMER_START(name)
332-
#define DEBUG_TIMER_STOP(name)
333-
#endif
334-
335318
#endif

src/hwaccel_vdpau.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#ifndef HWACCEL_VDPAU_H
4646
#define HWACCEL_VDPAU_H
4747

48+
#include "config.h" // for HWACC_VDPAU
49+
4850
#ifdef HWACC_VDPAU
4951

5052
#include "hwaccel_libav_common.h"

src/libavcodec/from_lavc_vid_conv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
#include "color.h"
5757
#include "compat/qsort_s.h"
58+
#include "config.h" // for HWACC_VDPAU
5859
#include "debug.h"
5960
#include "host.h"
6061
#include "hwaccel_vdpau.h"
@@ -64,6 +65,7 @@
6465
#include "libavcodec/lavc_common.h"
6566
#include "pixfmt_conv.h"
6667
#include "types.h"
68+
#include "utils/debug.h" // for DEBUG_TIMER_*
6769
#include "utils/macros.h" // OPTIMIZED_FOR
6870
#include "utils/misc.h" // get_cpu_core_count
6971
#include "utils/worker.h" // task_run_parallel

src/libavcodec/lavc_video.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* Some conversions to RGBA ignore RGB-shifts - either fix that or deprecate RGB-shifts
4545
*/
4646

47+
#include "config.h" // for HAVE_SWSCALE
4748
#include "debug.h"
4849
#include "lib_common.h"
4950
#include "libavcodec/lavc_common.h"

src/libavcodec/lavc_video.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <stdio.h>
4545
#endif
4646

47+
#include "config.h" // for HAVE_SWSCALE
4748
#include "libavcodec/lavc_common.h"
4849

4950
#ifdef __cplusplus

0 commit comments

Comments
 (0)