problem with appsink buffer in gstreamer 1.0

jyoti kulkarni jyotimk029 at gmail.com
Thu Aug 29 01:23:06 PDT 2013


Thank you very much for your reply.

It is working fine now, it was silly mistake from my side.

Regards
Jyoti


On Thu, Aug 29, 2013 at 1:15 PM, Wim Taymans <wim.taymans at gmail.com> wrote:

> On 08/29/2013 08:25 AM, jyoti kulkarni wrote:
>
>> Hello All,
>>
>> My pipeline is:
>>
>> gst-launch-1.0 -v appsrc ! qtdemux name=d d.audio_0 ! queue ! avdec_aac !
>> appsink d.video_0 ! queue ! avdec_h264 ! appsink
>>
>> 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.
>>
>> I do it in following way:
>>
>> For Audio: (here data.audio_sink is nothing but appsink)
>>
>> g_object_set (data.audio_sink, "emit-signals", TRUE, NULL);
>> g_signal_connect (data.audio_sink, "new-sample", G_CALLBACK
>> (new_audio_buffer), &data);
>>
>> static void new_audio_buffer (GstElement *sink,CustomData *data) {
>>   GstBuffer *buffer;
>>   GstMapInfo map;
>>   GstSample *sample;
>>   //gsize size;
>>
>>   g_signal_emit_by_name (data->audio_sink, "pull-sample", &sample,NULL);
>>   if (sample) {
>>
>>     buffer = gst_sample_get_buffer (sample);
>>
>>     gst_buffer_map (buffer, &map, GST_MAP_READ);
>>
>>     g_print("\n here size=%d\n",map.size);
>>
>> fwrite(map.data,1,map.size,**data->audio_file);
>>
>>     gst_buffer_unmap (buffer,&map);
>>     gst_sample_unref(sample);
>>
>>   }
>>
>> }
>>
>> AND similar kind of code for video appsink.
>>
>> But the problem is only single buffer data is written to the file there
>> after  gstreamer returns with a "General Stream Error"
>>
>>
>> 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:
>>
>> g_object_set (data.audio_sink, "emit-signals", TRUE, NULL);
>> g_signal_connect (data.audio_sink, "new-buffer", G_CALLBACK
>> (new_audio_buffer), &data);
>>
>> static void new_audio_buffer (GstElement *sink, CustomData *data) {
>>
>
> You callback is wrong, it should return a GstFlowReturn, see
> gst-inspect-1.0 appsink for the
> signature of the callback.
>
> Wim
>
>    GstBuffer *buffer;
>>
>>   g_signal_emit_by_name (sink, "pull-buffer", &buffer);
>>   if (buffer) {
>>
>>     gint size=GST_BUFFER_SIZE(buffer);
>>     g_print("\nsize=%d \n",size);
>>
>> fwrite(GST_BUFFER_DATA(buffer)**, 1, GST_BUFFER_SIZE(buffer),data->**
>> audio_file);
>>
>>     gst_buffer_unref (buffer);
>>   }
>> }
>>
>> Here all the buffers data written successfully to the file until the
>> source file reaches end of file.
>>
>> Please help with above concern.
>>
>> Thanks & Regards
>> Jyoti
>>
>>
>>
>>
>> ______________________________**_________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.**freedesktop.org<gstreamer-devel at lists.freedesktop.org>
>> http://lists.freedesktop.org/**mailman/listinfo/gstreamer-**devel<http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel>
>>
>
> ______________________________**_________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.**freedesktop.org<gstreamer-devel at lists.freedesktop.org>
> http://lists.freedesktop.org/**mailman/listinfo/gstreamer-**devel<http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130829/44319f51/attachment.html>


More information about the gstreamer-devel mailing list