From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2A40647562 for ; Tue, 12 Sep 2023 06:11:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E29A68C978; Tue, 12 Sep 2023 09:11:33 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 805B268C59D for ; Tue, 12 Sep 2023 09:11:27 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 395E910602D4 for ; Tue, 12 Sep 2023 06:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1694499087; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=XhhMMYsrQY7PNKiFrRN5ZDomh58XumoFs+9RGMs13Yk=; b=FLjecYALu1IX43KbwelBx8plhZc+rMQcuomdD3OYJ0ZrYArHrdqHwi29aUKv3wQi tt6mlHj9k39vCR4ocI9Vni+JakK2+pXlwpWgvITNMMABgwFksE8hgWuS9sIfkEQc+kD yH342gWjx82RGsJlr7EIf36jZGPWjdkp3hXdZX5ooQOUi6MsGTBvn/cC9+dAujc4HEK dixJraDyjf8tGxHWA4cEk3AGv/k8E5CspeVCSPx12F/5RxMnrwy4Wgl64ytTTgZHaU2 7vOAFxl0bH+hZ9LTFY5l24yC77GMTlkqtF5Jcxw5T8Z6xuKoz6d1kSadWWALAnJBBl/ BfgSRC4tyg== Date: Tue, 12 Sep 2023 08:11:27 +0200 (CEST) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_892965_1402620849.1694499087230" Subject: [FFmpeg-devel] [RFC PATCH 2/3] decode: allow decoders to override skip_samples X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_892965_1402620849.1694499087230 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Very hacky. There must be a better way of doing this. ------=_Part_892965_1402620849.1694499087230 Content-Type: text/x-diff; charset=us-ascii; name=0002-decode-allow-decoders-to-override-skip_samples.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-decode-allow-decoders-to-override-skip_samples.patch >From 843809ac072bbaf9ae0d3d3946723f1fcfb07923 Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 12 Sep 2023 08:00:02 +0200 Subject: [PATCH 2/3] decode: allow decoders to override skip_samples --- libavcodec/decode.c | 5 ++++- libavcodec/internal.h | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 169ee79acd..9e8a4532f2 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -312,7 +312,10 @@ static int discard_samples(AVCodecContext *avctx, AVFrame *frame, int64_t *disca side = av_frame_get_side_data(frame, AV_FRAME_DATA_SKIP_SAMPLES); if (side && side->size >= 10) { - avci->skip_samples = AV_RL32(side->data); + if (avci->skip_samples_add) + avci->skip_samples += AV_RL32(side->data); + else + avci->skip_samples = AV_RL32(side->data); avci->skip_samples = FFMAX(0, avci->skip_samples); discard_padding = AV_RL32(side->data + 4); av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to side data\n", diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 83e0bc3fb2..8f59a117ba 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -118,6 +118,11 @@ typedef struct AVCodecInternal { */ int skip_samples; + /** + * In case there's side data, add it to skip_samples, instead of overriding it. + */ + int skip_samples_add; + /** * hwaccel-specific private data */ -- 2.40.1 ------=_Part_892965_1402620849.1694499087230 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ------=_Part_892965_1402620849.1694499087230--