[vlc-devel] [PATCH v2 07/15] stats: use new md5 API

Marvin Scholz epirat07 at gmail.com
Wed Apr 8 00:04:23 CEST 2020


---
 modules/stream_out/stats.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/modules/stream_out/stats.c b/modules/stream_out/stats.c
index d6dd7cc0cb..7f153f7b7a 100644
--- a/modules/stream_out/stats.c
+++ b/modules/stream_out/stats.c
@@ -31,7 +31,7 @@
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
 #include <vlc_block.h>
-#include <vlc_md5.h>
+#include <vlc_hash.h>
 #include <vlc_fs.h>
 
 /*****************************************************************************
@@ -50,7 +50,7 @@ typedef struct
     void *next_id;
     const char *type;
     vlc_tick_t previous_dts,track_duration;
-    struct md5_s hash;
+    vlc_hash_md5_t hash;
 } sout_stream_id_sys_t;
 
 static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
@@ -82,7 +82,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
     id->segment_number = 0;
     id->previous_dts = VLC_TICK_INVALID;
     id->track_duration = 0;
-    InitMD5( &id->hash );
+    vlc_hash_md5_Init( &id->hash );
 
     msg_Dbg( p_stream, "%s: Adding track type:%s id:%d", p_sys->prefix, id->type, id->id);
     return id;
@@ -93,8 +93,7 @@ static void Del( sout_stream_t *p_stream, void *_id )
     sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
     sout_stream_id_sys_t *id = (sout_stream_id_sys_t *)_id;
 
-    EndMD5( &id->hash );
-    char *outputhash = psz_md5_hash( &id->hash );
+    char *outputhash = vlc_hash_md5_FinishHex( &id->hash );
     unsigned int num,den;
     vlc_ureduce( &num, &den, id->track_duration, id->segment_number, 0 );
     msg_Dbg( p_stream, "%s: Removing track type:%s id:%d", p_sys->prefix, id->type, id->id );
@@ -114,16 +113,15 @@ static int Send( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
 {
     sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
     sout_stream_id_sys_t *id = (sout_stream_id_sys_t *)_id;
-    struct md5_s hash;
+    vlc_hash_md5_t hash;
 
     block_t *p_block = p_buffer;
     while ( p_block != NULL )
     {
-        InitMD5( &hash );
-        AddMD5( &hash, p_block->p_buffer, p_block->i_buffer );
-        AddMD5( &id->hash, p_block->p_buffer, p_block->i_buffer );
-        EndMD5( &hash );
-        char *outputhash = psz_md5_hash( &hash );
+        vlc_hash_md5_Init( &hash );
+        vlc_hash_md5_Update( &hash, p_block->p_buffer, p_block->i_buffer );
+        vlc_hash_md5_Update( &id->hash, p_block->p_buffer, p_block->i_buffer );
+        char *outputhash = vlc_hash_md5_FinishHex( &hash );
 
         /* We could just set p_sys->output to stdout and remove user of msg_Dbg
          * if we don't need ability to output info to gui modules (like qt messages window
-- 
2.24.1 (Apple Git-126)



More information about the vlc-devel mailing list