problem with appsink buffer in gstreamer 1.0

jyoti kulkarni jyotimk029 at gmail.com
Wed Aug 28 23:25:04 PDT 2013


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) {
  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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130829/3a583cca/attachment.html>


More information about the gstreamer-devel mailing list