[vlc-devel] [PATCH 2/2] vlc_block: store per block ancillary

Francois Cartegnie fcvlcdev at free.fr
Tue Jun 19 18:50:36 CEST 2018


---
 include/vlc_block.h | 2 ++
 src/misc/block.c    | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/include/vlc_block.h b/include/vlc_block.h
index 1c94783016..2e5f90da55 100644
--- a/include/vlc_block.h
+++ b/include/vlc_block.h
@@ -127,6 +127,8 @@ struct block_t
 
     /* Rudimentary support for overloading block (de)allocation. */
     block_free_t pf_release;
+
+    vlc_ancillary_t *p_anc;
 };
 
 VLC_API void block_Init( block_t *, void *, size_t );
diff --git a/src/misc/block.c b/src/misc/block.c
index 12299f36ab..5858714d52 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -34,6 +34,7 @@
 #include <vlc_common.h>
 #include <vlc_block.h>
 #include <vlc_fs.h>
+#include <vlc_ancillary.h>
 
 #ifndef NDEBUG
 static void BlockNoRelease( block_t *b )
@@ -67,6 +68,7 @@ static void block_Invalidate (block_t *block)
     block->p_next = NULL;
     block_Check (block);
     block->pf_release = BlockNoRelease;
+    vlc_ancillary_StorageEmpty(&block->p_anc);
 }
 #else
 # define block_Check(b) ((void)(b))
@@ -86,6 +88,7 @@ void block_Init( block_t *restrict b, void *buf, size_t size )
     b->i_pts =
     b->i_dts = VLC_TS_INVALID;
     b->i_length = 0;
+    b->p_anc = NULL;
 #ifndef NDEBUG
     b->pf_release = BlockNoRelease;
 #endif
@@ -107,6 +110,8 @@ static void BlockMetaCopy( block_t *restrict out, const block_t *in )
     out->i_pts     = in->i_pts;
     out->i_flags   = in->i_flags;
     out->i_length  = in->i_length;
+    if( in->p_anc )
+        vlc_ancillary_StorageMerge( &out->p_anc, in->p_anc );
 }
 
 /** Initial memory alignment of data block.
-- 
2.14.4



More information about the vlc-devel mailing list