Skip to content

Commit 5e7ba73

Browse files
committed
onebinary: sources and stuff populated dynamically
1 parent cbaefaa commit 5e7ba73

File tree

7 files changed

+48
-22
lines changed

7 files changed

+48
-22
lines changed

meson.build

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,11 @@ onebinary_stuff = []
209209
onebinary_stuff += 'MistOutRTMP'
210210
onebinary_stuff += 'MistOutHLS'
211211
onebinary_stuff += 'MistOutHTTP'
212-
# onebinary_stuff += 'MistInBuffer'
212+
onebinary_stuff += 'MistInBuffer'
213213

214214
onebinary_tgts = []
215215
onebinary_headers = []
216+
onebinary_sources = []
216217

217218
## This makes sure all (installable) executables are build in top level directory
218219
## Done because MistController expects its binaries to all be in the same directory
@@ -234,6 +235,7 @@ foreach exec : executables
234235
if onebinary_stuff.contains(exec.get('name'))
235236
onebinary_tgts += gen_src
236237
onebinary_headers += exec.get('headers')
238+
onebinary_sources += exec.get('sources_debased')
237239
endif
238240
endforeach
239241

@@ -251,15 +253,6 @@ onebinary = executable(
251253
'MistServer',
252254
[
253255
files(
254-
'src/input/input.cpp',
255-
'src/input/input_buffer.cpp',
256-
'src/output/output.cpp',
257-
'src/output/output_hls.cpp',
258-
'src/output/output_http.cpp',
259-
'src/output/output_http_internal.cpp',
260-
'src/output/output_ts.cpp',
261-
'src/output/output_ts_base.cpp',
262-
'src/output/output_rtmp.cpp',
263256
'src/controller/controller_external_writers.cpp',
264257
'src/controller/controller_updater.cpp',
265258
'src/controller/controller_streams.cpp',
@@ -272,7 +265,10 @@ onebinary = executable(
272265
'src/controller/controller_api.cpp',
273266
'src/controller/controller_push.cpp',
274267
'src/controller/controller_variables.cpp',
268+
'src/session.cpp',
269+
'src/controller/controller.cpp',
275270
),
271+
onebinary_sources,
276272
io_cpp,
277273
header_tgts,
278274
embed_tgts,

scripts/onebinary_gen.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@
5050
if stem.startswith(MIST_IN):
5151
category = "inputs"
5252
connector = stem[len(MIST_IN):]
53-
class_name = "Mist::In" + connector
53+
class_name = "Mist::Input" + connector
54+
func_name = "InputMain"
5455
elif stem.startswith(MIST_OUT):
5556
category = "connectors"
5657
connector = stem[len(MIST_OUT):]
5758
class_name = "Mist::Out" + connector
59+
func_name = "OutputMain"
5860
else:
5961
raise Exception("unknown binary naming convention: " + stem)
6062
capabilities.append({
@@ -63,6 +65,7 @@
6365
'connector': connector,
6466
'class_name': class_name,
6567
'binary_name' : stem,
68+
'func_name': func_name,
6669
})
6770

6871
cap_lines = [
@@ -85,22 +88,27 @@
8588

8689
entrypoint_lines = []
8790

91+
for header_file in header_files:
92+
entrypoint_lines.append('#include "' + header_file + '"')
93+
8894
entrypoint_lines.extend([
8995
'#include <mist/config.h>',
9096
'#include <mist/defines.h>',
9197
'#include <mist/socket.h>',
9298
'#include <mist/util.h>',
9399
'#include <mist/stream.h>',
100+
'#include "src/session.h"',
101+
'#include "src/controller/controller.h"',
102+
'#include "src/output/mist_out.cpp"',
103+
'#include "src/input/mist_in.cpp"',
94104
])
95105

96-
for header_file in header_files:
97-
entrypoint_lines.append('#include "' + header_file + '"')
98106

99107
entrypoint_lines.extend([
100-
'#include "src/output/mist_out.cpp"',
101-
'#include "src/input/mist_in.cpp"',
102-
'#include "src/session.cpp"',
103-
'#include "src/controller/controller.cpp"',
108+
# '#include "src/output/mist_out.cpp"',
109+
# '#include "src/input/mist_in.cpp"',
110+
# '#include "src/session.cpp"',
111+
# '#include "src/controller/controller.cpp"',
104112
'int main(int argc, char *argv[]){',
105113
' if (argc < 2) {',
106114
' return ControllerMain(argc, argv);',
@@ -121,7 +129,7 @@
121129
for cap in capabilities:
122130
entrypoint_lines.extend([
123131
' else if (strcmp(argv[1], "' + cap['binary_name'] + '") == 0) {',
124-
' return OutputMain<' + cap['class_name'] + '>(new_argc, new_argv);',
132+
' return ' + cap['func_name'] +'<' + cap['class_name'] + '>(new_argc, new_argv);',
125133
' }',
126134
])
127135

src/controller/controller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int ControllerMain(int argc, char **argv);

src/input/meson.build

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,18 @@ foreach input : inputs
7474
io_cpp,
7575
header_tgts
7676
],
77+
'sources_debased' : [
78+
files(
79+
'input.cpp',
80+
'input_'+input.get('format')+'.cpp'
81+
)
82+
],
7783
'deps' : deps,
7884
'defines': [
7985
string_opt.format('INPUTTYPE', inputtype_header)
8086
],
8187
'headers': [
82-
inputtype_header
88+
files(inputtype_header)
8389
]
8490
}
8591
endforeach

src/input/mist_in.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include INPUTTYPE
33
#endif
44
#include <mist/util.h>
5+
#include <mist/config.h>
56

67
template<class T>
78
int InputMain(int argc, char *argv[]){

src/output/meson.build

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ foreach output : outputs
6868

6969
if output.has_key('extra')
7070
extra = output.get('extra')
71-
if not extra.contains('debased')
72-
sources += base
73-
endif
7471
if extra.contains('http')
7572
sources += files('output_http.cpp')
7673
if extra.contains('ts')
@@ -98,6 +95,18 @@ foreach output : outputs
9895
if extra.contains('embed')
9996
sources += embed_tgts
10097
endif
98+
endif
99+
100+
sources_debased = []
101+
foreach source : sources
102+
sources_debased += source
103+
endforeach
104+
105+
if output.has_key('extra')
106+
extra = output.get('extra')
107+
if not extra.contains('debased')
108+
sources += base
109+
endif
101110
else
102111
sources += base
103112
endif
@@ -110,6 +119,9 @@ foreach output : outputs
110119
sources,
111120
header_tgts
112121
],
122+
'sources_debased' : [
123+
sources_debased
124+
],
113125
'deps' : deps,
114126
'defines' : [
115127
string_opt.format('OUTPUTTYPE', outputtype_header),

src/session.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
int SessionMain(int argc, char **argv);

0 commit comments

Comments
 (0)