From 2fa57c9daf5b535bf9aa5253b45cc3df6bc05aa8 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 6 Aug 2012 12:38:57 -0400 Subject: [PATCH 1/3] mpc8: set packet duration and stream start time instead of tracking frames Fixes mpc8 timestamps. --- libavformat/mpc8.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index b6837c52f7..4f8d8eedda 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -49,7 +49,6 @@ static const int mpc8_rate[8] = { 44100, 48000, 37800, 32000, -1, -1, -1, -1 }; typedef struct { int ver; - int frame; int64_t header_pos; int64_t samples; @@ -240,6 +239,7 @@ static int mpc8_read_header(AVFormatContext *s) st->codec->channels = (st->codec->extradata[1] >> 4) + 1; st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5]; avpriv_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate); + st->start_time = 0; st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2); size -= avio_tell(pb) - pos; @@ -272,7 +272,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) if(av_get_packet(s->pb, pkt, size) < 0) return AVERROR(ENOMEM); pkt->stream_index = 0; - pkt->pts = c->frame; + pkt->duration = 1; return 0; } if(tag == TAG_STREAMEND) @@ -285,13 +285,12 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st = s->streams[stream_index]; - MPCContext *c = s->priv_data; int index = av_index_search_timestamp(st, timestamp, flags); if(index < 0) return -1; if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0) return -1; - c->frame = st->index_entries[index].timestamp; + ff_update_cur_dts(s, st, st->index_entries[index].timestamp); return 0; } From fdbeae449030543525ce45b048c0241643ce02ef Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 6 Aug 2012 13:06:25 -0400 Subject: [PATCH 2/3] mpc8: add a flush function Ensures that the next frame decoded after seeking will be decoded as a keyframe. --- libavcodec/mpc8.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index f2e8342dcb..639adaac3b 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -420,6 +420,12 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, return c->cur_frame ? c->last_bits_used >> 3 : buf_size; } +static av_cold void mpc8_decode_flush(AVCodecContext *avctx) +{ + MPCContext *c = avctx->priv_data; + c->cur_frame = 0; +} + AVCodec ff_mpc8_decoder = { .name = "mpc8", .type = AVMEDIA_TYPE_AUDIO, @@ -427,6 +433,7 @@ AVCodec ff_mpc8_decoder = { .priv_data_size = sizeof(MPCContext), .init = mpc8_decode_init, .decode = mpc8_decode_frame, + .flush = mpc8_decode_flush, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"), }; From f5d2c597e99af218b0d4d1cf9737c7e68ee934e4 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 7 Aug 2012 00:32:48 +0100 Subject: [PATCH 3/3] build: fix library installation on cygwin This installs libraries using the proper names and locations, generates an import lib for the DLL, and drops no longer needed linker flags. Signed-off-by: Mans Rullgard --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 805f33e4f5..e9058d4c45 100755 --- a/configure +++ b/configure @@ -2600,7 +2600,10 @@ case $target_os in SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' - SHFLAGS='-shared -Wl,--enable-auto-image-base' + SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' + SLIB_INSTALL_LINKS= + SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a' + SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a' objformat="win32" enable dos_paths check_cflags -fno-common