[FFmpeg-cvslog] avformat/subfile: allow to extract till EOF

Gyan Doshi git at videolan.org
Sun Nov 19 20:52:02 EET 2017


ffmpeg | branch: master | Gyan Doshi <gyandoshi at gmail.com> | Wed Nov 15 17:54:19 2017 +0530| [e75fe0ef213074381c09e074f1f9619012f1ffad] | committer: Nicolas George

avformat/subfile: allow to extract till EOF

Users can set end offset as 0 to extract till end of file.
Tested locally and documented.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e75fe0ef213074381c09e074f1f9619012f1ffad
---

 doc/protocols.texi    | 6 ++++++
 libavformat/subfile.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 4d48f8a411..8661aea147 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:
@@ -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:
+ at example
+subfile,,start,32815239,end,0,,:video.ts
+ at 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..b527f2bee1 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)
+        c->end = INT64_MAX;
+
     if (c->end <= c->start) {
         av_log(h, AV_LOG_ERROR, "end before start\n");
         return AVERROR(EINVAL);



More information about the ffmpeg-cvslog mailing list