gst-plugins-rs/meson.build
Mathieu Duponchelle de796c95f0 tttocea608: refactor to fit more scenarios
- Report a latency:
  By design, tttocea608 will output buffers in the "past" when
  receiving an input buffer: we want the second to last buffer
  in the buffer list that we output to have the same pts as the
  input buffer, as it contains the end_of_caption control code
  which determines when the current closed caption actually gets
  displayed in pop_on mode. The previous buffers have timestamps
  decreasing as a function of the framerate, for up to potentially
  74 byte pairs (the breakdown is detailed in a comment).

  The element thus has to report a latency, at 30 frames per second
  it represents around 2.5 seconds.

- Refactor timestamping:
  Stop using a frame duration, but rather base our timestamps on
  a scaled frame index. This is to avoid rounding errors, and
  allow for exactly one byte pair per buffer if the proper framerate
  is set on the closed caption branch, and the video branch has
  perfect timestamps, eg videorate. In practice, that one byte
  pair per frame requirement should only matter for line 21 encoding,
  but we have to think about this use case too.

- Splice in erase_display_memory:
  When there is a gap between the end of a buffer and the start
  of the next one, we want to erase the display memory (this
  is unnecessary otherwise, as the end_of_caption control code
  will in effect ensure that the display is erased when the
  new caption is displayed). The previous implementation only
  supported this imperfectly, as it could cause timestamps to
  go backwards.

- Output last erase_display_memory:
  The previous implementation was missing the final
  erase_display_memory on EOS

- Output gaps

- Write more tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00

160 lines
4.5 KiB
Meson

project('gst-plugins-rs',
'rust',
'c',
version: '0.13.0',
meson_version : '>= 0.52')
if get_option('debug')
target = 'debug'
else
target = 'release'
endif
cargo = find_program('cargo', version:'>=1.40')
cargo_wrapper = find_program('cargo_wrapper.py')
system = build_machine.system()
if system == 'windows'
ext = 'dll'
elif system == 'darwin'
ext = 'dylib'
else
ext = 'so'
endif
plugins_rep = {
'gst-plugin-audiofx': 'libgstrsaudiofx',
'gst-plugin-cdg': 'libgstcdg',
'gst-plugin-claxon': 'libgstclaxon',
'gst-plugin-closedcaption': 'libgstrsclosedcaption',
'gst-plugin-fallbackswitch': 'libgstfallbackswitch',
'gst-plugin-file': 'libgstrsfile',
'gst-plugin-flv': 'libgstrsflv',
'gst-plugin-lewton': 'libgstlewton',
'gst-plugin-rav1e': 'libgstrav1e',
'gst-plugin-reqwest': 'libgstreqwest',
'gst-plugin-rusoto': 'libgstrusoto',
'gst-plugin-threadshare': 'libgstthreadshare',
'gst-plugin-togglerecord': 'libgsttogglerecord',
}
exclude = []
extra_env = {}
if dependency('dav1d', required : get_option('dav1d')).found()
plugins_rep += {'gst-plugin-dav1d' : 'libgstrsdav1d'}
else
exclude += ['gst-plugin-dav1d']
endif
sodium = get_option ('sodium')
if sodium == 'system'
dependency('libsodium')
plugins_rep += {'gst-plugin-sodium': 'libgstsodium'}
extra_env += {'SODIUM_USE_PKG_CONFIG': '1'}
elif sodium == 'built-in'
plugins_rep += {'gst-plugin-sodium': 'libgstsodium'}
else
exclude += ['gst-plugin-sodium']
endif
cc = meson.get_compiler('c')
csound_option = get_option('csound')
csound_dep = dependency('', required: false) # not-found dependency
if not csound_option.disabled()
csound_dep = cc.find_library('csound64', required: false)
if not csound_dep.found()
python3 = import('python').find_installation('python3')
res = run_command(python3, '-c', 'import os; print(os.environ["CSOUND_LIB_DIR"])')
if res.returncode() == 0
csound_dep = cc.find_library('csound64', dirs: res.stdout(), required: csound_option)
elif csound_option.enabled()
error('csound option is enabled, but csound64 library could not be found and CSOUND_LIB_DIR was not set')
endif
endif
endif
if csound_dep.found() and false
plugins_rep += {'gst-plugin-csound' : 'libgstcsound'}
else
exclude += ['gst-plugin-csound']
endif
output = []
foreach p, lib : plugins_rep
# Add the plugin file as output
output += [lib + '.' + ext]
endforeach
# Need to depends on all gstreamer-rs deps to ensure they are built
# before gstreamer-rs when building with gst-build.
# Custom targets can't depend on dependency() objects so we have to depend
# on the library variable from the subproject instead.
gst_req = '>= 1.14.0'
depends = []
deps = [
# name, subproject name, subproject dep, library object
['gstreamer-1.0', 'gstreamer', 'gst_dep', 'libgst'],
['gstreamer-app-1.0', 'gst-plugins-base', 'app_dep', 'gstapp'],
['gstreamer-audio-1.0', 'gst-plugins-base', 'audio_dep', 'gstaudio'],
['gstreamer-base-1.0', 'gstreamer', 'gst_base_dep', 'gst_base'],
['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check'],
['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net'],
['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp'],
['gstreamer-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'],
]
foreach d: deps
dep = dependency(d[0], version : gst_req,
fallback : [d[1], d[2]])
if dep.type_name() == 'internal'
lib = subproject(d[1]).get_variable(d[3])
depends += lib
endif
endforeach
exclude = ','.join(exclude)
# serialize extra_env
extra_env_list = []
foreach key, value : extra_env
extra_env_list += key + ':' + value
endforeach
extra_env_str = ','.join(extra_env_list)
# Always build the target so we don't have to list all source files as input
rs_plugins = custom_target('gst-plugins-rs',
build_by_default: true,
output: output,
console: true,
install: false,
build_always_stale: true,
depends: depends,
command: [cargo_wrapper,
'build',
meson.current_build_dir(),
meson.current_source_dir(),
meson.build_root(),
target,
exclude,
extra_env_str,
ext])
# FIXME: raises a warning as the target has multiple outputs and meson will use
# only the first one. All the plugins have the same basedir, hence
# GST_PLUGIN_PATH will include them all, so that's ok.
plugins = [rs_plugins]
test('tests',
cargo_wrapper,
args: ['test',
meson.current_build_dir(),
meson.current_source_dir(),
meson.build_root(),
target,
exclude,
extra_env_str],
timeout: 600)