sending text data from appsrc to fakesink
ddongsu1223
ddongsu1223 at gmail.com
Fri Nov 28 11:30:43 PST 2014
Hi, all.
I'm working on a very simple problem here; I'm trying to send a stream of
text from appsrc to fakesink, with dump=true so that I can see the text data
that is going through. Once I get that done, I'm going to replace fakesink
with tcpserversrc so that I can send the data over tcp. But now, I cannot
get appsrc to send traffic for some reason.
this is where I set up the pipeline:
GstElement * tcp_pipeline = 0;
GError * error = 0;
std::string pipetext = "appsrc name=mysrc ! fakesink dump=true";
tcp_pipeline = gst_parse_launch(pipetext.c_str(), &error);
m_AppSrc = gst_bin_get_by_name_recurse_up(GST_BIN(tcp_pipeline),
"mysrc");
GstCaps * caps = gst_caps_new_simple("application/x-rtp",
"payload", G_TYPE_INT, 98,
NULL);
gst_app_src_set_caps((GstAppSrc*)m_AppSrc, caps);
gst_object_unref(caps);
g_object_set(G_OBJECT(m_AppSrc),
"stream-type", 0,
"is-live", TRUE,
"do-timestamp", TRUE,
"min-latency", 0,
"min-percent", 10,
"format", GST_FORMAT_TIME, NULL);
g_signal_connect(m_AppSrc, "need-data", G_CALLBACK(on_need_data),
(gpointer)this);
gst_bin_add_many(GST_BIN(m_Pipeline), tcp_pipeline, NULL);
gst_object_unref (m_AppSrc);
And the following is the "on_need_data" function which is called at
"need-data" signal:
/* get the tmpData, which is the text data that is going to buffer, and
its size */
GstFlowReturn ret;
GstBuffer * buffer;
buffer = gst_buffer_new();
gst_buffer_fill(buffer, 0, (gpointer)&tmpData[0], a+1);
g_signal_emit_by_name(instance->m_AppSrc, "push-buffer", buffer, &ret);
gst_buffer_unref(buffer);
I know that on_need_data function is being called constantly, because I have
a printf in there that alerts me so. I also had tmpData printed out every
time so I know that I have the right data instead of things like an empty
array. And there shouldn't really be anything wrong with "fakesink
dump=true" either. Could any one of you tell me what I'm doing wrong here?
Any help would be deeply appreciated.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/sending-text-data-from-appsrc-to-fakesink-tp4669731.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list