AW: appsrc using fopen
Bernhard Graaf
bernhard.graaf at gmx.de
Sat Oct 31 04:13:21 PDT 2015
Thank you Sebastian,
That was the problem (I haven't understood 'GstBuffer' :-)).
I will try your example.
Bernhard
-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org]
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:
> //cgit.freedesktop.org/gstreamer/gst-plugins-
> 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(map.data, 1, mal.size, app->file);
gst_buffer_unmap(buffer, &map);
--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
More information about the gstreamer-devel
mailing list