From patchwork Thu Jan 19 20:05:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 2259 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp435937vsb; Thu, 19 Jan 2017 12:05:50 -0800 (PST) X-Received: by 10.28.25.134 with SMTP id 128mr249449wmz.37.1484856350697; Thu, 19 Jan 2017 12:05:50 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k5si233274wmf.154.2017.01.19.12.05.50; Thu, 19 Jan 2017 12:05:50 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 19D1968A51A; Thu, 19 Jan 2017 22:05:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86FFF68A4E5 for ; Thu, 19 Jan 2017 22:05:26 +0200 (EET) Received: by mail-wm0-f66.google.com with SMTP id c85so1514345wmi.1 for ; Thu, 19 Jan 2017 12:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=tIQldpdg61XYnLZ6R1oTdD5KeNT7VGK0qexwKHASgng=; b=bTPt82PcdCenPz2i87Gnq+q6TD9/14PqfN0CkF/2Lw73yVt6VAutmwRh3lmwBqx8FL DFSP2jiJFhN5NSjWo828ovOcW+a3RuG0p+iIUBfqtsUAHJmFxGSHdTAnmh0wpEXvmNZb C3EEX0CH4zYmcY98EZ1Qy2qDPt7ibje4FnOzTCk3PtWw7BMGLS1H+PIOvaLbTkgBdUN1 2vEIrPHheIeejqx9j0737VDDp4R8OLcdd+NesCJIsu2ksFK0vBw4jm84S3kUKpzZQNFy 0Ptbk8PwDRtiH+R5KGAnJJL2GQErw0PsT7SYFFhju3OcLybSi3Vxchjz0vxOzfveazNL 9+WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=tIQldpdg61XYnLZ6R1oTdD5KeNT7VGK0qexwKHASgng=; b=BwjPrSmv3a+T6SmANfLDPu6xPyupPGKORWFDpJUbku36XC3a4nB3DsvYUT9Suzhy2H oOX7elowVv6yKbo5l6H3xzmT/n1l+AX6ZPfJRkw2fU98g65HfAzBof7Z299IznbFgi+x 5xTpigLpgRc3uqdnt71udeQ3jczLzeHHXHFkASZ/KfwuIF121Z4/4SQUT/dI2MGovdlo z8BMf0+04UUw/nAAqVR/inGobydZEe+vlTlpZigP3EsvZAXZDEVZgvQ5K2/zC7OZklM+ hXr5beu2sHz770LR+iEFXCZrRdBH42LbDFYg++xETKQ4b+/TDbLNXlCvRGr3H6CNdLel yh7Q== X-Gm-Message-State: AIkVDXInS5wDTi1OKfGNx9WNBViUuH3ZpfpxaLLxbULXNMECFUIogI8j+CBGOoooOnJ8EQ== X-Received: by 10.223.136.155 with SMTP id f27mr8713526wrf.98.1484856336900; Thu, 19 Jan 2017 12:05:36 -0800 (PST) Received: from localhost.localdomain ([109.227.48.244]) by smtp.gmail.com with ESMTPSA id c81sm483573wmf.22.2017.01.19.12.05.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 12:05:35 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 Jan 2017 21:05:05 +0100 Message-Id: <20170119200506.7936-2-onemda@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170119200506.7936-1-onemda@gmail.com> References: <20170119200506.7936-1-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/wmaprodec: add xma_flush for seeking in XMA2 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Paul B Mahol --- libavcodec/wmaprodec.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 55a4807..ed9cbcf 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1858,13 +1858,8 @@ static av_cold int xma_decode_end(AVCodecContext *avctx) return 0; } -/** - *@brief Clear decoder buffers (for seeking). - *@param avctx codec context - */ -static void flush(AVCodecContext *avctx) +static void flush(WMAProDecodeCtx *s) { - WMAProDecodeCtx *s = avctx->priv_data; int i; /** reset output buffer as a part of it is used during the windowing of a new frame */ @@ -1872,6 +1867,30 @@ static void flush(AVCodecContext *avctx) memset(s->channel[i].out, 0, s->samples_per_frame * sizeof(*s->channel[i].out)); s->packet_loss = 1; + s->skip_packets = 0; +} + + +/** + *@brief Clear decoder buffers (for seeking). + *@param avctx codec context + */ +static void wmapro_flush(AVCodecContext *avctx) +{ + WMAProDecodeCtx *s = avctx->priv_data; + + flush(s); +} + +static void xma_flush(AVCodecContext *avctx) +{ + XMADecodeCtx *s = avctx->priv_data; + int i; + for (i = 0; i < (avctx->channels + 1) / 2; i++) + flush(&s->xma[i]); + + memset(s->offset, 0, sizeof(s->offset)); + s->current_stream = 0; } @@ -1888,7 +1907,7 @@ AVCodec ff_wmapro_decoder = { .close = wmapro_decode_end, .decode = wmapro_decode_packet, .capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, - .flush = flush, + .flush = wmapro_flush, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, }; @@ -1916,6 +1935,7 @@ AVCodec ff_xma2_decoder = { .init = xma_decode_init, .close = xma_decode_end, .decode = xma_decode_packet, + .flush = xma_flush, .capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE },