summaryrefslogtreecommitdiff
path: root/libavcodec/vorbisdec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-01-24 18:10:28 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-24 17:37:25 -0500
commit19adb0bc2d42ad88d6137efa5420e13696e721d0 (patch)
tree1505349f064583e8e176439f209c174cb22f34d5 /libavcodec/vorbisdec.c
parent830f70442a87a31f7c75565e9380e3caf8333b8a (diff)
vorbisdec: add a flush() function
clear MDCT overlap buffer and reset previous window mode when seeking
Diffstat (limited to 'libavcodec/vorbisdec.c')
-rw-r--r--libavcodec/vorbisdec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 11d6d76235..d3f6faff69 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1698,6 +1698,17 @@ static av_cold int vorbis_decode_close(AVCodecContext *avccontext)
return 0;
}
+static av_cold void vorbis_decode_flush(AVCodecContext *avccontext)
+{
+ vorbis_context *vc = avccontext->priv_data;
+
+ if (vc->saved) {
+ memset(vc->saved, 0, (vc->blocksize[1] / 4) * vc->audio_channels *
+ sizeof(*vc->saved));
+ }
+ vc->previous_window = 0;
+}
+
AVCodec ff_vorbis_decoder = {
.name = "vorbis",
.type = AVMEDIA_TYPE_AUDIO,
@@ -1706,6 +1717,7 @@ AVCodec ff_vorbis_decoder = {
.init = vorbis_decode_init,
.close = vorbis_decode_close,
.decode = vorbis_decode_frame,
+ .flush = vorbis_decode_flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
.channel_layouts = ff_vorbis_channel_layouts,