static gboolean gst_inter_video_sink_start (GstBaseSink * sink) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); intervideosink->surface = gst_inter_surface_get (intervideosink->channel); return TRUE; }
void gst_inter_video_sink_finalize (GObject * object) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (object); /* clean up object here */ g_free (intervideosink->channel); G_OBJECT_CLASS (parent_class)->finalize (object); }
static gboolean gst_inter_video_sink_start (GstBaseSink * sink) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); intervideosink->surface = gst_inter_surface_get (intervideosink->channel); g_mutex_lock (&intervideosink->surface->mutex); memset (&intervideosink->surface->video_info, 0, sizeof (GstVideoInfo)); g_mutex_unlock (&intervideosink->surface->mutex); return TRUE; }
static GstFlowReturn gst_inter_video_sink_render (GstBaseSink * sink, GstBuffer * buffer) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); g_mutex_lock (intervideosink->surface->mutex); if (intervideosink->surface->video_buffer) { gst_buffer_unref (intervideosink->surface->video_buffer); } intervideosink->surface->video_buffer = gst_buffer_ref (buffer); intervideosink->surface->video_buffer_count = 0; g_mutex_unlock (intervideosink->surface->mutex); return GST_FLOW_OK; }
void gst_inter_video_sink_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (object); switch (property_id) { case PROP_CHANNEL: g_value_set_string (value, intervideosink->channel); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static gboolean gst_inter_video_sink_stop (GstBaseSink * sink) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); g_mutex_lock (intervideosink->surface->mutex); if (intervideosink->surface->video_buffer) { gst_buffer_unref (intervideosink->surface->video_buffer); } intervideosink->surface->video_buffer = NULL; g_mutex_unlock (intervideosink->surface->mutex); gst_inter_surface_unref (intervideosink->surface); intervideosink->surface = NULL; return TRUE; }
static GstFlowReturn gst_inter_video_sink_show_frame (GstVideoSink * sink, GstBuffer * buffer) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); GST_DEBUG_OBJECT (intervideosink, "render ts %" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_PTS (buffer))); g_mutex_lock (&intervideosink->surface->mutex); if (intervideosink->surface->video_buffer) { gst_buffer_unref (intervideosink->surface->video_buffer); } intervideosink->surface->video_buffer = gst_buffer_ref (buffer); intervideosink->surface->video_buffer_count = 0; g_mutex_unlock (&intervideosink->surface->mutex); return GST_FLOW_OK; }
static gboolean gst_inter_video_sink_set_caps (GstBaseSink * sink, GstCaps * caps) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); GstVideoInfo info; if (!gst_video_info_from_caps (&info, caps)) { GST_ERROR_OBJECT (sink, "Failed to parse caps %" GST_PTR_FORMAT, caps); return FALSE; } g_mutex_lock (&intervideosink->surface->mutex); intervideosink->surface->video_info = info; intervideosink->info = info; g_mutex_unlock (&intervideosink->surface->mutex); return TRUE; }
static void gst_inter_video_sink_get_times (GstBaseSink * sink, GstBuffer * buffer, GstClockTime * start, GstClockTime * end) { GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) { *start = GST_BUFFER_TIMESTAMP (buffer); if (GST_BUFFER_DURATION_IS_VALID (buffer)) { *end = *start + GST_BUFFER_DURATION (buffer); } else { if (intervideosink->info.fps_n > 0) { *end = *start + gst_util_uint64_scale_int (GST_SECOND, intervideosink->info.fps_d, intervideosink->info.fps_n); } } } }