* @brief Callback for signal stream-start.
*/
static void
-_stream_start_cb (GstElement * element, GstBuffer * buffer, gpointer user_data)
+_stream_start_cb (GstElement * element, gpointer user_data)
{
_print_log ("stream start callback");
}
* @brief Callback for signal eos.
*/
static void
-_eos_cb (GstElement * element, GstBuffer * buffer, gpointer user_data)
+_eos_cb (GstElement * element, gpointer user_data)
{
_print_log ("eos callback");
}
{
GstElement *appsrc;
GstBuffer *buf;
- GstMapInfo info;
guint buffer_index;
buffer_index = g_app.received + 1;
}
text_data = g_strdup_printf ("example for text [%d/20]", buffer_index);
-
- buf = gst_buffer_new_allocate (NULL, strlen (text_data) + 1, NULL);
- gst_buffer_map (buf, &info, GST_MAP_WRITE);
-
- strcpy ((gchar *) info.data, text_data);
-
- gst_buffer_unmap (buf, &info);
+ buf = gst_buffer_new_wrapped (text_data, strlen (text_data));
GST_BUFFER_PTS (buf) = 20 * GST_MSECOND * buffer_index;
- GST_BUFFER_DTS (buf) = GST_BUFFER_PTS (buf);
+ GST_BUFFER_DURATION (buf) = 20 * GST_MSECOND;
if (gst_app_src_push_buffer (GST_APP_SRC (appsrc), buf) != GST_FLOW_OK) {
_print_log ("failed to push buffer [%d]", buffer_index);
}
- g_free (text_data);
break;
}
default:
* @brief Callback for signal stream-start.
*/
static void
-_stream_start_cb (GstElement * element, GstBuffer * buffer, gpointer user_data)
+_stream_start_cb (GstElement * element, gpointer user_data)
{
g_test_data.start = TRUE;
_print_log ("stream start callback");
* @brief Callback for signal eos.
*/
static void
-_eos_cb (GstElement * element, GstBuffer * buffer, gpointer user_data)
+_eos_cb (GstElement * element, gpointer user_data)
{
g_test_data.end = TRUE;
_print_log ("eos callback");
sprintf ((char *) info.data, "%d", i);
gst_buffer_unmap (buf, &info);
- GST_BUFFER_DTS (buf) = GST_BUFFER_PTS (buf) = (i + 1) * 10 * GST_MSECOND;
+ GST_BUFFER_PTS (buf) = (i + 1) * 10 * GST_MSECOND;
GST_BUFFER_DURATION (buf) = 10 * GST_MSECOND;
if (gst_app_src_push_buffer (GST_APP_SRC (appsrc), buf) != GST_FLOW_OK) {