Commit Graph

120 Commits

Author SHA1 Message Date
Marton Balint 8d92f59d11 avformat/file: fail for non-numerical arguments to pipe:
Before this patch, the implementation of pipe: inputs/outputs would
silently fall back to stdin/stdout for any argument not successfully
parsed by strtol().

This patch introduces an explicit error for any non-numerical arguments,
which should avoid user confusion as in #10977.

New behavior:

$ cat /tmp/video.mkv | ./ffmpeg -i pipe:aa -acodec copy -vcodec copy -f matroska pipe:1 | cat >/tmp/out.mkv

[pipe @ 0x5618c7bcf740] Non-numerical argument "aa" to pipe:
[in#0 @ 0x5618c7bced00] Error opening input: Invalid argument
Error opening input file pipe:aa.
Error opening input files: Invalid argument

Based on the patch of Nils Goroll <nils.goroll@uplex.de>.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-07 23:38:05 +02:00
Leo Izen 7c338f470f avcodec, avformat/ffjni: fix duplicate JNI symbols
Use SHLIBOBJS and STLIBOBJS in the Makefiles for avcodec and avformat,
and add a stub ffjni.c to libavformat, which allows the symbols to be
duplicated for shared builds but not static builds.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2024-04-04 21:51:21 +02:00
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Andreas Rheinhardt e95dd6f53e avformat/file: Combine all CONFIG_ANDROID_CONTENT_PROTOCOL blocks
Besides improving readability this also ensures that
a developer who has the android content protocol enabled
and works on the other parts of the file will not
forget to add necessary inclusions just because of
(indirect) inclusions from the files included only
when said protocol is enabled.

Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-26 06:31:58 +01:00
Andreas Rheinhardt ebe8326409 avformat/file: Constify android content protocol
(The discrepancy between the definition and the declaration
in protocols.c is actually UB.)

Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-26 06:31:40 +01:00
Matthieu Bouron 6567516a5e avformat: add Android content resolver protocol support
Handles Android content URIs starting with content://.
2024-03-23 11:37:29 +01:00
Anton Khirnov 08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt 0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
Zhao Zhili 5c3d2177e7 avformat/file: seek back to initial position for fd protocol
So user's fd can be passed to libavformat multiple times in sequence
without changing the position.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-21 19:29:18 +08:00
Zhao Zhili e30bf5acee avformat/file: add S_IFBLK/S_ISBLK compatability macro
They are not available on Windows.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-12 20:52:37 +08:00
Zhao Zhili 6e7c006e40 avformat/file: add fd protocol
Unlike the pipe protocol, fd protocol has seek support if it
corresponding to a regular file.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Zhao Zhili e9fe1634d4 avformat/file: dup file descriptor for pipe
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Zhao Zhili 8d91a8faab avformat/file: reindent after the previous commit
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Zhao Zhili 49b8f043ca avformat/file: add fd option for pipe
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Andreas Rheinhardt 72c601e0f7 avutil/internal: Move avpriv-file API to a header of its own
It is not used by the large majority of files that include
lavu/internal.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
softworkz 5d5a014199 avformat/file: remove _WIN32 condition
stat is now re-mapped with long path support
in os_support.h

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-06-09 13:03:55 +03:00
Martin Storsjö a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the
list of enabled components has changed, but not the other properties
of the build, set in config.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:49 +02:00
Marton Balint 722d28db12 avformat/file: use proper return value in file_close
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-12-12 00:32:20 +01:00
Michael Witten f040c1ec4e libavformat/file.c: 'file_delete()' and 'file_move()' require 'CONFIG_FILE_PROTOCOL'
This quashes 2 warnings when the 'file' protocol is not enabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-12 04:43:31 +02:00
Steven Liu b9606064c4 avformat/hls: support data protocol in uri for EXT-X-MAP
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2020-01-18 22:41:11 +08:00
Marton Balint 3e10223385 avformat/file: add seekable option to disallow seeking
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-04-11 21:18:51 +02:00
Karthick Jeyapal e9564f7fea avformat/file: Fix file delete for Windows
Fixes bug id : 7638
2019-01-07 11:41:20 +05:30
Marton Balint db9e87dd8c avformat/file: increase min/max packet size to 256k for written files
Buffering more than one packet can be a huge performance improvement for
encoding files with small packets (e.g. wav) over SMB/CIFS.

Acked-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-06-24 18:51:29 +02:00
Daniel Kucera c557718bea libavformat/file: return AVERROR_EOF on EOF
Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-17 22:36:54 +02:00
Matt Oliver 37787f2616 lavf/os_support.h: Fix for unicode filenames on windows.
Fixes #819 #5256 #5281

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
2016-06-13 13:47:32 +10:00
Derek Buitenhuis 90eb249969 Merge commit '933dec0e29ec4d2cb83474279a6c52d62fdb7310'
* commit '933dec0e29ec4d2cb83474279a6c52d62fdb7310':
  file: Add an option for following a file that is being written

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-19 14:41:19 +01:00
Martin Storsjö 933dec0e29 file: Add an option for following a file that is being written
Using this requires setting the rw_timeout option to make it
terminate, alternatively using the interrupt callback (if used via
the API).

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-03-24 10:33:59 +02:00
Michael Niedermayer efa98cdc2f avformat/file: Add crypto to default whitelist
Fixes Ticket5287

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-19 18:56:59 +01:00
Derek Buitenhuis 9c75148e6e Merge commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d'
This commit also disables the async fate test, because it
used internal APIs in a non-kosher way, which no longer
exists.

* commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d':
  lavf: reorganize URLProtocols

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 16:51:10 +00:00
Raymond Hilseth 20e4863ab1 avformat/file: enable file_move() without unistd.h
it only requires the rename function from os_support.h.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-28 22:26:39 +01:00
Anton Khirnov 2758cdedfb lavf: reorganize URLProtocols
Instead of a linked list constructed at av_register_all(), store them
in a constant array of pointers.

Since no registration is necessary now, this removes some global state
from lavf. This will also allow the urlprotocol layer caller to limit
the available protocols in a simple and flexible way in the following
commits.
2016-02-22 11:30:58 +01:00
Michael Niedermayer fe3fed0b14 Update demuxers and protocols for protocol whitelist support
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-02 04:16:50 +01:00
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Hendrik Leppkes 88e7ea3e56 Merge commit 'e05f7ed5436207f4a55f1978b223c7f8bc82af42'
* commit 'e05f7ed5436207f4a55f1978b223c7f8bc82af42':
  file: properly forward errors from file_read() and file_write()

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-07 16:11:57 +02:00
Sean McGovern e05f7ed543 file: properly forward errors from file_read() and file_write()
Bug-Id: 881

CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-09-03 13:39:34 +02:00
Michael Niedermayer fddcd9e570 avformat/file: Fix copy and paste error
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-03 12:42:40 +02:00
Michael Niedermayer d65b9114f3 avformat/file: Check for lstat() instead of dirent.h
Fixes build on mingw

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-25 13:08:44 +02:00
Mariusz Szczepańczyk 1f4c62e84e lavf/file: check for dirent.h support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-25 02:06:06 +02:00
Lukasz Marek d39a9b01e2 lavf/file: implement directory listing callbacks
Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-25 02:04:34 +02:00
Mariusz Szczepańczyk 824a82d1b8 lavf/file: implement move and delete callbacks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-22 12:46:18 +02:00
Stefano Sabatini 22fa50d159 lavf/file: fix help message first character casing for trunc option 2014-01-05 00:51:38 +01:00
Alexander Strasser 77015443a8 lavf/file: file_check: Handle file URLs that start with "file:"
Handle the URL analog to file_open, it may contain a "file:"
prefix. Skip it. Make access checks to file URLs starting
with "file:" work.

Fix part of ticket #3249.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2014-01-04 23:19:37 +01:00
Michael Niedermayer 756f865e3b Merge commit '51eb213d00154b8e7856c7667ea62db8b0f663d4'
* commit '51eb213d00154b8e7856c7667ea62db8b0f663d4':
  libavformat: use avpriv_open()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-08 11:47:12 +02:00
Rémi Denis-Courmont 51eb213d00 libavformat: use avpriv_open()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-07 21:22:03 +02:00
Andrey Utkin a8f171151f file: Add 'blocksize' option
Interruptibility of file operations is strongly desirable in case of
slow storage access, e.g. mounted network share.
This commit introduces possibility to limit data quantity transferred by
'file' protocol at once. By default, old behaviour is preserved and data
is still tried to be transferred without block size limitation.

Note that file I/O operation still may block (or even freeze) inside of
single read(2) or write(2) operation.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-31 21:16:54 +02:00
Michael Niedermayer 257196209f file: fix 10l error in access() check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-27 13:24:00 +01:00
Michael Niedermayer 16ef48c37f file: Fallback to stat() based file_check() when access() or its named flags are unavailable.
Should fix compilation on native windows
We could also use _access() and literal numbers as flags but i cant test it
and the compilation failure should be fixed ASAP

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-27 05:03:24 +01:00
Michael Niedermayer 407921072f file: fix file_check()
Fixes Ticket1904

This should work on windows, but if not please contact me ASAP
i have another idea on how to solve this without access() if that
really doesnt work on windows.

Strongly based on patch by divVerent
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-27 03:53:53 +01:00
Michael Niedermayer ef9fe5bedd Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mingw/cygwin: Stop adding -fno-common to gcc CFLAGS
  Restructure av_log_missing_feature message
  rtp: Support packetization/depacketization of opus
  file: Set the return value type for lseek to int64_t.
  ppc: fix Altivec build with old compilers
  build: add LTO support for PGI compiler
  build: add -Mdse to PGI optimisation flags
  rtpenc_vp8: Update the packetizer to the latest spec version
  rtpdec_vp8: Make the depacketizer implement the latest spec draft
  doc: allow building with old texi2html versions
  avutil: skip old_pix_fmts.h since it is just a list

Conflicts:
	libavcodec/aacdec.c
	libavcodec/h264.c
	libavcodec/ppc/fmtconvert_altivec.c
	libavcodec/utils.c
	libavformat/file.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-09 13:06:04 +02:00
Yusuke Nakamura e04826c34e file: Set the return value type for lseek to int64_t.
This fixes a regression in 4ed5ac5.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-09 11:27:12 +03:00