[FFmpeg-cvslog] avformat/framehash: add extradata checksum
James Almer
git at videolan.org
Wed Apr 13 19:43:39 CEST 2016
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Apr 13 10:49:16 2016 -0300| [5557e881c9e5138f916447d8137b0ce404cd256c] | committer: James Almer
avformat/framehash: add extradata checksum
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5557e881c9e5138f916447d8137b0ce404cd256c
---
libavformat/hashenc.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index 614c815..4aa4fcf 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -149,6 +149,27 @@ AVOutputFormat ff_md5_muxer = {
#endif
#if CONFIG_FRAMEHASH_MUXER || CONFIG_FRAMEMD5_MUXER
+static void framehash_print_extradata(struct AVFormatContext *s)
+{
+ int i;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ AVCodecParameters *par = st->codecpar;
+ if (par->extradata) {
+ struct HashContext *c = s->priv_data;
+ char buf[AV_HASH_MAX_SIZE*2+1];
+
+ avio_printf(s->pb, "#extradata %d, %31d, ", i, par->extradata_size);
+ av_hash_init(c->hash);
+ av_hash_update(c->hash, par->extradata, par->extradata_size);
+ av_hash_final_hex(c->hash, buf, sizeof(buf));
+ avio_write(s->pb, buf, strlen(buf));
+ avio_printf(s->pb, "\n");
+ }
+ }
+}
+
static int framehash_write_header(struct AVFormatContext *s)
{
struct HashContext *c = s->priv_data;
@@ -158,6 +179,8 @@ static int framehash_write_header(struct AVFormatContext *s)
avio_printf(s->pb, "#format: frame checksums\n");
avio_printf(s->pb, "#version: %d\n", c->format_version);
avio_printf(s->pb, "#hash: %s\n", av_hash_get_name(c->hash));
+ if (c->format_version > 1)
+ framehash_print_extradata(s);
ff_framehash_write_header(s, c->format_version);
avio_printf(s->pb, "#stream#, dts, pts, duration, size, hash\n");
return 0;
More information about the ffmpeg-cvslog
mailing list