Gstreamer with multithread app (Qt)
George Kiagiadakis
kiagiadakis.george at gmail.com
Wed Apr 13 12:30:43 PDT 2011
On Wed, Apr 13, 2011 at 1:59 AM, Matias Hernandez Arellano
<msdark at archlinux.cl> wrote:
> Mat frame = this->ImageBuffer->getFrame();
>
> data = (quint8*)frame.data;
>
> I hope you realize that this statement is void, it copies no actual
> data. You need to copy the data with memcpy() instead.
>
> QGst::FlowReturn ret = this->m_src.pushBuffer(buffer);
>
>
> I do this cause i asking in other thread about the use of QGst::Buffer and i
> get this:
> The QGst::Buffer class has a data() method which gives you a pointer
> to the allocated buffer. You can use this pointer to write on the
> buffer.
>
> Btw, the above line of code looks terribly wrong to me... Here is how
> you should use it:
>
> QGst::BufferPtr b = QGst::Buffer::create(size);
> quint8 *data = b->data();
> //use the data pointer to write.
Yes, I meant to write on the location where data is pointing at, using
some function like memcpy() or something similar. This is basic C/C++.
> But i don't know if this is right.. so i try with memcpy. When i testing
> with C interface of Gstreamer i do this:
> memcpy(GST_BUFFER_DATA(buffer),img_data,data_size);
> even i use this GST_BUFFER_DATA(buffer) = img_data; GST_BUFFER_SIZE(buffer)
> = 640*480*3*sizeof(uchar*);
> but now i don't know how copy the data into QGst::Buffer... this don't work
> ...
>
> memcpy(data,frame.data,640*480*3*sizeof(uchar*))
What do you mean it doesn't work? Does it crash? Are you sure about
that sizeof(uchar*) there?
Try:
memcpy(data, frame.data, 640*480*3);
Regards,
George
More information about the gstreamer-devel
mailing list