mpegtsmux push arbitrary data

Ilya Averyanov averyanovin at
Wed Jun 3 04:31:30 PDT 2015

I want push in to mpegts stream some data. For that i modify tsmuxer
by adding new accepted caps.

I push data by appsrc. In appsrc i use "need-data" signal. When signal
calling i push data from my buffer. And if buffer is empty i want push
GstBuffer with zero size.
But if i do that i no get "need-data" signal again.
Also if i always push zero size GstBuffer all ok, if after zero buffer
push buffer with data, and again push zero size buffer signal no call.

void AppSrc::need_data(GstElement* element, guint, gpointer userData)
    AppSrc *appsrc = (AppSrc *) userData;
    GstBuffer *buffer = gst_buffer_new();
    std::string data;

   while (!appsrc->queue.empty())


    GST_BUFFER_DATA (buffer) = (guint8*)g_memdup( , data.size());
    GST_BUFFER_SIZE (buffer) = data.size();
    GST_BUFFER_TIMESTAMP (buffer) = appsrc->timestamp;
    GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1,

    appsrc->timestamp += GST_BUFFER_DURATION (buffer);

    gst_app_src_push_buffer(GST_APP_SRC(appsrc->element), buffer);

P.S. I use 0.10 but I think that the gst-1.0 everything will be same.

More information about the gstreamer-devel mailing list