diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-04 02:14:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-04 02:34:14 +0100 |
commit | 3b46daa31f566f9c6ef1518c1767b12e0ab2f62a (patch) | |
tree | e0baf74dc919859429488d4ea73cfc92e96db414 /libavformat | |
parent | 670229ef4392fa88d6add97c0eef412a5d6083c0 (diff) | |
parent | 6f1a5e8d6b7e085171a49b8ce6a371a7c9643764 (diff) | |
download | ffmpeg-3b46daa31f566f9c6ef1518c1767b12e0ab2f62a.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
dsputil: remove debug message in dsputil_init().
movdec: Avoid av_malloc(0) in stss
build: Drop YASM-OBJS-FFT from SUBDIR_VARS.
build: Drop unused X86-OBJS variable.
avconv: remove debugging cruft from do_video_out().
avconv: factorize setting stream_index for the output packet.
frame{crc/md5}: set the stream timebase from codec timebase.
apedec: remove unneeded #include of get_bits.h and associated macro
apedec: av_fast_malloc() instead of av_realloc()
apedec: fix handling of packet sizes that are not a multiple of 4 bytes
Conflicts:
libavcodec/apedec.c
tests/ref/fate/4xm-1
tests/ref/fate/4xm-2
tests/ref/fate/aasc
tests/ref/fate/armovie-escape124
tests/ref/fate/bethsoft-vid
tests/ref/fate/cljr
tests/ref/fate/creatureshock-avs
tests/ref/fate/cscd
tests/ref/fate/cvid-partial
tests/ref/fate/deluxepaint-anm
tests/ref/fate/dfa1
tests/ref/fate/dfa10
tests/ref/fate/dfa11
tests/ref/fate/dfa2
tests/ref/fate/dfa3
tests/ref/fate/dfa4
tests/ref/fate/dfa5
tests/ref/fate/dfa6
tests/ref/fate/dfa7
tests/ref/fate/dfa8
tests/ref/fate/dfa9
tests/ref/fate/film-cvid-pcm-stereo-8bit
tests/ref/fate/flic-af11-palette-change
tests/ref/fate/flic-magiccarpet
tests/ref/fate/fraps-v2
tests/ref/fate/fraps-v3
tests/ref/fate/h264-lossless
tests/ref/fate/interplay-mve-16bit
tests/ref/fate/interplay-mve-8bit
tests/ref/fate/mimic
tests/ref/fate/motionpixels
tests/ref/fate/mpeg2-field-enc
tests/ref/fate/msvideo1-16bit
tests/ref/fate/mtv
tests/ref/fate/nuv
tests/ref/fate/pictor
tests/ref/fate/prores-alpha
tests/ref/fate/ptx
tests/ref/fate/qtrle-16bit
tests/ref/fate/qtrle-1bit
tests/ref/fate/quickdraw
tests/ref/fate/rpza
tests/ref/fate/sierra-vmd
tests/ref/fate/targa-conformance-CCM8
tests/ref/fate/targa-conformance-UCM8
tests/ref/fate/tiertex-seq
tests/ref/fate/truemotion1-15
tests/ref/fate/truemotion1-24
tests/ref/fate/tscc-15bit
tests/ref/fate/tscc-32bit
tests/ref/fate/v210
tests/ref/fate/vc1-ism
tests/ref/fate/vc1_sa00040
tests/ref/fate/vc1_sa00050
tests/ref/fate/vc1_sa10091
tests/ref/fate/vc1_sa20021
tests/ref/fate/vmnc-16bit
tests/ref/fate/vmnc-32bit
tests/ref/fate/vp5
tests/ref/fate/vp8-sign-bias
tests/ref/fate/vqa-cc
tests/ref/fate/wmv8-drm
tests/ref/fate/yop
tests/ref/fate/zmbv-8bit
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/Makefile | 4 | ||||
-rw-r--r-- | libavformat/framecrcenc.c | 5 | ||||
-rw-r--r-- | libavformat/framehash.c | 33 | ||||
-rw-r--r-- | libavformat/internal.h | 6 | ||||
-rw-r--r-- | libavformat/md5enc.c | 5 | ||||
-rw-r--r-- | libavformat/mov.c | 2 |
6 files changed, 51 insertions, 4 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile index bd2b17b6cd..45d2aa3ca7 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -97,8 +97,8 @@ OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o -OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o -OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o +OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o +OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o framehash.o OBJS-$(CONFIG_GIF_MUXER) += gif.o OBJS-$(CONFIG_GSM_DEMUXER) += gsmdec.o OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index c3890373be..72eeba707b 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -21,13 +21,15 @@ #include "libavutil/adler32.h" #include "avformat.h" +#include "internal.h" static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) { uint32_t crc = av_adler32_update(0, pkt->data, pkt->size); char buf[256]; - snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc); + snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08x\n", + pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc); avio_write(s->pb, buf, strlen(buf)); avio_flush(s->pb); return 0; @@ -38,6 +40,7 @@ AVOutputFormat ff_framecrc_muxer = { .long_name = NULL_IF_CONFIG_SMALL("framecrc testing format"), .audio_codec = CODEC_ID_PCM_S16LE, .video_codec = CODEC_ID_RAWVIDEO, + .write_header = ff_framehash_write_header, .write_packet = framecrc_write_packet, .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT, }; diff --git a/libavformat/framehash.c b/libavformat/framehash.c new file mode 100644 index 0000000000..28e9e8407d --- /dev/null +++ b/libavformat/framehash.c @@ -0,0 +1,33 @@ +/* + * Common functions for the frame{crc,md5} muxers + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "internal.h" + +int ff_framehash_write_header(AVFormatContext *s) +{ + int i; + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den); + avio_printf(s->pb, "#tb %d: %d/%d\n", i, st->time_base.num, st->time_base.den); + avio_flush(s->pb); + } + return 0; +} diff --git a/libavformat/internal.h b/libavformat/internal.h index c8376f7dda..94c66b9ef8 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -306,4 +306,10 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels, uint64_t channel_layout, int32_t sample_rate, int32_t width, int32_t height); +/** + * Set the timebase for each stream from the corresponding codec timebase and + * print it. + */ +int ff_framehash_write_header(AVFormatContext *s); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/md5enc.c b/libavformat/md5enc.c index 052061f039..7077f47840 100644 --- a/libavformat/md5enc.c +++ b/libavformat/md5enc.c @@ -21,6 +21,7 @@ #include "libavutil/md5.h" #include "avformat.h" +#include "internal.h" #define PRIVSIZE 512 @@ -89,7 +90,8 @@ static int framemd5_write_packet(struct AVFormatContext *s, AVPacket *pkt) av_md5_init(s->priv_data); av_md5_update(s->priv_data, pkt->data, pkt->size); - snprintf(buf, sizeof(buf) - 64, "%d, %"PRId64", %d, ", pkt->stream_index, pkt->dts, pkt->size); + snprintf(buf, sizeof(buf) - 64, "%d, %10"PRId64", %10"PRId64", %8d, %8d, ", + pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size); md5_finish(s, buf); return 0; } @@ -100,6 +102,7 @@ AVOutputFormat ff_framemd5_muxer = { .priv_data_size = PRIVSIZE, .audio_codec = CODEC_ID_PCM_S16LE, .video_codec = CODEC_ID_RAWVIDEO, + .write_header = ff_framehash_write_header, .write_packet = framemd5_write_packet, .flags = AVFMT_VARIABLE_FPS, }; diff --git a/libavformat/mov.c b/libavformat/mov.c index ddbe49083a..214463c823 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1593,6 +1593,8 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_dlog(c->fc, "keyframe_count = %d\n", entries); + if (!entries) + return 0; if (entries >= UINT_MAX / sizeof(int)) return AVERROR_INVALIDDATA; sc->keyframes = av_malloc(entries * sizeof(int)); |