Gstreamer with multithread app (Qt)
Matias Hernandez Arellano
msdark at archlinux.cl
Wed Apr 13 18:21:57 PDT 2011
> Try:
> memcpy(data, frame.data, 640*480*3);
This work, but now .. i have a crash (EXEC_BAD_ACCESS) with this QGst::FlowReturn ret = this->m_src.pushBuffer(buffer);
Works for a while and then crash....
any idea??
Thanks again aga
El 13-04-2011, a las 15:30, George Kiagiadakis escribió:
> 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
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Matías Hernandez Arellano
Ingeniero de Software/Proyectos en VisionLabs S.A
CDA Archlinux-CL
www.msdark.archlinux.cl
More information about the gstreamer-devel
mailing list