Next: , Previous: , Up: The starter-core Library: Building Your Own Ecosystem   [Contents]


4.2 Adding Substance: Inputs and Outputs

In the STARTER ecosystem, a service exists to share data. To do that, we need to populate our inputs and outputs arrays. Let’s upgrade our code to version 0.2.0:

// ... headers as before ...

int main(int argc, char *argv[])
{
  // ... boilerplate initialization ...

  // Defining a new Input
  inputs = g_ptr_array_new_full(0, g_object_unref);
  g_ptr_array_add(inputs, st_input_new("myFirstInput",
    "My first input", ST_UNIT_NULL,
    0, 1, 1, 0, ST_IO_FLAG_NULL, NULL));

  // Defining a new Output
  outputs = g_ptr_array_new_full(0, g_object_unref);
  g_ptr_array_add(outputs, st_output_new("myFirstOutput",
    "My first output", ST_UNIT_NULL,
    0, 1, 1, 0, ST_IO_FLAG_NULL, NULL));
  
  // ... server creation and mDNS publish ...
}