<div dir="ltr"><div><div><div>Thank you very much for your reply.<br><br></div>It is working fine now, it was silly mistake from my side.<br><br></div>Regards<br></div>Jyoti<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Aug 29, 2013 at 1:15 PM, Wim Taymans <span dir="ltr"><<a href="mailto:wim.taymans@gmail.com" target="_blank">wim.taymans@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 08/29/2013 08:25 AM, jyoti kulkarni wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello All,<br>
<br>
My pipeline is:<br>
<br>
gst-launch-1.0 -v appsrc ! qtdemux name=d d.audio_0 ! queue ! avdec_aac ! appsink d.video_0 ! queue ! avdec_h264 ! appsink<br>
<br>
and when ever i get a new decoded audio/video buffer i put that in appsink. Then i use that same buffer to file write.<br>
<br>
I do it in following way:<br>
<br>
For Audio: (here data.audio_sink is nothing but appsink)<br>
<br>
g_object_set (data.audio_sink, "emit-signals", TRUE, NULL);<br>
g_signal_connect (data.audio_sink, "new-sample", G_CALLBACK (new_audio_buffer), &data);<br>
<br>
static void new_audio_buffer (GstElement *sink,CustomData *data) {<br>
GstBuffer *buffer;<br>
GstMapInfo map;<br>
GstSample *sample;<br>
//gsize size;<br>
<br>
g_signal_emit_by_name (data->audio_sink, "pull-sample", &sample,NULL);<br>
if (sample) {<br>
<br>
buffer = gst_sample_get_buffer (sample);<br>
<br>
gst_buffer_map (buffer, &map, GST_MAP_READ);<br>
<br>
g_print("\n here size=%d\n",map.size);<br>
<br>
fwrite(map.data,1,map.size,<u></u>data->audio_file);<br>
<br>
gst_buffer_unmap (buffer,&map);<br>
gst_sample_unref(sample);<br>
<br>
}<br>
<br>
}<br>
<br>
AND similar kind of code for video appsink.<br>
<br>
But the problem is only single buffer data is written to the file there after gstreamer returns with a "General Stream Error"<br>
<br>
<br>
The same application worked with gstreamer-0.10, where i used new_buffer signal instead of new_sample and corresponding code for user defined function was:<br>
<br>
g_object_set (data.audio_sink, "emit-signals", TRUE, NULL);<br>
g_signal_connect (data.audio_sink, "new-buffer", G_CALLBACK (new_audio_buffer), &data);<br>
<br>
static void new_audio_buffer (GstElement *sink, CustomData *data) {<br>
</blockquote>
<br></div></div>
You callback is wrong, it should return a GstFlowReturn, see gst-inspect-1.0 appsink for the<br>
signature of the callback.<br>
<br>
Wim<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
GstBuffer *buffer;<br>
<br>
g_signal_emit_by_name (sink, "pull-buffer", &buffer);<br>
if (buffer) {<br>
<br>
gint size=GST_BUFFER_SIZE(buffer);<br>
g_print("\nsize=%d \n",size);<br>
<br>
fwrite(GST_BUFFER_DATA(buffer)<u></u>, 1, GST_BUFFER_SIZE(buffer),data-><u></u>audio_file);<br>
<br>
gst_buffer_unref (buffer);<br>
}<br>
}<br>
<br>
Here all the buffers data written successfully to the file until the source file reaches end of file.<br>
<br>
Please help with above concern.<br>
<br>
Thanks & Regards<br>
Jyoti<br>
<br>
<br>
<br>
<br></div>
______________________________<u></u>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.<u></u>freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/gstreamer-<u></u>devel</a><br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.<u></u>freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/gstreamer-<u></u>devel</a><br>
</blockquote></div><br></div>