<div dir="ltr"><div><div><div><div>Hello All,<br><br></div>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></div>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></div>I do it in following way:<br><br></div>For Audio: (here data.audio_sink is nothing but appsink)<br><div><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,data->audio_file);<br>
<br> gst_buffer_unmap (buffer,&map);<br> gst_sample_unref(sample);<br> <br> }<br> <br>}<br><br></div><div>AND similar kind of code for video appsink.<br><br></div><div>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></div><div>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> 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), 1, GST_BUFFER_SIZE(buffer),data->audio_file);<br><br> gst_buffer_unref (buffer);<br>
}<br>}<br></div><div><br></div><div>Here all the buffers data written successfully to the file until the source file reaches end of file.<br><br></div><div>Please help with above concern.<br><br></div><div>Thanks & Regards<br>
</div><div>Jyoti<br></div><div><br><br></div></div>