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_stop (GssProgram * program) { GssProgramClass *program_class; GList *g; if (program->state == GSS_PROGRAM_STATE_STOPPED || program->state == GSS_PROGRAM_STATE_STOPPING) { return; } GST_DEBUG_OBJECT (program, "stop"); gss_program_set_state (program, GSS_PROGRAM_STATE_STOPPING); if (program->pngappsink) { g_object_unref (program->pngappsink); program->pngappsink = NULL; } if (program->jpegsink) { g_object_unref (program->jpegsink); program->jpegsink = NULL; } for (g = program->streams; g; g = g_list_next (g)) { GssStream *stream = g->data; gss_stream_set_sink (stream, NULL); } program_class = GSS_PROGRAM_GET_CLASS (program); if (program_class->stop) { program_class->stop (program); } else { for (g = program->streams; g; g = g_list_next (g)) { GssStream *stream = g->data; if (stream->pipeline) { gst_element_set_state (stream->pipeline, GST_STATE_NULL); g_object_unref (stream->pipeline); stream->pipeline = NULL; } } #if 0 for (g = program->streams; g; g = g_list_next (g)) { GssStream *stream = g->data; g_object_unref (stream); } #endif } }