Project

General

Profile

Actions

Support Request #11090

closed

Copy a sample stream to a buffer

Added by hidden about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Customer:
AUDI
Department:
EF
Requester's Priority:
Normal
Support Level:
2nd Level
Resolution:
Solved Issue
Product Issue Numbers:
Affected Products:
Platform:
Topic:
ADTF::SDK
FAQ Links:

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()));
Actions #1

Updated by hidden about 4 years ago

  • 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
Actions #3

Updated by hidden about 4 years ago

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

Actions #4

Updated by hidden almost 4 years ago

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

Actions #6

Updated by hidden almost 4 years ago

In addition to all other comments:

@Xinjie/Faisal: Are #11131 and #11090 the same issue ?

Actions #7

Updated by hidden almost 4 years ago

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

Actions #8

Updated by hidden almost 4 years ago

  • Status changed from In Progress to Customer Feedback Required

OK... so any feedback to #11090#note-4 ?

Actions #9

Updated by hidden almost 4 years ago

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

Actions #10

Updated by hidden almost 4 years ago

  • 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
Actions #13

Updated by hidden almost 4 years ago

  • Project changed from 11 to Public Support
Actions #14

Updated by hidden almost 4 years ago

  • Private changed from Yes to No
Actions #15

Updated by hidden almost 4 years ago

  • Status changed from To Be Closed to Closed
Actions

Also available in: Atom PDF