From patchwork Mon Jul 15 17:09:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 13952 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BCF2D446CE1 for ; Mon, 15 Jul 2019 20:16:05 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 95B4B68A77D; Mon, 15 Jul 2019 20:16:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3347C68A3EB for ; Mon, 15 Jul 2019 20:15:59 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id y4so17975669wrm.2 for ; Mon, 15 Jul 2019 10:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yDjVcqkqoGY6CLDNlcGcwLjZo4+9iUjf3FFrXfrSJAg=; b=eqVsgb2FKxWZOF+CWNwNe4yzvwKRvPHSct0qLTSkSfBAfim25yAjZyvd/Adci7KkKX phU5M33VCBPvCRoKO/W2SE3c3nHfkDGlsQHLKVWwNwaa4ot5UpUNEc9dgF2tXqbG+4Ct AgX4csTvNyvU+KYApViA3o4UBcoYF9ORCZRUdiRgapBXPKUkPL8uTVmqiZa5aE4nvjG5 c/Sgp469DnlvCORXjEKqyg0kTk/GKrPokUadofCr8mxOkqO7IEy/l6/TQU0V3eLGexiX o+H9yD4QBilX924Yzmrt/bDL9/BAD4GGGQRgf6w1rhSzMNpjyzTuvv2OlcAEwf7rjiev zv1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yDjVcqkqoGY6CLDNlcGcwLjZo4+9iUjf3FFrXfrSJAg=; b=hUdPUU24SA0nmikYuzl4YtFkmgYSgd/tutx3cmyz9tUGYETv03PvvFzcvfKv3s5AKk VvaH/GODFvfEdfJKnw2bCftduBfIKh3Hobi+vE+wKW3v+64rBHuZd3VsbPunDYuUTNdK q8pBlh5yMicQZiKw0civPCsfOsXDkDSe9JIxhXMi3rGhAOVUIx159Ds1ZcTg8MZr3KI4 UG89Qm4ZxgMVF3kZAuw0kqIHtSDwysfg8paFniHa6v89d3gx07BOkkOTo5h+29tWv3JF 7ieI7algMDDNfJr/KEcKgKOeID7vlLrxlszxtZ8Ln68iuYrdVCwfcIQkPRdckM88vbzr yfww== X-Gm-Message-State: APjAAAXwGohVeoAnuxnnnsfyxcd3PTCIPQc8efgJfd0q7SS6gtMaw8CT MxKUqHeXRsmreWN+kiU0FNIfD1jJ X-Google-Smtp-Source: APXvYqyu1Cd3mP4txe0+RWsp5kXhrLohPEY+0pMjWc45KuJptPnUwdAPB2nscis+VFZIDYmlXCTroQ== X-Received: by 2002:adf:df90:: with SMTP id z16mr17763900wrl.331.1563210569474; Mon, 15 Jul 2019 10:09:29 -0700 (PDT) Received: from localhost.localdomain (ipbcc08b8f.dynamic.kabel-deutschland.de. [188.192.139.143]) by smtp.gmail.com with ESMTPSA id t140sm16807063wmt.0.2019.07.15.10.09.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 10:09:28 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jul 2019 19:09:04 +0200 Message-Id: <20190715170904.46574-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavformat/subfile: Fix SEEK_END seeking 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Up until now, when performing a SEEK_END seek, the subfile protocol ignored the desired position (relative to EOF) and used the current absolute offset in the input file instead. Signed-off-by: Andreas Rheinhardt --- A situation affected by this is a concatenation of concat and subfile: For some reason, SEEK_SIZE is not implemented for the concat protocol, so that SEEK_END is used as a fallback. Depending on parameter combinations, this can mean that the duration of e.g. transport streams can't be estimated. Sorry for not spotting this in 4877b586; the bug here was already present in the initial commit of this protocol. libavformat/subfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/subfile.c b/libavformat/subfile.c index 2f162e0a34..8210dfb6b3 100644 --- a/libavformat/subfile.c +++ b/libavformat/subfile.c @@ -135,7 +135,7 @@ static int64_t subfile_seek(URLContext *h, int64_t pos, int whence) new_pos += pos; break; case SEEK_END: - new_pos = end + c->pos; + new_pos = end + pos; break; } if (new_pos < c->start)