void
gss_program_start (GssProgram * program)
{
  GssProgramClass *program_class;
  GList *g;

  if (program->state == GSS_PROGRAM_STATE_STARTING ||
      program->state == GSS_PROGRAM_STATE_RUNNING ||
      program->state == GSS_PROGRAM_STATE_STOPPING) {
    return;
  }
  if (!program->enabled || !program->server->enable_programs) {
    return;
  }
  GST_DEBUG_OBJECT (program, "start");
  gss_program_set_state (program, GSS_PROGRAM_STATE_STARTING);

  for (g = program->streams; g; g = g_list_next (g)) {
    GssStream *stream = GSS_STREAM (g->data);
    gss_stream_add_resources (stream);
  }

  program_class = GSS_PROGRAM_GET_CLASS (program);
  if (program_class->start) {
    program_class->start (program);
  }
}
void
gss_program_add_stream (GssProgram * program, GssStream * stream)
{
  g_return_if_fail (GSS_IS_PROGRAM (program));
  g_return_if_fail (GSS_IS_STREAM (stream));

  program->streams = g_list_append (program->streams, stream);

  stream->program = program;
  gss_stream_add_resources (stream);
}