diff mbox series

[FFmpeg-devel,06/10] avformat/aadec: Simplify data->hex conversion

Message ID AM7PR03MB6660A6C79448F79717F5D80F8F6D9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit e5ba554edf961e1ff761d68d4ebf5a7ea4e5a3b7
Headers show
Series [FFmpeg-devel,01/10] avformat/utils: Make ff_data_to_hex() zero-terminate the string | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 6, 2021, 1:12 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/aadec.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 5f49a543e4..840a9968c6 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -83,6 +83,7 @@  static int aa_read_header(AVFormatContext *s)
     uint32_t header_key_part[4];
     uint8_t header_key[16] = {0};
     AADemuxContext *c = s->priv_data;
+    char file_key[2 * sizeof(c->file_key) + 1];
     AVIOContext *pb = s->pb;
     AVStream *st;
     FFStream *sti;
@@ -130,10 +131,8 @@  static int aa_read_header(AVFormatContext *s)
             for (idx = 0; idx < 4; idx++) {
                 AV_WB32(&header_key[idx * 4], header_key_part[idx]); // convert each part to BE!
             }
-            av_log(s, AV_LOG_DEBUG, "Processed HeaderKey is ");
-            for (int j = 0; j < 16; j++)
-                av_log(s, AV_LOG_DEBUG, "%02x", header_key[j]);
-            av_log(s, AV_LOG_DEBUG, "\n");
+            ff_data_to_hex(key, header_key, sizeof(header_key), 1);
+            av_log(s, AV_LOG_DEBUG, "Processed HeaderKey is %s\n", key);
         } else {
             av_dict_set(&s->metadata, key, val, 0);
         }
@@ -161,10 +160,8 @@  static int aa_read_header(AVFormatContext *s)
     av_tea_crypt(c->tea_ctx, buf, buf, 3, NULL, 0);
     AV_WN64(c->file_key,     AV_RN64(buf + 2)  ^ AV_RN64(header_key));
     AV_WN64(c->file_key + 8, AV_RN64(buf + 10) ^ AV_RN64(header_key + 8));
-    av_log(s, AV_LOG_DEBUG, "File key is ");
-    for (i = 0; i < 16; i++)
-        av_log(s, AV_LOG_DEBUG, "%02x", c->file_key[i]);
-    av_log(s, AV_LOG_DEBUG, "\n");
+    ff_data_to_hex(file_key, c->file_key, sizeof(c->file_key), 1);
+    av_log(s, AV_LOG_DEBUG, "File key is %s\n", file_key);
     av_tea_init(c->tea_ctx, c->file_key, 16);
 
     /* decoder setup */