appsrc using fopen

Sebastian Dröge sebastian at centricular.com
Sat Oct 31 05:09:25 PDT 2015


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151031/046b1d03/attachment.sig>


More information about the gstreamer-devel mailing list