[vlc-devel] [PATCH V3] dcp: Creation of access-demux module for DCP (using asdcplib)

Nicolas Bertrand nicoinattendu at gmail.com
Fri Sep 6 17:56:56 CEST 2013

Le 02/09/2013 19:00, Rémi Denis-Courmont a écrit :
> Le lundi 2 septembre 2013 16:42:10 Rémi Denis-Courmont a écrit :
>> On Mon, 02 Sep 2013 16:16:36 +0200, Nicolas Bertrand

> For demuxers, there are two ways to avoid memory copying. A custom block_t
> allocator/deallocator can be created with block_Init(). This is more flexible
> but more prone to implementation errors.
Event with that method  I don't get the implementatipon on how to avoid 
the memcpy.

First I do a block init
and then I made some
block_alloc/release instead of MemCpy or a block_realloc ?

> Alternatively, custom callbacks for output frame buffer allocation can be
> provided to the library (most libraries support that).
Looks like I have nothing for that on the lib :
FrameBuffer API:
class FrameBuffer

       byte_t* m_Data;          // pointer to memory area containing 
frame data
       ui32_t  m_Capacity;      // size of memory area pointed to by m_Data
       bool    m_OwnMem;        // if false, m_Data points to externally 
allocated memory
       ui32_t  m_Size;          // size of frame data in memory area 
pointed to by m_Data
       ui32_t  m_FrameNumber;   // delivery-order frame number

       // It is possible to read raw ciphertext from an encrypted AS-DCP 
       // After reading an encrypted AS-DCP file in raw mode, the frame 
buffer will
       // contain the encrypted source value portion of the Encrypted 
Triplet, followed
       // by the integrity pack, if it exists.
       // The buffer will begin with the IV and CheckValue, followed by 
encrypted essence
       // and optional integrity pack
       // The SourceLength and PlaintextOffset values from the packet 
will be held in the
       // following variables:
       ui32_t  m_SourceLength;       // plaintext length (delivered 
plaintext+decrypted ciphertext)
       ui32_t  m_PlaintextOffset;    // offset to first byte of ciphertext

       virtual ~FrameBuffer();

       // Instructs the object to use an externally allocated buffer. 
The external
       // buffer will not be cleaned up by the frame buffer when it exits.
       // Call with (0,0) to revert to internally allocated buffer.
       // Returns error if the buf_addr argument is NULL and buf_size is 
       Result_t SetData(byte_t* buf_addr, ui32_t buf_size);

       // Sets the size of the internally allocate buffer. Returns 
       // if the object is using an externally allocated buffer via 
       // Resets content size to zero.
       Result_t Capacity(ui32_t cap);

       // returns the size of the buffer
       inline ui32_t  Capacity() const { return m_Capacity; }

       // returns a const pointer to the essence data
       inline const byte_t* RoData() const { return m_Data; }

       // returns a non-const pointer to the essence data
       inline byte_t* Data() { return m_Data; }

       // set the size of the buffer's contents
       inline ui32_t  Size(ui32_t size) { return m_Size = size; }

       // returns the size of the buffer's contents
       inline ui32_t  Size() const { return m_Size; }

       // Sets the absolute frame number of this frame in the file in 
delivery order.
       inline void    FrameNumber(ui32_t num) { m_FrameNumber = num; }

       // Returns the absolute frame number of this frame in the file in 
delivery order.
       inline ui32_t  FrameNumber() const { return m_FrameNumber; }

       // Sets the length of the plaintext essence data
       inline void    SourceLength(ui32_t len) { m_SourceLength = len; }

       // When this value is 0 (zero), the buffer contains only 
plaintext. When it is
       // non-zero, the buffer contains raw ciphertext and the return 
value is the length
       // of the original plaintext.
       inline ui32_t  SourceLength() const { return m_SourceLength; }

       // Sets the offset into the buffer at which encrypted data begins
       inline void    PlaintextOffset(ui32_t ofst) { m_PlaintextOffset = 
ofst; }

       // Returns offset into buffer of first byte of ciphertext.
       inline ui32_t  PlaintextOffset() const { return m_PlaintextOffset; }


More information about the vlc-devel mailing list