static guint gst_app_src_signals[LAST_SIGNAL] = { 0 };
-static void
-_do_init (GType filesrc_type)
-{
- static const GInterfaceInfo urihandler_info = {
- gst_app_src_uri_handler_init,
- NULL,
- NULL
- };
- g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
- &urihandler_info);
-}
-
-GST_BOILERPLATE_FULL (GstAppSrc, gst_app_src, GstBaseSrc, GST_TYPE_BASE_SRC,
- _do_init);
-
-static void
-gst_app_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element");
-
- gst_element_class_set_details_simple (element_class, "AppSrc",
- "Generic/Source", "Allow the application to feed buffers to a pipeline",
- "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_app_src_template));
-}
+#define gst_app_src_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAppSrc, gst_app_src, GST_TYPE_BASE_SRC,
+ G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_app_src_uri_handler_init));
static void
gst_app_src_class_init (GstAppSrcClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *element_class = (GstElementClass *) klass;
GstBaseSrcClass *basesrc_class = (GstBaseSrcClass *) klass;
+ GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element");
+
gobject_class->dispose = gst_app_src_dispose;
gobject_class->finalize = gst_app_src_finalize;
end_of_stream), NULL, NULL, __gst_app_marshal_ENUM__VOID,
GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
+ gst_element_class_set_details_simple (element_class, "AppSrc",
+ "Generic/Source", "Allow the application to feed buffers to a pipeline",
+ "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_app_src_template));
+
basesrc_class->create = gst_app_src_create;
basesrc_class->start = gst_app_src_start;
basesrc_class->stop = gst_app_src_stop;
}
static void
-gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass)
+gst_app_src_init (GstAppSrc * appsrc)
{
GstAppSrcPrivate *priv;
gint64 desired_position;
gboolean res = FALSE;
- desired_position = segment->last_stop;
+ desired_position = segment->position;
GST_DEBUG_OBJECT (appsrc, "seeking to %" G_GINT64_FORMAT ", format %s",
desired_position, gst_format_get_name (segment->format));
GST_DEBUG_OBJECT (appsrc,
"Size changed from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT,
bsrc->segment.duration, priv->size);
- gst_segment_set_duration (&bsrc->segment, GST_FORMAT_BYTES, priv->size);
+ bsrc->segment.duration = priv->size;
GST_OBJECT_UNLOCK (appsrc);
gst_element_post_message (GST_ELEMENT (appsrc),
guint buf_size;
*buf = g_queue_pop_head (priv->queue);
- buf_size = GST_BUFFER_SIZE (*buf);
+ buf_size = gst_buffer_get_size (*buf);
GST_DEBUG_OBJECT (appsrc, "we have buffer %p of size %u", *buf, buf_size);
/* only update the offset when in random_access mode */
if (priv->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS)
priv->offset += buf_size;
- if (caps) {
- *buf = gst_buffer_make_metadata_writable (*buf);
- gst_buffer_set_caps (*buf, caps);
- }
/* signal that we removed an item */
g_cond_broadcast (priv->cond);
if (!steal_ref)
gst_buffer_ref (buffer);
g_queue_push_tail (priv->queue, buffer);
- priv->queued_bytes += GST_BUFFER_SIZE (buffer);
+ priv->queued_bytes += gst_buffer_get_size (buffer);
g_cond_broadcast (priv->cond);
g_mutex_unlock (priv->mutex);