AW: appsrc using fopen

Bernhard Graaf bernhard.graaf at
Sat Oct 31 06:57:28 PDT 2015

Yes, that's works fine!

But one other question:
If the file size is changed, I set the size of appsrc with 'g_object_set
(app->appsrc, "size", (gint64) app->length, NULL);' to the new size.
But the duration of the stream is newer changed!
Is there an approach to recalculate the new duration after the file size is

Thank you

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at]
Im Auftrag von Bernhard Graaf
Gesendet: Samstag, 31. Oktober 2015 12:13
An: 'Discussion of the development of and with GStreamer'
Betreff: AW: appsrc using fopen

Thank you Sebastian,

That was the problem (I haven't understood 'GstBuffer' :-)).
I will try your example.


-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at]
Im Auftrag von Sebastian Dröge
Gesendet: Samstag, 31. Oktober 2015 13:09
An: Discussion of the development of and with GStreamer
Betreff: Re: appsrc using fopen

On Sa, 2015-10-31 at 11:52 +0100, Bernhard Graaf wrote:
> Hi,
> I try to develop an app using appsrc on gstreamer 1.6.0.
> The basic of this app is the ‘appsrc_seek.c’ from this example: http:
> //
> base/tree/tests/examples/app/appsrc-seekable.c, but with fopen() (not
> with ‘mmapped file’).
> After changing the code, I get this error message:
> *** Error in `./appsrc_seek': free(): invalid next size (normal):
> 0x00007f24c4009000 ***
> [...]
>   buffer = gst_buffer_new_allocate (NULL, len, NULL);
>   if(!buffer) printf("Error to allocate memory\n");
>   printf("Buffersize: %" G_GSIZE_FORMAT "\n", gst_buffer_get_size
> (buffer));
>   fseek(app->file,app->offset,SEEK_SET);
>   fread (buffer,1,len,app->file);

That's not how GstBuffer works. You're here overwriting the GstBuffer
datastructure with the data from the file.

To get access to the memory area of the buffer, you need to map it
first. For example try the following:
  GstMapInfo map;
  gst_buffer_map(buffer, &map, GST_MAP_WRITE);
  fread(, 1, mal.size, app->file);
  gst_buffer_unmap(buffer, &map); 

Sebastian Dröge, Centricular Ltd ·

gstreamer-devel mailing list
gstreamer-devel at

More information about the gstreamer-devel mailing list