static gboolean gst_imx_blitter_video_sink_event(GstBaseSink *sink, GstEvent *event) { GstImxBlitterVideoSink *blitter_video_sink = GST_IMX_BLITTER_VIDEO_SINK(sink); switch (GST_EVENT_TYPE(event)) { case GST_EVENT_FLUSH_STOP: { GST_IMX_BLITTER_VIDEO_SINK_LOCK(blitter_video_sink); if (blitter_video_sink->blitter != NULL) gst_imx_blitter_flush(blitter_video_sink->blitter); GST_IMX_BLITTER_VIDEO_SINK_UNLOCK(blitter_video_sink); break; } default: break; } return GST_BASE_SINK_CLASS(gst_imx_blitter_video_sink_parent_class)->event(sink, event); }
static gboolean gst_gtk_gl_sink_stop (GstBaseSink * bsink) { GstGtkGLSink *gtk_sink = GST_GTK_GL_SINK (bsink); if (gtk_sink->display) { gst_object_unref (gtk_sink->display); gtk_sink->display = NULL; } if (gtk_sink->context) { gst_object_unref (gtk_sink->context); gtk_sink->context = NULL; } if (gtk_sink->gtk_context) { gst_object_unref (gtk_sink->gtk_context); gtk_sink->gtk_context = NULL; } return GST_BASE_SINK_CLASS (parent_class)->stop (bsink); }
static void gst_linsys_sdi_sink_class_init (GstLinsysSdiSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass); gobject_class->set_property = gst_linsys_sdi_sink_set_property; gobject_class->get_property = gst_linsys_sdi_sink_get_property; gobject_class->dispose = gst_linsys_sdi_sink_dispose; gobject_class->finalize = gst_linsys_sdi_sink_finalize; base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_get_caps); base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_set_caps); if (0) base_sink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_buffer_alloc); base_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_get_times); base_sink_class->start = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_start); base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_stop); base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_unlock); base_sink_class->event = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_event); base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_preroll); base_sink_class->render = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_render); if (0) base_sink_class->async_play = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_async_play); if (0) base_sink_class->activate_pull = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_activate_pull); base_sink_class->fixate = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_fixate); base_sink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_unlock_stop); base_sink_class->render_list = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_render_list); g_object_class_install_property (gobject_class, PROP_DEVICE, g_param_spec_string ("device", "Device", "device to transmit data on", DEFAULT_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); }
static gboolean gst_fake_sink_query (GstBaseSink * bsink, GstQuery * query) { gboolean ret; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_SEEKING:{ GstFormat fmt; /* we don't supporting seeking */ gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL); gst_query_set_seeking (query, fmt, FALSE, 0, -1); ret = TRUE; break; } default: ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query); break; } return ret; }
static void gst_inter_video_sink_class_init (GstInterVideoSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass); gobject_class->set_property = gst_inter_video_sink_set_property; gobject_class->get_property = gst_inter_video_sink_get_property; gobject_class->dispose = gst_inter_video_sink_dispose; gobject_class->finalize = gst_inter_video_sink_finalize; base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_video_sink_get_caps); base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_video_sink_set_caps); if (0) base_sink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_inter_video_sink_buffer_alloc); base_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_inter_video_sink_get_times); base_sink_class->start = GST_DEBUG_FUNCPTR (gst_inter_video_sink_start); base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_inter_video_sink_stop); base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_inter_video_sink_unlock); if (0) base_sink_class->event = GST_DEBUG_FUNCPTR (gst_inter_video_sink_event); //if (0) base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_inter_video_sink_preroll); base_sink_class->render = GST_DEBUG_FUNCPTR (gst_inter_video_sink_render); if (0) base_sink_class->async_play = GST_DEBUG_FUNCPTR (gst_inter_video_sink_async_play); if (0) base_sink_class->activate_pull = GST_DEBUG_FUNCPTR (gst_inter_video_sink_activate_pull); base_sink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_inter_video_sink_unlock_stop); g_object_class_install_property (gobject_class, PROP_CHANNEL, g_param_spec_string ("channel", "Channel", "Channel name to match inter src and sink elements", "default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); }
static void gst_checksum_sink_class_init (GstChecksumSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass); gobject_class->dispose = gst_checksum_sink_dispose; gobject_class->finalize = gst_checksum_sink_finalize; base_sink_class->start = GST_DEBUG_FUNCPTR (gst_checksum_sink_start); base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_checksum_sink_stop); base_sink_class->render = GST_DEBUG_FUNCPTR (gst_checksum_sink_render); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_checksum_sink_src_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_checksum_sink_sink_template)); gst_element_class_set_static_metadata (element_class, "Checksum sink", "Debug/Sink", "Calculates a checksum for buffers", "David Schleef <*****@*****.**>"); }
static void gst_test_class_init (GstTestClass * klass) { GstBaseSinkClass *basesink_class = GST_BASE_SINK_CLASS (klass); GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); guint i; GST_DEBUG_CATEGORY_INIT (gst_test_debug, "testsink", 0, "debugging category for testsink element"); object_class->set_property = gst_test_set_property; object_class->get_property = gst_test_get_property; object_class->finalize = (GObjectFinalizeFunc) gst_test_finalize; for (i = 0; i < TESTS_COUNT; i++) { GParamSpec *spec; spec = tests[i].get_spec (&tests[i], FALSE); klass->param_names[2 * i] = g_strdup (g_param_spec_get_name (spec)); g_object_class_install_property (object_class, 2 * i + 1, spec); spec = tests[i].get_spec (&tests[i], TRUE); klass->param_names[2 * i + 1] = g_strdup (g_param_spec_get_name (spec)); g_object_class_install_property (object_class, 2 * i + 2, spec); } gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_static_metadata (gstelement_class, "Test plugin", "Testing", "perform a number of tests", "Benjamin Otte <otte@gnome>"); basesink_class->render = GST_DEBUG_FUNCPTR (gst_test_render_buffer); basesink_class->event = GST_DEBUG_FUNCPTR (gst_test_sink_event); basesink_class->start = GST_DEBUG_FUNCPTR (gst_test_start); basesink_class->stop = GST_DEBUG_FUNCPTR (gst_test_stop); }
static gboolean gst_mir_sink_query (GstBaseSink * bsink, GstQuery * query) { GstMirSink *sink = GST_MIR_SINK (bsink); GST_INFO_OBJECT (sink, "query type %s", GST_QUERY_TYPE_NAME (query)); switch (GST_QUERY_TYPE (query)) { case GST_QUERY_CONTEXT: { const gchar *context_type; GstMirContext *gst_mir_context; if (gst_query_parse_context_type (query, &context_type) && strcmp (context_type, GST_MIR_CONTEXT_TYPE) == 0 && sink->surface_texture_client) { GST_DEBUG_OBJECT (sink, "GST_MIR_CONTEXT_TYPE"); gst_mir_context = gst_mir_context_new (GST_ELEMENT_CAST (sink), sink->surface_texture_client); sink->context = gst_mir_context_new_with_stc (gst_mir_context); GST_INFO_OBJECT (sink, "Setting context on the sink"); gst_query_set_context (query, sink->context); gst_context_unref (sink->context); return TRUE; } else { goto base_class; } break; } default: goto base_class; break; } base_class: return GST_BASE_SINK_CLASS (parent_class)->query (bsink, query); }
static void gst_gdk_pixbuf_sink_class_init (GstGdkPixbufSinkClass * klass) { GstBaseSinkClass *basesink_class = GST_BASE_SINK_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gst_element_class_set_static_metadata (element_class, "GdkPixbuf sink", "Sink/Video", "Output images as GdkPixbuf objects in bus messages", "Tim-Philipp Müller <tim centricular net>"); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&pixbufsink_sink_factory)); gobject_class->set_property = gst_gdk_pixbuf_sink_set_property; gobject_class->get_property = gst_gdk_pixbuf_sink_get_property; /** * GstGdkPixbuf:post-messages: * * Post messages on the bus containing pixbufs. */ g_object_class_install_property (gobject_class, PROP_POST_MESSAGES, g_param_spec_boolean ("post-messages", "Post Messages", "Whether to post messages containing pixbufs on the bus", DEFAULT_POST_MESSAGES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_LAST_PIXBUF, g_param_spec_object ("last-pixbuf", "Last Pixbuf", "Last GdkPixbuf object rendered", GDK_TYPE_PIXBUF, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); basesink_class->start = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_start); basesink_class->stop = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_stop); basesink_class->render = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_render); basesink_class->preroll = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_preroll); basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_set_caps); }
static void type_class_init (gpointer g_class, gpointer class_data) { GObjectClass *gobject_class; GstElementClass *gstelement_class; GstBaseSinkClass *gst_base_sink_class; gobject_class = G_OBJECT_CLASS (g_class); gstelement_class = GST_ELEMENT_CLASS (g_class); gst_base_sink_class = GST_BASE_SINK_CLASS (g_class); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); gobject_class->dispose = dispose; gst_base_sink_class->start = start; gst_base_sink_class->stop = stop; gst_base_sink_class->event = event; gst_base_sink_class->preroll = render; gst_base_sink_class->render = render; /* Properties stuff */ { gobject_class->set_property = set_property; gobject_class->get_property = get_property; g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME, g_param_spec_string ("component-name", "Component name", "Name of the OpenMAX IL component to use", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME, g_param_spec_string ("library-name", "Library name", "Name of the OpenMAX IL implementation library to use", NULL, G_PARAM_READWRITE)); } }
static gboolean gst_osx_audio_sink_query (GstBaseSink * base, GstQuery * query) { GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (base); gboolean ret = FALSE; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_ACCEPT_CAPS: { GstCaps *caps = NULL; gst_query_parse_accept_caps (query, &caps); ret = gst_osx_audio_sink_acceptcaps (sink, caps); gst_query_set_accept_caps_result (query, ret); ret = TRUE; break; } default: ret = GST_BASE_SINK_CLASS (parent_class)->query (base, query); break; } return ret; }
static void gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass * klass) { GstElementClass *gstelement_class; GstBaseSinkClass *gstbase_sink_class; gstelement_class = GST_ELEMENT_CLASS (klass); gstbase_sink_class = GST_BASE_SINK_CLASS (klass); gst_element_class_set_metadata (gstelement_class, "Test Reverse Negotiation Sink", "Sink", "Some test sink", "Sebastian Dröge <*****@*****.**>"); gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate); #if 0 gstbase_sink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_test_reverse_negotiation_sink_buffer_alloc); #endif gstbase_sink_class->render = GST_DEBUG_FUNCPTR (gst_test_reverse_negotiation_sink_render); }
/** * @brief query vmethod implementation */ static gboolean gst_tensor_reposink_query (GstBaseSink * sink, GstQuery * query) { GstTensorRepoSink *self; GstQueryType type; GstFormat format; self = GST_TENSOR_REPOSINK (sink); type = GST_QUERY_TYPE (query); GST_DEBUG_OBJECT (self, "received query %s", GST_QUERY_TYPE_NAME (query)); switch (type) { case GST_QUERY_SEEKING: gst_query_parse_seeking (query, &format, NULL, NULL, NULL); gst_query_set_seeking (query, format, FALSE, 0, -1); return TRUE; default: break; } return GST_BASE_SINK_CLASS (parent_class)->query (sink, query); }
static gboolean gst_alsasink_query (GstBaseSink * sink, GstQuery * query) { GstAlsaSink *alsa = GST_ALSA_SINK (sink); gboolean ret; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_ACCEPT_CAPS: { GstCaps *caps; gst_query_parse_accept_caps (query, &caps); ret = gst_alsasink_acceptcaps (alsa, caps); gst_query_set_accept_caps_result (query, ret); ret = TRUE; break; } default: ret = GST_BASE_SINK_CLASS (parent_class)->query (sink, query); break; } return ret; }
static void webkit_video_sink_class_init(WebKitVideoSinkClass* klass) { GObjectClass* gobjectClass = G_OBJECT_CLASS(klass); GstBaseSinkClass* baseSinkClass = GST_BASE_SINK_CLASS(klass); GstElementClass* elementClass = GST_ELEMENT_CLASS(klass); gst_element_class_add_pad_template(elementClass, gst_static_pad_template_get(&s_sinkTemplate)); gst_element_class_set_metadata(elementClass, "WebKit video sink", "Sink/Video", "Sends video data from a GStreamer pipeline to a Cairo surface", "Alp Toker <*****@*****.**>"); g_type_class_add_private(klass, sizeof(WebKitVideoSinkPrivate)); gobjectClass->dispose = webkitVideoSinkDispose; gobjectClass->get_property = webkitVideoSinkGetProperty; baseSinkClass->unlock = webkitVideoSinkUnlock; baseSinkClass->unlock_stop = webkitVideoSinkUnlockStop; baseSinkClass->render = webkitVideoSinkRender; baseSinkClass->preroll = webkitVideoSinkRender; baseSinkClass->stop = webkitVideoSinkStop; baseSinkClass->start = webkitVideoSinkStart; baseSinkClass->set_caps = webkitVideoSinkSetCaps; baseSinkClass->propose_allocation = webkitVideoSinkProposeAllocation; g_object_class_install_property(gobjectClass, PROP_CAPS, g_param_spec_boxed("current-caps", "Current-Caps", "Current caps", GST_TYPE_CAPS, G_PARAM_READABLE)); webkitVideoSinkSignals[REPAINT_REQUESTED] = g_signal_new("repaint-requested", G_TYPE_FROM_CLASS(klass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, // Class offset 0, // Accumulator 0, // Accumulator data g_cclosure_marshal_generic, G_TYPE_NONE, // Return type 1, // Only one parameter GST_TYPE_BUFFER); }
static void gst_gdk_pixbuf_sink_class_init (GstGdkPixbufSinkClass * klass) { GstBaseSinkClass *basesink_class = GST_BASE_SINK_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->set_property = gst_gdk_pixbuf_sink_set_property; gobject_class->get_property = gst_gdk_pixbuf_sink_get_property; /* FIXME 0.11, remove in favour of post-messages */ g_object_class_install_property (gobject_class, PROP_SEND_MESSAGES, g_param_spec_boolean ("send-messages", "Send Messages", "Whether to post messages containing pixbufs on the bus " " (deprecated, use post-messages)", DEFAULT_SEND_MESSAGES, G_PARAM_READWRITE)); /** * GstGdkPixbuf:post-messages: * * Post messages on the bus containing pixbufs. * * Since: 0.10.17 */ g_object_class_install_property (gobject_class, PROP_POST_MESSAGES, g_param_spec_boolean ("post-messages", "Post Messages", "Whether to post messages containing pixbufs on the bus", DEFAULT_POST_MESSAGES, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_LAST_PIXBUF, g_param_spec_object ("last-pixbuf", "Last Pixbuf", "Last GdkPixbuf object rendered", GDK_TYPE_PIXBUF, G_PARAM_READABLE)); basesink_class->start = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_start); basesink_class->stop = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_stop); basesink_class->render = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_render); basesink_class->preroll = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_preroll); basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_sink_set_caps); }
static void gst_fd_sink_class_init (GstFdSinkClass * klass) { GObjectClass *gobject_class; GstBaseSinkClass *gstbasesink_class; gobject_class = G_OBJECT_CLASS (klass); gstbasesink_class = GST_BASE_SINK_CLASS (klass); gobject_class->set_property = gst_fd_sink_set_property; gobject_class->get_property = gst_fd_sink_get_property; gobject_class->dispose = gst_fd_sink_dispose; gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_fd_sink_render); gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_fd_sink_start); gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_fd_sink_stop); gstbasesink_class->unlock = GST_DEBUG_FUNCPTR (gst_fd_sink_unlock); gstbasesink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_fd_sink_unlock_stop); gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_fd_sink_event); g_object_class_install_property (gobject_class, ARG_FD, g_param_spec_int ("fd", "fd", "An open file descriptor to write to", 0, G_MAXINT, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); }
static gboolean gst_decklink_audio_sink_event (GstBaseSink * bsink, GstEvent * event) { GstDecklinkAudioSink *self = GST_DECKLINK_AUDIO_SINK_CAST (bsink); if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) { const GstSegment *new_segment; gst_event_parse_segment (event, &new_segment); if (ABS (new_segment->rate) != 1.0) { guint out_rate = self->info.rate / ABS (new_segment->rate); if (self->resampler && (self->resampler_out_rate != out_rate || self->resampler_in_rate != (guint) self->info.rate)) gst_audio_resampler_update (self->resampler, self->info.rate, out_rate, NULL); else if (!self->resampler) self->resampler = gst_audio_resampler_new (GST_AUDIO_RESAMPLER_METHOD_LINEAR, GST_AUDIO_RESAMPLER_FLAG_NONE, self->info.finfo->format, self->info.channels, self->info.rate, out_rate, NULL); self->resampler_in_rate = self->info.rate; self->resampler_out_rate = out_rate; } else if (self->resampler) { gst_audio_resampler_free (self->resampler); self->resampler = NULL; } if (new_segment->rate < 0) gst_audio_stream_align_set_rate (self->stream_align, -48000); } return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event); }
static gboolean gst_curl_smtp_sink_event (GstBaseSink * bsink, GstEvent * event) { GstCurlBaseSink *bcsink = GST_CURL_BASE_SINK (bsink); GstCurlSmtpSink *sink = GST_CURL_SMTP_SINK (bsink); switch (event->type) { case GST_EVENT_EOS: GST_DEBUG_OBJECT (sink, "received EOS"); gst_curl_base_sink_set_live (bcsink, FALSE); GST_OBJECT_LOCK (sink); sink->eos = TRUE; GST_OBJECT_UNLOCK (sink); if (sink->base64_chunk != NULL) add_final_boundary_unlocked (sink); gst_curl_base_sink_transfer_thread_notify_unlocked (bcsink); GST_OBJECT_LOCK (sink); if (sink->base64_chunk != NULL && bcsink->flow_ret == GST_FLOW_OK) { gst_curl_smtp_sink_wait_for_transfer_end_unlocked (sink); } GST_OBJECT_UNLOCK (sink); gst_curl_base_sink_transfer_thread_close (bcsink); break; default: break; } return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event); }
static gboolean gst_inter_audio_sink_event (GstBaseSink * sink, GstEvent * event) { GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS:{ GstBuffer *tmp; guint n; if ((n = gst_adapter_available (interaudiosink->input_adapter)) > 0) { g_mutex_lock (&interaudiosink->surface->mutex); tmp = gst_adapter_take_buffer (interaudiosink->input_adapter, n); gst_adapter_push (interaudiosink->surface->audio_adapter, tmp); g_mutex_unlock (&interaudiosink->surface->mutex); } break; } default: break; } return GST_BASE_SINK_CLASS (parent_class)->event (sink, event); }
static void gst_inter_video_sink_class_init (GstInterVideoSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass); GstVideoSinkClass *video_sink_class = GST_VIDEO_SINK_CLASS (klass); GST_DEBUG_CATEGORY_INIT (gst_inter_video_sink_debug_category, "intervideosink", 0, "debug category for intervideosink element"); gst_element_class_add_static_pad_template (element_class, &gst_inter_video_sink_sink_template); gst_element_class_set_static_metadata (element_class, "Internal video sink", "Sink/Video", "Virtual video sink for internal process communication", "David Schleef <*****@*****.**>"); gobject_class->set_property = gst_inter_video_sink_set_property; gobject_class->get_property = gst_inter_video_sink_get_property; gobject_class->finalize = gst_inter_video_sink_finalize; base_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_inter_video_sink_get_times); base_sink_class->start = GST_DEBUG_FUNCPTR (gst_inter_video_sink_start); base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_inter_video_sink_stop); base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_video_sink_set_caps); video_sink_class->show_frame = GST_DEBUG_FUNCPTR (gst_inter_video_sink_show_frame); g_object_class_install_property (gobject_class, PROP_CHANNEL, g_param_spec_string ("channel", "Channel", "Channel name to match inter src and sink elements", DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); }
static void gst_multi_file_sink_class_init (GstMultiFileSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); GstBaseSinkClass *gstbasesink_class = GST_BASE_SINK_CLASS (klass); gobject_class->set_property = gst_multi_file_sink_set_property; gobject_class->get_property = gst_multi_file_sink_get_property; g_object_class_install_property (gobject_class, PROP_LOCATION, g_param_spec_string ("location", "File Location", "Location of the file to write", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_INDEX, g_param_spec_int ("index", "Index", "Index to use with location property to create file names. The " "index is incremented by one for each buffer written.", 0, G_MAXINT, DEFAULT_INDEX, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstMultiFileSink:post-messages: * * Post a message on the GstBus for each file. */ g_object_class_install_property (gobject_class, PROP_POST_MESSAGES, g_param_spec_boolean ("post-messages", "Post Messages", "Post a message for each file with information of the buffer", DEFAULT_POST_MESSAGES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstMultiFileSink:next-file: * * When to start a new file. */ g_object_class_install_property (gobject_class, PROP_NEXT_FILE, g_param_spec_enum ("next-file", "Next File", "When to start a new file", GST_TYPE_MULTI_FILE_SINK_NEXT, DEFAULT_NEXT_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstMultiFileSink:max-files: * * Maximum number of files to keep on disk. Once the maximum is reached, old * files start to be deleted to make room for new ones. */ g_object_class_install_property (gobject_class, PROP_MAX_FILES, g_param_spec_uint ("max-files", "Max files", "Maximum number of files to keep on disk. Once the maximum is reached," "old files start to be deleted to make room for new ones.", 0, G_MAXUINT, DEFAULT_MAX_FILES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstMultiFileSink:max-file-size: * * Maximum file size before starting a new file in max-size mode. */ g_object_class_install_property (gobject_class, PROP_MAX_FILE_SIZE, g_param_spec_uint64 ("max-file-size", "Maximum File Size", "Maximum file size before starting a new file in max-size mode", 0, G_MAXUINT64, DEFAULT_MAX_FILE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstMultiFileSink:max-file-duration: * * Maximum file size before starting a new file in max-size mode. */ g_object_class_install_property (gobject_class, PROP_MAX_FILE_DURATION, g_param_spec_uint64 ("max-file-duration", "Maximum File Duration", "Maximum file duration before starting a new file in max-size mode", 0, G_MAXUINT64, DEFAULT_MAX_FILE_DURATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstMultiFileSink:aggregate-gops: * * Whether to aggregate complete GOPs before doing any processing. Set this * to TRUE to make sure each new file starts with a keyframe. This requires * the upstream element to flag buffers containing key units and delta * units correctly. At least the MPEG-PS and MPEG-TS muxers should be doing * this. * * Since: 1.6 */ g_object_class_install_property (gobject_class, PROP_AGGREGATE_GOPS, g_param_spec_boolean ("aggregate-gops", "Aggregate GOPs", "Whether to aggregate GOPs and process them as a whole without " "splitting", DEFAULT_AGGREGATE_GOPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gobject_class->finalize = gst_multi_file_sink_finalize; gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_multi_file_sink_start); gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_multi_file_sink_stop); gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_multi_file_sink_render); gstbasesink_class->render_list = GST_DEBUG_FUNCPTR (gst_multi_file_sink_render_list); gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_multi_file_sink_set_caps); gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_multi_file_sink_event); GST_DEBUG_CATEGORY_INIT (gst_multi_file_sink_debug, "multifilesink", 0, "multifilesink element"); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_static_metadata (gstelement_class, "Multi-File Sink", "Sink/File", "Write buffers to a sequentially named set of files", "David Schleef <*****@*****.**>"); }
/****************************************************************************** * gst_tidmaivideosink_class_init ******************************************************************************/ static void gst_tidmaivideosink_class_init(GstTIDmaiVideoSinkClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; GstBaseSinkClass *gstbase_sink_class; gobject_class = G_OBJECT_CLASS(klass); gstelement_class = GST_ELEMENT_CLASS(klass); gstbase_sink_class = GST_BASE_SINK_CLASS(klass); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tidmaivideosink_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tidmaivideosink_get_property); g_object_class_install_property(gobject_class, PROP_DISPLAYSTD, g_param_spec_string("displayStd", "Display Standard", "Use V4L2 or FBDev for Video Display", NULL, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_DISPLAYDEVICE, g_param_spec_string("displayDevice", "Display Device", "Video device to use (usually /dev/video0", NULL, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_VIDEOSTD, g_param_spec_string("videoStd", "Video Standard", "Video Standard used\n" "\tAUTO (if supported), CIF, SIF_NTSC, SIF_PAL, VGA, D1_NTSC\n" "\tD1_PAL, 480P, 576P, 720P_60, 720P_50, 1080I_30, 1080I_25\n" "\t1080P_30, 1080P_25, 1080P_24, PRGB\n", NULL, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_VIDEOOUTPUT, g_param_spec_string("videoOutput", "Video Output", "Output used to display video (i.e. Composite, Component, " "LCD, DVI)", NULL, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_AUTOSELECT, g_param_spec_boolean("autoselect", "Auto Select the VideoStd", "Automatically select the Video Standard to use based on " "the video input. This only works when the upstream element " "sets the video size attributes in the buffer", FALSE, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_NUMBUFS, g_param_spec_int("numBufs", "Number of Video Buffers", "Number of video buffers allocated by the driver", -1, G_MAXINT, -1, G_PARAM_READWRITE)); #if PLATFORM == omap35x g_object_class_install_property(gobject_class, PROP_ROTATION, g_param_spec_int("rotation", "Rotation angle", "Rotation angle " "(OMAP35x only)", -1, G_MAXINT, -1, G_PARAM_READWRITE)); #endif g_object_class_install_property(gobject_class, PROP_ACCEL_FRAME_COPY, g_param_spec_boolean("accelFrameCopy", "Accel frame copy", "Use hardware accelerated framecopy", TRUE, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_NOMEMCPY, g_param_spec_boolean("noCopy", "Enable support for pad-allocation (zero memcpy)", "Enable support for pad-allocation (zero memcpy)", FALSE, G_PARAM_READWRITE)); /*Positioning*/ g_object_class_install_property(gobject_class, PROP_X_POSITION, g_param_spec_int("x", "x position", "X positioning of" " frame in display", G_MININT, G_MAXINT, -1, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_Y_POSITION, g_param_spec_int("y", "y position", "Y positioning of" " frame in display", G_MININT, G_MAXINT, -1, G_PARAM_READWRITE)); gstbase_sink_class->set_caps = GST_DEBUG_FUNCPTR(gst_tidmaivideosink_set_caps); gstbase_sink_class->start = GST_DEBUG_FUNCPTR(gst_tidmaivideosink_start); gstbase_sink_class->stop = GST_DEBUG_FUNCPTR(gst_tidmaivideosink_stop); gstbase_sink_class->preroll = GST_DEBUG_FUNCPTR(gst_tidmaivideosink_preroll); gstbase_sink_class->render = GST_DEBUG_FUNCPTR(gst_tidmaivideosink_render); gstbase_sink_class->buffer_alloc = GST_DEBUG_FUNCPTR(gst_tidmaivideosink_buffer_alloc); }
static void cogl_gst_video_sink_class_init (CoglGstVideoSinkClass *klass) { GObjectClass *go_class = G_OBJECT_CLASS (klass); GstBaseSinkClass *gb_class = GST_BASE_SINK_CLASS (klass); GstElementClass *ge_class = GST_ELEMENT_CLASS (klass); GstPadTemplate *pad_template; GParamSpec *pspec; g_type_class_add_private (klass, sizeof (CoglGstVideoSinkPrivate)); go_class->set_property = cogl_gst_video_sink_set_property; go_class->get_property = cogl_gst_video_sink_get_property; go_class->dispose = cogl_gst_video_sink_dispose; go_class->finalize = cogl_gst_video_sink_finalize; pad_template = gst_static_pad_template_get (&sinktemplate_all); gst_element_class_add_pad_template (ge_class, pad_template); gst_element_class_set_metadata (ge_class, "Cogl video sink", "Sink/Video", "Sends video data from GStreamer to a " "Cogl pipeline", "Jonathan Matthew <*****@*****.**>, " "Matthew Allum <[email protected], " "Chris Lord <*****@*****.**>, " "Plamena Manolova " "<*****@*****.**>"); gb_class->render = _cogl_gst_video_sink_render; gb_class->preroll = _cogl_gst_video_sink_render; gb_class->start = cogl_gst_video_sink_start; gb_class->stop = cogl_gst_video_sink_stop; gb_class->set_caps = cogl_gst_video_sink_set_caps; gb_class->get_caps = cogl_gst_video_sink_get_caps; pspec = g_param_spec_int ("update-priority", "Update Priority", "Priority of video updates in the thread", -G_MAXINT, G_MAXINT, COGL_GST_DEFAULT_PRIORITY, COGL_GST_PARAM_READWRITE); g_object_class_install_property (go_class, PROP_UPDATE_PRIORITY, pspec); video_sink_signals[PIPELINE_READY_SIGNAL] = g_signal_new ("pipeline-ready", COGL_GST_TYPE_VIDEO_SINK, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CoglGstVideoSinkClass, pipeline_ready), NULL, /* accumulator */ NULL, /* accu_data */ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 /* n_params */); video_sink_signals[NEW_FRAME_SIGNAL] = g_signal_new ("new-frame", COGL_GST_TYPE_VIDEO_SINK, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CoglGstVideoSinkClass, new_frame), NULL, /* accumulator */ NULL, /* accu_data */ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 /* n_params */); }
static gboolean gst_app_sink_event (GstBaseSink * sink, GstEvent * event) { GstAppSink *appsink = GST_APP_SINK_CAST (sink); GstAppSinkPrivate *priv = appsink->priv; switch (event->type) { case GST_EVENT_SEGMENT: g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "receiving SEGMENT"); g_queue_push_tail (priv->queue, gst_event_ref (event)); if (!priv->preroll) gst_event_copy_segment (event, &priv->preroll_segment); g_mutex_unlock (&priv->mutex); break; case GST_EVENT_EOS:{ gboolean emit = TRUE; g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "receiving EOS"); priv->is_eos = TRUE; g_cond_signal (&priv->cond); g_mutex_unlock (&priv->mutex); g_mutex_lock (&priv->mutex); /* wait until all buffers are consumed or we're flushing. * Otherwise we might signal EOS before all buffers are * consumed, which is a bit confusing for the application */ while (priv->num_buffers > 0 && !priv->flushing) g_cond_wait (&priv->cond, &priv->mutex); if (priv->flushing) emit = FALSE; g_mutex_unlock (&priv->mutex); if (emit) { /* emit EOS now */ if (priv->callbacks.eos) priv->callbacks.eos (appsink, priv->user_data); else g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_EOS], 0); } break; } case GST_EVENT_FLUSH_START: /* we don't have to do anything here, the base class will call unlock * which will make sure we exit the _render method */ GST_DEBUG_OBJECT (appsink, "received FLUSH_START"); break; case GST_EVENT_FLUSH_STOP: g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "received FLUSH_STOP"); gst_app_sink_flush_unlocked (appsink); g_mutex_unlock (&priv->mutex); break; default: break; } return GST_BASE_SINK_CLASS (parent_class)->event (sink, event); }
static void gst_dasf_sink_class_init (GstDasfSinkClass* klass) { GObjectClass* g_klass; GParamSpec* pspec; GstBaseSinkClass* gst_base_klass; GstElementClass *gst_element_klass; const char *env; if ((env=getenv("USE_OMX_CLOCK")) && (atoi(env) == 1)) { GST_INFO ("using OMX_CLOCK as default"); default_clock_source = OMX_CLOCK; default_clock_required = OMX_CLOCK; } else { GST_INFO ("using GSTREAMER_CLOCK as default"); default_clock_source = GSTREAMER_CLOCK; default_clock_required = GSTREAMER_CLOCK; } /* gobject */ g_klass = G_OBJECT_CLASS (klass); g_type_class_add_private (klass, sizeof (GstDasfSinkPrivate)); g_klass->set_property = GST_DEBUG_FUNCPTR (gst_dasf_sink_set_property); g_klass->get_property = GST_DEBUG_FUNCPTR (gst_dasf_sink_get_property); g_klass->dispose = GST_DEBUG_FUNCPTR (gst_dasf_sink_dispose); pspec = g_param_spec_uint ("input-buffers", "Input buffers", "The number of OMX input buffers", 1, 10, NUM_INPUT_BUFFERS_DEFAULT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property (g_klass, PROP_NUM_INPUT_BUFFERS, pspec); pspec = g_param_spec_enum ("clock-source", "Clock Source", "Selects the clock source to synchronize", GST_DASF_SINK_CLOCK_SOURCE, default_clock_source, G_PARAM_READWRITE); g_object_class_install_property (g_klass, PROP_CLOCK_SOURCE, pspec); pspec = g_param_spec_enum ("clock-required", "Clock Required", "The clock more suitable for the pipeline", GST_DASF_SINK_CLOCK_SOURCE, default_clock_required, G_PARAM_READABLE); g_object_class_install_property (g_klass, PROP_CLOCK_REQUIRED, pspec); pspec = g_param_spec_boolean ("halted", "", "Halt the peer sinks", FALSE, G_PARAM_WRITABLE); g_object_class_install_property (g_klass, PROP_HALTED, pspec); /* GST */ gst_base_klass = GST_BASE_SINK_CLASS (klass); gst_element_klass = GST_ELEMENT_CLASS (klass); /* GST BASE SINK */ gst_base_klass->preroll = GST_DEBUG_FUNCPTR (gst_dasf_sink_preroll); gst_base_klass->render = GST_DEBUG_FUNCPTR (gst_dasf_sink_render); gst_base_klass->event = GST_DEBUG_FUNCPTR (gst_dasf_sink_event); gst_base_klass->set_caps = GST_DEBUG_FUNCPTR (gst_dasf_sink_setcaps); /* GST ELEMENT */ GST_ELEMENT_CLASS (klass)->change_state = GST_DEBUG_FUNCPTR (gst_dasf_sink_change_state); return; }
static void gst_fake_sink_class_init (GstFakeSinkClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; GstBaseSinkClass *gstbase_sink_class; gobject_class = G_OBJECT_CLASS (klass); gstelement_class = GST_ELEMENT_CLASS (klass); gstbase_sink_class = GST_BASE_SINK_CLASS (klass); gobject_class->set_property = gst_fake_sink_set_property; gobject_class->get_property = gst_fake_sink_get_property; gobject_class->finalize = gst_fake_sink_finalize; g_object_class_install_property (gobject_class, PROP_STATE_ERROR, g_param_spec_enum ("state-error", "State Error", "Generate a state change error", GST_TYPE_FAKE_SINK_STATE_ERROR, DEFAULT_STATE_ERROR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); pspec_last_message = g_param_spec_string ("last-message", "Last Message", "The message describing current status", DEFAULT_LAST_MESSAGE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (gobject_class, PROP_LAST_MESSAGE, pspec_last_message); g_object_class_install_property (gobject_class, PROP_SIGNAL_HANDOFFS, g_param_spec_boolean ("signal-handoffs", "Signal handoffs", "Send a signal before unreffing the buffer", DEFAULT_SIGNAL_HANDOFFS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DROP_OUT_OF_SEGMENT, g_param_spec_boolean ("drop-out-of-segment", "Drop out-of-segment buffers", "Drop and don't render / hand off out-of-segment buffers", DEFAULT_DROP_OUT_OF_SEGMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SILENT, g_param_spec_boolean ("silent", "Silent", "Don't produce last_message events", DEFAULT_SILENT, G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DUMP, g_param_spec_boolean ("dump", "Dump", "Dump buffer contents to stdout", DEFAULT_DUMP, G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PUSH, g_param_spec_boolean ("can-activate-push", "Can activate push", "Can activate in push mode", DEFAULT_CAN_ACTIVATE_PUSH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PULL, g_param_spec_boolean ("can-activate-pull", "Can activate pull", "Can activate in pull mode", DEFAULT_CAN_ACTIVATE_PULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_NUM_BUFFERS, g_param_spec_int ("num-buffers", "num-buffers", "Number of buffers to accept going EOS", -1, G_MAXINT, DEFAULT_NUM_BUFFERS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstFakeSink::handoff: * @fakesink: the fakesink instance * @buffer: the buffer that just has been received * @pad: the pad that received it * * This signal gets emitted before unreffing the buffer. */ gst_fake_sink_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD); /** * GstFakeSink::preroll-handoff: * @fakesink: the fakesink instance * @buffer: the buffer that just has been received * @pad: the pad that received it * * This signal gets emitted before unreffing the buffer. */ gst_fake_sink_signals[SIGNAL_PREROLL_HANDOFF] = g_signal_new ("preroll-handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeSinkClass, preroll_handoff), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD); gst_element_class_set_static_metadata (gstelement_class, "Fake Sink", "Sink", "Black hole for data", "Erik Walthinsen <*****@*****.**>, " "Wim Taymans <*****@*****.**>, " "Mr. 'frag-me-more' Vanderwingo <*****@*****.**>"); gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_fake_sink_change_state); gstbase_sink_class->event = GST_DEBUG_FUNCPTR (gst_fake_sink_event); gstbase_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_fake_sink_preroll); gstbase_sink_class->render = GST_DEBUG_FUNCPTR (gst_fake_sink_render); gstbase_sink_class->query = GST_DEBUG_FUNCPTR (gst_fake_sink_query); }
static void gst_decklink_video_sink_class_init (GstDecklinkVideoSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstBaseSinkClass *basesink_class = GST_BASE_SINK_CLASS (klass); GstCaps *templ_caps; gobject_class->set_property = gst_decklink_video_sink_set_property; gobject_class->get_property = gst_decklink_video_sink_get_property; gobject_class->finalize = gst_decklink_video_sink_finalize; element_class->change_state = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_change_state); element_class->state_changed = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_state_changed); element_class->provide_clock = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_provide_clock); basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_get_caps); basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_set_caps); basesink_class->prepare = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_prepare); basesink_class->render = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_render); // FIXME: These are misnamed in basesink! basesink_class->start = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_open); basesink_class->stop = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_close); basesink_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_propose_allocation); g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Playback Mode", "Video Mode to use for playback", GST_TYPE_DECKLINK_MODE, GST_DECKLINK_MODE_NTSC, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER, g_param_spec_int ("device-number", "Device number", "Output device instance to use", 0, G_MAXINT, 0, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_VIDEO_FORMAT, g_param_spec_enum ("video-format", "Video format", "Video format type to use for playback", GST_TYPE_DECKLINK_VIDEO_FORMAT, GST_DECKLINK_VIDEO_FORMAT_8BIT_YUV, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_TIMECODE_FORMAT, g_param_spec_enum ("timecode-format", "Timecode format", "Timecode format type to use for playback", GST_TYPE_DECKLINK_TIMECODE_FORMAT, GST_DECKLINK_TIMECODE_FORMAT_RP188ANY, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); templ_caps = gst_decklink_mode_get_template_caps (FALSE); templ_caps = gst_caps_make_writable (templ_caps); /* For output we support any framerate and only really care about timestamps */ gst_caps_map_in_place (templ_caps, reset_framerate, NULL); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, templ_caps)); gst_caps_unref (templ_caps); gst_element_class_set_static_metadata (element_class, "Decklink Video Sink", "Video/Sink", "Decklink Sink", "David Schleef <*****@*****.**>, " "Sebastian Dröge <*****@*****.**>"); GST_DEBUG_CATEGORY_INIT (gst_decklink_video_sink_debug, "decklinkvideosink", 0, "debug category for decklinkvideosink element"); }
static gboolean gst_multi_file_sink_event (GstBaseSink * sink, GstEvent * event) { GstMultiFileSink *multifilesink; gchar *filename; multifilesink = GST_MULTI_FILE_SINK (sink); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_DOWNSTREAM: { GstClockTime timestamp, duration; GstClockTime running_time, stream_time; guint64 offset, offset_end; gboolean all_headers; guint count; if (multifilesink->next_file != GST_MULTI_FILE_SINK_NEXT_KEY_UNIT_EVENT || !gst_video_event_is_force_key_unit (event)) goto out; gst_video_event_parse_downstream_force_key_unit (event, ×tamp, &stream_time, &running_time, &all_headers, &count); if (multifilesink->force_key_unit_count != -1 && multifilesink->force_key_unit_count == count) goto out; multifilesink->force_key_unit_count = count; if (multifilesink->file) { duration = GST_CLOCK_TIME_NONE; offset = offset_end = -1; filename = g_strdup_printf (multifilesink->filename, multifilesink->index); gst_multi_file_sink_close_file (multifilesink, NULL); gst_multi_file_sink_post_message_full (multifilesink, timestamp, duration, offset, offset_end, running_time, stream_time, filename); g_free (filename); } if (multifilesink->file == NULL) { if (!gst_multi_file_sink_open_next_file (multifilesink)) goto stdio_write_error; } break; } case GST_EVENT_EOS: if (multifilesink->aggregate_gops) { GstBuffer *buf = gst_buffer_new (); /* push key unit buffer to force writing out the pending GOP data */ GST_INFO_OBJECT (sink, "EOS, write pending GOP data"); GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); gst_multi_file_sink_render (sink, buf); gst_buffer_unref (buf); } if (multifilesink->file) { gchar *filename; filename = g_strdup_printf (multifilesink->filename, multifilesink->index); gst_multi_file_sink_close_file (multifilesink, NULL); gst_multi_file_sink_post_message_from_time (multifilesink, GST_BASE_SINK (multifilesink)->segment.position, -1, filename); g_free (filename); } break; default: break; } out: return GST_BASE_SINK_CLASS (parent_class)->event (sink, event); /* ERRORS */ stdio_write_error: { GST_ELEMENT_ERROR (multifilesink, RESOURCE, WRITE, ("Error while writing to file."), (NULL)); gst_event_unref (event); return FALSE; } }
/** * @brief Initialize tensor_sink2 class. */ static void gst_tensor_sink2_class_init (GstTensorSink2Class * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstBaseSinkClass *bsink_class; gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); bsink_class = GST_BASE_SINK_CLASS (klass); /** GObject methods */ gobject_class->set_property = gst_tensor_sink2_set_property; gobject_class->get_property = gst_tensor_sink2_get_property; gobject_class->dispose = gst_tensor_sink2_dispose; gobject_class->finalize = gst_tensor_sink2_finalize; /** * GstTensorSink2::signal-rate: * * The number of new data signals per second (Default 0 for unlimited, MAX 500) * If signal-rate is larger than 0, GstTensorSink2 calculates the time to emit a signal with this property. * If set 0 (default value), all the received buffers will be passed to the application. * * Please note that this property does not guarantee the periodic signals. * This means if GstTensorSink2 cannot get the buffers in time, it will pass all the buffers. (working like default 0) */ g_object_class_install_property (gobject_class, PROP_SIGNAL_RATE, g_param_spec_uint ("signal-rate", "Signal rate", "New data signals per second (0 for unlimited, max 500)", 0, 500, DEFAULT_SIGNAL_RATE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstTensorSink2::emit-signal: * * The flag to emit the signals for new data, stream start, and eos. */ g_object_class_install_property (gobject_class, PROP_EMIT_SIGNAL, g_param_spec_boolean ("emit-signal", "Emit signal", "Emit signal for new data, stream start, eos", DEFAULT_EMIT_SIGNAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstTensorSink2::silent: * * The flag to enable/disable debugging messages. */ g_object_class_install_property (gobject_class, PROP_SILENT, g_param_spec_boolean ("silent", "Silent", "Produce verbose output", DEFAULT_SILENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstTensorSink2::new-data: * * Signal to get the buffer from GstTensorSink2. */ _tensor_sink2_signals[SIGNAL_NEW_DATA] = g_signal_new ("new-data", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTensorSink2Class, new_data), NULL, NULL, NULL, G_TYPE_NONE, 1, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE); /** * GstTensorSink2::stream-start: * * Signal to indicate the start of a new stream. * Optional. An application can use this signal to detect the start of a new stream, instead of the message GST_MESSAGE_STREAM_START from pipeline. */ _tensor_sink2_signals[SIGNAL_STREAM_START] = g_signal_new ("stream-start", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTensorSink2Class, stream_start), NULL, NULL, NULL, G_TYPE_NONE, 0, G_TYPE_NONE); /** * GstTensorSink2::eos: * * Signal to indicate the end-of-stream. * Optional. An application can use this signal to detect the EOS (end-of-stream), instead of the message GST_MESSAGE_EOS from pipeline. */ _tensor_sink2_signals[SIGNAL_EOS] = g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTensorSink2Class, eos), NULL, NULL, NULL, G_TYPE_NONE, 0, G_TYPE_NONE); gst_element_class_set_static_metadata (element_class, "TensorSink", "Sink/Tensor", "Sink element to handle tensor stream", "Samsung Electronics Co., Ltd."); /** pad template */ gst_element_class_add_static_pad_template (element_class, &sink_template); /** GstBaseSink methods */ bsink_class->start = GST_DEBUG_FUNCPTR (gst_tensor_sink2_start); bsink_class->stop = GST_DEBUG_FUNCPTR (gst_tensor_sink2_stop); bsink_class->event = GST_DEBUG_FUNCPTR (gst_tensor_sink2_event); bsink_class->query = GST_DEBUG_FUNCPTR (gst_tensor_sink2_query); bsink_class->render = GST_DEBUG_FUNCPTR (gst_tensor_sink2_render); bsink_class->render_list = GST_DEBUG_FUNCPTR (gst_tensor_sink2_render_list); bsink_class->set_caps = GST_DEBUG_FUNCPTR (gst_tensor_sink2_set_caps); bsink_class->get_caps = GST_DEBUG_FUNCPTR (gst_tensor_sink2_get_caps); }