The uncodedframecrc muxer didn't like the new ff_framehash_write_header signature. This may also simplify further improvements to the output of framehash.
Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/Makefile | 8 ++++---- libavformat/{framehash.c => framecrc.c} | 19 ++----------------- libavformat/framecrcenc.c | 2 +- libavformat/hashenc.c | 27 +++++++++++++++++++++++++-- libavformat/internal.h | 2 +- libavformat/uncodedframecrcenc.c | 2 +- 6 files changed, 34 insertions(+), 26 deletions(-) rename libavformat/{framehash.c => framecrc.c} (54%) diff --git a/libavformat/Makefile b/libavformat/Makefile index 4bae3b7..bea5a59 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -174,9 +174,9 @@ OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o -OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o -OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o -OBJS-$(CONFIG_FRAMEMD5_MUXER) += hashenc.o framehash.o +OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framecrc.o +OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o +OBJS-$(CONFIG_FRAMEMD5_MUXER) += hashenc.o OBJS-$(CONFIG_FRM_DEMUXER) += frmdec.o OBJS-$(CONFIG_FSB_DEMUXER) += fsb.o OBJS-$(CONFIG_GIF_MUXER) += gif.o @@ -461,7 +461,7 @@ OBJS-$(CONFIG_TRUEHD_MUXER) += rawenc.o OBJS-$(CONFIG_TTA_DEMUXER) += tta.o apetag.o img2.o OBJS-$(CONFIG_TTY_DEMUXER) += tty.o sauce.o OBJS-$(CONFIG_TXD_DEMUXER) += txd.o -OBJS-$(CONFIG_UNCODEDFRAMECRC_MUXER) += uncodedframecrcenc.o framehash.o +OBJS-$(CONFIG_UNCODEDFRAMECRC_MUXER) += uncodedframecrcenc.o framecrc.o OBJS-$(CONFIG_V210_DEMUXER) += v210.o OBJS-$(CONFIG_V210X_DEMUXER) += v210.o OBJS-$(CONFIG_VAG_DEMUXER) += vag.o diff --git a/libavformat/framehash.c b/libavformat/framecrc.c similarity index 54% rename from libavformat/framehash.c rename to libavformat/framecrc.c index 7431d45..436da2c 100644 --- a/libavformat/framehash.c +++ b/libavformat/framecrc.c @@ -1,5 +1,5 @@ /* - * Common functions for the frame{crc,md5} muxers + * Common functions for the framecrc muxers * * This file is part of FFmpeg. * @@ -20,7 +20,7 @@ #include "internal.h" -int ff_framehash_write_header(AVFormatContext *s, int version) +int ff_framecrc_write_header(AVFormatContext *s) { int i; @@ -28,22 +28,7 @@ int ff_framehash_write_header(AVFormatContext *s, int version) avio_printf(s->pb, "#software: %s\n", LIBAVFORMAT_IDENT); for (i = 0; i < s->nb_streams; i++) { 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_flush(s->pb); } return 0; diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index 3533c52..348e913 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, 1); + return ff_framecrc_write_header(s); } static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index 614c815..a45cc42 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -152,13 +152,36 @@ AVOutputFormat ff_md5_muxer = { static int framehash_write_header(struct AVFormatContext *s) { struct HashContext *c = s->priv_data; - int res = av_hash_alloc(&c->hash, c->hash_name); + int i, res = av_hash_alloc(&c->hash, c->hash_name); if (res < 0) return res; 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)); - ff_framehash_write_header(s, c->format_version); + if (s->nb_streams && !(s->flags & AVFMT_FLAG_BITEXACT)) + avio_printf(s->pb, "#software: %s\n", LIBAVFORMAT_IDENT); + + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + AVCodecParameters *par = st->codecpar; + avio_printf(s->pb, "#tb %d: %d/%d\n", i, st->time_base.num, st->time_base.den); + if (c->format_version > 1) { + avio_printf(s->pb, "#media_type %d: %s\n", i, av_get_media_type_string(par->codec_type)); + avio_printf(s->pb, "#codec_id %d: %s\n", i, avcodec_get_name(par->codec_id)); + switch (par->codec_type) { + case AVMEDIA_TYPE_AUDIO: + avio_printf(s->pb, "#sample_rate %d: %d\n", i,par->sample_rate); + avio_printf(s->pb, "#channel_layout %d: %"PRIx64"\n", i,par->channel_layout); + break; + case AVMEDIA_TYPE_VIDEO: + avio_printf(s->pb, "#dimensions %d: %dx%d\n", i, par->width, par->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); + } + avio_printf(s->pb, "#stream#, dts, pts, duration, size, hash\n"); return 0; } diff --git a/libavformat/internal.h b/libavformat/internal.h index 8e0cb34..5f475f3 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_framecrc_write_header(AVFormatContext *s); /** * Read a transport packet from a media file. diff --git a/libavformat/uncodedframecrcenc.c b/libavformat/uncodedframecrcenc.c index 9702a70..f4602d1 100644 --- a/libavformat/uncodedframecrcenc.c +++ b/libavformat/uncodedframecrcenc.c @@ -164,7 +164,7 @@ AVOutputFormat ff_uncodedframecrc_muxer = { .long_name = NULL_IF_CONFIG_SMALL("uncoded framecrc testing"), .audio_codec = AV_CODEC_ID_PCM_S16LE, .video_codec = AV_CODEC_ID_RAWVIDEO, - .write_header = ff_framehash_write_header, + .write_header = ff_framecrc_write_header, .write_packet = write_packet, .write_uncoded_frame = write_frame, .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT | -- 2.8.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel