Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/hashenc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index a45cc42..e007e79 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -149,6 +149,33 @@ AVOutputFormat ff_md5_muxer = { #endif #if CONFIG_FRAMEHASH_MUXER || CONFIG_FRAMEMD5_MUXER +static void framehash_print_extradata(struct AVFormatContext *s) +{ + int i, header_printed = 0; + + 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+128]; + int len; + + if (!header_printed) { + avio_printf(s->pb, "#extradata#, size, hash\n"); + header_printed = 1; + } + av_hash_init(c->hash); + av_hash_update(c->hash, par->extradata, par->extradata_size); + snprintf(buf, sizeof(buf) - 64, "%d, %42d, ", i, par->extradata_size); + len = strlen(buf); + av_hash_final_hex(c->hash, buf + len, sizeof(buf) - len); + av_strlcatf(buf, sizeof(buf), "\n"); + avio_write(s->pb, buf, strlen(buf)); + } + } +} + static int framehash_write_header(struct AVFormatContext *s) { struct HashContext *c = s->priv_data; @@ -182,6 +209,9 @@ static int framehash_write_header(struct AVFormatContext *s) avio_flush(s->pb); } + if (c->format_version > 1) + framehash_print_extradata(s); + avio_printf(s->pb, "#stream#, dts, pts, duration, size, hash\n"); return 0; } -- 2.8.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel