Support Request #11090
closed
Copy a sample stream to a buffer
Added by hidden about 4 years ago.
Updated almost 4 years ago.
Requester's Priority:
Normal
Description
Supportanfrage
we notice that in ADTF2 we can use "CopyBufferTo" to copy a sample stream to a buffer, is there same function or similar thing in ADTF3?
Our goal is to sample all the streams coming from input pins to a buffer.
Thanks in advance!
Lösung
The equivalent to CopyToBuffer in ADTF 3 is
object_ptr<const ISample> pSample;
object_ptr_locked<const ISampleBuffer> pBuffer;
RETURN_IF_FAILED(pSample->Lock(pBuffer));
memcpy(pDest, pBuffer->GetPtr(), std::min(nDestSize, pBuffer->GetSize()));
- Project changed from Public Support to 11
- Status changed from New to In Progress
- Topic set to ADTF::SDK
- Customer set to AUDI
- Department set to EF
Hi Martin,
we would like to provide more information on this.
Our assumption:
1. To copy streams to a buffer, we need to give the size. Therefore first we need to get the size of a struct based on DDL. Is that correct?
2. If first assumption is correct, how do we get the size of a struct based on a DDL file? We noticed that in the demo “demo_md_data_generator”, function “create_adtf_default_stream_type_from_service” is used to get pType of a user specified structure. So we used this function, and print the size of this pType. However it always gives the same size no matter which struct name we gave.
3. Could you please tell us whether our assumption is correct and how can we obtain the size of a struct based on DDL ?
Thanks a lot!
Best regards,
Xinjie
Hi Xinjie,
I'm not sure I'm understanding you correctly, but the equivalent to CopyToBuffer in ADTF 3 is
object_ptr<const ISample> pSample;
object_ptr_locked<const ISampleBuffer> pBuffer;
RETURN_IF_FAILED(pSample->Lock(pBuffer));
memcpy(pDest, pBuffer->GetPtr(), std::min(nDestSize, pBuffer->GetSize()));
Regards,
Martin
In addition to all other comments:
@Xinjie/Faisal: Are #11131 and #11090 the same issue ?
Hello Florian,
Not entirely, but they can perhaps be treated similar, because Issue #11090 was one part of the #Issue 11131.
The previous Copy buffer problem was solved by using oCoder and ddl::Serialization::transform() Funktion.
VG
Faisal
- Status changed from In Progress to Customer Feedback Required
Hallo Florian,
sorry für eine spätere Antwort. Bzgl. #11090#note-4 haben wir zurzeit eine andere Lösung mit cSampleDecoder und ddl::serialization::transform(oDecoder, oCoder)benutzt, um die Stream Inhalte in einem Buffer zu kopieren, wo wir ein Buffer mit oCoder hinzufügt haben. Und es scheint soweit zu funktionieren.
Danke für eure Support. ☺
Viele Grüße
Faisal
- Subject changed from Buffer Problem to Copy a sample stream to a buffer
- Description updated (diff)
- Status changed from Customer Feedback Required to To Be Closed
- Resolution set to Solved Issue
- Project changed from 11 to Public Support
- Private changed from Yes to No
- Status changed from To Be Closed to Closed
Also available in: Atom
PDF