aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avisynth.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/avisynth: move avs_planes* consts into relevant functionStephen Hutchinson2024-08-131-11/+11
| | | | | | | | These consts are only used in the switch(planar) case located in avisynth_create_stream_video and nowhere else in the demuxer, so move them into that function directly. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: remove library allocation from global stateStephen Hutchinson2024-08-131-69/+64
| | | | | | | | | As part of this, the mutexes are no longer necessary, and avisynth_read_close needs to check that avs->avs_library.library still exists before it attempts to call avisynth_context_destroy and dlclose. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: remove mutex lock from avisynth_read_closeStephen Hutchinson2024-08-131-4/+0
| | | | Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: remove atexit() handlerStephen Hutchinson2024-08-131-45/+1
| | | | | | | | | | | | | | | | | | | The atexit() handler in the avisynth demuxer was added because there was a conflict in AvxSynth that arose due to their use of C++ global objects, particularly in relation to having added a logging function relying on log4cpp. This conflict was responsible for causing a segfault on exit. It did not affect Windows with the (at the time) upstream AviSynth 2.5 and 2.6, nor does it affect AviSynth+. Unfortunately, none of this was actually shielded by ifdefs indicating the fact it was only needed for AvxSynth, so four years ago when AviSynth+ replaced AvxSynth as the handler for AviSynth scripts on Unix-like OSes, the fact that the atexit handler was no longer necessary was overlooked. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/utils: Use static mutexes instead of ff_lock_avformat()Andreas Rheinhardt2024-05-201-6/+9
| | | | | | | | | Its existence is a remnant of (libavcodec's) lock-manager API which has been removed in a04c2c707de2ce850f79870e84ac9d7ec7aa9143. There is no need to use the same lock for avisynth, chromaprint or tls, so switch to ordinary static mutexes instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-2/+1
| | | | | | | | | | | 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>
* avformat/avformat: Add FFInputFormat, hide internals of AVInputFormatAndreas Rheinhardt2024-03-071-5/+6
| | | | | | | | | | | | | | | | | | | | | This commit does for AVInputFormat what commit 59c9dc82f450638a3068deeb1db5c56f6d155752 did for AVOutputFormat: It adds a new type FFInputFormat, moves all the internals of AVInputFormat to it and adds a now reduced AVInputFormat as first member. This does not affect/improve extensibility of both public or private fields for demuxers (it is still a mess due to lavd). This is possible since 50f34172e0cca2cabc5836308ec66dbf93f5f2a3 (which removed the last usage of an internal field of AVInputFormat in fftools). (Hint: tools/probetest.c accesses the internals of FFInputFormat as well, but given that it is a testing tool this is not considered a problem.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-201-0/+1
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-221-1/+0
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avisynth: pass audio channel layoutStephen Hutchinson2023-07-191-0/+6
| | | | Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: reindentStephen Hutchinson2022-09-041-174/+174
| | | | Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: implement avisynth_flags optionStephen Hutchinson2022-09-041-0/+52
| | | | Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: read _SARNum/_SARDen from frame propertiesStephen Hutchinson2022-09-041-0/+8
| | | | | | | Initialized to 1:1, but if the script sets these properties, it will be set to those instead (0:0 disables it, apparently). Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: add missing avs_release_video_frameStephen Hutchinson2022-08-121-0/+1
| | | | | | | | | The AviSynth C API requires using avs_release_video_frame whenever avs_get_frame has been used, but the recent addition of frameprop reading to the demuxer was missing this in avisynth_create_stream_video. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: cosmetics after nb_channels changeStephen Hutchinson2022-08-071-4/+4
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/avisynth: use ch_layout.nb_channels for channel countStephen Hutchinson2022-08-071-1/+1
| | | | | | Fixes deprecation warning Signed-off-by: James Almer <jamrial@gmail.com>
* libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()Nil Admirari2022-06-211-12/+27
| | | | | | | | | 1. getenv() is replaced with getenv_utf8() across libavformat. 2. New versions of AviSynth+ are now called with UTF-8 filenames. 3. Old versions of AviSynth are still using ANSI strings, but MAX_PATH limit on filename is removed. Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/avisynth: fix fallbacks for four framepropsStephen Hutchinson2022-03-021-83/+101
| | | | | | | | | | If _FieldBased, _Matrix, _ColorRange, or _ChromaLocation haven't been set, that absence would be interpreted as 0, leading to those being set to case 0 instead of default. There is no case 0 for _Primaries and _Transfer, so those were correctly falling back to the default case. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: remove framedata variableStephen Hutchinson2022-02-231-2/+2
| | | | | | | | It's just a simple index. Addresses Coverity issue 1500290 Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: remove unused variable 'frameprop'Stephen Hutchinson2022-02-231-1/+0
| | | | | | | Since the check got simplified and stdbool was no longer necessary to include, neither is that variable. Silences a warning. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: fix frameprop version checkStephen Hutchinson2022-02-181-19/+6
| | | | | | | | | | | Trying to be clever about determining between interface version 8 and 8.1 ended up with pre-8.1 versions of AviSynth+ segfaulting. The amount of time between interface version 8.1 and 9 is small, so just restrict the frameprop awareness to version 9 and call it a day. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avisynth: use AviSynth+'s frame properties to set various fieldsStephen Hutchinson2022-02-131-13/+250
| | | | | | | | | | | | | | | * Field Order * Chroma Location * Color Transfer Characteristics * Color Range * Color Primaries * Matrix Coefficients The existing TFF/BFF detection is retained as a fallback for older versions of AviSynth that can't access frame properties. The other properties have no legacy equivalent to detect them. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avisynth: corrected interlace detectionemcodem2022-02-131-7/+4
| | | | | | | | | | | | | | | AviSynth works on frame-based video by default, which can be either progressive or interlaced. Some filters can break frames into half-height fields, at which point it considers the clip to be field-based (avs_is_field_based can be used to check for this situation). To properly detect the field order of a typical video clip, the frame needs to have been weaved back together already, so avs_is_field_based should actually report 'false' when checked. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avisynth: fix audio on big endianStephen Hutchinson2021-03-111-4/+11
| | | | | | | | AviSynth+ outputs audio in the same format as the OS, so assuming little endian formats as input on big endian OSes results in nothing but static. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avisynth: populate field orderemcodem2021-03-111-0/+17
| | | | | | Fixes Trac ticket #8757 Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avisynth: more intelligent RGB flippingStephen Hutchinson2021-03-111-22/+5
| | | | | | | | avs_is_color_space provides a generic way of checking whether the video is RGB, and has been available through AVSC_API since 2.6. This means that GetProcAddress doesn't have to run on every frame. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avformat/avisynth: fix deprecation warningStephen Hutchinson2020-04-051-2/+2
|
* avformat/avisynth: switch to AviSynth+ on LinuxStephen Hutchinson2020-04-051-41/+15
| | | | | | | | | | AviSynth+ now supports non-Windows OSes, making AvxSynth obsolete. Since we no longer support AviSynth 2.5 (which is essentially what AvxSynth is), remove AvxSynth support and replace it with AviSynth+. As a result, the USING_AVISYNTH defines can be switched back to generic _WIN32.
* avformat: Forward errors where possibleAndreas Rheinhardt2019-12-121-6/+6
| | | | | | | | | | It is not uncommon to find code where the caller thinks to know better what the return value should be than the callee. E.g. something like "if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit changes several instances of this to instead forward the actual error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avisynth: adapt 239d02eff3ffe9f7d40caa21dde50fb4a0e94c24 to dlsymStephen Hutchinson2019-05-041-1/+2
| | | | | | | | This commit was merged in a couple years ago as a no-op because we had already switched from GetProcAddress to dlsym some time before that. However, not applying the actual cast causes warnings about FARPROC and when attempting to build FFmpeg in MSVC with AviSynth-GCC 32-bit compatibility, those FARPROC warnings turn into FARPROC errors.
* libavformat/avisynth: enable additional pix_fmtsStephen Hutchinson2019-05-041-1/+32
| | | | | | | These pix_fmts have been added to FFmpeg in the 31 months since commit 92916e8542e425ca20daddb490261a5818643206 added support for the larger number of pix_fmts that AviSynth+ can use. They were present in AviSynth+ even then, just not in libavutil.
* lavc, lavf: move avformat static mutex from avcodec to avformatwm42017-12-261-5/+5
| | | | | | | | It's completely absurd that libavcodec would care about libavformat locking, but it was there because the lock manager was in libavcodec. This is more stright forward. Changes ABI, but we don't require ABI compatibility currently.
* Merge commit '3cc3463f306f425f76bd962755df1132eeac6dfa'Clément Bœsch2017-04-011-12/+14
|\ | | | | | | | | | | | | | | | | | | | | | | * commit '3cc3463f306f425f76bd962755df1132eeac6dfa': avisynth: Support pix_fmts added to AviSynth+ This commit is mostly a noop, see 92916e8542e425ca20daddb490261a5818643206. Cosmetics and a small fix are merged. Merged-by: Clément Bœsch <u@pkh.me>
| * avisynth: Support pix_fmts added to AviSynth+Stephen Hutchinson2016-11-171-1/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A number of new pix_fmts* have been added to AviSynth+: 16-bit packed RGB and RGBA 10-, 12-, 14, and 16-bit YUV 4:2:0, 4:2:2, and 4:4:4 8-, 10-, 12-, 14-, and 16-bit Planar RGB 8-, 10-, 12-, 14-, and 16-bit Planar YUVA and Planar RGBA 10-, 12-, 14-, and 16-bit GRAY variants 32-bit floating point Planar YUV(A), Planar RGB(A), and GRAY *some of which are not currently available pix_fmts here and were not added to the demuxer due to this Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * avisynth: Simplify the pix_fmt check for the newer AviSynth APIStephen Hutchinson2016-11-171-22/+5
| | | | | | | | | | | | | | The values don't need to be hardcoded since the correct values are returned by avs_bits_per_pixel. Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * avisynth: Fix setting stream timebaseMarton Balint2016-11-171-5/+3
| | | | | | | | | | | | | | | | | | Stream timebase should be set using avpriv_set_pts_info, otherwise avctx->pkt_timebase is not correct, leading to A/V desync. Signed-off-by: Marton Balint <cus@passwd.hu> Reviewed-by: Stephen Hutchinson <qyot27@gmail.com> Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '800d91d348c89fc8ca3fbec7696ab1ec8787acc6'James Almer2017-03-311-2/+1
|\| | | | | | | | | | | | | * commit '800d91d348c89fc8ca3fbec7696ab1ec8787acc6': Drop pointless void* casts Merged-by: James Almer <jamrial@gmail.com>
| * Drop pointless void* castsDiego Biurrun2016-11-131-2/+1
| |
* | avformat/avisynth.c: Use new safe dlopen code.Matt Oliver2016-11-051-9/+5
| | | | | | | | Signed-off-by: Matt Oliver <protogonoi@gmail.com>
* | avisynth: fix Planar RGB outputStephen Hutchinson2016-10-271-1/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avisynth: support pix_fmts added to AviSynth+Stephen Hutchinson2016-08-301-1/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A number of new pix_fmts have been added to AviSynth+: 16-bit packed RGB and RGBA 10-, 12-, 14, and 16-bit YUV 4:2:0, 4:2:2, and 4:4:4 8-, 10-, 12-, 14-, and 16-bit Planar RGB 8-, 10-, 12-, 14-, and 16-bit Planar YUVA and Planar RGBA* 10-, 12-, 14-, and 16-bit GRAY variants* 32-bit floating point Planar YUV(A), Planar RGB(A), and GRAY* *some of which are not currently available pix_fmts here and were not added to the demuxer due to this Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avisynth: simplify the pix_fmt check for the newer AviSynth APIStephen Hutchinson2016-08-111-22/+5
| | | | | | | | | | | | | | The values don't need to be hardcoded since the correct values are returned by avs_bits_per_pixel. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-1/+1
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-1/+1
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-101-30/+30
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-231-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* | avisynth: fix setting stream timebaseMarton Balint2015-08-131-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Stream timebase should be set using avpriv_set_pts_info, otherwise avctx->pkt_timebase is not correct. This should fix ticket #4766. Patch is only compile tested. Signed-off-by: Marton Balint <cus@passwd.hu> Reviewed-by: Stephen Hutchinson <qyot27@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '247aa7af7d8197247c181e3fbfe8d93d75e41b29'Michael Niedermayer2015-04-171-5/+3
|\| | | | | | | | | | | | | | | | | | | * commit '247aa7af7d8197247c181e3fbfe8d93d75e41b29': avisynth: Simplify shared library name construction Conflicts: libavformat/avisynth.c Merged-by: Michael Niedermayer <michaelni@gmx.at>