Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

remove ebur128 dependency of libinputaudio

  • Loading branch information...
commit c1260149e2fdaa58aa6646d56010e3ea01db914c 1 parent b36a226
jiixyj authored
5 CMakeLists.txt
@@ -54,9 +54,7 @@ endif()
54 54 if(RSVG2_FOUND)
55 55 include_directories(SYSTEM ${RSVG2_INCLUDE_DIRS})
56 56 endif()
57   -if(SPEEXDSP_FOUND)
58   -include_directories(SYSTEM ${SPEEXDSP_INCLUDE_DIRS})
59   -else()
  57 +if(NOT SPEEXDSP_FOUND)
60 58 add_definitions(-DEBUR128_USE_SPEEX_RESAMPLER=0)
61 59 endif()
62 60 if(FFMPEG_FOUND)
@@ -136,7 +134,6 @@ else()
136 134 endif()
137 135
138 136
139   -set(EBUR128_LINK_AGAINST_SCANNER TRUE)
140 137 add_subdirectory(libebur128)
141 138 add_subdirectory(libinputaudio)
142 139 if(GLIB_FOUND)
8 libebur128/CMakeLists.txt
... ... @@ -1,16 +1,16 @@
1 1 cmake_minimum_required(VERSION 2.6.4)
2 2
3 3 include_directories(queue)
  4 +if(SPEEXDSP_FOUND)
  5 + include_directories(SYSTEM ${SPEEXDSP_INCLUDE_DIRS})
  6 +endif()
4 7
5 8 add_library(ebur128 ebur128.c)
  9 +
6 10 if(SPEEXDSP_FOUND)
7 11 target_link_libraries(ebur128 ${SPEEXDSP_LIBRARIES})
8 12 endif()
9 13
10   -if(EBUR128_LINK_AGAINST_SCANNER)
11   - set_target_properties(ebur128 PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
12   -endif()
13   -
14 14 if(NOT WIN32)
15 15 target_link_libraries(ebur128 m)
16 16 endif()
6 libinputaudio/CMakeLists.txt
@@ -18,7 +18,7 @@ if(GLIB_FOUND)
18 18
19 19 if(SNDFILE_FOUND)
20 20 add_library(input_sndfile MODULE input_sndfile.c)
21   - target_link_libraries(input_sndfile ebur128 ${SNDFILE_LIBRARIES} ${INPUT_HELPERS})
  21 + target_link_libraries(input_sndfile ${SNDFILE_LIBRARIES} ${INPUT_HELPERS})
22 22 endif()
23 23
24 24 if(MPG123_FOUND)
@@ -33,7 +33,7 @@ if(GLIB_FOUND)
33 33
34 34 if(FFMPEG_FOUND)
35 35 add_library(input_ffmpeg MODULE input_ffmpeg.c)
36   - target_link_libraries(input_ffmpeg ebur128 ${FFMPEG_LIBRARIES} ${GLIB_LIBRARIES})
  36 + target_link_libraries(input_ffmpeg ${FFMPEG_LIBRARIES} ${GLIB_LIBRARIES})
37 37 endif()
38 38
39 39 if(GSTREAMER_FOUND)
@@ -43,7 +43,7 @@ if(GLIB_FOUND)
43 43 else()
44 44 add_library(input_gstreamer MODULE input_gstreamer.c)
45 45 endif()
46   - target_link_libraries(input_gstreamer ebur128 ${GLIB_LIBRARIES} ${GTK2_GOBJECT_LIBRARY} ${GSTREAMER_LIBRARIES})
  46 + target_link_libraries(input_gstreamer ${GLIB_LIBRARIES} ${GTK2_GOBJECT_LIBRARY} ${GSTREAMER_LIBRARIES})
47 47 endif()
48 48
49 49 if(SNDFILE_FOUND AND MPG123_FOUND AND MPCDEC_FOUND AND FFMPEG_FOUND)
2  libinputaudio/input.h
@@ -18,7 +18,7 @@ struct input_ops {
18 18 struct input_handle* (*handle_init)();
19 19 void (*handle_destroy)(struct input_handle** ih);
20 20 int (*open_file)(struct input_handle* ih, const char* filename);
21   - int (*set_channel_map)(struct input_handle* ih, ebur128_state* st);
  21 + int (*set_channel_map)(struct input_handle* ih, int* st);
22 22 int (*allocate_buffer)(struct input_handle* ih);
23 23 size_t (*get_total_frames)(struct input_handle* ih);
24 24 size_t (*read_frames)(struct input_handle* ih);
14 libinputaudio/input_ffmpeg.c
@@ -145,7 +145,7 @@ static int ffmpeg_open_file(struct input_handle* ih, const char* filename) {
145 145 return 1;
146 146 }
147 147
148   -static int ffmpeg_set_channel_map(struct input_handle* ih, ebur128_state* st) {
  148 +static int ffmpeg_set_channel_map(struct input_handle* ih, int* st) {
149 149 if (ih->codec_context->channel_layout) {
150 150 unsigned int channel_map_index = 0;
151 151 int bit_counter = 0;
@@ -153,22 +153,22 @@ static int ffmpeg_set_channel_map(struct input_handle* ih, ebur128_state* st) {
153 153 if (ih->codec_context->channel_layout & (1 << bit_counter)) {
154 154 switch (1 << bit_counter) {
155 155 case CH_FRONT_LEFT:
156   - ebur128_set_channel(st, channel_map_index, EBUR128_LEFT);
  156 + st[channel_map_index] = EBUR128_LEFT;
157 157 break;
158 158 case CH_FRONT_RIGHT:
159   - ebur128_set_channel(st, channel_map_index, EBUR128_RIGHT);
  159 + st[channel_map_index] = EBUR128_RIGHT;
160 160 break;
161 161 case CH_FRONT_CENTER:
162   - ebur128_set_channel(st, channel_map_index, EBUR128_CENTER);
  162 + st[channel_map_index] = EBUR128_CENTER;
163 163 break;
164 164 case CH_BACK_LEFT:
165   - ebur128_set_channel(st, channel_map_index, EBUR128_LEFT_SURROUND);
  165 + st[channel_map_index] = EBUR128_LEFT_SURROUND;
166 166 break;
167 167 case CH_BACK_RIGHT:
168   - ebur128_set_channel(st, channel_map_index, EBUR128_RIGHT_SURROUND);
  168 + st[channel_map_index] = EBUR128_RIGHT_SURROUND;
169 169 break;
170 170 default:
171   - ebur128_set_channel(st, channel_map_index, EBUR128_UNUSED);
  171 + st[channel_map_index] = EBUR128_UNUSED;
172 172 break;
173 173 }
174 174 ++channel_map_index;
20 libinputaudio/input_gstreamer.c
@@ -252,26 +252,26 @@ static int gstreamer_open_file(struct input_handle* ih, const char* filename) {
252 252 }
253 253 }
254 254
255   -static int gstreamer_set_channel_map(struct input_handle* ih, ebur128_state* st) {
  255 +static int gstreamer_set_channel_map(struct input_handle* ih, int* st) {
256 256 unsigned j;
257   - for (j = 0; j < st->channels; ++j) {
  257 + for (j = 0; j < ih->n_channels; ++j) {
258 258 switch (ih->channel_positions[j]) {
259 259 case GST_AUDIO_CHANNEL_POSITION_INVALID:
260   - ebur128_set_channel(st, j, EBUR128_UNUSED); break;
  260 + st[j] = EBUR128_UNUSED; break;
261 261 case GST_AUDIO_CHANNEL_POSITION_FRONT_MONO:
262   - ebur128_set_channel(st, j, EBUR128_CENTER); break;
  262 + st[j] = EBUR128_CENTER; break;
263 263 case GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT:
264   - ebur128_set_channel(st, j, EBUR128_LEFT); break;
  264 + st[j] = EBUR128_LEFT; break;
265 265 case GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT:
266   - ebur128_set_channel(st, j, EBUR128_RIGHT); break;
  266 + st[j] = EBUR128_RIGHT; break;
267 267 case GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER:
268   - ebur128_set_channel(st, j, EBUR128_CENTER); break;
  268 + st[j] = EBUR128_CENTER; break;
269 269 case GST_AUDIO_CHANNEL_POSITION_REAR_LEFT:
270   - ebur128_set_channel(st, j, EBUR128_LEFT_SURROUND); break;
  270 + st[j] = EBUR128_LEFT_SURROUND; break;
271 271 case GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT:
272   - ebur128_set_channel(st, j, EBUR128_RIGHT_SURROUND); break;
  272 + st[j] = EBUR128_RIGHT_SURROUND; break;
273 273 default:
274   - ebur128_set_channel(st, j, EBUR128_UNUSED); break;
  274 + st[j] = EBUR128_UNUSED; break;
275 275 }
276 276 }
277 277 return 0;
2  libinputaudio/input_mpcdec.c
@@ -58,7 +58,7 @@ static int mpcdec_open_file(struct input_handle* ih, const char* filename) {
58 58 return 0;
59 59 }
60 60
61   -static int mpcdec_set_channel_map(struct input_handle* ih, ebur128_state* st) {
  61 +static int mpcdec_set_channel_map(struct input_handle* ih, int* st) {
62 62 (void) ih;
63 63 (void) st;
64 64 return 1;
2  libinputaudio/input_mpg123.c
@@ -84,7 +84,7 @@ static int mpg123_open_file(struct input_handle* ih, const char* filename) {
84 84 return 1;
85 85 }
86 86
87   -static int mpg123_set_channel_map(struct input_handle* ih, ebur128_state* st) {
  87 +static int mpg123_set_channel_map(struct input_handle* ih, int* st) {
88 88 (void) ih;
89 89 (void) st;
90 90 return 1;
24 libinputaudio/input_sndfile.c
@@ -58,35 +58,35 @@ static int sndfile_open_file(struct input_handle* ih, const char* filename) {
58 58 }
59 59 }
60 60
61   -static int sndfile_set_channel_map(struct input_handle* ih, ebur128_state* st) {
  61 +static int sndfile_set_channel_map(struct input_handle* ih, int* st) {
62 62 int result;
63   - int* channel_map = (int*) calloc(st->channels, sizeof(int));
  63 + int* channel_map = (int*) calloc(ih->file_info.channels, sizeof(int));
64 64 if (!channel_map) return 1;
65 65 result = sf_command(ih->file, SFC_GET_CHANNEL_MAP_INFO,
66 66 (void*) channel_map,
67   - (int) (st->channels * sizeof(int)));
  67 + (int) (ih->file_info.channels * sizeof(int)));
68 68 /* If sndfile found a channel map, set it with
69 69 * ebur128_set_channel_map */
70 70 if (result == SF_TRUE) {
71 71 unsigned j;
72   - for (j = 0; j < st->channels; ++j) {
  72 + for (j = 0; j < ih->file_info.channels; ++j) {
73 73 switch (channel_map[j]) {
74 74 case SF_CHANNEL_MAP_INVALID:
75   - ebur128_set_channel(st, j, EBUR128_UNUSED); break;
  75 + st[j] = EBUR128_UNUSED; break;
76 76 case SF_CHANNEL_MAP_MONO:
77   - ebur128_set_channel(st, j, EBUR128_CENTER); break;
  77 + st[j] = EBUR128_CENTER; break;
78 78 case SF_CHANNEL_MAP_LEFT:
79   - ebur128_set_channel(st, j, EBUR128_LEFT); break;
  79 + st[j] = EBUR128_LEFT; break;
80 80 case SF_CHANNEL_MAP_RIGHT:
81   - ebur128_set_channel(st, j, EBUR128_RIGHT); break;
  81 + st[j] = EBUR128_RIGHT; break;
82 82 case SF_CHANNEL_MAP_CENTER:
83   - ebur128_set_channel(st, j, EBUR128_CENTER); break;
  83 + st[j] = EBUR128_CENTER; break;
84 84 case SF_CHANNEL_MAP_REAR_LEFT:
85   - ebur128_set_channel(st, j, EBUR128_LEFT_SURROUND); break;
  85 + st[j] = EBUR128_LEFT_SURROUND; break;
86 86 case SF_CHANNEL_MAP_REAR_RIGHT:
87   - ebur128_set_channel(st, j, EBUR128_RIGHT_SURROUND); break;
  87 + st[j] = EBUR128_RIGHT_SURROUND; break;
88 88 default:
89   - ebur128_set_channel(st, j, EBUR128_UNUSED); break;
  89 + st[j] = EBUR128_UNUSED; break;
90 90 }
91 91 }
92 92 free(channel_map);
10 scanner/scanner-common.c
@@ -91,6 +91,7 @@ void init_state_and_scan_work_item(struct filename_list_node *fln, struct scan_o
91 91 struct input_handle* ih = NULL;
92 92 int r128_mode = EBUR128_MODE_I;
93 93 unsigned int i;
  94 + int *channel_map;
94 95
95 96 int result;
96 97 float *buffer = NULL;
@@ -123,7 +124,14 @@ void init_state_and_scan_work_item(struct filename_list_node *fln, struct scan_o
123 124 ops->get_samplerate(ih),
124 125 r128_mode);
125 126
126   - result = ops->set_channel_map(ih, fd->st);
  127 + channel_map = g_malloc(fd->st->channels * sizeof(int));
  128 + if (!ops->set_channel_map(ih, channel_map)) {
  129 + for (i = 0; i < fd->st->channels; ++i) {
  130 + ebur128_set_channel(fd->st, i, channel_map[i]);
  131 + }
  132 + }
  133 + free(channel_map);
  134 +
127 135 if (fd->st->channels == 1 && opts->force_dual_mono) {
128 136 ebur128_set_channel(fd->st, 0, EBUR128_DUAL_MONO);
129 137 }

0 comments on commit c126014

Please sign in to comment.
Something went wrong with that request. Please try again.