how to release the GstBuffer memory
trinadh Pala
me_wavelet at yahoo.co.uk
Tue Jun 25 09:22:23 PDT 2013
Hello,
I am using these libraries, I do not find the
gst_app_buffer_new in these libraries. I understand this may be in the gst/app/ library. i may end up mixing too many libraries, which is the proper way to do using QGst libraries?
-lQtGStreamer-0.10 \
-lQtGStreamerUi-0.10 \
-lQtGStreamerUtils-0.10 \
Thanks and regards
Trinadh
________________________________
From: Angel Martin <amartin at vicomtech.org>
To: trinadh Pala <me_wavelet at yahoo.co.uk>; Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
Sent: Tuesday, 25 June 2013, 16:21
Subject: Re: how to release the GstBuffer memory
Hi,
Here you will find the proper way:
http://users.design.ucla.edu/~acolubri/test/gstreamer/appsrc_filesink.c
/* used to inject a new buffer into the pipeline */
static void
inject_new_buffer_into_pipeline (ProgramData * data)
{
guint size;
gpointer raw_buffer;
GstBuffer *app_buffer;
GstElement *source;
size = 80 * 60 * 4; // 80x60 pixels, 32 bpp.
g_print ("Pushing a buffer of size %d\n", size);
// Allocating the memory for the buffer.
raw_buffer = g_malloc0 (size);
app_buffer = gst_app_buffer_new (raw_buffer, size, g_free, raw_buffer);
/* newer basesrc will set caps for use automatically but it does not really
* hurt to set it on the buffer again */
gst_buffer_set_caps (app_buffer, gst_caps_from_string (video_caps));
/* get source an push new buffer */
source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
}
2013/6/25 trinadh Pala <me_wavelet at yahoo.co.uk>:
> Hello,
>
> I am writing an application using QtGstreamer library.
>
> I am implemeting a media player application. i am using Appsource for
> linking the source. The data is available in a char *buffer.
>
> I created a buffer using QGst::Buffer::create(size).
> // pBuf has the Transport stream data char *pBuf
> // This piece of code is in a loop.
>
> QGst::BufferPtr m_buffer;
> m_buffer=QGst::Buffer::create(buf_size);
>
> quint8 *m_data_ptr=m_buffer->data();
>
> memcpy(m_data_ptr,pBuf,buf_size);
>
> if(this->m_player->m_pipeline);
>
> ret = this->m_player->m_appsrc.pushBuffer(m_buffer);
>
> if (!m_buffer.isNull())
> {
> if (ret != QGst::FlowOk)
> {
> /* some error, stop sending data */
> qDebug("some error");
> }
> else
> {
> qDebug("pushed a buffer successfully");
>
> }
> }
>
>
> The method works, i am able to display the video. However, I did not know
> how to release the buffer created. so the application leaks memory. How to
> release the Buffer, after pushBuffer. Please help.
>
> Thanks and regards
> Trinadh
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130625/0781cd58/attachment.html>
More information about the gstreamer-devel
mailing list