AW: appsrc using fopen

Bernhard Graaf bernhard.graaf at gmx.de
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
changed?

Thank you
Bernhard

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org]
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.

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


_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list