From patchwork Wed Nov 15 11:55:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan X-Patchwork-Id: 6097 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp4475736jah; Wed, 15 Nov 2017 03:56:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMaIrmRTOfLzcDk752/cb7ZtgkLu4xSJF+1TXY8ihRg0iP7ITt+UhPxLyiXDLmc0USrRH1Yr X-Received: by 10.223.166.103 with SMTP id k94mr12993697wrc.22.1510746970117; Wed, 15 Nov 2017 03:56:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510746970; cv=none; d=google.com; s=arc-20160816; b=Jsj8EIdFMlvuBhS5q+5Con9ZjPfm2QvNu0HU5qgXGSELHnnAg1xyFlgHRQeksOAcfs aMIcdxXpMK8P7SbtUca1dCKRRz2cGxzEXkz/w12l6nn6Vh74aRn7/HSC5oJjN1kMOMBo FUlxYgLxYS/RWSRuZe9J5LRvg6lMpflBblVnydT5LHnZPX3FqVNJhTvj9VAFfDjSoaY+ UH5nqzgMTUptiw9p2DLwGByh7bNUlLnRrTFyLTA1Y0WuD9pJjKKXoBYHKpgN7GmznzoT 5nsMQVnmGi6S6W7oFkGV0KkoEtdI9amqVEKEddkgxctoeSLliNImXWjww0glcElEunEe oVAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:mime-version:user-agent:date:message-id:from:to :dkim-signature:delivered-to:arc-authentication-results; bh=ZOqnOMVxF3qghaAxi0bYHt1Y0UN2rHDIhnsIdbuGeu0=; b=baJX7naDIxlE+AMGAx65+JJr33hZfMLC2yU25YwFbtvU1lXfuRyQBaMCSAIly6FPer T8j1LgeZ4qT+JbrneQxM3BvCRddY6NXXpYmrX7RH4fd3p/EEG861dE63KKsCUitYnLqN 4NfCzFZ/YKT7CFyDmGJwnKTyeXKuv0TyXgLOqAq+lcd6f19qle4eTCypjB0mI1K/1EuC gYNMqGwjGaDcNhjbjokJaJkc0z7toSOeVYGB2/nf995BJN3ZHnc+BmJ4o1Lv/5j7a8Vz LvPHmaA9KfHNHOoPDCZ1BUvSlHUDzHrkRQ2deNUul/t/trCn+jxXDHeYQfzMGgXDtyE+ 7Wvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=qtjPpHls; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e191si8907963wme.68.2017.11.15.03.56.09; Wed, 15 Nov 2017 03:56:10 -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 header.s=20161025 header.b=qtjPpHls; 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 2EE69689FB1; Wed, 15 Nov 2017 13:55:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com [209.85.192.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80567689DA6 for ; Wed, 15 Nov 2017 13:55:46 +0200 (EET) Received: by mail-pf0-f179.google.com with SMTP id m88so9612752pfi.9 for ; Wed, 15 Nov 2017 03:56:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=BkQSATJ0GMjPmeAbvbv9HiwTyAJKDC1lsVmh+JQcH5U=; b=qtjPpHlsx4YmpTf8xpp3+oZjr/QM/FKRTkSbI5EljOojBIVEeIeX4OwQi3b0KFFAXL p7qJQzj3RYfyZrF8T+KoNNO+fBYHuKgI0xl5tXQTSSHG1SVW4T/6tpc5JCI3h9ccFNxB gmumo+2OB+of0c89k+XAqAuxthCNNX5XDyoxCYG6jjyXePOKmpsrDQEWGKRy2e2cHeKH 4VuPVmfV02DQmg7J7b3WNtjC0ewzQJ7xqvSIMzSdIa7F4oJfsEuL4sORhIeq6X2ds75u rAwX6My+xSOA14BSJrhSxUFy4d1GvbdkSKjzz1WKThz9tvryhNVdTsrjc6f+wmMZ7LmI tquQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=BkQSATJ0GMjPmeAbvbv9HiwTyAJKDC1lsVmh+JQcH5U=; b=I3oSl55EC9DOjargKZ5dhOYiXMK4vy9SA9WsbQbijNGlPlAMcx9csb6Ping1o4g9EH aiCTJUDWd4SUV+YOKHjDqsx1y63B8jMQM+Zhu/LLjMN9fe14zfHYS3KjOzO62YryAdym 0neEgSAKms/bv2934zht8l65Rk6H8UDz1J/drodNwUPHzh5dgpFj3Yx1TJwxgEkbvp9N jUsuNJwxvovw3O79lndlLX0xEsw5FgwCnP8NLcv/M3BsUZRXRKzkiK/gBIiMNLCWcmha 0FxnDd6mbaml51jsNmUCngicQ3HxWCzz0uH4HBziTJOHHRTjLHUuvVesqrQQ9K9GK52s hkBA== X-Gm-Message-State: AJaThX61JCPB+W3fuYlc4HTWqO3k1nTTwI+govnWtZLR5i7sSsD8c/gc 0Pnp7moqA0Wqb5b3DfuFWYhyTnX4 X-Received: by 10.101.65.200 with SMTP id b8mr15447084pgq.274.1510746959642; Wed, 15 Nov 2017 03:55:59 -0800 (PST) Received: from [192.168.1.105] ([103.206.133.10]) by smtp.gmail.com with ESMTPSA id x1sm45203628pfh.113.2017.11.15.03.55.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 03:55:58 -0800 (PST) To: ffmpeg-devel@ffmpeg.org From: Gyan Doshi Message-ID: <3699556a-0442-01b0-a3ca-32c21712b66a@gmail.com> Date: Wed, 15 Nov 2017 17:25:51 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] avformat/subfile: allow to extract till EOF 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Attached patch allows users to set end offset as 0 to extract till end of file. Tested locally and documented. Regards, Gyan From e5c555774f88639f0e9337f1b55733d0ad156b64 Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Wed, 15 Nov 2017 17:12:30 +0530 Subject: [PATCH] avformat/subfile: allow to extract till EOF Users can set end offset as 0 to extract till end of file. Tested locally and documented. --- doc/protocols.texi | 8 +++++++- libavformat/subfile.c | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index a7968ff56e..18c72532e1 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1186,6 +1186,7 @@ Accepted options: Start offset of the extracted segment, in bytes. @item end End offset of the extracted segment, in bytes. +If set to 0, extract till end of file. @end table Examples: @@ -1193,7 +1194,7 @@ Examples: Extract a chapter from a DVD VOB file (start and end sectors obtained externally and multiplied by 2048): @example -subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB +ffmpeg subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB @end example Play an AVI file directly from a TAR archive: @@ -1201,6 +1202,11 @@ Play an AVI file directly from a TAR archive: subfile,,start,183241728,end,366490624,,:archive.tar @end example +Play a MPEG-TS file from start offset till end: +@example +subfile,,start,32815239,end,0,,:video.ts +@end example + @section tee Writes the output to multiple protocols. The individual outputs are separated diff --git a/libavformat/subfile.c b/libavformat/subfile.c index 497cf85211..2094cdcdd0 100644 --- a/libavformat/subfile.c +++ b/libavformat/subfile.c @@ -72,6 +72,9 @@ static int subfile_open(URLContext *h, const char *filename, int flags, SubfileContext *c = h->priv_data; int ret; + if (c->end == 0) + c->end = INT64_MAX; + if (c->end <= c->start) { av_log(h, AV_LOG_ERROR, "end before start\n"); return AVERROR(EINVAL);