[FFmpeg-cvslog] avformat/aadec: Simplify data->hex conversion

Andreas Rheinhardt git at videolan.org
Wed Dec 8 15:28:53 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Dec  5 23:04:35 2021 +0100| [e5ba554edf961e1ff761d68d4ebf5a7ea4e5a3b7] | committer: Andreas Rheinhardt

avformat/aadec: Simplify data->hex conversion

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5ba554edf961e1ff761d68d4ebf5a7ea4e5a3b7
---

 libavformat/aadec.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

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 */



More information about the ffmpeg-cvslog mailing list