summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-04-13 21:13:21 -0300
committerJames Almer <jamrial@gmail.com>2016-04-13 21:13:21 -0300
commit0efafc5849037046c3834769d6e20d33fae0c769 (patch)
tree7c3d83c5b3dbb734835a9f7c116f5cf4c044dad7 /libavformat
parent868bce48f6d85c29d1b8c17686b42ea5601865ce (diff)
avformat/framehash: enable new output
Also, make every addition except for sidedata part of version 1 instead of the new version 2. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/framecrcenc.c2
-rw-r--r--libavformat/framehash.c26
-rw-r--r--libavformat/hashenc.c9
-rw-r--r--libavformat/internal.h2
-rw-r--r--libavformat/uncodedframecrcenc.c2
5 files changed, 19 insertions, 22 deletions
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index a7d729a01c..91bcdcd99e 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -39,7 +39,7 @@ static int framecrc_write_header(struct AVFormatContext *s)
}
}
- return ff_framehash_write_header(s, 2);
+ return ff_framehash_write_header(s);
}
static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
diff --git a/libavformat/framehash.c b/libavformat/framehash.c
index 7431d45c22..4c5499ea7b 100644
--- a/libavformat/framehash.c
+++ b/libavformat/framehash.c
@@ -20,7 +20,7 @@
#include "internal.h"
-int ff_framehash_write_header(AVFormatContext *s, int version)
+int ff_framehash_write_header(AVFormatContext *s)
{
int i;
@@ -30,19 +30,17 @@ int ff_framehash_write_header(AVFormatContext *s, int version)
AVStream *st = s->streams[i];
AVCodecParameters *avctx = st->codecpar;
avio_printf(s->pb, "#tb %d: %d/%d\n", i, st->time_base.num, st->time_base.den);
- if (version > 1) {
- avio_printf(s->pb, "#media_type %d: %s\n", i, av_get_media_type_string(avctx->codec_type));
- avio_printf(s->pb, "#codec_id %d: %s\n", i, avcodec_get_name(avctx->codec_id));
- switch (avctx->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- avio_printf(s->pb, "#sample_rate %d: %d\n", i,avctx->sample_rate);
- avio_printf(s->pb, "#channel_layout %d: %"PRIx64"\n", i,avctx->channel_layout);
- break;
- case AVMEDIA_TYPE_VIDEO:
- avio_printf(s->pb, "#dimensions %d: %dx%d\n", i, avctx->width, avctx->height);
- avio_printf(s->pb, "#sar %d: %d/%d\n", i, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
- break;
- }
+ avio_printf(s->pb, "#media_type %d: %s\n", i, av_get_media_type_string(avctx->codec_type));
+ avio_printf(s->pb, "#codec_id %d: %s\n", i, avcodec_get_name(avctx->codec_id));
+ switch (avctx->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ avio_printf(s->pb, "#sample_rate %d: %d\n", i,avctx->sample_rate);
+ avio_printf(s->pb, "#channel_layout %d: %"PRIx64"\n", i,avctx->channel_layout);
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ avio_printf(s->pb, "#dimensions %d: %dx%d\n", i, avctx->width, avctx->height);
+ avio_printf(s->pb, "#sar %d: %d/%d\n", i, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
+ break;
}
avio_flush(s->pb);
}
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index 86f93813fe..ced2f66e65 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -58,7 +58,7 @@ static void hash_finish(struct AVFormatContext *s, char *buf)
#if CONFIG_HASH_MUXER || CONFIG_FRAMEHASH_MUXER
static const AVOption hash_options[] = {
{ "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "sha256"}, 0, 0, ENC },
- { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, ENC },
+ { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 2}, 1, 2, ENC },
{ NULL },
};
#endif
@@ -66,7 +66,7 @@ static const AVOption hash_options[] = {
#if CONFIG_MD5_MUXER || CONFIG_FRAMEMD5_MUXER
static const AVOption md5_options[] = {
{ "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "md5"}, 0, 0, ENC },
- { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, ENC },
+ { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 2}, 1, 2, ENC },
{ NULL },
};
#endif
@@ -180,9 +180,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);
+ framehash_print_extradata(s);
+ ff_framehash_write_header(s);
avio_printf(s->pb, "#stream#, dts, pts, duration, size, hash\n");
return 0;
}
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 8e0cb34d76..1719deb219 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -401,7 +401,7 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
* Set the timebase for each stream from the corresponding codec timebase and
* print it.
*/
-int ff_framehash_write_header(AVFormatContext *s, int version);
+int ff_framehash_write_header(AVFormatContext *s);
/**
* Read a transport packet from a media file.
diff --git a/libavformat/uncodedframecrcenc.c b/libavformat/uncodedframecrcenc.c
index 4269015b07..5e1a445f4f 100644
--- a/libavformat/uncodedframecrcenc.c
+++ b/libavformat/uncodedframecrcenc.c
@@ -121,7 +121,7 @@ static void audio_frame_cksum(AVBPrint *bp, AVFrame *frame)
static int write_header(struct AVFormatContext *s)
{
- return ff_framehash_write_header(s, 2);
+ return ff_framehash_write_header(s);
}
static int write_frame(struct AVFormatContext *s, int stream_index,