summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst/app/gstappsrc.h
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-06-05 16:38:50 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-06-05 16:38:50 +0000
commit308354073ca3a67261f6cfa096490803bf037ccd (patch)
tree3d22cda2df0c74b2be38607998f394655fa9c109 /gst-libs/gst/app/gstappsrc.h
parentc6dffa0538819d2995d105e63b445359faa340d0 (diff)
downloadgst-plugins-bad-308354073ca3a67261f6cfa096490803bf037ccd.tar.gz
gst-plugins-bad-308354073ca3a67261f6cfa096490803bf037ccd.tar.bz2
gst-plugins-bad-308354073ca3a67261f6cfa096490803bf037ccd.zip
examples/app/: Added an example on how to use appsrc in playbin in streaming mode from an mmapped file.
Original commit message from CVS: * examples/app/.cvsignore: * examples/app/Makefile.am: * examples/app/appsrc-stream.c: (read_data), (start_feed), (stop_feed), (found_source), (bus_message), (main): Added an example on how to use appsrc in playbin in streaming mode from an mmapped file. * examples/app/appsrc_ex.c: (main): Set pipeline to NULL to free queued buffers. * gst-libs/gst/app/gstapp-marshal.list: * gst-libs/gst/app/gstappsrc.c: (stream_type_get_type), (_do_init), (gst_app_src_class_init), (gst_app_src_init), (gst_app_src_flush_queued), (gst_app_src_dispose), (gst_app_src_set_property), (gst_app_src_get_property), (gst_app_src_unlock), (gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop), (gst_app_src_is_seekable), (gst_app_src_check_get_range), (gst_app_src_do_seek), (gst_app_src_create), (gst_app_src_set_stream_type), (gst_app_src_get_stream_type), (gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes), (gst_app_src_push_buffer), (gst_app_src_end_of_stream), (gst_app_src_uri_get_type), (gst_app_src_uri_get_protocols), (gst_app_src_uri_get_uri), (gst_app_src_uri_set_uri), (gst_app_src_uri_handler_init): * gst-libs/gst/app/gstappsrc.h: Measure max queue size in bytes instead. Add support for 3 modes of operation, streaming, seekable and random-access, making basesrc handle the scheduling modes for each. Add appsrc:// uri handler so that automatic plugging can be done from playbin2 or uridecodebin, for example. Added support for custom segment formats. Add support for push and pull based operations from the application. Expand the methods so that errors can be detected. Flush the queued buffers on seeks and when shutting down. Add signals to inform the app that a seek must happen.
Diffstat (limited to 'gst-libs/gst/app/gstappsrc.h')
-rw-r--r--gst-libs/gst/app/gstappsrc.h59
1 files changed, 40 insertions, 19 deletions
diff --git a/gst-libs/gst/app/gstappsrc.h b/gst-libs/gst/app/gstappsrc.h
index 4ca5cbc9..1ce73b4c 100644
--- a/gst-libs/gst/app/gstappsrc.h
+++ b/gst-libs/gst/app/gstappsrc.h
@@ -39,9 +39,27 @@ G_BEGIN_DECLS
typedef struct _GstAppSrc GstAppSrc;
typedef struct _GstAppSrcClass GstAppSrcClass;
+/**
+ * GstAppStreamType:
+ * @GST_APP_STREAM_TYPE_STREAM: No seeking is supported in the stream, such as a
+ * live stream.
+ * @GST_APP_STREAM_TYPE_SEEKABLE: The stream is seekable but seeking might not
+ * be very fast, such as data from a webserver.
+ * @GST_APP_STREAM_TYPE_RANDOM_ACCESS: The stream is seekable and seeking is fast,
+ * such as in a local file.
+ *
+ * The stream type.
+ */
+typedef enum
+{
+ GST_APP_STREAM_TYPE_STREAM,
+ GST_APP_STREAM_TYPE_SEEKABLE,
+ GST_APP_STREAM_TYPE_RANDOM_ACCESS
+} GstAppStreamType;
+
struct _GstAppSrc
{
- GstPushSrc pushsrc;
+ GstBaseSrc basesrc;
/*< private >*/
GCond *cond;
@@ -50,46 +68,49 @@ struct _GstAppSrc
GstCaps *caps;
gint64 size;
- gboolean seekable;
- guint max_buffers;
+ GstAppStreamType stream_type;
+ guint64 max_bytes;
+ GstFormat format;
gboolean flushing;
gboolean started;
gboolean is_eos;
+ guint64 queued_bytes;
+ GstAppStreamType current_type;
};
struct _GstAppSrcClass
{
- GstPushSrcClass pushsrc_class;
+ GstBaseSrcClass basesrc_class;
/* signals */
- void (*need_data) (GstAppSrc *src);
- void (*enough_data) (GstAppSrc *src);
- gboolean (*seek_data) (GstAppSrc *src, guint64 offset);
+ void (*need_data) (GstAppSrc *src, guint length);
+ void (*enough_data) (GstAppSrc *src);
+ gboolean (*seek_data) (GstAppSrc *src, guint64 offset);
/* actions */
- void (*push_buffer) (GstAppSrc *src, GstBuffer *buffer);
- void (*end_of_stream) (GstAppSrc *src);
+ GstFlowReturn (*push_buffer) (GstAppSrc *src, GstBuffer *buffer);
+ GstFlowReturn (*end_of_stream) (GstAppSrc *src);
};
GType gst_app_src_get_type(void);
GST_DEBUG_CATEGORY_EXTERN (app_src_debug);
-void gst_app_src_set_caps (GstAppSrc *appsrc, const GstCaps *caps);
-GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc);
+void gst_app_src_set_caps (GstAppSrc *appsrc, const GstCaps *caps);
+GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc);
-void gst_app_src_set_size (GstAppSrc *appsrc, gint64 size);
-gint64 gst_app_src_get_size (GstAppSrc *appsrc);
+void gst_app_src_set_size (GstAppSrc *appsrc, gint64 size);
+gint64 gst_app_src_get_size (GstAppSrc *appsrc);
-void gst_app_src_set_seekable (GstAppSrc *appsrc, gboolean seekable);
-gboolean gst_app_src_get_seekable (GstAppSrc *appsrc);
+void gst_app_src_set_stream_type (GstAppSrc *appsrc, GstAppStreamType type);
+GstAppStreamType gst_app_src_get_stream_type (GstAppSrc *appsrc);
-void gst_app_src_set_max_buffers (GstAppSrc *appsrc, guint max);
-guint gst_app_src_get_max_buffers (GstAppSrc *appsrc);
+void gst_app_src_set_max_bytes (GstAppSrc *appsrc, guint64 max);
+guint64 gst_app_src_get_max_bytes (GstAppSrc *appsrc);
-void gst_app_src_push_buffer (GstAppSrc *appsrc, GstBuffer *buffer);
-void gst_app_src_end_of_stream (GstAppSrc *appsrc);
+GstFlowReturn gst_app_src_push_buffer (GstAppSrc *appsrc, GstBuffer *buffer);
+GstFlowReturn gst_app_src_end_of_stream (GstAppSrc *appsrc);
G_END_DECLS