Commit Graph

28 Commits

Author SHA1 Message Date
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
Anton Khirnov a2f5913857 lavf: set internal thread names 2022-10-24 02:00:31 +02:00
Guangyu Sun fc6f7e2a3b lavf/async: Fix ring_write return value
This fixes a regression from commit 36117968ad.

wrapped_url_read() used to be able to return positive number from
ffurl_read(). It relies on the result to check if EOF is reached in
async_buffer_task().

But FIFO callbacks must return 0 on success. This should be handled
in ring_write() instead.

Test case:
  ffmpeg -f lavfi -i testsrc -t 1 test.mp4
  ffmpeg -i async:test.mp4

Signed-off-by: Guangyu Sun <gsun@roblox.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-10-14 12:19:13 +02:00
Anton Khirnov 36117968ad lavf/async: switch to new FIFO API 2022-02-07 00:31:23 +01:00
Andreas Rheinhardt 7b43646e18 avformat/avio: Remove ffurl_open
It is only used in commented-out (and nonworking) code in async.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-02 23:53:29 +01:00
Limin Wang 6dad428546 avformat/async: Use AVERROR macro
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-01-22 07:40:29 +08:00
Andreas Rheinhardt 82bf41f3ab avformat: Replace ffurl_close() by ffurl_closep() where appropriate
It avoids leaving dangling pointers behind in memory.

Also remove redundant checks for whether the URLContext to be closed is
already NULL.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-25 13:11:36 +02:00
Marton Balint 4b46d1ee46 avformat/async: fix assertion condition when draining buffer
Fixes some random assertion failures with

ffprobe -show_packets async:samples/ffmpeg-bugs/trac/ticket6132/Samsung_HDR_-_Chasing_the_Light.ts > /dev/null

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-04 21:43:30 +01:00
Derek Buitenhuis f8e89d8a29 Merge commit 'fab8156b2f30666adabe227b3d7712fd193873b1'
* commit 'fab8156b2f30666adabe227b3d7712fd193873b1':
  avio: Copy URLContext generic options into child URLContexts

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-21 15:55:09 +01:00
Derek Buitenhuis 93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00: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
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
Bryan Huh d07585f04a avformat/async: Fix bug where async could not recover after seek to eof
When async issues its inner seek via ffurl_seek, it treats failures as
EOF being reached. This is not consistent with the behavior of other
protocols (e.g. http, cache) which continue to tolerate reads after
failed seeks, and therefore does not interact correctly with them.

A common pattern where this manifests itself is where avio_seek is
called with pos to be the end-of-file - the http range-request would
fail here, and async would set io_eof_reached to 1. The background
thread would then refuse to read more bytes, and subsequent reads would
only empty the fifo and end in an error.

Presumably the code may have expected subsequent seeks to unset the
io_eof_reached but this is not guaranteed to be true - a subsequent seek
that lands in the AVIOContext's buffer (the fact that the
previously-failed avio_seek leaves the AVIOContext's buffer intact also
suggests that follow-up reads are expected to be tolerated) would not be
issued to the async_seek function, and when that buffer is drained only
async_read calls would follow, leading to the same error just described.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-13 12:43:22 +01:00
Ganesh Ajjanagadde 4c96985af1 all: remove some casts of function pointer to void *
These casts are unnecessary, and may safely be removed.
Found by enabling -Wpedantic on clang 3.7.

Tested with FATE.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-24 15:14:59 -04:00
Zhang Rui 6c7f289fab avformat/async: cache some data for fast seek backward
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-14 20:40:09 +02:00
Zhang Rui 810fbd8933 fate/async: test error code from underlying protocol
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-10 17:58:45 +02:00
Zhang Rui 7dc42c9e65 avformat/async: pass internal I/O error
av_fifo_generic_write() does not return any error code.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-10 17:58:45 +02:00
Matt Oliver 3b03bde46e avformat/async: Allow compilation with native threads. 2015-09-30 13:41:53 +10:00
Zhang Rui b821aed706 avformat/async: fix integer conversion warning
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-07 13:15:44 +02:00
Zhang Rui 929451c5cb avformat/async: replace strerror with av_err2str
Fixes CID1322337

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-06 10:51:46 +02:00
Zhang Rui 8a17335189 avformat/async: wake up main thread before exit background thread
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-25 02:26:01 +02:00
Zhang Rui c0a4af408e avformat/async: move more code into locked area in background thread
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-25 01:43:44 +02:00
Zhang Rui 830d3a0ebe avformat/async: rename async_interrupt_callback to async_check_interrupt
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-21 21:19:05 +02:00
Zhang Rui 5e2098d906 avformat/async: fix interrupt_callback usage and return code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-21 21:18:48 +02:00
Michael Niedermayer f2d7409c72 avformat/async: Add missing else
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-21 17:04:11 +02:00
Zhang Rui aee909acfb fate: add test for async protocol
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-21 15:19:42 +02:00
Zhang Rui f477a3f5ab avformat/async: support filling with a background thread.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-18 01:46:50 +02:00