[FFmpeg-devel] [PATCH] avformat/file: add fd protocol

Zhao Zhili quinkblack at foxmail.com
Thu Dec 8 18:16:36 EET 2022


On Thu, 2022-12-08 at 16:28 +0100, Andreas Rheinhardt wrote:
> Marvin Scholz:
> > 
> > On 8 Dec 2022, at 16:11, Zhao Zhili wrote:
> > 
> > > On Mon, 2022-12-05 at 10:51 +0800, zhilizhao(赵志立) wrote:
> > > > > On Nov 19, 2022, at 02:48, Zhao Zhili <quinkblack at foxmail.com
> > > > > >
> > > > > wrote:
> > > > > 
> > > > > From: Zhao Zhili <zhilizhao at tencent.com>
> > > > > 
> > > > > Unlike the pipe protocol, fd protocol has seek support if it
> > > > > corresponding to a regular file.
> > > > > ---
> > > > > Sometimes it's the only way to access files via file
> > > > > descriptor,
> > > > > e.g.,
> > > > > requesting a shared file on Android:
> > > > > https://developer.android.com/training/secure-file-sharing/request-file
> > > > > 
> > > > > doc/protocols.texi      | 24 +++++++++++++++++++
> > > > > libavformat/Makefile    |  1 +
> > > > > libavformat/file.c      | 51
> > > > > +++++++++++++++++++++++++++++++++++++++++
> > > > > libavformat/protocols.c |  1 +
> > > > > libavformat/version.h   |  4 ++--
> > > > > 5 files changed, 79 insertions(+), 2 deletions(-)
> > > > > 
> > > > > 
> > > > 
> > > > Ping for review.
> > > > 
> > > 
> > > Will apply tomorrow unless there are objections.
> > > 
> > 
> > Maybe I overlooked something but where does the CONFIG_FD_PROTOCOL
> > define comes from?
> > 
> 
> It is autogenerated by configure due to the entry in lavf/protocols.c
> (and this change will trigger a request to rerun configure when
> compiling).
> (I haven't looked at the patch at all.)
> 
> - Andreas

Yes, it was automatically generated by configure and included in
config_components.

For the patch itself, make pipe protocol is easy, but it doesn't sound
right (a seekable pipe). So I chose to add a new one, which is
supported by VLC too (URl is little different).

A quick test case for this patch is:

$ ./ffplay fd:0 < ~/video/cctv.mp4

You can seek back and forth.



More information about the ffmpeg-devel mailing list