#define DEFAULT_CAN_ACTIVATE_PUSH TRUE
#define DEFAULT_CAN_ACTIVATE_PULL FALSE
#define DEFAULT_NUM_BUFFERS -1
+#ifdef TIZEN_FEATURE_FAKESINK_MODIFICATION
+#define DEFAULT_NUMER_FPS 0
+#define DEFAULT_DEN_FPS 1
+#endif
enum
{
GstBuffer * buffer);
static gboolean gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event);
static gboolean gst_fake_sink_query (GstBaseSink * bsink, GstQuery * query);
+#ifdef TIZEN_FEATURE_FAKESINK_MODIFICATION
+static gboolean gst_fake_sink_set_caps (GstBaseSink * bsink, GstCaps * caps);
+static void gst_fake_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
+ GstClockTime * start, GstClockTime * end);
+#endif
static guint gst_fake_sink_signals[LAST_SIGNAL] = { 0 };
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);
+#ifdef TIZEN_FEATURE_FAKESINK_MODIFICATION
+ gstbase_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_fake_sink_set_caps);
+ gstbase_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_fake_sink_get_times);
+#endif
}
static void
fakesink->state_error = DEFAULT_STATE_ERROR;
fakesink->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
fakesink->num_buffers = DEFAULT_NUM_BUFFERS;
+#ifdef TIZEN_FEATURE_FAKESINK_MODIFICATION
+ fakesink->fps_n = DEFAULT_NUMER_FPS;
+ fakesink->fps_d = DEFAULT_DEN_FPS;
+#endif
gst_base_sink_set_sync (GST_BASE_SINK (fakesink), DEFAULT_SYNC);
gst_base_sink_set_drop_out_of_segment (GST_BASE_SINK (fakesink),
return ret;
}
+#ifdef TIZEN_FEATURE_FAKESINK_MODIFICATION
+static gboolean
+gst_fake_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
+{
+ GstFakeSink *sink;
+ GstStructure *structure;
+ const gchar *name;
+ gint fps_n, fps_d;
+
+ sink = GST_FAKE_SINK (bsink);
+ GST_DEBUG_OBJECT (sink, "set caps %" GST_PTR_FORMAT, caps);
+
+ structure = gst_caps_get_structure(caps, 0);
+ name = gst_structure_get_name(structure);
+
+ if (g_strrstr(name, "video/")) {
+ if (gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d)) {
+ if (fps_n == 0) {
+ /* in case of variable framerate, need to check max-framerate value */
+ gst_structure_get_fraction (structure, "max-framerate", &fps_n, &fps_d);
+ }
+ sink->fps_n = fps_n;
+ sink->fps_d = fps_d;
+ } else {
+ GST_DEBUG_OBJECT (sink, "framerate is unspecified");
+ }
+ }
+
+ return TRUE;
+}
+
+static void
+gst_fake_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
+ GstClockTime * start, GstClockTime * end)
+{
+ /* to check valid buffer based on the start and end time */
+ GstFakeSink *sink;
+
+ sink = GST_FAKE_SINK (bsink);
+
+ if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+ *start = GST_BUFFER_TIMESTAMP (buf);
+
+ if (GST_BUFFER_DURATION_IS_VALID (buf)) {
+ *end = *start + GST_BUFFER_DURATION (buf);
+ } else {
+ if (sink->fps_n > 0) {
+ *end =
+ *start + gst_util_uint64_scale_int (GST_SECOND, sink->fps_d,
+ sink->fps_n);
+ }
+ }
+ }
+}
+#endif
+
static GstStateChangeReturn
gst_fake_sink_change_state (GstElement * element, GstStateChange transition)
{