8
#include <gst/app/gstappsrc.h>
9
#include <gst/app/gstappbuffer.h>
10
#include <gst/app/gstappsink.h>
16
typedef struct _App App;
27
static void dont_eat_my_chicken_wings (void *priv);
30
main (int argc, char *argv[])
35
gst_init (&argc, &argv);
37
app->pipe = gst_pipeline_new (NULL);
40
app->src = gst_element_factory_make ("appsrc", NULL);
42
gst_bin_add (GST_BIN (app->pipe), app->src);
44
app->id = gst_element_factory_make ("identity", NULL);
46
gst_bin_add (GST_BIN (app->pipe), app->id);
48
app->sink = gst_element_factory_make ("appsink", NULL);
50
gst_bin_add (GST_BIN (app->pipe), app->sink);
52
gst_element_link (app->src, app->id);
53
gst_element_link (app->id, app->sink);
55
gst_element_set_state (app->pipe, GST_STATE_PLAYING);
57
for (i = 0; i < 10; i++) {
62
memset (data, i, 100);
64
printf ("%d: creating buffer for pointer %p\n", i, data);
65
buf = gst_app_buffer_new (data, 100, dont_eat_my_chicken_wings, data);
66
gst_app_src_push_buffer (GST_APP_SRC (app->src), buf);
69
gst_app_src_end_of_stream (GST_APP_SRC (app->src));
71
while (!gst_app_sink_end_of_stream (GST_APP_SINK (app->sink))) {
74
buf = gst_app_sink_pull_buffer (GST_APP_SINK (app->sink));
75
gst_buffer_unref (buf);
82
dont_eat_my_chicken_wings (void *priv)
84
printf ("freeing buffer for pointer %p\n", priv);