summaryrefslogtreecommitdiff
path: root/libavformat/aadec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-05 23:04:35 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-08 14:11:14 +0100
commite5ba554edf961e1ff761d68d4ebf5a7ea4e5a3b7 (patch)
tree951dd77aa1ac66fbc3c688ae87efb7438cef5a77 /libavformat/aadec.c
parentd27b97b04321db147cf7db6fa9cb05ba7f6ef06f (diff)
avformat/aadec: Simplify data->hex conversion
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/aadec.c')
-rw-r--r--libavformat/aadec.c13
1 files 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 */