rustduck-sys 1.1.0

Raw Rust FFI bindings to the C ABI used by TSDuck's Python API
Documentation
#include "rustduck-sys/native/abi_probe.h"
#include "rustduck-sys/native/tspy.h"

#include <tsVersion.h>

#include <stddef.h>

extern "C" void rustduck_tspy_query_abi_layout(rustduck_tspy_abi_layout *layout) {
  layout->tsduck_header_version_major = TS_VERSION_MAJOR;
  layout->tsduck_header_version_minor = TS_VERSION_MINOR;
  layout->ts_processor_args_size = sizeof(tspyTSProcessorArgs);
  layout->ts_processor_args_align = alignof(tspyTSProcessorArgs);
  const size_t processor_offsets[] = {
      offsetof(tspyTSProcessorArgs, ignore_joint_termination),
      offsetof(tspyTSProcessorArgs, buffer_size),
      offsetof(tspyTSProcessorArgs, max_flushed_packets),
      offsetof(tspyTSProcessorArgs, max_input_packets),
      offsetof(tspyTSProcessorArgs, max_output_packets),
      offsetof(tspyTSProcessorArgs, initial_input_packets),
      offsetof(tspyTSProcessorArgs, add_input_stuffing_0),
      offsetof(tspyTSProcessorArgs, add_input_stuffing_1),
      offsetof(tspyTSProcessorArgs, add_start_stuffing),
      offsetof(tspyTSProcessorArgs, add_stop_stuffing),
      offsetof(tspyTSProcessorArgs, bitrate),
      offsetof(tspyTSProcessorArgs, bitrate_adjust_interval),
      offsetof(tspyTSProcessorArgs, receive_timeout),
      offsetof(tspyTSProcessorArgs, log_plugin_index),
      offsetof(tspyTSProcessorArgs, plugins),
      offsetof(tspyTSProcessorArgs, plugins_size),
  };
  for (size_t index = 0; index < 16; ++index) {
    layout->ts_processor_args_offsets[index] = processor_offsets[index];
  }

  layout->input_switcher_args_size = sizeof(tspyInputSwitcherArgs);
  layout->input_switcher_args_align = alignof(tspyInputSwitcherArgs);
  const size_t switcher_offsets[] = {
      offsetof(tspyInputSwitcherArgs, fast_switch),
      offsetof(tspyInputSwitcherArgs, delayed_switch),
      offsetof(tspyInputSwitcherArgs, terminate),
      offsetof(tspyInputSwitcherArgs, reuse_port),
      offsetof(tspyInputSwitcherArgs, first_input),
      offsetof(tspyInputSwitcherArgs, primary_input),
      offsetof(tspyInputSwitcherArgs, cycle_count),
      offsetof(tspyInputSwitcherArgs, buffered_packets),
      offsetof(tspyInputSwitcherArgs, max_input_packets),
      offsetof(tspyInputSwitcherArgs, max_output_packets),
      offsetof(tspyInputSwitcherArgs, sock_buffer),
      offsetof(tspyInputSwitcherArgs, remote_server_port),
      offsetof(tspyInputSwitcherArgs, receive_timeout),
      offsetof(tspyInputSwitcherArgs, plugins),
      offsetof(tspyInputSwitcherArgs, plugins_size),
      offsetof(tspyInputSwitcherArgs, event_command),
      offsetof(tspyInputSwitcherArgs, event_command_size),
      offsetof(tspyInputSwitcherArgs, event_udp_addr),
      offsetof(tspyInputSwitcherArgs, event_udp_addr_size),
      offsetof(tspyInputSwitcherArgs, event_udp_port),
      offsetof(tspyInputSwitcherArgs, local_addr),
      offsetof(tspyInputSwitcherArgs, local_addr_size),
      offsetof(tspyInputSwitcherArgs, event_ttl),
  };
  for (size_t index = 0; index < 23; ++index) {
    layout->input_switcher_args_offsets[index] = switcher_offsets[index];
  }

  layout->uint32_size = sizeof(uint32_t);
  layout->uint32_align = alignof(uint32_t);
  layout->size_t_size = sizeof(size_t);
  layout->size_t_align = alignof(size_t);
  layout->bool_size = sizeof(bool);
  layout->bool_align = alignof(bool);
  layout->long_size = sizeof(long);
  layout->long_align = alignof(long);
}