/** * gst_switch_server_new_record: * @return: TRUE if succeeded. * * Start a new recording. * */ gboolean gst_switch_server_new_record (GstSwitchServer * srv) { GstWorkerClass *worker_class; gboolean result = FALSE; g_return_val_if_fail (GST_IS_RECORDER (srv->recorder), FALSE); if (srv->recorder) { GST_SWITCH_SERVER_LOCK_RECORDER (srv); if (srv->recorder) { gst_worker_stop (GST_WORKER (srv->recorder)); g_object_set (G_OBJECT (srv->recorder), "mode", srv->composite->mode, "port", srv->composite->encode_sink_port, "width", srv->composite->width, "height", srv->composite->height, NULL); worker_class = GST_WORKER_CLASS (G_OBJECT_GET_CLASS (srv->recorder)); if (worker_class->reset (GST_WORKER (srv->recorder))) { result = gst_worker_start (GST_WORKER (srv->recorder)); } else { ERROR ("failed to reset composite recorder"); } } GST_SWITCH_SERVER_UNLOCK_RECORDER (srv); } return result; }
/** * @brief * @param klass The GstVideoDispClass instance. * @memberof GstVideoDispClass */ static void gst_video_disp_class_init (GstVideoDispClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GstWorkerClass *worker_class = GST_WORKER_CLASS (klass); object_class->dispose = (GObjectFinalizeFunc) gst_video_disp_dispose; object_class->finalize = (GObjectFinalizeFunc) gst_video_disp_finalize; object_class->set_property = (GObjectSetPropertyFunc) gst_video_disp_set_property; object_class->get_property = (GObjectGetPropertyFunc) gst_video_disp_get_property; g_object_class_install_property (object_class, PROP_PORT, g_param_spec_uint ("port", "Port", "Sink port", GST_SWITCH_MIN_SINK_PORT, GST_SWITCH_MAX_SINK_PORT, GST_SWITCH_MIN_SINK_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_HANDLE, g_param_spec_ulong ("handle", "Handle", "Window Handle", 0, ((gulong) - 1), 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); worker_class->prepare = (GstWorkerPrepareFunc) gst_video_disp_prepare; worker_class->get_pipeline_string = (GstWorkerGetPipelineStringFunc) gst_video_disp_get_pipeline_string; }
static gboolean test_worker_reset (GstWorker * worker) { GstWorkerClass *worker_class; worker_class = GST_WORKER_CLASS (G_OBJECT_GET_CLASS (worker)); return worker_class->reset (worker); }
/** * gst_composite_apply_parameters: * * Applying new composite parameters such as PIP position. This is actually * resetting the composite pipeline with the new parameters. */ static void gst_composite_apply_parameters (GstComposite * composite) { GstWorkerClass *worker_class; g_return_if_fail (GST_IS_COMPOSITE (composite)); worker_class = GST_WORKER_CLASS (G_OBJECT_GET_CLASS (composite)); if (!worker_class->reset (GST_WORKER (composite))) { ERROR ("failed to reset composite"); } /* if (!worker_class->reset (GST_WORKER (composite->output))) { ERROR ("failed to reset composite output"); } */ /* g_object_set (composite->recorder, "port", composite->encode_sink_port, "mode", composite->mode, "width", composite->width, "height", composite->height, NULL); if (!worker_class->reset (GST_WORKER (composite->recorder))) { ERROR ("failed to reset composite recorder"); } */ }
static void gst_switch_ptz_class_init (GstSwitchPTZClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GstWorkerClass *worker_class = GST_WORKER_CLASS (klass); object_class->finalize = (GObjectFinalizeFunc) gst_switch_ptz_fini; worker_class->prepare = (GstWorkerPrepareFunc) gst_switch_ptz_prepare; worker_class->get_pipeline_string = (GstWorkerGetPipelineStringFunc) gst_switch_ptz_get_pipeline; }
/** * @brief Initialize the GstRecorderClass. * @param klass The GstRecorderClass instance. * @memberof GstRecorderClass */ static void gst_recorder_class_init (GstRecorderClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GstWorkerClass *worker_class = GST_WORKER_CLASS (klass); object_class->dispose = (GObjectFinalizeFunc) gst_recorder_dispose; object_class->finalize = (GObjectFinalizeFunc) gst_recorder_finalize; object_class->set_property = (GObjectSetPropertyFunc) gst_recorder_set_property; object_class->get_property = (GObjectGetPropertyFunc) gst_recorder_get_property; g_object_class_install_property (object_class, PROP_MODE, g_param_spec_uint ("mode", "Mode", "Composite Mode", COMPOSE_MODE_NONE, COMPOSE_MODE__LAST, COMPOSE_MODE_NONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_PORT, g_param_spec_uint ("port", "Port", "Sink port", GST_SWITCH_MIN_SINK_PORT, GST_SWITCH_MAX_SINK_PORT, GST_SWITCH_MIN_SINK_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_WIDTH, g_param_spec_uint ("width", "Input Width", "Input video frame width", 1, G_MAXINT, gst_composite_default_width (), G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_HEIGHT, g_param_spec_uint ("height", "Input Height", "Input video frame height", 1, G_MAXINT, gst_composite_default_height (), G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); worker_class->prepare = (GstWorkerPrepareFunc) gst_recorder_prepare; worker_class->get_pipeline_string = (GstWorkerGetPipelineStringFunc) gst_recorder_get_pipeline_string; }
/** * gst_composite_commit_adjustment: * @return Always FALSE to tell glib to cleanup the timeout source. * * Commit a PIP adjustment request. */ static gboolean gst_composite_commit_adjustment (GstComposite * composite) { g_return_val_if_fail (GST_IS_COMPOSITE (composite), FALSE); if (composite->adjusting) { GST_COMPOSITE_LOCK_ADJUSTMENT (composite); if (composite->adjusting) { GstWorkerClass *worker_class; worker_class = GST_WORKER_CLASS (G_OBJECT_GET_CLASS (composite)); if (!worker_class->reset (GST_WORKER (composite))) { ERROR ("failed to reset composite"); } } GST_COMPOSITE_UNLOCK_ADJUSTMENT (composite); } return FALSE; }
/** * gst_composite_prepare: * @return TRUE if the composite pipeline is well prepared. * * Prepare the composite pipeline. */ static gboolean gst_composite_prepare (GstComposite * composite) { g_return_val_if_fail (GST_IS_COMPOSITE (composite), FALSE); if (composite->scaler == NULL) { composite->scaler = GST_WORKER (g_object_new (GST_TYPE_WORKER, "name", "scale", NULL)); composite->scaler->pipeline_func_data = composite; composite->scaler->pipeline_func = (GstWorkerGetPipelineString) gst_composite_get_scaler_string; } else { GstWorkerClass *worker_class; worker_class = GST_WORKER_CLASS (G_OBJECT_GET_CLASS (composite->scaler)); if (!worker_class->reset (GST_WORKER (composite->scaler))) { ERROR ("failed to reset scaler"); } } return TRUE; }
/** * gst_composite_class_init: * * Initialize the GstCompositeClass. */ static void gst_composite_class_init (GstCompositeClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GstWorkerClass *worker_class = GST_WORKER_CLASS (klass); object_class->dispose = (GObjectFinalizeFunc) gst_composite_dispose; object_class->finalize = (GObjectFinalizeFunc) gst_composite_finalize; object_class->set_property = (GObjectSetPropertyFunc) gst_composite_set_property; object_class->get_property = (GObjectGetPropertyFunc) gst_composite_get_property; /* gst_composite_signals[SIGNAL_START_OUTPUT] = g_signal_new ("start-output", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCompositeClass, start_output), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0); gst_composite_signals[SIGNAL_START_RECORDER] = g_signal_new ("start-recorder", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCompositeClass, start_recorder), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0); gst_composite_signals[SIGNAL_END_OUTPUT] = g_signal_new ("end-output", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCompositeClass, end_output), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0); gst_composite_signals[SIGNAL_END_RECORDER] = g_signal_new ("end-recorder", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCompositeClass, end_recorder), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0); */ gst_composite_signals[SIGNAL_END_TRANSITION] = g_signal_new ("end-transition", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCompositeClass, end_transition), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0 /*1, G_TYPE_INT */ ); g_object_class_install_property (object_class, PROP_MODE, g_param_spec_uint ("mode", "Mode", "Composite Mode", COMPOSE_MODE_0, COMPOSE_MODE__LAST, DEFAULT_COMPOSE_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_PORT, g_param_spec_uint ("port", "Port", "Sink port", GST_SWITCH_MIN_SINK_PORT, GST_SWITCH_MAX_SINK_PORT, GST_SWITCH_MIN_SINK_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_ENCODE_PORT, g_param_spec_uint ("encode", "EncodePort", "Encoding Sink port", GST_SWITCH_MIN_SINK_PORT, GST_SWITCH_MAX_SINK_PORT, GST_SWITCH_MIN_SINK_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_A_X, g_param_spec_uint ("ax", "A xpos", "Channel A frame xpos", 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_A_Y, g_param_spec_uint ("ay", "A ypos", "Channel A frame ypos", 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_A_WIDTH, g_param_spec_uint ("awidth", "A Width", "Channel A frame width", 1, G_MAXINT, GST_SWITCH_COMPOSITE_DEFAULT_WIDTH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_A_HEIGHT, g_param_spec_uint ("aheight", "A Height", "Channel A frame height", 1, G_MAXINT, GST_SWITCH_COMPOSITE_DEFAULT_HEIGHT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_B_X, g_param_spec_uint ("bx", "B xpos", "Channel B frame xpos", 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_B_Y, g_param_spec_uint ("by", "B ypos", "Channel B frame ypos", 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_B_WIDTH, g_param_spec_uint ("bwidth", "B Width", "Channel B frame width", 1, G_MAXINT, GST_SWITCH_COMPOSITE_DEFAULT_WIDTH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_B_HEIGHT, g_param_spec_uint ("bheight", "B Height", "Channel B frame height", 1, G_MAXINT, GST_SWITCH_COMPOSITE_DEFAULT_HEIGHT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_WIDTH, g_param_spec_uint ("width", "Composite Width", "Output frame width", 1, G_MAXINT, GST_SWITCH_COMPOSITE_DEFAULT_WIDTH, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_HEIGHT, g_param_spec_uint ("height", "Composite Height", "Output frame height", 1, G_MAXINT, GST_SWITCH_COMPOSITE_DEFAULT_HEIGHT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); worker_class->alive = (GstWorkerAliveFunc) gst_composite_alive; worker_class->null = (GstWorkerNullFunc) gst_composite_null; worker_class->prepare = (GstWorkerPrepareFunc) gst_composite_prepare; worker_class->start_worker = (GstWorkerAliveFunc) gst_composite_start; worker_class->end_worker = (GstWorkerAliveFunc) gst_composite_end; worker_class->message = (GstWorkerMessageFunc) gst_composite_message; worker_class->get_pipeline_string = (GstWorkerGetPipelineStringFunc) gst_composite_get_pipeline_string; }