[vlc-commits] Add block_CopyProperties() helper

Rafaël Carré git at videolan.org
Tue Dec 25 18:55:11 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Dec 25 18:46:20 2012 +0100| [5596a281fcdb87582fb4d6dae208244b8002a798] | committer: Rafaël Carré

Add block_CopyProperties() helper

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5596a281fcdb87582fb4d6dae208244b8002a798
---

 include/vlc_block.h |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/vlc_block.h b/include/vlc_block.h
index 92dd5ff..eae1995 100644
--- a/include/vlc_block.h
+++ b/include/vlc_block.h
@@ -140,17 +140,23 @@ VLC_API block_t *block_Alloc( size_t ) VLC_USED VLC_MALLOC;
 VLC_API block_t *block_Realloc( block_t *, ssize_t i_pre, size_t i_body ) VLC_USED;
 
 VLC_USED
+static inline void block_CopyProperties( block_t *dst, block_t *src )
+{
+    dst->i_flags   = src->i_flags;
+    dst->i_nb_samples = src->i_nb_samples;
+    dst->i_dts     = src->i_dts;
+    dst->i_pts     = src->i_pts;
+    dst->i_length  = src->i_length;
+}
+
+VLC_USED
 static inline block_t *block_Duplicate( block_t *p_block )
 {
     block_t *p_dup = block_Alloc( p_block->i_buffer );
     if( p_dup == NULL )
         return NULL;
 
-    p_dup->i_flags   = p_block->i_flags;
-    p_dup->i_nb_samples = p_block->i_nb_samples;
-    p_dup->i_dts     = p_block->i_dts;
-    p_dup->i_pts     = p_block->i_pts;
-    p_dup->i_length  = p_block->i_length;
+    block_CopyProperties( p_dup, p_block );
     memcpy( p_dup->p_buffer, p_block->p_buffer, p_block->i_buffer );
 
     return p_dup;



More information about the vlc-commits mailing list