Re: [FFmpeg-devel] [PATCH 3/3] avcodec/bink: disallow odd positioned scaled blocks
Have you checked this with longer samples? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/fmvc: buffer size is stride based not 4*width
On Sat, Jun 11, 2022 at 4:55 PM Michael Niedermayer wrote: > On Sat, Jun 11, 2022 at 10:47:57AM +0200, Paul B Mahol wrote: > > Have you actually tested this "change" ? > > On every file i found > 6-methyl-5-hepten-2-one-CC-db_small.avi > fmvcVirtualDub_small.avi > skrzyzowanie4.avi > fmvc-poc.avi > > are there any other files i should test it on ? > Yes, the ones where stride != width. > > thx > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The bravest are surely those who have the clearest vision > of what is before them, glory and danger alike, and yet > notwithstanding go out to meet it. -- Thucydides > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/qsvenc: make QSV encoder encode VAAPI and D3D11 frames directly
Quoting Wu, Tong1 (2022-06-08 06:47:27) > > > > Quoting Tong Wu (2022-06-07 11:22:16) > > > QSV encoder is able to encode frames with VAAPI or D3D11 pixel format > > > directly. This patch adds support for qsv encoder to accept VAAPI and > > > D3D11 pixel formats as input. > > > > This looks like an ad-hoc hack to me. Encoders should not do these kinds of > > tricks. > > > > -- > > Anton Khirnov > > Thanks for the comments. The MFXSurface is based on VaSurface on Linux > and D3D texture on Windows. Since the QSV encoder can accept > AV_PIX_FMT_QSV as input, it seems kind of reasonable to accept VAAPI > and D3D as its input. And it just may not look like a 'real' trick, > let's say, for example, make QSV encoder accept VULKAN format > directly. By adding this patch, we just want QSV encoder have more > input format supports like what nvenc does. The difference with nvenc is that the nvenc API actually supports d3d textures directly, our encoder wrapper merely passes them through. Your patch, on the other hand, derives a new device inside the decoder. The intent behind the hwcontext interface is that such operations should be left to the library caller, and are actually quite easy to do. So I don't see why is this patch really needed. > Plus, this patch can really help the users who have hybrid transcode needs. Could you elaborate? How would this patch be useful in this specific case. Why can't the callers dervice the device themselves? -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/fmvc: buffer size is stride based not 4*width
Quoting Paul B Mahol (2022-06-13 10:04:04) > On Sat, Jun 11, 2022 at 4:55 PM Michael Niedermayer > wrote: > > > On Sat, Jun 11, 2022 at 10:47:57AM +0200, Paul B Mahol wrote: > > > Have you actually tested this "change" ? > > > > On every file i found > > 6-methyl-5-hepten-2-one-CC-db_small.avi > > fmvcVirtualDub_small.avi > > skrzyzowanie4.avi > > fmvc-poc.avi > > > > are there any other files i should test it on ? > > > > Yes, the ones where stride != width. Give examples of such files then. And add more tests. You really should try to be more helpful if you care about this code working. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/fmvc: buffer size is stride based not 4*width
On Mon, Jun 13, 2022 at 11:10 AM Anton Khirnov wrote: > Quoting Paul B Mahol (2022-06-13 10:04:04) > > On Sat, Jun 11, 2022 at 4:55 PM Michael Niedermayer < > mich...@niedermayer.cc> > > wrote: > > > > > On Sat, Jun 11, 2022 at 10:47:57AM +0200, Paul B Mahol wrote: > > > > Have you actually tested this "change" ? > > > > > > On every file i found > > > 6-methyl-5-hepten-2-one-CC-db_small.avi > > > fmvcVirtualDub_small.avi > > > skrzyzowanie4.avi > > > fmvc-poc.avi > > > > > > are there any other files i should test it on ? > > > > > > > Yes, the ones where stride != width. > > Give examples of such files then. And add more tests. > > You really should try to be more helpful if you care about this code > working. Code works perfectly from start. There are always attempts to break it. Your attempts to belittle my work are futile. > > -- > Anton Khirnov > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v9 08/10] qsv: support OPAQUE memory when MFX_VERSION < 2.0
Quoting Xiang, Haihao (2022-06-02 05:41:16) > From: Haihao Xiang > > OPAQUE memory isn't supported for MFX_VERSION >= 2.0[1][2]. This is in > preparation for oneVPL support > > [1] > https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals > [2] https://github.com/oneapi-src/oneVPL > --- Do you have plans to deprecate and eventually remove original MSDK support along with all this legacy code? -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/fmvc: buffer size is stride based not 4*width
Quoting Paul B Mahol (2022-06-13 11:34:44) > On Mon, Jun 13, 2022 at 11:10 AM Anton Khirnov wrote: > > > Quoting Paul B Mahol (2022-06-13 10:04:04) > > > On Sat, Jun 11, 2022 at 4:55 PM Michael Niedermayer < > > mich...@niedermayer.cc> > > > wrote: > > > > > > > On Sat, Jun 11, 2022 at 10:47:57AM +0200, Paul B Mahol wrote: > > > > > Have you actually tested this "change" ? > > > > > > > > On every file i found > > > > 6-methyl-5-hepten-2-one-CC-db_small.avi > > > > fmvcVirtualDub_small.avi > > > > skrzyzowanie4.avi > > > > fmvc-poc.avi > > > > > > > > are there any other files i should test it on ? > > > > > > > > > > Yes, the ones where stride != width. > > > > Give examples of such files then. And add more tests. > > > > You really should try to be more helpful if you care about this code > > working. > > > Code works perfectly from start. There are always attempts to break it. > Your attempts to belittle my work are futile. Perfect code should live in an external repository that is locked against modification. The ffmpeg repository is only for imperfect code that evolves with time, and so requires changes. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/fmvc: buffer size is stride based not 4*width
On Mon, Jun 13, 2022 at 11:48 AM Anton Khirnov wrote: > Quoting Paul B Mahol (2022-06-13 11:34:44) > > On Mon, Jun 13, 2022 at 11:10 AM Anton Khirnov > wrote: > > > > > Quoting Paul B Mahol (2022-06-13 10:04:04) > > > > On Sat, Jun 11, 2022 at 4:55 PM Michael Niedermayer < > > > mich...@niedermayer.cc> > > > > wrote: > > > > > > > > > On Sat, Jun 11, 2022 at 10:47:57AM +0200, Paul B Mahol wrote: > > > > > > Have you actually tested this "change" ? > > > > > > > > > > On every file i found > > > > > 6-methyl-5-hepten-2-one-CC-db_small.avi > > > > > fmvcVirtualDub_small.avi > > > > > skrzyzowanie4.avi > > > > > fmvc-poc.avi > > > > > > > > > > are there any other files i should test it on ? > > > > > > > > > > > > > Yes, the ones where stride != width. > > > > > > Give examples of such files then. And add more tests. > > > > > > You really should try to be more helpful if you care about this code > > > working. > > > > > > Code works perfectly from start. There are always attempts to break it. > > Your attempts to belittle my work are futile. > > Perfect code should live in an external repository that is locked > against modification. > > The ffmpeg repository is only for imperfect code that evolves with time, > and so requires changes. > > I dunno what Michael attempts to fix. Decoder works fine with valid files. I doubt that encoder would encode random bytes or padding into valid file bitstream. > -- > Anton Khirnov > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v9 09/10] qsv: use a new method to create mfx session when using oneVPL
Quoting Xiang, Haihao (2022-06-02 05:41:17) > From: Haihao Xiang > > In oneVPL, MFXLoad() and MFXCreateSession() are required to create a > workable mfx session[1] > > Add config filters for D3D9/D3D11 session (galinart) > > The default device is changed to d3d11va for oneVPL when both d3d11va > and dxva2 are enabled on Microsoft Windows > > This is in preparation for oneVPL support > > TODO: Add a config filter for device on Linux when enumerating all of > available implementations once we may get the corresponding device info > via a VADisplay handle > > [1] > https://spec.oneapi.io/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html#onevpl-dispatcher > > Co-authored-by: galinart > Signed-off-by: galinart > --- > libavcodec/qsv.c | 191 ++-- > libavcodec/qsv_internal.h| 1 + > libavcodec/qsvdec.c | 10 + > libavcodec/qsvenc.h | 3 + > libavcodec/qsvenc_h264.c | 1 - > libavcodec/qsvenc_hevc.c | 1 - > libavcodec/qsvenc_jpeg.c | 1 - > libavcodec/qsvenc_mpeg2.c| 1 - > libavcodec/qsvenc_vp9.c | 1 - > libavfilter/qsvvpp.c | 113 +++- > libavfilter/qsvvpp.h | 5 + > libavfilter/vf_deinterlace_qsv.c | 14 +- > libavfilter/vf_scale_qsv.c | 12 +- > libavutil/hwcontext_qsv.c| 478 --- > libavutil/hwcontext_qsv.h| 1 + Could you please split the API changes into their own patch? That makes this whole thing easier to understand and review. > diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c > index 21a2a805f8..aaa62f0bcc 100644 > --- a/libavutil/hwcontext_qsv.c > +++ b/libavutil/hwcontext_qsv.c > +#if QSV_ONEVPL > + > +static int qsv_create_mfx_session(void *ctx, > + mfxHDL handle, > + mfxHandleType handle_type, > + mfxIMPL implementation, > + mfxVersion *pver, > + mfxSession *psession, > + void **ploader) > +{ > +mfxStatus sts; > +mfxLoader loader = NULL; > +mfxSession session = NULL; > +mfxConfig cfg; > +mfxVersion ver; > +mfxVariant impl_value; > +uint32_t impl_idx = 0; > + > +av_log(ctx, AV_LOG_VERBOSE, > + "Use Intel(R) oneVPL to create MFX session, API version is " > + "%d.%d, the required implementation version is %d.%d\n", > + MFX_VERSION_MAJOR, MFX_VERSION_MINOR, pver->Major, pver->Minor); > + > +if (handle_type != MFX_HANDLE_VA_DISPLAY && > +handle_type != MFX_HANDLE_D3D9_DEVICE_MANAGER && > +handle_type != MFX_HANDLE_D3D11_DEVICE) { > +av_log(ctx, AV_LOG_ERROR, > + "Invalid MFX device handle\n"); > +return AVERROR(EXDEV); > +} > + > +*psession = NULL; > +*ploader = NULL; > +loader = MFXLoad(); > + > +if (!loader) { > +av_log(ctx, AV_LOG_ERROR, "Error creating a MFX loader\n"); > +goto fail; > +} > + > +/* Create configurations for implementation */ > +cfg = MFXCreateConfig(loader); Am I understanding correctly that this config object is attached to the loader and owned/freed by it? > + > +if (!cfg) { > +av_log(ctx, AV_LOG_ERROR, "Error creating a MFX configuration\n"); > +goto fail; > +} > + > +impl_value.Type = MFX_VARIANT_TYPE_U32; > +impl_value.Data.U32 = (implementation == MFX_IMPL_SOFTWARE) ? > +MFX_IMPL_TYPE_SOFTWARE : MFX_IMPL_TYPE_HARDWARE; > +sts = MFXSetConfigFilterProperty(cfg, > + (const mfxU8 > *)"mfxImplDescription.Impl", impl_value); > + > +if (sts != MFX_ERR_NONE) { > +av_log(ctx, AV_LOG_ERROR, "Error adding a MFX configuration " > + "property: %d.\n", sts); > +goto fail; > +} > + > +impl_value.Type = MFX_VARIANT_TYPE_U32; > + > +if (MFX_HANDLE_VA_DISPLAY == handle_type) > +impl_value.Data.U32 = MFX_ACCEL_MODE_VIA_VAAPI; > +else if (MFX_HANDLE_D3D9_DEVICE_MANAGER == handle_type) > +impl_value.Data.U32 = MFX_ACCEL_MODE_VIA_D3D9; > +else > +impl_value.Data.U32 = MFX_ACCEL_MODE_VIA_D3D11; > + > +sts = MFXSetConfigFilterProperty(cfg, > + (const mfxU8 > *)"mfxImplDescription.AccelerationMode", impl_value); > + > +if (sts != MFX_ERR_NONE) { > +av_log(ctx, AV_LOG_ERROR, "Error adding a MFX configuration" > + "AccelerationMode property: %d.\n", sts); > +goto fail; > +} > + > +impl_value.Type = MFX_VARIANT_TYPE_U16; > +impl_value.Data.U16 = 0x8086; > +sts = MFXSetConfigFilterProperty(cfg, > + (const mfxU8 > *)"mfxExtendedDeviceId.VendorID", impl_value); Is it necessary to hardcode a specific vendor id? > + >
Re: [FFmpeg-devel] Need info on how to run ffmpeg command using dll file
Op ma 13 jun. 2022 om 11:09 schreef Kumar, Rahul : > alternative instead of using "ffmpeg.exe" (as its size is 110 mb+ and we > want to avoid shipping it with our product). ? > Questions about use of ffmpeg are better posted at the user mailinglist, see https://ffmpeg.org/mailman/listinfo/ffmpeg-user If you want a smaller executable, you can simply compile ffmpeg yourself, during build configuration you can disable all parts you don't need. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/get_bits: declare VLC table args as const
On 6/12/22 16:01, Andreas Rheinhardt wrote: Leo Izen: Declaring the VLC table as const allows a caller to call get_vlc2() with a pre-generated static const table without generating warnings for -Wdiscarded-qualifiers. --- libavcodec/get_bits.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index d4e9276da1..49202b0211 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -775,7 +775,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s) /* Return the LUT element for the given bitstream configuration. */ static inline int set_idx(GetBitContext *s, int code, int *n, int *nb_bits, - VLC_TYPE (*table)[2]) + const VLC_TYPE (*table)[2]) { unsigned idx; @@ -795,7 +795,7 @@ static inline int set_idx(GetBitContext *s, int code, int *n, int *nb_bits, * = (max_vlc_length + bits - 1) / bits * @returns the code parsed or -1 if no vlc matches */ -static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], +static av_always_inline int get_vlc2(GetBitContext *s, const VLC_TYPE (*table)[2], int bits, int max_depth) { #if CACHED_BITSTREAM_READER There is unfortunately an issue here: C11 6.7.3/9 contains the following: "If the specification of an array type includes any type qualifiers, the element type is so-qualified, not the array type." Therefore adding const above means that the functions accept a pointer-to-array-of-two-const-VLC_TYPE, but ordinary callers call this with a pointer-to-array-of-two-VLC_TYPE; the automatic conversion from pointer-to-T to pointer-to-const-T does not help you here, because it would only give you a pointer-to-const-array-of-two-VLC_TYPE, but not a pointer-to-an-array-of-two-const-VLC_TYPE; at least that is the prevailing interpretation of the above part of the spec (I don't get why one does not just use 6.7.3/9 once more to conclude that pointer-to-const-array-of-two-VLC_TYPE is actually equivalent to pointer-to-array-of-const-VLC_TYPE). Older versions of GCC warned by default for such conversions (when using an ISO standard -- it is legal in GNU C standards); current versions still do so when compiling with -pedantic. Clang does not warn about this at all, not even with -pedantic. I see three ways to fix this: a) Add a get_vlc2c that accepts const. It will have the implementation of the current get_vlc2; get_vlc2 meanwhile would be turned into a wrapper for get_vlc2c, i.e. it would solely be used to cast to the expected pointer type. b) Add the necessary casts in the only user that wants to use a const table. c) Stop using VLC_TYPE[2] altogether; use a struct { VLC_TYPE symbol, bits; } (it feels like this struct should actually be called VLC_TYPE). Then adding const works fine as usual; it would IMO be more readable, too, because it would be automatically documented which of the entries is what. This is therefore my preferred option. Would you mind if I implemented this or do you want to do it? - Andreas I would not mind if you implemented this. Thank you, I appreciate it. - Leo Izen (thebombzen) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v14 1/5] libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi() and getenv_utf8()
wchartoutf8() converts strings returned by WinAPI into UTF-8, which is FFmpeg's preffered encoding. Some external dependencies, such as AviSynth, are still not Unicode-enabled. utf8toansi() converts UTF-8 strings into ANSI in two steps: UTF-8 -> wchar_t -> ANSI. wchartoansi() is responsible for the second step of the conversion. Conversion in just one step is not supported by WinAPI. Since these character converting functions allocate the buffer of necessary size, they also facilitate the removal of MAX_PATH limit in places where fixed-size ANSI/WCHAR strings were used as filename buffers. getenv_utf8() wraps _wgetenv() converting its input from and its output to UTF-8. Compared to plain getenv(), getenv_utf8() requires a cleanup. Because of that, in places that only test the existence of an environment variable or compare its value with a string consisting entirely of ASCII characters, the use of plain getenv() is still preferred. (libavutil/log.c check_color_terminal() is an example of such a place.) Plain getenv() is also preffered in UNIX-only code, such as bktr.c, fbdev_common.c, oss.c in libavdevice or af_ladspa.c in libavfilter. --- libavutil/getenv_utf8.h| 63 ++ libavutil/wchar_filename.h | 51 ++ 2 files changed, 114 insertions(+) create mode 100644 libavutil/getenv_utf8.h diff --git a/libavutil/getenv_utf8.h b/libavutil/getenv_utf8.h new file mode 100644 index 00..2c48a36355 --- /dev/null +++ b/libavutil/getenv_utf8.h @@ -0,0 +1,63 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_GETENV_UTF8_H +#define AVUTIL_GETENV_UTF8_H + +#include + +#include "mem.h" + +#ifdef _WIN32 + +#include "libavutil/wchar_filename.h" + +static inline char *getenv_utf8(const char *varname) +{ +wchar_t *varname_w, *var_w; +char *var; + +if (utf8towchar(varname, &varname_w)) +return NULL; +if (!varname_w) +return NULL; + +var_w = _wgetenv(varname_w); +av_free(varname_w); + +if (!var_w) +return NULL; +if (wchartoutf8(var_w, &var)) +return NULL; + +return var; + +// No CP_ACP fallback compared to other *_utf8() functions: +// non UTF-8 strings must not be returned. +} + +#else + +static inline char *getenv_utf8(const char *varname) +{ +return av_strdup(getenv(varname)); +} + +#endif // _WIN32 + +#endif // AVUTIL_GETENV_UTF8_H diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h index f36d9dfea3..a6d71e52e5 100644 --- a/libavutil/wchar_filename.h +++ b/libavutil/wchar_filename.h @@ -41,6 +41,57 @@ static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w) return 0; } +av_warn_unused_result +static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w, +char **filename) +{ +DWORD flags = code_page == CP_UTF8 ? WC_ERR_INVALID_CHARS : 0; +int num_chars = WideCharToMultiByte(code_page, flags, filename_w, -1, +NULL, 0, NULL, NULL); +if (num_chars <= 0) { +*filename = NULL; +return 0; +} +*filename = av_malloc_array(num_chars, sizeof *filename); +if (!*filename) { +errno = ENOMEM; +return -1; +} +WideCharToMultiByte(code_page, flags, filename_w, -1, +*filename, num_chars, NULL, NULL); +return 0; +} + +av_warn_unused_result +static inline int wchartoutf8(const wchar_t *filename_w, char **filename) +{ +return wchartocp(CP_UTF8, filename_w, filename); +} + +av_warn_unused_result +static inline int wchartoansi(const wchar_t *filename_w, char **filename) +{ +return wchartocp(CP_ACP, filename_w, filename); +} + +av_warn_unused_result +static inline int utf8toansi(const char *filename_utf8, char **filename) +{ +wchar_t *filename_w = NULL; +int ret = -1; +if (utf8towchar(filename_utf8, &filename_w)) +return -1; + +if (!filename_w) { +*filename = NULL; +return 0; +} + +ret = wchartoansi(filename_w, filename); +av_free(filename_w); +return ret; +} + /** * Checks for extended path prefixes for which normalization needs to be skipped. * see .NET6: PathInte
[FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
--- compat/w32dlfcn.h | 80 ++- libavcodec/mf_utils.h | 1 + 2 files changed, 65 insertions(+), 16 deletions(-) diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h index 52a94efafb..e49d3841aa 100644 --- a/compat/w32dlfcn.h +++ b/compat/w32dlfcn.h @@ -22,9 +22,31 @@ #ifdef _WIN32 #include #include "config.h" -#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT #include "libavutil/wchar_filename.h" -#endif + +static inline wchar_t *get_module_filename(HMODULE module) +{ +wchar_t *path = NULL, *new_path; +DWORD path_size = 0, path_len; + +do { +path_size = path_size ? 2 * path_size : MAX_PATH; +new_path = av_realloc_array(path, path_size, sizeof *path); +if (!new_path) { +av_free(path); +return NULL; +} +path = new_path; +path_len = GetModuleFileNameW(module, path, path_size); +} while (path_len && path_size <= 32768 && path_size <= path_len); + +if (!path_len) { +av_free(path); +return NULL; +} +return path; +} + /** * Safe function used to open dynamic libs. This attempts to improve program security * by removing the current directory from the dll search path. Only dll's found in the @@ -34,29 +56,53 @@ */ static inline HMODULE win32_dlopen(const char *name) { +wchar_t *name_w = NULL; +if (utf8towchar(name, &name_w)) +name_w = NULL; #if _WIN32_WINNT < 0x0602 // Need to check if KB2533623 is available if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) { HMODULE module = NULL; -wchar_t *path = NULL, *name_w = NULL; -DWORD pathlen; -if (utf8towchar(name, &name_w)) +wchar_t *path = NULL, *new_path; +DWORD pathlen, pathsize, namelen; +if (!name_w) goto exit; -path = (wchar_t *)av_calloc(MAX_PATH, sizeof(wchar_t)); +namelen = wcslen(name_w); // Try local directory first -pathlen = GetModuleFileNameW(NULL, path, MAX_PATH); -pathlen = wcsrchr(path, '\\') - path; -if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) +path = get_module_filename(NULL); +if (!path) goto exit; -path[pathlen] = '\\'; +new_path = wcsrchr(path, '\\'); +if (!new_path) +goto exit; +pathlen = new_path - path; +pathsize = pathlen + namelen + 2; +new_path = av_realloc_array(path, pathsize, sizeof *path); +if (!new_path) +goto exit; +path = new_path; wcscpy(path + pathlen + 1, name_w); module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (module == NULL) { // Next try System32 directory -pathlen = GetSystemDirectoryW(path, MAX_PATH); -if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) +pathlen = GetSystemDirectoryW(path, pathsize); +if (!pathlen) goto exit; -path[pathlen] = '\\'; +// Buffer is not enough in two cases: +// 1. system directory + \ + module name +// 2. system directory even without the module name. +if (pathlen + namelen + 2 > pathsize) { +pathsize = pathlen + namelen + 2; +new_path = av_realloc_array(path, pathsize, sizeof *path); +if (!new_path) +goto exit; +path = new_path; +// Query again to handle the case #2. +pathlen = GetSystemDirectoryW(path, pathsize); +if (!pathlen) +goto exit; +} +path[pathlen] = L'\\'; wcscpy(path + pathlen + 1, name_w); module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); } @@ -73,15 +119,17 @@ exit: # define LOAD_LIBRARY_SEARCH_SYSTEM320x0800 #endif #if HAVE_WINRT -wchar_t *name_w = NULL; int ret; -if (utf8towchar(name, &name_w)) +if (!name_w) return NULL; ret = LoadPackagedLibrary(name_w, 0); av_free(name_w); return ret; #else -return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); +/* filename may be be in CP_ACP */ +if (!name_w) +return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); +return LoadLibraryExW(name_w, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); #endif } #define dlopen(name, flags) win32_dlopen(name) diff --git a/libavcodec/mf_utils.h b/libavcodec/mf_utils.h index 3b12344f3e..aebfb9ad21 100644 --- a/libavcodec/mf_utils.h +++ b/libavcodec/mf_utils.h @@ -29,6 +29,7 @@ // mf*.h headers below indirectly include strmif.h.) #include #else +#define NO_DSHOW_STRSAFE #include // Older versions of min
[FFmpeg-devel] [PATCH v14 5/5] libavfilter/vf_frei0r.c: Use UTF-8 version of getenv()
--- libavfilter/vf_frei0r.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index f11ae6e55c..727e96561a 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -31,6 +31,7 @@ #include "libavutil/avstring.h" #include "libavutil/common.h" #include "libavutil/eval.h" +#include "libavutil/getenv_utf8.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/mathematics.h" @@ -204,7 +205,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx, } /* see: http://frei0r.dyne.org/codedoc/html/group__pluglocations.html */ -if ((path = av_strdup(getenv("FREI0R_PATH" { +if ((path = getenv_utf8("FREI0R_PATH"))) { #ifdef _WIN32 const char *separator = ";"; #else @@ -231,12 +232,17 @@ static av_cold int frei0r_init(AVFilterContext *ctx, if (ret < 0) return ret; } -if (!s->dl_handle && (path = getenv("HOME"))) { +if (!s->dl_handle && (path = getenv_utf8("HOME"))) { char *prefix = av_asprintf("%s/.frei0r-1/lib/", path); -if (!prefix) -return AVERROR(ENOMEM); +if (!prefix) { +ret = AVERROR(ENOMEM); +goto home_path_end; +} ret = load_path(ctx, &s->dl_handle, prefix, dl_name); av_free(prefix); + +home_path_end: +av_free(path); if (ret < 0) return ret; } -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
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. --- libavformat/avisynth.c| 39 +++ libavformat/http.c| 20 +--- libavformat/ipfsgateway.c | 35 +++ libavformat/tls.c | 11 +-- 4 files changed, 72 insertions(+), 33 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 8ba2bdead2..a97d12b6b6 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -34,6 +34,7 @@ /* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" + #include "libavutil/wchar_filename.h" #undef EXTERN_C #define AVISYNTH_LIB "avisynth" #else @@ -56,6 +57,7 @@ typedef struct AviSynthLibrary { #define AVSC_DECLARE_FUNC(name) name ## _func name AVSC_DECLARE_FUNC(avs_bit_blt); AVSC_DECLARE_FUNC(avs_clip_get_error); +AVSC_DECLARE_FUNC(avs_check_version); AVSC_DECLARE_FUNC(avs_create_script_environment); AVSC_DECLARE_FUNC(avs_delete_script_environment); AVSC_DECLARE_FUNC(avs_get_audio); @@ -137,6 +139,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_bit_blt, 0); LOAD_AVS_FUNC(avs_clip_get_error, 0); +LOAD_AVS_FUNC(avs_check_version, 0); LOAD_AVS_FUNC(avs_create_script_environment, 0); LOAD_AVS_FUNC(avs_delete_script_environment, 0); LOAD_AVS_FUNC(avs_get_audio, 0); @@ -807,26 +810,38 @@ static int avisynth_create_stream(AVFormatContext *s) static int avisynth_open_file(AVFormatContext *s) { AviSynthContext *avs = s->priv_data; -AVS_Value arg, val; +AVS_Value val; int ret; -#ifdef _WIN32 -char filename_ansi[MAX_PATH * 4]; -wchar_t filename_wc[MAX_PATH * 4]; -#endif if (ret = avisynth_context_create(s)) return ret; +if (!avs_library.avs_check_version(avs->env, 7)) { +AVS_Value args[] = { +avs_new_value_string(s->url), +avs_new_value_bool(1) // filename is in UTF-8 +}; +val = avs_library.avs_invoke(avs->env, "Import", + avs_new_value_array(args, 2), 0); +} else { +AVS_Value arg; #ifdef _WIN32 -/* Convert UTF-8 to ANSI code page */ -MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); -WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, -MAX_PATH * 4, NULL, NULL); -arg = avs_new_value_string(filename_ansi); +char *filename_ansi; +/* Convert UTF-8 to ANSI code page */ +if (utf8toansi(s->url, &filename_ansi)) { +ret = AVERROR_UNKNOWN; +goto fail; +} +arg = avs_new_value_string(filename_ansi); #else -arg = avs_new_value_string(s->url); +arg = avs_new_value_string(s->url); #endif -val = avs_library.avs_invoke(avs->env, "Import", arg, 0); +val = avs_library.avs_invoke(avs->env, "Import", arg, 0); +#ifdef _WIN32 +av_free(filename_ansi); +#endif +} + if (avs_is_error(val)) { av_log(s, AV_LOG_ERROR, "%s\n", avs_as_error(val)); ret = AVERROR_UNKNOWN; diff --git a/libavformat/http.c b/libavformat/http.c index c8f3f4b6a3..d90117e422 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -29,6 +29,7 @@ #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "libavutil/getenv_utf8.h" #include "libavutil/opt.h" #include "libavutil/time.h" #include "libavutil/parseutils.h" @@ -198,6 +199,7 @@ void ff_http_init_auth_state(URLContext *dest, const URLContext *src) static int http_open_cnx_internal(URLContext *h, AVDictionary **options) { const char *path, *proxy_path, *lower_proto = "tcp", *local_path; +char *env_http_proxy, *env_no_proxy; char *hashmark; char hostname[1024], hoststr[1024], proto[10]; char auth[1024], proxyauth[1024] = ""; @@ -211,9 +213,13 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) path1, sizeof(path1), s->location); ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); -proxy_path = s->http_proxy ? s->http_proxy : getenv("http_proxy"); -use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), hostname) && +env_http_proxy = getenv_utf8("http_proxy"); +proxy_path = s->http_proxy ? s->http_proxy : env_http_proxy; + +env_no_proxy = getenv_utf8("no_proxy"); +use_proxy = !ff_http_match_no_proxy(env_no_proxy, hostname) && proxy_path && av_strstart(proxy_path, "http://";, NULL); +av_freep(&env_no_proxy); if (!strcmp(proto, "https")) { lower_proto = "tls"; @@ -224,7 +230,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options
[FFmpeg-devel] [PATCH v14 3/5] fftools: Remove MAX_PATH limit and switch to UTF-8 versions of fopen() and getenv()
--- fftools/cmdutils.c | 53 +--- fftools/ffmpeg_opt.c | 9 ++-- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 5d7cdc3e10..5e7fbbe2ee 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -39,6 +39,7 @@ #include "libavutil/avstring.h" #include "libavutil/channel_layout.h" #include "libavutil/display.h" +#include "libavutil/getenv_utf8.h" #include "libavutil/mathematics.h" #include "libavutil/imgutils.h" #include "libavutil/libm.h" @@ -47,9 +48,11 @@ #include "libavutil/dict.h" #include "libavutil/opt.h" #include "cmdutils.h" +#include "fopen_utf8.h" #include "opt_common.h" #ifdef _WIN32 #include +#include "compat/w32dlfcn.h" #endif AVDictionary *sws_dict; @@ -465,7 +468,7 @@ static void check_options(const OptionDef *po) void parse_loglevel(int argc, char **argv, const OptionDef *options) { int idx = locate_option(argc, argv, options, "loglevel"); -const char *env; +char *env; check_options(options); @@ -474,7 +477,8 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) if (idx && argv[idx + 1]) opt_loglevel(NULL, "loglevel", argv[idx + 1]); idx = locate_option(argc, argv, options, "report"); -if ((env = getenv("FFREPORT")) || idx) { +env = getenv_utf8("FFREPORT"); +if (env || idx) { FILE *report_file = NULL; init_report(env, &report_file); if (report_file) { @@ -487,6 +491,7 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) fflush(report_file); } } +av_free(env); idx = locate_option(argc, argv, options, "hide_banner"); if (idx) hide_banner = 1; @@ -812,28 +817,45 @@ FILE *get_preset_file(char *filename, size_t filename_size, { FILE *f = NULL; int i; -const char *base[3] = { getenv("FFMPEG_DATADIR"), -getenv("HOME"), +#if HAVE_GETMODULEHANDLE && defined(_WIN32) +char *datadir = NULL; +#endif +char *env_home = getenv_utf8("HOME"); +char *env_ffmpeg_datadir = getenv_utf8("FFMPEG_DATADIR"); +const char *base[3] = { env_home, +env_ffmpeg_datadir, FFMPEG_DATADIR, }; if (is_path) { av_strlcpy(filename, preset_name, filename_size); -f = fopen(filename, "r"); +f = fopen_utf8(filename, "r"); } else { #if HAVE_GETMODULEHANDLE && defined(_WIN32) -char datadir[MAX_PATH], *ls; +wchar_t *datadir_w = get_module_filename(NULL); base[2] = NULL; -if (GetModuleFileNameA(GetModuleHandleA(NULL), datadir, sizeof(datadir) - 1)) +if (wchartoutf8(datadir_w, &datadir)) +datadir = NULL; +av_free(datadir_w); + +if (datadir) { -for (ls = datadir; ls < datadir + strlen(datadir); ls++) +char *ls; +for (ls = datadir; *ls; ls++) if (*ls == '\\') *ls = '/'; if (ls = strrchr(datadir, '/')) { -*ls = 0; -strncat(datadir, "/ffpresets", sizeof(datadir) - 1 - strlen(datadir)); -base[2] = datadir; +ptrdiff_t datadir_len = ls - datadir; +size_t desired_size = datadir_len + strlen("/ffpresets") + 1; +char *new_datadir = av_realloc_array( +datadir, desired_size, sizeof *datadir); +if (new_datadir) { +datadir = new_datadir; +datadir[datadir_len] = 0; +strncat(datadir, "/ffpresets", desired_size - 1 - datadir_len); +base[2] = datadir; +} } } #endif @@ -842,17 +864,22 @@ FILE *get_preset_file(char *filename, size_t filename_size, continue; snprintf(filename, filename_size, "%s%s/%s.ffpreset", base[i], i != 1 ? "" : "/.ffmpeg", preset_name); -f = fopen(filename, "r"); +f = fopen_utf8(filename, "r"); if (!f && codec_name) { snprintf(filename, filename_size, "%s%s/%s-%s.ffpreset", base[i], i != 1 ? "" : "/.ffmpeg", codec_name, preset_name); -f = fopen(filename, "r"); +f = fopen_utf8(filename, "r"); } } } +#if HAVE_GETMODULEHANDLE && defined(_WIN32) +av_free(datadir); +#endif +av_free(env_ffmpeg_datadir); +av_free(env_home); return f; } diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 398067da96..f49acf6ad0 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -44,6 +44,7 @@ #include "libavutil/avutil.h" #include "libavutil/bprint.h" #include "libavutil/channel_layout.h" +#include "libavutil/getenv_utf8.
Re: [FFmpeg-devel] [PATCH] avformat/movenc: Support alpha channel for AVIF
On Mon, Jun 6, 2022 at 9:29 AM Vignesh Venkatasubramanian wrote: > > On Wed, Jun 1, 2022 at 12:47 PM Vignesh Venkatasubramanian > wrote: > > > > On Wed, Jun 1, 2022 at 11:52 AM xyesbee wrote: > > > > > > Why can it not accept it as one but two distinct streams? Why the extra > > > hurdle of alphaextract? YUVA pixel format exists though. > > > > Yes, while the YUVA pixel formats exist, AVIF specification requires > > alpha channel to be a separate track (i.e.) we would need two AV1 > > encoders to make an AVIF image with alpha channel (one for the YUV > > planes and one for the alpha plane encoded as a monochrome frame). The > > underlying AV1 codec does not support the YUVA pixel format. So, in > > order to be able to encode an AVIF image with alpha channel, we would > > have to separate the alpha channel with the alphaextract filter and > > pass it to a separate AV1 encoder. > > > > If you already have the alpha channel as a separate input, then you > > can simply pass it along as a second input stream and there will be no > > need to use the alphaextract filter. I pointed out the use of > > alphaextract filter simply because it is the simplest way to re-encode > > existing PNG images with alpha channel into AVIF. > > > > An alternative solution is to use the YUVA pixel format and internally > > use two AV1 encoders in the libaom wrapper. But that requires more > > changes and does not really make things any better. If you have a > > better solution, please let me know and I can update this. > > > > > Original Message > > > On Jun 1, 2022, 11:35 PM, Vignesh Venkatasubramanian wrote: > > > > > > > AVIF specification allows for alpha channel as an auxiliary item (in > > > > case of still images) or as an auxiliary track (in case of animated > > > > images). Add support for both of these. The AVIF muxer will take > > > > exactly two streams (when alpha is present) as input (first one being > > > > the YUV planes and the second one being the alpha plane). > > > > > > > > The input has to come from two different images (one of it color and > > > > the other one being alpha), or it can come from a single file > > > > source with the alpha channel extracted using the "alphaextract" > > > > filter. > > > > > > > > Example using alphaextract: > > > > ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map > > > > "[a]" -still-picture 1 avif_with_alpha.avif > > > > > > > > Example using two sources (first source can be in any pixel format and > > > > the second source has to be in monochrome grey pixel format): > > > > ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy > > > > avif_with_alpha.avif > > > > > > > > The generated files pass the compliance checks in Compliance Warden: > > > > https://github.com/gpac/ComplianceWarden > > > > > > > > libavif (the reference avif library) is able to decode the files > > > > generated using this patch. > > > > > > > > They also play back properly (with transparent background) in: > > > > 1) Chrome > > > > 2) Firefox (only still AVIF, no animation support) > > > > > > > > Signed-off-by: Vignesh Venkatasubramanian > > > > --- > > > > libavformat/movenc.c | 188 +-- > > > > libavformat/movenc.h | 4 +- > > > > 2 files changed, 130 insertions(+), 62 deletions(-) > > > > > > > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > > > > index de971f94e8..02eb4d0e9a 100644 > > > > --- a/libavformat/movenc.c > > > > +++ b/libavformat/movenc.c > > > > @@ -2852,7 +2852,7 @@ static int mov_write_hdlr_tag(AVFormatContext *s, > > > > AVIOContext *pb, MOVTrack *tra > > > > hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; > > > > if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) { > > > > if (track->mode == MODE_AVIF) { > > > > - hdlr_type = "pict"; > > > > + hdlr_type = (track == &mov->tracks[0]) ? "pict" : "auxv"; > > > > descr = "PictureHandler"; > > > > } else { > > > > hdlr_type = "vide"; > > > > @@ -2940,57 +2940,83 @@ static int mov_write_iloc_tag(AVIOContext *pb, > > > > MOVMuxContext *mov, AVFormatConte > > > > avio_wb32(pb, 0); /* Version & flags */ > > > > avio_w8(pb, (4 << 4) + 4); /* offset_size(4) and length_size(4) */ > > > > avio_w8(pb, 0); /* base_offset_size(4) and reserved(4) */ > > > > - avio_wb16(pb, 1); /* item_count */ > > > > + avio_wb16(pb, s->nb_streams); /* item_count */ > > > > > > > > - avio_wb16(pb, 1); /* item_id */ > > > > - avio_wb16(pb, 0); /* data_reference_index */ > > > > - avio_wb16(pb, 1); /* extent_count */ > > > > - mov->avif_extent_pos = avio_tell(pb); > > > > - avio_wb32(pb, 0); /* extent_offset (written later) */ > > > > - // For animated AVIF, we simply write the first packet's size. > > > > - avio_wb32(pb, mov->avif_extent_length); /* extent_length */ > > > > + for (int i = 0; i < s->nb_streams; i++) { > > > > + avio_wb16(pb, i + 1); /* item_id */ > > > > + avio_wb16(pb, 0); /* data_reference_index */ > > > > + avio_wb16(pb, 1); /* extent_count */
Re: [FFmpeg-devel] [PATCH] avformat/mov: Only read the primary item for AVIF
On Fri, Jun 10, 2022 at 10:34 AM Vignesh Venkatasubramanian wrote: > > On Thu, Jun 9, 2022 at 12:50 AM Gyan Doshi wrote: > > > > > > > > On 2022-06-08 10:51 pm, Vignesh Venkatasubramanian wrote: > > > On Thu, Jun 2, 2022 at 1:35 PM James Zern wrote: > > >> On Wed, Jun 1, 2022 at 1:38 PM Vignesh Venkatasubramanian > > >> wrote: > > >>> On Wed, Jun 1, 2022 at 10:30 AM James Zern wrote: > > On Sun, Apr 24, 2022 at 11:35 AM Vignesh Venkatasubramanian > > wrote: > > > Update the still AVIF parser to only read the primary item. With this > > > patch, AVIF still images with exif/icc/alpha channel will no longer > > > fail to parse. > > > > > > For example, this patch enables parsing of files in: > > > https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/Microsoft > > > > > Can some of the failing files or similar ones be added to fate? > > >>> There are no fate tests for AVIF parsing as of now. I was thinking > > >>> about adding some for the muxing. But i am not sure what can be done > > >>> here for the parsing. > > >>> > > >> Thanks. Are there any for general mov/mp4 parsing that could be > > >> extended? This looks good otherwise. > > > From what i see, most of the mov tests only seem to be for muxing. I'm > > > not entirely certain about how to add a test for AVIF parsing. If > > > anybody has an idea, i'd be open to adding it. > > > > Basic test would use the framemd5 muxer to compare demuxed packets with > > a reference. > > See fate-ffmpeg-streamloop > > > > Thank you i have added a couple of fate tests. > > I am not sure how to add the AVIF files to the fate test server. I > have them on Google Drive here: > > https://drive.google.com/file/d/1diZoM0Ew7Co3Yh5w5y1J-3IiBYVmUv9J/view?usp=sharing > https://drive.google.com/file/d/1DdrD1mW36evt40a4RkeLYpx-oojmbc3z/view?usp=sharing > > These links should be publicly available without any sign in required. > Please let me know if there is another preferred way of sharing test > files and i can share it that way. > Also, i forgot to mention that these files have to be uploaded under a new directory called "avif" in the fate server. > Also for the record, these files were created by remuxing an existing > file in the fate suite. > > still_image.avif - contains the first frame from > av1-test-vectors/av1-1-b8-02-allintra.ivf > still_image_exif.avif - contains the first frame from > av1-test-vectors/av1-1-b8-02-allintra.ivf with dummy exif data. > > > Regards, > > Gyan > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > > > -- > Vignesh -- Vignesh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi
>> ... >> 1. fopen() is replaced with avpriv_fopen_utf8(), getenv() is made >> Unicode-aware >> on Windows, and wide version of get_module_filename() is used as it is now. > ... > For that, the first option sounds better - that sounds to me more like a > direction forward, not backwards. Done: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/297491.html. getenv_utf8 is a static inline in its own header in libavutil. log.c, bktr.c, fbdev_common.c, oss.c and af_ladspa.c still use plain getenv(), please check commit message for details. All other uses of getenv() have been replaced with getenv_utf8(): https://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/297495.html https://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/297494.html https://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/297493.html ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
> -Original Message- > From: ffmpeg-devel On Behalf Of Nil > Admirari > Sent: Monday, June 13, 2022 6:26 PM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove > MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW > > --- > compat/w32dlfcn.h | 80 ++--- > -- > libavcodec/mf_utils.h | 1 + > 2 files changed, 65 insertions(+), 16 deletions(-) > > diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h > index 52a94efafb..e49d3841aa 100644 > --- a/compat/w32dlfcn.h > +++ b/compat/w32dlfcn.h > @@ -22,9 +22,31 @@ > #ifdef _WIN32 > #include > #include "config.h" > -#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT > #include "libavutil/wchar_filename.h" > -#endif > + > +static inline wchar_t *get_module_filename(HMODULE module) > +{ > +wchar_t *path = NULL, *new_path; > +DWORD path_size = 0, path_len; > + > +do { > +path_size = path_size ? 2 * path_size : MAX_PATH; > +new_path = av_realloc_array(path, path_size, sizeof *path); > +if (!new_path) { > +av_free(path); > +return NULL; > +} > +path = new_path; > +path_len = GetModuleFileNameW(module, path, path_size); > +} while (path_len && path_size <= 32768 && path_size <= > path_len); Why do you use a 'do' loop? Can't you use the normal 2-step approach, i.e. call the winapi function with a NULL buffer, and then use the returned size to allocate the buffer. This way you always need a single allocation only. softworkz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows
> ... > > - defining NO_DSHOW_STRSAFE in libavcodec/mf_utils.h > ... > Or if we'd add the define projectwide in e.g. configure it probably > wouldn't be that bad? Kinda like how we already add > "-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS" in MSVC builds. > Then we wouldn't need to worry about missing it somewhere accidentally. Ended up defining NO_DSHOW_STRSAFE in mf_utils.h, just like dshow_capture.h does (these are the only two uses). -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS are defined only for MVSC: elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then NO_DSHOW_STRSAFE should cover MinGW as well, and probably others. If you still want global NO_DSHOW_STRSAFE, please point where to add it exactly. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v13 3/4] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
> src/libavutil/wchar_filename.h: In function ‘add_extended_prefix’: > src/libavutil/wchar_filename.h:211:9: error: > ‘wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW’ > undeclared (first use in this function) > wcscpy(temp_w, unc_prefix); are fixed by defining NO_DSHOW_STRSAFE: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/297492.html. I don't know whether it's enough to fix COM related errors: I never got them. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v13 2/4] libavformat/avisynth.c: Remove MAX_PATH limit
> Presumably, the original manifest idea, parsed down to only using it to > force FFmpeg into UTF-8, would be sufficient for this, right? UTF-8 in manifest was rejected as too far-reaching, and then longs paths were reimplemented with \\?\ prefixes, so now there is no manifest at all. > The Windows API does have a SetConsoleCP function. It does not change process code page. > C3) Use avs_get_version, but if it's not a new enough version, just fall > back to the logic that exists now Done in https://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/297494.html. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
> Why do you use a 'do' loop? Can't you use the normal 2-step > approach, i.e. call the winapi function with a NULL buffer, > and then use the returned size to allocate the buffer. > This way you always need a single allocation only. GetModuleFileNameW does not follow this convention: https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew > If the length of the path exceeds the size that the nSize parameter specifies, > the function succeeds and the string is truncated to nSize characters > including the terminating null character. MS does the looping too in their WIL library: https://github.com/microsoft/wil/blob/master/include/wil/win32_helpers.h#L339-L341. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/movenc: Support alpha channel for AVIF
On Wed, Jun 1, 2022 at 11:06 AM Vignesh Venkatasubramanian wrote: > > AVIF specification allows for alpha channel as an auxiliary item (in > case of still images) or as an auxiliary track (in case of animated > images). Add support for both of these. The AVIF muxer will take > exactly two streams (when alpha is present) as input (first one being > the YUV planes and the second one being the alpha plane). > > The input has to come from two different images (one of it color and > the other one being alpha), or it can come from a single file > source with the alpha channel extracted using the "alphaextract" > filter. > > Example using alphaextract: > ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map "[a]" > -still-picture 1 avif_with_alpha.avif > > Example using two sources (first source can be in any pixel format and > the second source has to be in monochrome grey pixel format): > ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy avif_with_alpha.avif > > The generated files pass the compliance checks in Compliance Warden: > https://github.com/gpac/ComplianceWarden > > libavif (the reference avif library) is able to decode the files > generated using this patch. > > They also play back properly (with transparent background) in: > 1) Chrome > 2) Firefox (only still AVIF, no animation support) > > Signed-off-by: Vignesh Venkatasubramanian > --- > libavformat/movenc.c | 188 +-- > libavformat/movenc.h | 4 +- > 2 files changed, 130 insertions(+), 62 deletions(-) > lgtm. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/exif: Move tag_list out of header
> Am 12.06.2022 um 20:46 schrieb Andreas Rheinhardt > : > It is only used by exif.c (and e.g. EXIF_TAG_NAME_LENGTH > is an implementation detail anyway). > Also remove the sentinel, as it is used in conjunction > with FF_ARRAY_ELEMS. > > Signed-off-by: Andreas Rheinhardt > --- LGTM if tested. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
> -Original Message- > From: ffmpeg-devel On Behalf Of Nil > Admirari > Sent: Monday, June 13, 2022 6:26 PM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH > limit and use UTF-8 version of getenv() > > 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. > --- > libavformat/avisynth.c| 39 +++-- > -- > libavformat/http.c| 20 +--- > libavformat/ipfsgateway.c | 35 +++ > libavformat/tls.c | 11 +-- > 4 files changed, 72 insertions(+), 33 deletions(-) > > diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c > index 8ba2bdead2..a97d12b6b6 100644 > --- a/libavformat/avisynth.c > +++ b/libavformat/avisynth.c > @@ -34,6 +34,7 @@ > /* Platform-specific directives. */ > #ifdef _WIN32 >#include "compat/w32dlfcn.h" > + #include "libavutil/wchar_filename.h" >#undef EXTERN_C >#define AVISYNTH_LIB "avisynth" > #else > @@ -56,6 +57,7 @@ typedef struct AviSynthLibrary { > #define AVSC_DECLARE_FUNC(name) name ## _func name > AVSC_DECLARE_FUNC(avs_bit_blt); > AVSC_DECLARE_FUNC(avs_clip_get_error); > +AVSC_DECLARE_FUNC(avs_check_version); > AVSC_DECLARE_FUNC(avs_create_script_environment); > AVSC_DECLARE_FUNC(avs_delete_script_environment); > AVSC_DECLARE_FUNC(avs_get_audio); > @@ -137,6 +139,7 @@ static av_cold int avisynth_load_library(void) > > LOAD_AVS_FUNC(avs_bit_blt, 0); > LOAD_AVS_FUNC(avs_clip_get_error, 0); > +LOAD_AVS_FUNC(avs_check_version, 0); > LOAD_AVS_FUNC(avs_create_script_environment, 0); > LOAD_AVS_FUNC(avs_delete_script_environment, 0); > LOAD_AVS_FUNC(avs_get_audio, 0); > @@ -807,26 +810,38 @@ static int > avisynth_create_stream(AVFormatContext *s) > static int avisynth_open_file(AVFormatContext *s) > { > AviSynthContext *avs = s->priv_data; > -AVS_Value arg, val; > +AVS_Value val; > int ret; > -#ifdef _WIN32 > -char filename_ansi[MAX_PATH * 4]; > -wchar_t filename_wc[MAX_PATH * 4]; > -#endif > > if (ret = avisynth_context_create(s)) > return ret; > > +if (!avs_library.avs_check_version(avs->env, 7)) { I like the version check. I don't know about all the derivatives of AviSynth, but I assume you have checked that it's valid for the common ones (or at least the original non-Plus variant)? > +AVS_Value args[] = { > +avs_new_value_string(s->url), > +avs_new_value_bool(1) // filename is in UTF-8 > +}; > +val = avs_library.avs_invoke(avs->env, "Import", > + avs_new_value_array(args, 2), > 0); > +} else { > +AVS_Value arg; > #ifdef _WIN32 > -/* Convert UTF-8 to ANSI code page */ > -MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, > MAX_PATH * 4); > -WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, > filename_ansi, > -MAX_PATH * 4, NULL, NULL); > -arg = avs_new_value_string(filename_ansi); > +char *filename_ansi; > +/* Convert UTF-8 to ANSI code page */ > +if (utf8toansi(s->url, &filename_ansi)) { Two ideas came to my mind how this could be done better. What's actually needed here is not a string conversion, we need a valid and usable filename, and the function could be more something like "get_ansi_filename()". The first thing that this function could do is to convert the the filename to ANSI and right back to UTF-8, then compare the UTF-8 result with the original UTF-8 string. When both are equal, we know that the conversion is safe, otherwise we know that it won't work. Then, we can use the win32 API GetShortFileName(). Which returns file and directory names in 8.3 notation which (IIRC) contains only letters which are valid in the ANSI code page. 8.3 file names do not always exist (depending on system config), but it's always worth trying. Should both of these procedures fail, we could at least output a useful message, explaining why it doesn't work. Let me know what you think. sw ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
On Mon, Jun 13, 2022 at 7:47 PM Soft Works wrote: > > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of Nil > > Admirari > > Sent: Monday, June 13, 2022 6:26 PM > > To: ffmpeg-devel@ffmpeg.org > > Subject: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH > > limit and use UTF-8 version of getenv() > > > > 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. > > --- > > libavformat/avisynth.c| 39 +++-- > > -- > > libavformat/http.c| 20 +--- > > libavformat/ipfsgateway.c | 35 +++ > > libavformat/tls.c | 11 +-- > > 4 files changed, 72 insertions(+), 33 deletions(-) > > > > diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c > > index 8ba2bdead2..a97d12b6b6 100644 > > --- a/libavformat/avisynth.c > > +++ b/libavformat/avisynth.c > > @@ -34,6 +34,7 @@ > > /* Platform-specific directives. */ > > #ifdef _WIN32 > >#include "compat/w32dlfcn.h" > > + #include "libavutil/wchar_filename.h" > >#undef EXTERN_C > >#define AVISYNTH_LIB "avisynth" > > #else > > @@ -56,6 +57,7 @@ typedef struct AviSynthLibrary { > > #define AVSC_DECLARE_FUNC(name) name ## _func name > > AVSC_DECLARE_FUNC(avs_bit_blt); > > AVSC_DECLARE_FUNC(avs_clip_get_error); > > +AVSC_DECLARE_FUNC(avs_check_version); > > AVSC_DECLARE_FUNC(avs_create_script_environment); > > AVSC_DECLARE_FUNC(avs_delete_script_environment); > > AVSC_DECLARE_FUNC(avs_get_audio); > > @@ -137,6 +139,7 @@ static av_cold int avisynth_load_library(void) > > > > LOAD_AVS_FUNC(avs_bit_blt, 0); > > LOAD_AVS_FUNC(avs_clip_get_error, 0); > > +LOAD_AVS_FUNC(avs_check_version, 0); > > LOAD_AVS_FUNC(avs_create_script_environment, 0); > > LOAD_AVS_FUNC(avs_delete_script_environment, 0); > > LOAD_AVS_FUNC(avs_get_audio, 0); > > @@ -807,26 +810,38 @@ static int > > avisynth_create_stream(AVFormatContext *s) > > static int avisynth_open_file(AVFormatContext *s) > > { > > AviSynthContext *avs = s->priv_data; > > -AVS_Value arg, val; > > +AVS_Value val; > > int ret; > > -#ifdef _WIN32 > > -char filename_ansi[MAX_PATH * 4]; > > -wchar_t filename_wc[MAX_PATH * 4]; > > -#endif > > > > if (ret = avisynth_context_create(s)) > > return ret; > > > > +if (!avs_library.avs_check_version(avs->env, 7)) { > > I like the version check. I don't know about all the derivatives > of AviSynth, but I assume you have checked that it's valid for > the common ones (or at least the original non-Plus variant)? > > > +AVS_Value args[] = { > > +avs_new_value_string(s->url), > > +avs_new_value_bool(1) // filename is in UTF-8 > > +}; > > +val = avs_library.avs_invoke(avs->env, "Import", > > + avs_new_value_array(args, 2), > > 0); > > +} else { > > +AVS_Value arg; > > #ifdef _WIN32 > > -/* Convert UTF-8 to ANSI code page */ > > -MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, > > MAX_PATH * 4); > > -WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, > > filename_ansi, > > -MAX_PATH * 4, NULL, NULL); > > -arg = avs_new_value_string(filename_ansi); > > +char *filename_ansi; > > +/* Convert UTF-8 to ANSI code page */ > > +if (utf8toansi(s->url, &filename_ansi)) { > > Two ideas came to my mind how this could be done better. > What's actually needed here is not a string conversion, we need > a valid and usable filename, and the function could be more > something like "get_ansi_filename()". > > The first thing that this function could do is to convert the > the filename to ANSI and right back to UTF-8, then compare the > UTF-8 result with the original UTF-8 string. When both are equal, > we know that the conversion is safe, otherwise we know that it > won't work. > > Then, we can use the win32 API GetShortFileName(). Which returns > file and directory names in 8.3 notation which (IIRC) contains > only letters which are valid in the ANSI code page. > This seems unrelated to this patch, which is about removing the MAX_PATH limit. The code previously converted UTF-8 to ANSI, and still does so now, just without the MAX_PATH limit. Further improvements tangential to this topic can, and should, be applied independently, and not hold up this patch in discussion-hell for longer than necessary. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
> -Original Message- > From: ffmpeg-devel On Behalf Of > Hendrik Leppkes > Sent: Monday, June 13, 2022 8:55 PM > To: FFmpeg development discussions and patches de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove > MAX_PATH limit and use UTF-8 version of getenv() > > On Mon, Jun 13, 2022 at 7:47 PM Soft Works > wrote: > > > > > > > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of > Nil > > > Admirari > > > Sent: Monday, June 13, 2022 6:26 PM > > > To: ffmpeg-devel@ffmpeg.org > > > Subject: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove > MAX_PATH > > > limit and use UTF-8 version of getenv() > > > > > > 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. > > > --- > > > libavformat/avisynth.c| 39 +++-- > > > > -- > > > libavformat/http.c| 20 +--- > > > libavformat/ipfsgateway.c | 35 +++-- > -- > > > libavformat/tls.c | 11 +-- > > > 4 files changed, 72 insertions(+), 33 deletions(-) > > > > > > diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c > > > index 8ba2bdead2..a97d12b6b6 100644 > > > --- a/libavformat/avisynth.c > > > +++ b/libavformat/avisynth.c > > > @@ -34,6 +34,7 @@ > > > /* Platform-specific directives. */ > > > #ifdef _WIN32 > > >#include "compat/w32dlfcn.h" > > > + #include "libavutil/wchar_filename.h" > > >#undef EXTERN_C > > >#define AVISYNTH_LIB "avisynth" > > > #else > > > @@ -56,6 +57,7 @@ typedef struct AviSynthLibrary { > > > #define AVSC_DECLARE_FUNC(name) name ## _func name > > > AVSC_DECLARE_FUNC(avs_bit_blt); > > > AVSC_DECLARE_FUNC(avs_clip_get_error); > > > +AVSC_DECLARE_FUNC(avs_check_version); > > > AVSC_DECLARE_FUNC(avs_create_script_environment); > > > AVSC_DECLARE_FUNC(avs_delete_script_environment); > > > AVSC_DECLARE_FUNC(avs_get_audio); > > > @@ -137,6 +139,7 @@ static av_cold int > avisynth_load_library(void) > > > > > > LOAD_AVS_FUNC(avs_bit_blt, 0); > > > LOAD_AVS_FUNC(avs_clip_get_error, 0); > > > +LOAD_AVS_FUNC(avs_check_version, 0); > > > LOAD_AVS_FUNC(avs_create_script_environment, 0); > > > LOAD_AVS_FUNC(avs_delete_script_environment, 0); > > > LOAD_AVS_FUNC(avs_get_audio, 0); > > > @@ -807,26 +810,38 @@ static int > > > avisynth_create_stream(AVFormatContext *s) > > > static int avisynth_open_file(AVFormatContext *s) > > > { > > > AviSynthContext *avs = s->priv_data; > > > -AVS_Value arg, val; > > > +AVS_Value val; > > > int ret; > > > -#ifdef _WIN32 > > > -char filename_ansi[MAX_PATH * 4]; > > > -wchar_t filename_wc[MAX_PATH * 4]; > > > -#endif > > > > > > if (ret = avisynth_context_create(s)) > > > return ret; > > > > > > +if (!avs_library.avs_check_version(avs->env, 7)) { > > > > I like the version check. I don't know about all the derivatives > > of AviSynth, but I assume you have checked that it's valid for > > the common ones (or at least the original non-Plus variant)? > > > > > +AVS_Value args[] = { > > > +avs_new_value_string(s->url), > > > +avs_new_value_bool(1) // filename is in UTF-8 > > > +}; > > > +val = avs_library.avs_invoke(avs->env, "Import", > > > + avs_new_value_array(args, > 2), > > > 0); > > > +} else { > > > +AVS_Value arg; > > > #ifdef _WIN32 > > > -/* Convert UTF-8 to ANSI code page */ > > > -MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, > > > MAX_PATH * 4); > > > -WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, > > > filename_ansi, > > > -MAX_PATH * 4, NULL, NULL); > > > -arg = avs_new_value_string(filename_ansi); > > > +char *filename_ansi; > > > +/* Convert UTF-8 to ANSI code page */ > > > +if (utf8toansi(s->url, &filename_ansi)) { > > > > Two ideas came to my mind how this could be done better. > > What's actually needed here is not a string conversion, we need > > a valid and usable filename, and the function could be more > > something like "get_ansi_filename()". > > > > The first thing that this function could do is to convert the > > the filename to ANSI and right back to UTF-8, then compare the > > UTF-8 result with the original UTF-8 string. When both are equal, > > we know that the conversion is safe, otherwise we know that it > > won't work. > > > > Then, we can use the win32 API GetShortFileName(). Which returns > > file and directory names in 8.3 notation which (IIRC) contains > > only letters which are valid in the ANSI code page. > > > > This seems unrelated to this patch, which is about removing the > MAX_PATH limit. The code previously convert
Re: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
> -Original Message- > From: ffmpeg-devel On Behalf Of > nil-admir...@mailo.com > Sent: Monday, June 13, 2022 7:03 PM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove > MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW > > > Why do you use a 'do' loop? Can't you use the normal 2-step > > approach, i.e. call the winapi function with a NULL buffer, > > and then use the returned size to allocate the buffer. > > This way you always need a single allocation only. > > GetModuleFileNameW does not follow this convention: > https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf- > libloaderapi-getmodulefilenamew > > > If the length of the path exceeds the size that the nSize parameter > specifies, > > the function succeeds and the string is truncated to nSize > characters > > including the terminating null character. > > MS does the looping too in their WIL library: > https://github.com/microsoft/wil/blob/master/include/wil/win32_helper > s.h#L339-L341. Yes, you're right in this case; hadn't looked it up. Thanks for the pointers. sw ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
On 6/13/22 2:55 PM, Hendrik Leppkes wrote: This seems unrelated to this patch, which is about removing the MAX_PATH limit. The code previously converted UTF-8 to ANSI, and still does so now, just without the MAX_PATH limit. Further improvements tangential to this topic can, and should, be applied independently, and not hold up this patch in discussion-hell for longer than necessary. Agreed. As is stands, if a user finds that they need to open files that use non-ANSI characters in their filenames, they can always go into their Language settings and turn on UTF-8 for worldwide language support, which was just as true before the MAX_PATH-related patches. Honestly, Microsoft just needs to stop delaying it and make UTF-8 the default, and then we won't have this problem anymore. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/fmvc: buffer size is stride based not 4*width
On Mon, Jun 13, 2022 at 12:10:44PM +0200, Paul B Mahol wrote: > On Mon, Jun 13, 2022 at 11:48 AM Anton Khirnov wrote: > > > Quoting Paul B Mahol (2022-06-13 11:34:44) > > > On Mon, Jun 13, 2022 at 11:10 AM Anton Khirnov > > wrote: > > > > > > > Quoting Paul B Mahol (2022-06-13 10:04:04) > > > > > On Sat, Jun 11, 2022 at 4:55 PM Michael Niedermayer < > > > > mich...@niedermayer.cc> > > > > > wrote: > > > > > > > > > > > On Sat, Jun 11, 2022 at 10:47:57AM +0200, Paul B Mahol wrote: > > > > > > > Have you actually tested this "change" ? > > > > > > > > > > > > On every file i found > > > > > > 6-methyl-5-hepten-2-one-CC-db_small.avi > > > > > > fmvcVirtualDub_small.avi > > > > > > skrzyzowanie4.avi > > > > > > fmvc-poc.avi > > > > > > > > > > > > are there any other files i should test it on ? > > > > > > > > > > > > > > > > Yes, the ones where stride != width. > > > > > > > > Give examples of such files then. And add more tests. > > > > > > > > You really should try to be more helpful if you care about this code > > > > working. > > > > > > > > > Code works perfectly from start. There are always attempts to break it. > > > Your attempts to belittle my work are futile. > > > > Perfect code should live in an external repository that is locked > > against modification. > > > > The ffmpeg repository is only for imperfect code that evolves with time, > > and so requires changes. > > > > > I dunno what Michael attempts to fix. Decoder works fine with valid files. > I doubt that encoder would encode random bytes or padding into valid file > bitstream. the stride*4 / width*4 change was because of 2 things. first with AV_PIX_FMT_BGR24 the data stored is not width*4 stride is in units of 4 bytes for some reason, so stride*4 fixes this The 2nd issue is that the code addresses it by "s->stride * 4" so the buffer allocation should be stride*4 if we belive the other code is correct src = s->buffer; ... for (y = 0; y < avctx->height; y++) { ... src += s->stride * 4; width*4 works because its bigger than stride*4 for BGR24 which is what all samples i have use. also ssrc = s->buffer; ... for (y = 0; y < avctx->height; y++) { ... ssrc += s->stride * 4; and dst = (uint32_t *)s->buffer; for (block = 0, y = 0; y < s->yb; y++) { int block_h = s->blocks[block].h; uint32_t *rect = dst; for (x = 0; x < s->xb; x++) { int block_w = s->blocks[block].w; uint32_t *row = dst; block_h = s->blocks[block].h; if (s->blocks[block].xor) { for (k = 0; k < block_h; k++) { uint32_t *column = dst; for (l = 0; l < block_w; l++) *dst++ ^= *src++; dst = &column[s->stride]; } } dst = &row[block_w]; ++block; } dst = &rect[block_h * s->stride]; } Again, if you have fmvc files with more odd widths or other pixel formats these would be very welcome. I can just say the code as is in git is wrong and the buffer size as is in git is wrong. I noticed this when i added a check to see if the buffer is only partly filled and realized its always partly filled even when the whole image is actually touched thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart than the original author, trying to rewrite it will not make it better. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
> -Original Message- > From: ffmpeg-devel On Behalf Of Nil > Admirari > Sent: Monday, June 13, 2022 6:26 PM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove > MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW > > --- > compat/w32dlfcn.h | 80 ++--- > -- > libavcodec/mf_utils.h | 1 + > 2 files changed, 65 insertions(+), 16 deletions(-) > > diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h > index 52a94efafb..e49d3841aa 100644 > --- a/compat/w32dlfcn.h > +++ b/compat/w32dlfcn.h > @@ -22,9 +22,31 @@ > #ifdef _WIN32 > #include > #include "config.h" > -#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT > #include "libavutil/wchar_filename.h" > -#endif > + > +static inline wchar_t *get_module_filename(HMODULE module) > +{ > +wchar_t *path = NULL, *new_path; > +DWORD path_size = 0, path_len; > + > +do { > +path_size = path_size ? 2 * path_size : MAX_PATH; > +new_path = av_realloc_array(path, path_size, sizeof *path); > +if (!new_path) { > +av_free(path); > +return NULL; > +} > +path = new_path; > +path_len = GetModuleFileNameW(module, path, path_size); > +} while (path_len && path_size <= 32768 && path_size <= > path_len); path_size <= INT16_MAX (the edge case is already covered by the equals) > + > +if (!path_len) { > +av_free(path); > +return NULL; > +} > +return path; > +} > + > /** > * Safe function used to open dynamic libs. This attempts to improve > program security > * by removing the current directory from the dll search path. Only > dll's found in the > @@ -34,29 +56,53 @@ > */ > static inline HMODULE win32_dlopen(const char *name) > { > +wchar_t *name_w = NULL; > +if (utf8towchar(name, &name_w)) > +name_w = NULL; > #if _WIN32_WINNT < 0x0602 > // Need to check if KB2533623 is available I know this line existed before your path, but it would be nice to clarify check and condition, like: // On Win7 an earlier we check if KB2533623 is available > if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), > "SetDefaultDllDirectories")) { > HMODULE module = NULL; > -wchar_t *path = NULL, *name_w = NULL; > -DWORD pathlen; > -if (utf8towchar(name, &name_w)) > +wchar_t *path = NULL, *new_path; > +DWORD pathlen, pathsize, namelen; > +if (!name_w) > goto exit; > -path = (wchar_t *)av_calloc(MAX_PATH, sizeof(wchar_t)); > +namelen = wcslen(name_w); > // Try local directory first > -pathlen = GetModuleFileNameW(NULL, path, MAX_PATH); > -pathlen = wcsrchr(path, '\\') - path; > -if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) > +path = get_module_filename(NULL); > +if (!path) > goto exit; > -path[pathlen] = '\\'; > +new_path = wcsrchr(path, '\\'); > +if (!new_path) > +goto exit; > +pathlen = new_path - path; > +pathsize = pathlen + namelen + 2; > +new_path = av_realloc_array(path, pathsize, sizeof *path); > +if (!new_path) > +goto exit; > +path = new_path; > wcscpy(path + pathlen + 1, name_w); > module = LoadLibraryExW(path, NULL, > LOAD_WITH_ALTERED_SEARCH_PATH); > if (module == NULL) { > // Next try System32 directory > -pathlen = GetSystemDirectoryW(path, MAX_PATH); > -if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > > MAX_PATH) > +pathlen = GetSystemDirectoryW(path, pathsize); > +if (!pathlen) > goto exit; > -path[pathlen] = '\\'; > +// Buffer is not enough in two cases: > +// 1. system directory + \ + module name > +// 2. system directory even without the module name. > +if (pathlen + namelen + 2 > pathsize) { > +pathsize = pathlen + namelen + 2; > +new_path = av_realloc_array(path, pathsize, sizeof > *path); > +if (!new_path) > +goto exit; > +path = new_path; > +// Query again to handle the case #2. > +pathlen = GetSystemDirectoryW(path, pathsize); > +if (!pathlen) > +goto exit; > +} > +path[pathlen] = L'\\'; > wcscpy(path + pathlen + 1, name_w); > module = LoadLibraryExW(path, NULL, > LOAD_WITH_ALTERED_SEARCH_PATH); > } > @@ -73,15 +119,17 @@ exit: > # define LOAD_LIBRARY_SEARCH_SYSTEM320x0800 > #endif > #if HAVE_WINRT > -wchar_t *name_w = NULL; > int ret; > -if (utf8towchar(name, &name_w)) > +if (!name_w) > return NULL; > ret = LoadPackagedLibrary(name_w, 0); > av_free(name_w)
Re: [FFmpeg-devel] [PATCH 2/2] ffprobe: add -o option
On Sun, 12 Jun 2022, Stefano Sabatini wrote: On date Thursday 2022-06-09 21:09:02 +0200, Marton Balint wrote: On Sun, 3 Apr 2022, Stefano Sabatini wrote: [...] Updated again, now it's locally passing fate with FATE samples (don't remember if other issues were spotted the past time). This looks good to me in general, so I intend to apply. One thing that we might do is to keep writing to the standard output if no output file is specified instead of using the special "pipe:" URL. This way ffprobe keeps working even if the pipe protocol is not compiled into ffmpeg/libavformat. Sounds good, patch updated accordingly. Thanks, applied the series. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 1/5] libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi() and getenv_utf8()
On Mon, 13 Jun 2022, Nil Admirari wrote: wchartoutf8() converts strings returned by WinAPI into UTF-8, which is FFmpeg's preffered encoding. Some external dependencies, such as AviSynth, are still not Unicode-enabled. utf8toansi() converts UTF-8 strings into ANSI in two steps: UTF-8 -> wchar_t -> ANSI. wchartoansi() is responsible for the second step of the conversion. Conversion in just one step is not supported by WinAPI. Since these character converting functions allocate the buffer of necessary size, they also facilitate the removal of MAX_PATH limit in places where fixed-size ANSI/WCHAR strings were used as filename buffers. getenv_utf8() wraps _wgetenv() converting its input from and its output to UTF-8. Compared to plain getenv(), getenv_utf8() requires a cleanup. Because of that, in places that only test the existence of an environment variable or compare its value with a string consisting entirely of ASCII characters, the use of plain getenv() is still preferred. (libavutil/log.c check_color_terminal() is an example of such a place.) Plain getenv() is also preffered in UNIX-only code, such as bktr.c, fbdev_common.c, oss.c in libavdevice or af_ladspa.c in libavfilter. --- libavutil/getenv_utf8.h| 63 ++ libavutil/wchar_filename.h | 51 ++ 2 files changed, 114 insertions(+) create mode 100644 libavutil/getenv_utf8.h diff --git a/libavutil/getenv_utf8.h b/libavutil/getenv_utf8.h new file mode 100644 index 00..2c48a36355 --- /dev/null +++ b/libavutil/getenv_utf8.h @@ -0,0 +1,63 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_GETENV_UTF8_H +#define AVUTIL_GETENV_UTF8_H + +#include + +#include "mem.h" + +#ifdef _WIN32 + +#include "libavutil/wchar_filename.h" + +static inline char *getenv_utf8(const char *varname) +{ +wchar_t *varname_w, *var_w; +char *var; + +if (utf8towchar(varname, &varname_w)) +return NULL; +if (!varname_w) +return NULL; + +var_w = _wgetenv(varname_w); +av_free(varname_w); + +if (!var_w) +return NULL; +if (wchartoutf8(var_w, &var)) +return NULL; + +return var; + +// No CP_ACP fallback compared to other *_utf8() functions: +// non UTF-8 strings must not be returned. +} Note, there are Windows configurations that entirely lack getenv() (and presumably _wgetenv() too), namely the Windows Store App / Windows Phone App API subsets for Windows 8.x. I think those functions were allowed again in Windows 10 though... In configure, we have this: check_func_headers stdlib.h getenv enabled getenv || echo "#define getenv(x) NULL" >> $TMPH I guess we'd might have to add getenv to e.g. the SYSTEM_FUNCS list, so we'd get a HAVE_GETENV in config.h - then we could make getenv_utf8 a no-op if HAVE_GETENV is 0. (I'm not in a situation where I can test and investigate properly right now, I can maybe look closer into it later.) // Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
> I like the version check. I don't know about all the derivatives > of AviSynth, but I assume you have checked that it's valid for > the common ones (or at least the original non-Plus variant)? Interface version was changed to 7 in 2020: https://github.com/AviSynth/AviSynthPlus/commit/40900dc1c54c14ea9f188c7242b88d464d067a44 three years after utf8 was implemented. If I'm not mistaken, there is no way to check for a particular revision. > Two ideas came to my mind how this could be done better. > What's actually needed here is not a string conversion, we need > a valid and usable filename, and the function could be more > something like "get_ansi_filename()". > > The first thing that this function could do is to convert the > the filename to ANSI and right back to UTF-8, then compare the > UTF-8 result with the original UTF-8 string. When both are equal, > we know that the conversion is safe, otherwise we know that it > won't work. > > Then, we can use the win32 API GetShortFileName(). Which returns > file and directory names in 8.3 notation which (IIRC) contains > only letters which are valid in the ANSI code page. > > 8.3 file names do not always exist (depending on system config), > but it's always worth trying. > > Should both of these procedures fail, we could at least output > a useful message, explaining why it doesn't work. > > Let me know what you think. Too much work for something that was fixed on AviSynth+ side two years ago. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fftools/ffprobe: report avio errors
Signed-off-by: Marton Balint --- fftools/ffprobe.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 4e2fdbaec8..5020ba484c 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -545,12 +545,13 @@ static const AVClass writer_class = { .child_next = writer_child_next, }; -static void writer_close(WriterContext **wctx) +static int writer_close(WriterContext **wctx) { int i; +int ret = 0; if (!*wctx) -return; +return -1; if ((*wctx)->writer->uninit) (*wctx)->writer->uninit(*wctx); @@ -562,9 +563,10 @@ static void writer_close(WriterContext **wctx) av_opt_free(*wctx); if ((*wctx)->avio) { avio_flush((*wctx)->avio); -avio_close((*wctx)->avio); +ret = avio_close((*wctx)->avio); } av_freep(wctx); +return ret; } static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size) @@ -4145,7 +4147,9 @@ int main(int argc, char **argv) } writer_print_section_footer(wctx); -writer_close(&wctx); +ret = writer_close(&wctx); +if (ret < 0) +av_log(NULL, AV_LOG_ERROR, "Writing output failed: %s\n", av_err2str(ret)); } end: -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
> -Original Message- > From: ffmpeg-devel On Behalf Of > nil-admir...@mailo.com > Sent: Monday, June 13, 2022 10:53 PM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove > MAX_PATH limit and use UTF-8 version of getenv() > > > I like the version check. I don't know about all the derivatives > > of AviSynth, but I assume you have checked that it's valid for > > the common ones (or at least the original non-Plus variant)? > > Interface version was changed to 7 in 2020: > https://github.com/AviSynth/AviSynthPlus/commit/40900dc1c54c14ea9f188 > c7242b88d464d067a44 > three years after utf8 was implemented. If I'm not mistaken, there is > no way to check > for a particular revision. > > > Two ideas came to my mind how this could be done better. > > What's actually needed here is not a string conversion, we need > > a valid and usable filename, and the function could be more > > something like "get_ansi_filename()". > > > > The first thing that this function could do is to convert the > > the filename to ANSI and right back to UTF-8, then compare the > > UTF-8 result with the original UTF-8 string. When both are equal, > > we know that the conversion is safe, otherwise we know that it > > won't work. > > > > Then, we can use the win32 API GetShortFileName(). Which returns > > file and directory names in 8.3 notation which (IIRC) contains > > only letters which are valid in the ANSI code page. > > > > 8.3 file names do not always exist (depending on system config), > > but it's always worth trying. > > > > Should both of these procedures fail, we could at least output > > a useful message, explaining why it doesn't work. > > > > Let me know what you think. > > Too much work for something that was fixed on AviSynth+ side two > years ago. I wasn't sure how important AviSynth is for you. Until I had given the hint at the UTF8 option in AviSynth, it seemed to be a high priority to enable the use of long paths with AviSynth, and what I was thinking is that this might be of interest because paths with non-ANSI chars are a way more frequent case than long paths (on Windows). Anyway, as long as people are using a non-ancient version of AviSynthPlus, it's all covered by your patch, and I'm totally fine with this part! Thanks, sw ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/bink: disallow odd positioned scaled blocks
On Mon, Jun 13, 2022 at 10:02:24AM +0200, Paul B Mahol wrote: > Have you checked this with longer samples? ive tested it with the files in the bink directory on samples anything else i should test it with ? thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/bink: disallow odd positioned scaled blocks
On Mon, Jun 13, 2022 at 11:55 PM Michael Niedermayer wrote: > On Mon, Jun 13, 2022 at 10:02:24AM +0200, Paul B Mahol wrote: > > Have you checked this with longer samples? > > ive tested it with the files in the bink directory on samples > anything else i should test it with ? > Something longer, where is big gap between keyframes. > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The educated differ from the uneducated as much as the living from the > dead. -- Aristotle > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
> -Original Message- > From: ffmpeg-devel On Behalf Of > Soft Works > Sent: Monday, June 13, 2022 11:53 PM > To: FFmpeg development discussions and patches de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove > MAX_PATH limit and use UTF-8 version of getenv() > > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > nil-admir...@mailo.com > > Sent: Monday, June 13, 2022 10:53 PM > > To: ffmpeg-devel@ffmpeg.org > > Subject: Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove > > MAX_PATH limit and use UTF-8 version of getenv() > > > > > I like the version check. I don't know about all the derivatives > > > of AviSynth, but I assume you have checked that it's valid for > > > the common ones (or at least the original non-Plus variant)? > > > > Interface version was changed to 7 in 2020: > > > https://github.com/AviSynth/AviSynthPlus/commit/40900dc1c54c14ea9f188 > > c7242b88d464d067a44 > > three years after utf8 was implemented. If I'm not mistaken, there > is > > no way to check > > for a particular revision. > > > > > Two ideas came to my mind how this could be done better. > > > What's actually needed here is not a string conversion, we need > > > a valid and usable filename, and the function could be more > > > something like "get_ansi_filename()". > > > > > > The first thing that this function could do is to convert the > > > the filename to ANSI and right back to UTF-8, then compare the > > > UTF-8 result with the original UTF-8 string. When both are equal, > > > we know that the conversion is safe, otherwise we know that it > > > won't work. > > > > > > Then, we can use the win32 API GetShortFileName(). Which returns > > > file and directory names in 8.3 notation which (IIRC) contains > > > only letters which are valid in the ANSI code page. > > > > > > 8.3 file names do not always exist (depending on system config), > > > but it's always worth trying. > > > > > > Should both of these procedures fail, we could at least output > > > a useful message, explaining why it doesn't work. > > > > > > Let me know what you think. > > > > Too much work for something that was fixed on AviSynth+ side two > > years ago. > > I wasn't sure how important AviSynth is for you. Until I had given > the hint at the UTF8 option in AviSynth, it seemed to be a high > priority to enable the use of long paths with AviSynth, and what > I was thinking is that this might be of interest because paths > with non-ANSI chars are a way more frequent case than long paths > (on Windows). Before somebody will ask how I come to make such claims, here's why: As of Win 11, the Explorer still warns or even prevents you from creating long paths, but you are free to use any kind of non-ANSI characters for file and folders names. This does not only apply to the file management application, but includes the file open and save dialogs of all applications that are using the standard dialogs. sw ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/vlc: Use structure instead of VLC_TYPE array as VLC element
In C, qualifiers for arrays are broken: const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE elements and unfortunately this is not compatible with a pointer to a const array of two VLC_TYPE, because the latter does not exist as array types are never qualified (the qualifier applies to the base type instead). This is the reason why get_vlc2() doesn't accept a const VLC table despite not modifying the table at all, as there is no automatic conversion from VLC_TYPE (*)[2] to const VLC_TYPE (*)[2]. Fix this by using a structure VLCElem for the VLC table. This also has the advantage of making it clear which element is which. Signed-off-by: Andreas Rheinhardt --- libavcodec/4xm.c | 2 +- libavcodec/aacdec_template.c | 6 +++--- libavcodec/aacps_common.c| 2 +- libavcodec/aacsbr_template.c | 4 ++-- libavcodec/asvdec.c | 6 +++--- libavcodec/atrac3.c | 4 ++-- libavcodec/atrac3plus.c | 2 +- libavcodec/atrac9dec.c | 2 +- libavcodec/bink.c| 2 +- libavcodec/cfhddata.c| 8 libavcodec/clearvideo.c | 2 +- libavcodec/dcahuff.c | 2 +- libavcodec/dvdec.c | 6 +++--- libavcodec/faxcompr.c| 4 ++-- libavcodec/get_bits.h| 24 libavcodec/h264_cavlc.c | 16 libavcodec/huffyuvdec.c | 20 ++-- libavcodec/imc.c | 2 +- libavcodec/intrax8.c | 2 +- libavcodec/ivi.c | 2 +- libavcodec/mlpdec.c | 2 +- libavcodec/mobiclip.c| 2 +- libavcodec/mpc7.c| 2 +- libavcodec/mpc8.c| 2 +- libavcodec/mpeg12.c | 6 +++--- libavcodec/mpeg4videodec.c | 2 +- libavcodec/mpegaudiodec_common.c | 6 +++--- libavcodec/msmpeg4dec.c | 2 +- libavcodec/mss4.c| 2 +- libavcodec/qdm2_tablegen.c | 2 +- libavcodec/qdm2_tablegen.h | 2 +- libavcodec/qdmc.c| 2 +- libavcodec/rl.c | 6 +++--- libavcodec/rv10.c| 10 +- libavcodec/rv34.c| 2 +- libavcodec/rv40.c| 4 ++-- libavcodec/svq1dec.c | 2 +- libavcodec/tableprint_vlc.h | 17 - libavcodec/tscc2.c | 2 +- libavcodec/vc1.c | 2 +- libavcodec/vlc.c | 26 +- libavcodec/vlc.h | 13 + libavcodec/vp3.c | 2 +- 43 files changed, 120 insertions(+), 116 deletions(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 3fb3568afd..7b88631a6b 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -250,7 +250,7 @@ static void idct(int16_t block[64]) static av_cold void init_vlcs(void) { -static VLC_TYPE table[2][4][32][2]; +static VLCElem table[2][4][32]; int i, j; for (i = 0; i < 2; i++) { diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 463bf92fc0..70382c3175 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1221,8 +1221,8 @@ static void aacdec_init(AACContext *ac); static av_cold void aac_static_table_init(void) { -static VLC_TYPE vlc_buf[304 + 270 + 550 + 300 + 328 + -294 + 306 + 268 + 510 + 366 + 462][2]; +static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 + + 294 + 306 + 268 + 510 + 366 + 462]; for (unsigned i = 0, offset = 0; i < 11; i++) { vlc_spectral[i].table = &vlc_buf[offset]; vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; @@ -1821,7 +1821,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024], #if !USE_FIXED const float *vq = ff_aac_codebook_vector_vals[cbt_m1]; #endif /* !USE_FIXED */ -VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table; +const VLCElem *vlc_tab = vlc_spectral[cbt_m1].table; OPEN_READER(re, gb); switch (cbt_m1 >> 1) { diff --git a/libavcodec/aacps_common.c b/libavcodec/aacps_common.c index 8653b871ca..c388d5b9bc 100644 --- a/libavcodec/aacps_common.c +++ b/libavcodec/aacps_common.c @@ -78,7 +78,7 @@ static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCom int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \ { \ int b, num = ps->nr_ ## PAR ## _par; \ -VLC_TYPE (*vlc_table)[2] = vlc_ps[table_idx].table; \ +const VLCElem *vlc_table = vlc_ps[table_idx].table; \ if (dt) { \ int e_prev = e ? e - 1 : ps->num_env_old - 1; \ e_prev = FFMAX(e_prev, 0); \ diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c index 774f12e77a..87791d8791 100644 --- a/libavcodec/aacsbr_templ
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/bink: disallow odd positioned scaled blocks
On Tue, Jun 14, 2022 at 12:01:14AM +0200, Paul B Mahol wrote: > On Mon, Jun 13, 2022 at 11:55 PM Michael Niedermayer > wrote: > > > On Mon, Jun 13, 2022 at 10:02:24AM +0200, Paul B Mahol wrote: > > > Have you checked this with longer samples? > > > > ive tested it with the files in the bink directory on samples > > anything else i should test it with ? > > > > Something longer, where is big gap between keyframes. I would have thought that some of the 46 files in the samples archieve would have adequate gaps. Can you share some better test file ? thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avformat/ape: more bits in size for less overflows
On Sun, Apr 03, 2022 at 12:05:12AM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 2147483647 + 3 cannot be represented in type > 'int' > Fixes: > 46184/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-4678059519770624 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/ape.c | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) will apply patchset [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you drop bombs on a foreign country and kill a hundred thousand innocent people, expect your government to call the consequence "unprovoked inhuman terrorist attacks" and use it to justify dropping more bombs and killing more people. The technology changed, the idea is old. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: Non overflowing ambisonic order check
On Sat, Mar 26, 2022 at 12:06:49AM +0100, Michael Niedermayer wrote: > Fixes: signed integer overflow: 536870913 * 536870913 cannot be represented > in type 'int' > Fixes: > 45862/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4730373768085504 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/mov.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/4] avformat/mxf: Use AVUUID for uids
This is in preparation for using av_uuid functions directly. Signed-off-by: Andreas Rheinhardt --- libavformat/mxf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mxf.h b/libavformat/mxf.h index d53a16df51..4d9f5119a3 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -25,8 +25,9 @@ #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" +#include "libavutil/uuid.h" -typedef uint8_t UID[16]; +typedef AVUUID UID; enum MXFMetadataSetType { AnyType, -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/4] avformat/mxfdec: Don't duplicate av_uuid_unparse
Also don't allocate the string ourselves, let av_dict_set() do it. Signed-off-by: Andreas Rheinhardt --- libavformat/mxfdec.c | 24 +++- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 6a22c33995..392066b65a 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2118,24 +2118,6 @@ static int mxf_is_intra_only(MXFDescriptor *descriptor) &descriptor->essence_codec_ul)->id != AV_CODEC_ID_NONE; } -static int mxf_uid_to_str(UID uid, char **str) -{ -int i; -char *p; -p = *str = av_mallocz(sizeof(UID) * 2 + 4 + 1); -if (!p) -return AVERROR(ENOMEM); -for (i = 0; i < sizeof(UID); i++) { -snprintf(p, 2 + 1, "%.2x", uid[i]); -p += 2; -if (i == 3 || i == 5 || i == 7 || i == 9) { -snprintf(p, 1 + 1, "-"); -p++; -} -} -return 0; -} - static int mxf_umid_to_str(UID ul, UID uid, char **str) { int i; @@ -3088,10 +3070,10 @@ static int64_t mxf_timestamp_to_int64(uint64_t timestamp) } while (0) #define SET_UID_METADATA(pb, name, var, str) do { \ +char uuid_str[2 * AV_UUID_LEN + 4 + 1]; \ avio_read(pb, var, 16); \ -if ((ret = mxf_uid_to_str(var, &str)) < 0) \ -return ret; \ -av_dict_set(&s->metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \ +av_uuid_unparse(uid, uuid_str); \ +av_dict_set(&s->metadata, name, uuid_str, 0); \ } while (0) #define SET_TS_METADATA(pb, name, var, str) do { \ -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/4] avformat/mxfdec: Use ff_data_to_hex() for data->hex conversion
In this case it also stops pretending that the length of the output string is somehow checked (which is currently being done by using snprintf that is called with the amount of space needed instead of the amount of space actually available). Signed-off-by: Andreas Rheinhardt --- libavformat/mxfdec.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 392066b65a..77bde7c3fe 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2120,22 +2120,13 @@ static int mxf_is_intra_only(MXFDescriptor *descriptor) static int mxf_umid_to_str(UID ul, UID uid, char **str) { -int i; char *p; p = *str = av_mallocz(sizeof(UID) * 4 + 2 + 1); if (!p) return AVERROR(ENOMEM); snprintf(p, 2 + 1, "0x"); -p += 2; -for (i = 0; i < sizeof(UID); i++) { -snprintf(p, 2 + 1, "%.2X", ul[i]); -p += 2; - -} -for (i = 0; i < sizeof(UID); i++) { -snprintf(p, 2 + 1, "%.2X", uid[i]); -p += 2; -} +ff_data_to_hex(p + 2, ul, sizeof(UID), 0); +ff_data_to_hex(p + 2 + 2 * sizeof(UID), uid, sizeof(UID), 0); return 0; } -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/4] avformat/mxfdec: Offload allocating string to av_dict_set()
Signed-off-by: Andreas Rheinhardt --- libavformat/mxfdec.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 77bde7c3fe..ad8fb77f9b 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2118,16 +2118,11 @@ static int mxf_is_intra_only(MXFDescriptor *descriptor) &descriptor->essence_codec_ul)->id != AV_CODEC_ID_NONE; } -static int mxf_umid_to_str(UID ul, UID uid, char **str) +static void mxf_umid_to_str(UID ul, UID uid, char str[2 + sizeof(UID) * 4 + 1]) { -char *p; -p = *str = av_mallocz(sizeof(UID) * 4 + 2 + 1); -if (!p) -return AVERROR(ENOMEM); -snprintf(p, 2 + 1, "0x"); -ff_data_to_hex(p + 2, ul, sizeof(UID), 0); -ff_data_to_hex(p + 2 + 2 * sizeof(UID), uid, sizeof(UID), 0); -return 0; +snprintf(str, 2 + sizeof(UID) * 4 + 1, "0x"); +ff_data_to_hex(str + 2, ul, sizeof(UID), 0); +ff_data_to_hex(str + 2 + 2 * sizeof(UID), uid, sizeof(UID), 0); } static int mxf_version_to_str(uint16_t major, uint16_t minor, uint16_t tertiary, @@ -2141,13 +2136,11 @@ static int mxf_version_to_str(uint16_t major, uint16_t minor, uint16_t tertiary, static int mxf_add_umid_metadata(AVDictionary **pm, const char *key, MXFPackage* package) { -char *str; -int ret; +char str[2 + 4 * sizeof(UID) + 1]; if (!package) return 0; -if ((ret = mxf_umid_to_str(package->package_ul, package->package_uid, &str)) < 0) -return ret; -av_dict_set(pm, key, str, AV_DICT_DONT_STRDUP_VAL); +mxf_umid_to_str(package->package_ul, package->package_uid, str); +av_dict_set(pm, key, str, 0); return 0; } -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fftools/fopen_utf8: support long paths on Windows for fftools
From: softworkz Signed-off-by: softworkz --- fftools/fopen_utf8: support long paths on Windows for fftools After Nil's patchset, this is probably the final missing bit. Signed-off-by: softworkz softwo...@hotmail.com Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-36%2Fsoftworkz%2Fsubmit_fftools_long_paths-v1 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-36/softworkz/submit_fftools_long_paths-v1 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/36 fftools/fopen_utf8.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/fopen_utf8.h b/fftools/fopen_utf8.h index cd18fe8ce1..e5be84179a 100644 --- a/fftools/fopen_utf8.h +++ b/fftools/fopen_utf8.h @@ -35,7 +35,7 @@ static inline FILE *fopen_utf8(const char *path_utf8, const char *mode) FILE *f; /* convert UTF-8 to wide chars */ -if (utf8towchar(path_utf8, &path_w)) /* This sets errno on error. */ +if (get_extended_win32_path(path_utf8, &path_w)) /* This sets errno on error. */ return NULL; if (!path_w) goto fallback; base-commit: 4d45f5acbd9ab55cd8d29d01843f28315ee27fee -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avutil/version: 57.26.100 -> 57.27.100
Forgot to bump after the uuid patches. Signed-off-by: Zane van Iperen --- libavutil/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/version.h b/libavutil/version.h index 2c7f4f6b37..2e9e02dda8 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 26 +#define LIBAVUTIL_VERSION_MINOR 27 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.36.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] doc/APIchanges: add missing uuid and csp entries
Signed-off-by: Zane van Iperen --- doc/APIchanges | 10 ++ 1 file changed, 10 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 4f7a19d176..3349e94a4f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -18,6 +18,16 @@ API changes, most recent first: Add avio_vprintf(), similar to avio_printf() but allow to use it from within a function taking a variable argument list as input. +2022-06-01 - x - lavu 57.27.100 - uuid.c uuid.h + Add UUID handling functions. + Add av_uuid_parse(), av_uuid_urn_parse(), av_uuid_parse_range(), + av_uuid_parse_range(), av_uuid_equal(), av_uuid_copy(), and av_uuid_nil(). + +2022-05-28 - x - lavu 57.26.100 - csp.c csp.h + Add public API for colorspace structs. + Add av_csp_luma_coeffs_from_avcsp(), av_csp_primaries_desc_from_id(), + and av_csp_primaries_id_from_desc(). + 2022-05-23 - x - lavu 57.25.100 - avutil.h Deprecate av_fopen_utf8() without replacement. -- 2.36.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avutil/version: 57.26.100 -> 57.27.100
On 6/13/2022 9:03 PM, Zane van Iperen wrote: Forgot to bump after the uuid patches. Signed-off-by: Zane van Iperen --- libavutil/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/version.h b/libavutil/version.h index 2c7f4f6b37..2e9e02dda8 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 26 +#define LIBAVUTIL_VERSION_MINOR 27 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ Patchset applied. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/4] lavc/hevc_refs: fix dpb logical for IRAP
From: Xu Guangxin According to C.5.2.2, item 2. When we got an IRAP, and the NoOutputOfPriorPicsFlag = 0, we need bump all outputable frames. Tested-by: Fei Wang Signed-off-by: Xu Guangxin --- Update: 1. fixed segment fault for some special clip in 2nd patch. libavcodec/hevc_refs.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index fe18ca2b1d..3f8fe1ef18 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -174,21 +174,24 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc) int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush) { +if (IS_IRAP(s) && s->no_rasl_output_flag == 1) { +const static int mask = HEVC_FRAME_FLAG_BUMPING | HEVC_FRAME_FLAG_OUTPUT; +for (int i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { +HEVCFrame *frame = &s->DPB[i]; +if ((frame->flags & mask) == HEVC_FRAME_FLAG_OUTPUT && +frame->sequence != s->seq_decode) { +if (s->sh.no_output_of_prior_pics_flag == 1) +ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT); +else +frame->flags |= HEVC_FRAME_FLAG_BUMPING; +} +} +} do { int nb_output = 0; int min_poc = INT_MAX; int i, min_idx, ret; -if (s->sh.no_output_of_prior_pics_flag == 1 && s->no_rasl_output_flag == 1) { -for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { -HEVCFrame *frame = &s->DPB[i]; -if (!(frame->flags & HEVC_FRAME_FLAG_BUMPING) && frame->poc != s->poc && -frame->sequence == s->seq_output) { -ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT); -} -} -} - for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { HEVCFrame *frame = &s->DPB[i]; if ((frame->flags & HEVC_FRAME_FLAG_OUTPUT) && -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/4] lavc/hevcdec: do not let missing ref frames invovled in dpb process
From: Xu Guangxin We will generate a new frame for a missed reference. The frame can only be used for reference. We assign an invalid decode sequence to it, so it will not be involved in any dpb process. Tested-by: Fei Wang Signed-off-by: Xu Guangxin --- libavcodec/hevc_refs.c | 14 +- libavcodec/hevcdec.c | 4 ++-- libavcodec/hevcdec.h | 3 +++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 3f8fe1ef18..89053fd1a2 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -172,6 +172,16 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc) return 0; } +static void unref_missing_refs(HEVCContext *s) +{ +for (int i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { + HEVCFrame *frame = &s->DPB[i]; + if (frame->sequence == HEVC_DECODE_SEQUENCE_INVALID) { + ff_hevc_unref_frame(s, frame, ~0); + } +} +} + int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush) { if (IS_IRAP(s) && s->no_rasl_output_flag == 1) { @@ -418,7 +428,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc) } frame->poc = poc; -frame->sequence = s->seq_decode; +frame->sequence = HEVC_DECODE_SEQUENCE_INVALID; frame->flags= 0; if (s->threads_type == FF_THREAD_FRAME) @@ -462,6 +472,8 @@ int ff_hevc_frame_rps(HEVCContext *s) return 0; } +unref_missing_refs(s); + /* clear the reference flags on all frames except the current one */ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { HEVCFrame *frame = &s->DPB[i]; diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f782ea6394..99785aa5d1 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -569,7 +569,7 @@ static int hls_slice_header(HEVCContext *s) } if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) { -s->seq_decode = (s->seq_decode + 1) & 0xff; +s->seq_decode = (s->seq_decode + 1) & HEVC_DECODE_SEQUENCE_MASK; s->max_ra = INT_MAX; if (IS_IDR(s)) ff_hevc_clear_refs(s); @@ -614,7 +614,7 @@ static int hls_slice_header(HEVCContext *s) return pix_fmt; s->avctx->pix_fmt = pix_fmt; -s->seq_decode = (s->seq_decode + 1) & 0xff; +s->seq_decode = (s->seq_decode + 1) & HEVC_DECODE_SEQUENCE_MASK; s->max_ra = INT_MAX; } diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index de861b88b3..9c8bcefb48 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -390,6 +390,9 @@ typedef struct DBParams { #define HEVC_FRAME_FLAG_LONG_REF (1 << 2) #define HEVC_FRAME_FLAG_BUMPING (1 << 3) +#define HEVC_DECODE_SEQUENCE_MASK 0xff +#define HEVC_DECODE_SEQUENCE_INVALID (HEVC_DECODE_SEQUENCE_MASK + 1) + typedef struct HEVCFrame { AVFrame *frame; AVFrame *frame_grain; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/4] lavc/hevc_refs: exclude current frame from long term refs
From: Xu Guangxin suppose a. You have 3 frames, 0, 1, 4096. b. The ltMask is 0xfff and use_msb is 0. c. The 0, 1 are lt refs for 4096. d. you are decoding frame 4096, and get the 0 frame. Since 4096 & ltMask is 0 too, even you want get 0, find_ref_idx may give you 4096. add_candidate_ref will report an error for this Tested-by: Fei Wang Signed-off-by: Xu Guangxin --- libavcodec/hevc_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 89053fd1a2..b3d5f96043 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -386,7 +386,7 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int poc, uint8_t use_msb) for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { HEVCFrame *ref = &s->DPB[i]; if (ref->frame->buf[0] && ref->sequence == s->seq_decode) { -if ((ref->poc & mask) == poc) +if ((ref->poc & mask) == poc && (use_msb || ref->poc != s->poc)) return ref; } } -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 4/4] lavc/hevcdec: respect the value of no_output_of_prior_pics_flag
From: Xu Guangxin Even resolution or number of picture stores changes, we still need follow no_output_of_prior_pics_flag in next IDR. Tested-by: Fei Wang Signed-off-by: Xu Guangxin --- libavcodec/hevcdec.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 99785aa5d1..b0317339a2 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -594,15 +594,8 @@ static int hls_slice_header(HEVCContext *s) if (s->ps.sps != (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) { const HEVCSPS *sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data; -const HEVCSPS *last_sps = s->ps.sps; enum AVPixelFormat pix_fmt; -if (last_sps && IS_IRAP(s) && s->nal_unit_type != HEVC_NAL_CRA_NUT) { -if (sps->width != last_sps->width || sps->height != last_sps->height || -sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering != -last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering) -sh->no_output_of_prior_pics_flag = 0; -} ff_hevc_clear_refs(s); ret = set_sps(s, sps, sps->pix_fmt); -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 2/4] lavc/hevcdec: do not let missing ref frames invovled in dpb process
> -Original Message- > From: ffmpeg-devel On Behalf Of > Michael Niedermayer > Sent: Thursday, June 9, 2022 10:05 PM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] [PATCH v1 2/4] lavc/hevcdec: do not let missing > ref > frames invovled in dpb process > > On Thu, Jun 09, 2022 at 05:34:47AM +, Wang, Fei W wrote: > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of > > > Michael Niedermayer > > > Sent: Tuesday, June 7, 2022 8:07 PM > > > To: FFmpeg development discussions and patches > > > > > > Subject: Re: [FFmpeg-devel] [PATCH v1 2/4] lavc/hevcdec: do not let > > > missing ref frames invovled in dpb process > > > > > > On Tue, Jun 07, 2022 at 03:08:28PM +0800, Fei Wang wrote: > > > > From: Xu Guangxin > > > > > > > > We will generate a new frame for a missed reference. The frame can > > > > only be used for reference. We assign an invalid decode sequence > > > > to it, so it will not be involved in any dpb process. > > > > > > > > Tested-by: Fei Wang > > > > Signed-off-by: Xu Guangxin > > > > --- > > > > libavcodec/hevc_refs.c | 13 - > > > > libavcodec/hevcdec.c | 4 ++-- > > > > libavcodec/hevcdec.h | 3 +++ > > > > 3 files changed, 17 insertions(+), 3 deletions(-) > > > > > > This causes segfaults > > > > Thanks Michael, could you share your clip to me? I can't reproduce this > > with all > my clips. > > file sent by private mail Fixed in V2. Thanks Fei > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The smallest minority on earth is the individual. Those who deny individual > rights > cannot claim to be defenders of minorities. - Ayn Rand ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".