Re: [FFmpeg-devel] [PATCH] avformat/img2dec: Option to play sequence backwards
> seems to break/change -loop > > ffmpeg -f image2 -loop 1 -framerate 2 -i tickets/3329/arrow_%1d.png -frames > 1000 -vf fps=fps=25 -omit_video_pes_length 0 file-3329.ts > > the output filesize changes by more than 10x > > thx Ok, I'll look into that later. Once I have a new patch, how should I proceed? Should I amend my previous commit and send a new patch with [FFmpeg-devel,v2] prefix? Thanks, > On 12 Feb 2022, at 12:57, Sergio Acereda wrote: ___ 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/img2dec: Option to play sequence backwards
On Sun, Feb 13, 2022 at 12:36:14PM +0100, Sergio Acereda wrote: > > seems to break/change -loop > > > > ffmpeg -f image2 -loop 1 -framerate 2 -i tickets/3329/arrow_%1d.png -frames > > 1000 -vf fps=fps=25 -omit_video_pes_length 0 file-3329.ts > > > > the output filesize changes by more than 10x > > > > thx > > Ok, I'll look into that later. > > Once I have a new patch, how should I proceed? Should I amend my previous > commit and send a new patch with [FFmpeg-devel,v2] prefix? whatever was the last version +1 thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- 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".
Re: [FFmpeg-devel] [RFC][PATCH 1/4] avutil/frame: add an internal field to store the size of AVFrame
On Sat, Feb 12, 2022 at 09:16:36AM -0300, James Almer wrote: > On 2/12/2022 9:08 AM, Michael Niedermayer wrote: > > On Fri, Feb 11, 2022 at 09:12:58PM -0300, James Almer wrote: > > > This is unfortunately needed to remove (or reduce the awfulness) of > > > certain > > > modules violating the AVFrame API and using sizeof(AVFrame). > > > With this, the sizeof(AVFrame) value of the libavutil loaded at runtime > > > can be > > > used instead of the compile time value of whatever library included > > > frame.h > > > > > > Signed-off-by: James Almer > > > --- > > > This is sucks, but at least less so than the current situation. > > > > > > I don't see wrapped_avframe going away anytime soon, so something must be > > > done, > > > and last time i tried to change how the packets are generated my approach > > > was > > > shut down, so here's another attempt. > > > > iam probably missing something but if the goal is to wrap AVFrame in some > > other structure as a array or buffer > > without the sizeof(AVFrame) cant the wraping/unwraping code be put in > > libavutil ? > > How would that fix the situation of setting AVPacket.size to sizeof(AVFrame) > and AVPacket.data to an structure that big + padding bytes in packets > returned to the caller? If you had a function which turned a AVFrame into a AVBufferRef pkt->data = buf->data; pkt->size = buf->size; If done carefully, this might work even independant of how that function does it, by reference, copy or full serialization If that direction would be pursued (possibly later), the wraping function could have a flag that switches between zero copy reference and full serialization of AVFrames which could be passed accross a network or stored on disk and used later/elsewhere thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch 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] avformat/id3v2: Add Grouping frame to id3v2.4 metadata table
The ID3v2.4.0 standard defines TIT1 as the "Content group description" tag [1]. This frame is usually referred to as the "Grouping" tag and in de-facto use under that name by Vorbis and APEv2 [2]. This commit introduces a mapping from "TIT1" to "grouping" in the id3v2.4 metadata conversion table. This will enable software to access it using that name. In particular, MPD will now read this tag correctly when using the ffmpeg decoder plugin. [1] https://id3.org/id3v2.4.0-frames (4.2.1) [2] https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html#grouping-3 Signed-off-by: Wolfgang Müller --- As evident from the commit message, I ran into this using MPD with the ffmpeg decoder plugin. MPD relies on these mappings heavily, and I found it the easiest place to fix this particular issue, especially if other pieces of software can also gain from this. libavformat/id3v2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index ff27c062e5..0f9bedea02 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -69,6 +69,7 @@ const AVMetadataConv ff_id3v2_4_metadata_conv[] = { { "TSOA", "album-sort"}, { "TSOP", "artist-sort" }, { "TSOT", "title-sort"}, +{ "TIT1", "grouping" }, { 0 } }; -- 2.35.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] Long path support for Windows (fixes #8885)
Does this break compatibility with older Windows-Versions? smime.p7s Description: S/MIME Cryptographic 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] avformat/matroskadec: Check pre_ns
Fixes: division by 0 Fixes: 44615/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6681108677263360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/matroskadec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 31e5111225..91f3567692 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -4205,6 +4205,8 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t // prebuffered. pre_bytes = desc_end.end_offset - desc_end.start_offset; pre_ns = desc_end.end_time_ns - desc_end.start_time_ns; +if (pre_ns <= 0) +return -1; pre_sec = pre_ns / nano_seconds_per_second; prebuffer_bytes += pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec); -- 2.17.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] avcodec/setts_bsf: set the output packet duration to 0
On 2/9/2022 12:28 PM, James Almer wrote: It's not possible to know the resulting packet's duration after applying the expression as it depends on the timestamp of the next packet, which we haven't seen yet. The old duration, if any, is no longer valid, so just remove it. Signed-off-by: James Almer --- libavcodec/setts_bsf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c index d604f91f71..56307fc8cd 100644 --- a/libavcodec/setts_bsf.c +++ b/libavcodec/setts_bsf.c @@ -180,6 +180,7 @@ static int setts_filter(AVBSFContext *ctx, AVPacket *pkt) pkt->pts = new_pts; pkt->dts = new_dts; +pkt->duration = 0; return ret; } Will apply. ___ 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/setts_bsf: set the output packet duration to 0
Too soon. Wait more, does this breaks something? ___ 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/setts_bsf: set the output packet duration to 0
On 2/13/2022 2:14 PM, Paul B Mahol wrote: Too soon. Wait more, Ok. does this breaks something? There are no fate tests, and 0 is used when the duration is unknown, so it shouldn't break anything. ___ 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/setts_bsf: set the output packet duration to 0
James Almer: > On 2/13/2022 2:14 PM, Paul B Mahol wrote: >> Too soon. >> >> Wait more, > > Ok. > >> does this breaks something? > > There are no fate tests, and 0 is used when the duration is unknown, so > it shouldn't break anything. > It breaks the simple use-case where this filter is used to just shift the timestamps. - Andreas ___ 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/setts_bsf: set the output packet duration to 0
On 2/13/2022 2:22 PM, Andreas Rheinhardt wrote: James Almer: On 2/13/2022 2:14 PM, Paul B Mahol wrote: Too soon. Wait more, Ok. does this breaks something? There are no fate tests, and 0 is used when the duration is unknown, so it shouldn't break anything. It breaks the simple use-case where this filter is used to just shift the timestamps. How so? It's a documented value that means unknown. What breaks because of it? Wouldn't it be revealing a bug if so? And in non simple use cases that completely replace or rescale the timestamps, the old duration value is no longer valid, and something definitely worse to have than 0. - Andreas ___ 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/setts_bsf: set the output packet duration to 0
James Almer: > > > On 2/13/2022 2:22 PM, Andreas Rheinhardt wrote: >> James Almer: >>> On 2/13/2022 2:14 PM, Paul B Mahol wrote: Too soon. Wait more, >>> >>> Ok. >>> does this breaks something? >>> >>> There are no fate tests, and 0 is used when the duration is unknown, so >>> it shouldn't break anything. >>> >> >> It breaks the simple use-case where this filter is used to just shift >> the timestamps. > > How so? It's a documented value that means unknown. What breaks because > of it? Wouldn't it be revealing a bug if so? > Effectively forgetting a known value can have bad consequences. Think of subtitles. > And in non simple use cases that completely replace or rescale the > timestamps, the old duration value is no longer valid, and something > definitely worse to have than 0. > I am not saying that this filter is currently always outputting valid durations. - Andreas ___ 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 0/3] avformat/avisynth: support frame properties
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: AviSynth+ 3.6.0 introduced support for frame properties, allowing various metadata to be passed between filters or read out by client programs. Using this, FFmpeg can read Color Range, Transfer Characteristics, Matrix, Color Primaries, Chroma Location, and Field Order information from AviSynth scripts. Reading frame properties through AviSynth's C interface was not possible until a few months ago, though, so client programs that use the C API need version 3.7.1 or higher to be able to take advantage of it. Incorporates a previous patch by emcodem that fixes setting field order on non-frameprop-aware versions of AviSynth. Stephen Hutchinson (2): avisynth: use AviSynth+'s frame properties to set various fields configure: check avisynth header version emcodem (1): avisynth: corrected interlace detection configure | 4 +- libavformat/avisynth.c | 266 ++--- 2 files changed, 253 insertions(+), 17 deletions(-) Since it's been about a week, if there aren't any objections that show up, I'll go ahead and push this later today or tomorrow. ___ 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 v6 0/1] Add IPFS protocol support.
Hi, This patch series adds support for IPFS. V6: - Moved the gateway buffer (now called gateway_buffer) to IPFSGatewayContext - Changed nearly all PATH_MAX uses to sizeof(...) uses for future flexibility - The rest is relatively minor feedback changes V5: - "c->gateway" is now not modified anymore - Moved most variables to the stack - Even more strict checks with the auto detection logic - Errors are now AVERROR :) - Added more logging and changed some debug ones to info ones as they are valuable to aid debugging as a user when something goes wrong. V3 (V4): - V4: title issue from V3.. - A lot of style changes - Made url checks a lot more strict - av_asprintf leak fixes - So many changes that a diff to v2 is again not sensible. V2: - Squashed and changed so much that a diff to v1 was not sensible. The following is a short summary. In the IPFS ecosystem you access it's content by a "Content IDentifier" (CID). This CID is, in simplified terms, a hash of the content. IPFS itself is a distributed network where any user can run a node to be part of the network and access files by their CID. If any reachable node within that network has the CID, you can get it. IPFS (as a technology) has two protocols, ipfs and ipns. The ipfs protocol is the immutable way to access content. The ipns protocol is a mutable layer on top of it. It's essentially a new CID that points to a ipfs CID. This "pointer" if you will can be changed to point to something else. Much more information on how this technology works can be found here [1]. This patch series allows to interact natively with IPFS. That means being able to access files like: - ffplay ipfs:// - ffplay ipns:// There are multiple ways to access files on the IPFS network. This patch series uses the gateway driven way. An IPFS node - by default - exposes a local gateway (say http://localhost:8080) which is then used to get content from IPFS. The gateway functionality on the IPFS side contains optimizations to be as ideal to streaming data as it can be. Optimizations that the http protocol in ffmpeg also has and are thus reused for free in this approach. A note on other "more appropiate" ways, as I received some feedback on that. For ffmpeg purposes the gateway approach is ideal! There is a "libipfs" but that would spin up an ipfs node with the overhead of: - bootstrapping - connecting to nodes - finding other nodes to connect too - finally finding your file This alternative approach could take minutes before a file is played. The gateway approach immediately connects to an already running node thus gives the file the fastest. Much of the logic in this patch series is to find that gateway and essentially rewrite: "ipfs://" to: "http://localhost:8080/ipfs/" Once that's found it's forwared to the protocol handler where eventually the http protocol is going to handle it. Note that it could also be https. There's enough flexibility in the implementation to allow the user to provide a gateway. There are also public https gateways which can be used just as well. After this patch is accepted, I'll work on getting IPFS supported in: - mpv (requires this ffmpeg patch) - vlc (prefers this patch but can be made to work without this patch) - kodi (requires this ffmpeg patch) Best regards, Mark Gaiser [1] https://docs.ipfs.io/concepts/ Mark Gaiser (1): avformat: Add IPFS protocol support. configure | 2 + doc/protocols.texi| 30 libavformat/Makefile | 2 + libavformat/ipfsgateway.c | 324 ++ libavformat/protocols.c | 2 + 5 files changed, 360 insertions(+) create mode 100644 libavformat/ipfsgateway.c -- 2.35.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 v6 1/1] avformat: Add IPFS protocol support.
This patch adds support for: - ffplay ipfs:// - ffplay ipns:// IPFS data can be played from so called "ipfs gateways". A gateway is essentially a webserver that gives access to the distributed IPFS network. This protocol support (ipfs and ipns) therefore translates ipfs:// and ipns:// to a http:// url. This resulting url is then handled by the http protocol. It could also be https depending on the gateway provided. To use this protocol, a gateway must be provided. If you do nothing it will try to find it in your $HOME/.ipfs/gateway file. The ways to set it manually are: 1. Define a -gateway to the gateway. 2. Define $IPFS_GATEWAY with the full http link to the gateway. 3. Define $IPFS_PATH and point it to the IPFS data path. 4. Have IPFS running in your local user folder (under $HOME/.ipfs). Signed-off-by: Mark Gaiser --- configure | 2 + doc/protocols.texi| 30 libavformat/Makefile | 2 + libavformat/ipfsgateway.c | 324 ++ libavformat/protocols.c | 2 + 5 files changed, 360 insertions(+) create mode 100644 libavformat/ipfsgateway.c diff --git a/configure b/configure index 5b19a35f59..6ff09e7974 100755 --- a/configure +++ b/configure @@ -3585,6 +3585,8 @@ udp_protocol_select="network" udplite_protocol_select="network" unix_protocol_deps="sys_un_h" unix_protocol_select="network" +ipfs_protocol_select="https_protocol" +ipns_protocol_select="https_protocol" # external library protocols libamqp_protocol_deps="librabbitmq" diff --git a/doc/protocols.texi b/doc/protocols.texi index d207df0b52..7c9c0a4808 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -2025,5 +2025,35 @@ decoding errors. @end table +@section ipfs + +InterPlanetary File System (IPFS) protocol support. One can access files stored +on the IPFS network through so called gateways. Those are http(s) endpoints. +This protocol wraps the IPFS native protocols (ipfs:// and ipns://) to be send +to such a gateway. Users can (and should) host their own node which means this +protocol will use your local machine gateway to access files on the IPFS network. + +If a user doesn't have a node of their own then the public gateway dweb.link is +used by default. + +You can use this protocol in 2 ways. Using IPFS: +@example +ffplay ipfs://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T +@end example + +Or the IPNS protocol (IPNS is mutable IPFS): +@example +ffplay ipns://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T +@end example + +You can also change the gateway to be used: + +@table @option + +@item gateway +Defines the gateway to use. When nothing is provided the protocol will first try +your local gateway. If that fails dweb.link will be used. + +@end table @c man end PROTOCOLS diff --git a/libavformat/Makefile b/libavformat/Makefile index 3dc6a479cc..4edce8420f 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -656,6 +656,8 @@ OBJS-$(CONFIG_SRTP_PROTOCOL) += srtpproto.o srtp.o OBJS-$(CONFIG_SUBFILE_PROTOCOL) += subfile.o OBJS-$(CONFIG_TEE_PROTOCOL) += teeproto.o tee_common.o OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o +OBJS-$(CONFIG_IPFS_PROTOCOL) += ipfsgateway.o +OBJS-$(CONFIG_IPNS_PROTOCOL) += ipfsgateway.o TLS-OBJS-$(CONFIG_GNUTLS)+= tls_gnutls.o TLS-OBJS-$(CONFIG_LIBTLS)+= tls_libtls.o TLS-OBJS-$(CONFIG_MBEDTLS) += tls_mbedtls.o diff --git a/libavformat/ipfsgateway.c b/libavformat/ipfsgateway.c new file mode 100644 index 00..dcafd375e8 --- /dev/null +++ b/libavformat/ipfsgateway.c @@ -0,0 +1,324 @@ +/* + * IPFS and IPNS protocol support through IPFS Gateway. + * Copyright (c) 2022 Mark Gaiser + * + * 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 + */ + +#include "avformat.h" +#include "libavutil/avassert.h" +#include "libavutil/avstring.h" +#include "libavutil/internal.h" +#include "libavutil/opt.h" +#include "libavutil/tree.h" +#include +#if HAVE_IO_H +#include +#endif +#if HAVE_UNISTD_H +#include +#endif +#include "os_support.h" +#include "url.h" +#include +#include + +typedef struct IPFSGatewayContext { +AVClass *class; +URLContext *inner; +// Is filled by the -gateway a
Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
On 2022-02-13 10:58 pm, James Almer wrote: On 2/13/2022 2:22 PM, Andreas Rheinhardt wrote: James Almer: On 2/13/2022 2:14 PM, Paul B Mahol wrote: Too soon. Wait more, Ok. does this breaks something? There are no fate tests, and 0 is used when the duration is unknown, so it shouldn't break anything. It breaks the simple use-case where this filter is used to just shift the timestamps. How so? It's a documented value that means unknown. What breaks because of it? Wouldn't it be revealing a bug if so? And in non simple use cases that completely replace or rescale the timestamps, the old duration value is no longer valid, and something definitely worse to have than 0. If the legacy value remains, a downstream processor can still use it for some reference or heuristic. And it can peek and compare adjacent timestamps to harmonize the duration value if needed. But once zeroed out, that hint is gone. 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".
[FFmpeg-devel] [PATCH] avfilter/af_aderivative: add timeline support
Signed-off-by: Paul B Mahol --- libavfilter/af_aderivative.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_aderivative.c b/libavfilter/af_aderivative.c index baa272d609..ca8af6cec8 100644 --- a/libavfilter/af_aderivative.c +++ b/libavfilter/af_aderivative.c @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/opt.h" #include "audio.h" #include "avfilter.h" #include "internal.h" @@ -103,8 +104,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterContext *ctx = inlink->dst; ADerivativeContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; -AVFrame *out = ff_get_audio_buffer(outlink, in->nb_samples); +AVFrame *out; +if (ctx->is_disabled) { +if (s->prev) +av_samples_set_silence(s->prev->extended_data, 0, 1, + s->prev->channels, + s->prev->format); + +return ff_filter_frame(outlink, in); +} + +out = ff_get_audio_buffer(outlink, in->nb_samples); if (!out) { av_frame_free(&in); return AVERROR(ENOMEM); @@ -149,23 +160,33 @@ static const AVFilterPad aderivative_outputs[] = { }, }; +static const AVOption aderivative_options[] = { +{ NULL } +}; + +AVFILTER_DEFINE_CLASS_EXT(aderivative, "aderivative/aintegral", aderivative_options); + const AVFilter ff_af_aderivative = { .name = "aderivative", .description = NULL_IF_CONFIG_SMALL("Compute derivative of input audio."), .priv_size = sizeof(ADerivativeContext), +.priv_class= &aderivative_class, .uninit= uninit, FILTER_INPUTS(aderivative_inputs), FILTER_OUTPUTS(aderivative_outputs), FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP), +.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; const AVFilter ff_af_aintegral = { .name = "aintegral", .description = NULL_IF_CONFIG_SMALL("Compute integral of input audio."), .priv_size = sizeof(ADerivativeContext), +.priv_class= &aderivative_class, .uninit= uninit, FILTER_INPUTS(aderivative_inputs), FILTER_OUTPUTS(aderivative_outputs), FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP), +.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; -- 2.33.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 1/3] avcodec: add ADPCM IMA HVQM4 decoder
Signed-off-by: Paul B Mahol --- libavcodec/Makefile | 1 + libavcodec/adpcm.c | 64 + libavcodec/allcodecs.c | 1 + libavcodec/codec_desc.c | 7 + libavcodec/codec_id.h | 1 + 5 files changed, 74 insertions(+) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index cfc70a3eaf..150a734421 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -900,6 +900,7 @@ OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_EA_SEAD_DECODER) += adpcm.o adpcm_data.o +OBJS-$(CONFIG_ADPCM_IMA_HVQM4_DECODER)+= adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_ISS_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_MOFLEX_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_MTF_DECODER) += adpcm.o adpcm_data.o diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index cfde5f58b9..f453628786 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -523,6 +523,49 @@ static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble) return c->predictor; } +static void decode_adpcm_ima_hvqm4(AVCodecContext *avctx, int16_t *outbuf, int samples_to_do, + int frame_format, GetByteContext *gb) +{ +ADPCMDecodeContext *c = avctx->priv_data; +int st = avctx->channels == 2; +unsigned tmp; + +for (int ch = 0; ch < avctx->channels; ch++) { +switch (frame_format) { +case 1: /* combined hist+index */ +tmp = bytestream2_get_be16(gb); +c->status[ch].predictor = sign_extend(tmp & 0xFF80, 16); +c->status[ch].step_index = tmp & 0x7f; +break; +case 2: /* no hist/index (continues from previous frame) */ +default: +break; +case 3: /* separate hist+index */ +tmp = bytestream2_get_be16(gb); +c->status[ch].predictor = sign_extend(tmp, 16); +c->status[ch].step_index = bytestream2_get_byte(gb); +break; +} + +c->status[ch].step_index = av_clip(c->status[ch].step_index, 0, 88); +} + +if (frame_format == 1 || frame_format == 3) { +for (int ch = 0; ch < avctx->channels; ch++) +*outbuf++ = (int16_t)c->status[st - ch].predictor; +samples_to_do--; +} + +for (int i = 0; i < samples_to_do; i++) { +uint8_t nibble = bytestream2_get_byte(gb); + +*outbuf++ = adpcm_ima_qt_expand_nibble(&c->status[st], nibble & 0xF); +*outbuf++ = adpcm_ima_qt_expand_nibble(&c->status[ 0], nibble >> 4); +} + +bytestream2_seek(gb, 0, SEEK_END); +} + static inline int16_t adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble) { int predictor; @@ -910,6 +953,20 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb, *coded_samples -= *coded_samples % 28; nb_samples = (buf_size - 12) / 30 * 28; break; +case AV_CODEC_ID_ADPCM_IMA_HVQM4: +{ +int frame_format = bytestream2_get_be16(gb); +int skip = 6; + +if (frame_format == 1) +skip += 2 * ch; +if (frame_format == 3) +skip += 3 * ch; + +nb_samples = (buf_size - skip) * 2 / ch; +bytestream2_seek(gb, 0, SEEK_SET); +} +break; case AV_CODEC_ID_ADPCM_IMA_EA_EACS: has_coded_samples = 1; *coded_samples = bytestream2_get_le32(gb); @@ -1453,6 +1510,12 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } ) /* End of CASE */ +CASE(ADPCM_IMA_HVQM4, +int format = bytestream2_get_be16(&gb); + +bytestream2_skip(&gb, 4); +decode_adpcm_ima_hvqm4(avctx, samples, nb_samples, format, &gb); +) /* End of CASE */ CASE(ADPCM_IMA_SSI, for (int n = nb_samples >> (1 - st); n > 0; n--) { int v = bytestream2_get_byteu(&gb); @@ -2322,6 +2385,7 @@ ADPCM_DECODER(ADPCM_IMA_DK3, sample_fmts_s16, adpcm_ima_dk3, "ADPCM IMA ADPCM_DECODER(ADPCM_IMA_DK4, sample_fmts_s16, adpcm_ima_dk4, "ADPCM IMA Duck DK4") ADPCM_DECODER(ADPCM_IMA_EA_EACS, sample_fmts_s16, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS") ADPCM_DECODER(ADPCM_IMA_EA_SEAD, sample_fmts_s16, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD") +ADPCM_DECODER(ADPCM_IMA_HVQM4, sample_fmts_s16, adpcm_ima_hvqm4, "ADPCM IMA HVQM4") ADPCM_DECODER(ADPCM_IMA_ISS, sample_fmts_s16, adpcm_ima_iss, "ADPCM IMA Funcom ISS") ADPCM_DECODER(ADPCM_IMA_MOFLEX, sample_fmts_s16p, adpcm_ima_moflex, "ADPCM IMA MobiClip MOFLEX") ADPCM_DECODER(ADPCM_IMA_MTF, sample_fmts_s16, adpcm_ima_mtf, "ADPCM IMA Capcom's MT Frame
[FFmpeg-devel] [PATCH 2/3] [WIP] avcodec: add HVQM4 Video decoder
Signed-off-by: Paul B Mahol --- libavcodec/Makefile |1 + libavcodec/allcodecs.c |1 + libavcodec/codec_desc.c |7 + libavcodec/codec_id.h |1 + libavcodec/hvqm4.c | 1719 +++ 5 files changed, 1729 insertions(+) create mode 100644 libavcodec/hvqm4.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 150a734421..04eacad679 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -418,6 +418,7 @@ OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \ OBJS-$(CONFIG_HQX_DECODER) += hqx.o hqxvlc.o hqxdsp.o canopus.o OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o +OBJS-$(CONFIG_HVQM4_DECODER) += hvqm4.o OBJS-$(CONFIG_HYMT_DECODER)+= huffyuv.o huffyuvdec.o OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o OBJS-$(CONFIG_IDF_DECODER) += bintext.o cga_data.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 89ba205a2f..9fa5007c0f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -164,6 +164,7 @@ extern const AVCodec ff_hq_hqa_decoder; extern const AVCodec ff_hqx_decoder; extern const AVCodec ff_huffyuv_encoder; extern const AVCodec ff_huffyuv_decoder; +extern const AVCodec ff_hvqm4_decoder; extern const AVCodec ff_hymt_decoder; extern const AVCodec ff_idcin_decoder; extern const AVCodec ff_iff_ilbm_decoder; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 6deba785dc..cdcb164336 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1862,6 +1862,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("GEM Raster image"), .props = AV_CODEC_PROP_LOSSY, }, +{ +.id= AV_CODEC_ID_HVQM4, +.type = AVMEDIA_TYPE_VIDEO, +.name = "hvqm4", +.long_name = NULL_IF_CONFIG_SMALL("HVQM4 Video"), +.props = AV_CODEC_PROP_LOSSY, +}, /* various PCM "codecs" */ { diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index f3f262ec75..f1109c27d9 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -308,6 +308,7 @@ enum AVCodecID { AV_CODEC_ID_SIMBIOSIS_IMX, AV_CODEC_ID_SGA_VIDEO, AV_CODEC_ID_GEM, +AV_CODEC_ID_HVQM4, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/hvqm4.c b/libavcodec/hvqm4.c new file mode 100644 index 00..9b1238c5bc --- /dev/null +++ b/libavcodec/hvqm4.c @@ -0,0 +1,1719 @@ +/* + * HVQM4 Video decoder + * Copyright (c) 2018-2020 Tillmann Karras + * Copyright (c) 2022 Paul B Mahol + * + * 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 + */ + +#include + +#include "libavutil/avassert.h" +#include "libavutil/thread.h" + +#include "avcodec.h" +#include "bytestream.h" +#include "get_bits.h" +#include "golomb.h" +#include "internal.h" + +#define PLANE_COUNT 3 +#define LUMA_CHROMA 2 +#define LUMA_IDX 0 +#define CHROMA_IDX 1 + +enum FrameType { +I_FRAME = 0x10, +P_FRAME = 0x20, +B_FRAME = 0x30, +}; + +typedef struct BlockData { +uint8_t value; +uint8_t type; +} BlockData; + +typedef struct StackState { +uint32_t plane_idx; +BlockData const *line_prev; +BlockData const *line_curr; +BlockData const *line_next; +BlockData next; +BlockData curr; +uint8_t value_prev; +} StackState; + +typedef struct GBCWithVLC { +GetBitContext gb; +VLC *vlc; +} GBCWithVLC; + +typedef struct HVQPlaneDesc { +BlockData *border; // 0-3 beginning of the plane including the border +BlockData *payload; // 4-7 beginning of the non-border plane data +uint16_t h_blocks; +uint16_t v_blocks; +uint16_t h_blocks_safe; +uint16_t v_blocks_safe; +// offsets of PBs within one MCB +// +---+---+ +// | 0 | 3 | +// +---+---+ +// | 1 | 2 | +// +---+---+ +uint16_t mcb_offset[4]; +uint32_t px_offset[4]; +uint32_t py_offset[4]; +uint8_t width_shift; +uint8_t height_shift; +uint8_t pb_per_mcb_x; +uint8_t pb_per_mcb_y; +uint8_t
[FFmpeg-devel] [PATCH 3/3] avformat: add hvqm4 demuxer
Signed-off-by: Paul B Mahol --- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/hvqm4dec.c | 265 +++ 3 files changed, 267 insertions(+) create mode 100644 libavformat/hvqm4dec.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 6566e40cac..0661432e29 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -244,6 +244,7 @@ OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o OBJS-$(CONFIG_HLS_DEMUXER) += hls.o hls_sample_encryption.o OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o avc.o OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o +OBJS-$(CONFIG_HVQM4_DEMUXER) += hvqm4dec.o OBJS-$(CONFIG_ICO_DEMUXER) += icodec.o OBJS-$(CONFIG_ICO_MUXER) += icoenc.o OBJS-$(CONFIG_IDCIN_DEMUXER) += idcin.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index d066a7745b..2b809d8adc 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -199,6 +199,7 @@ extern const AVOutputFormat ff_hevc_muxer; extern const AVInputFormat ff_hls_demuxer; extern const AVOutputFormat ff_hls_muxer; extern const AVInputFormat ff_hnm_demuxer; +extern const AVInputFormat ff_hvqm4_demuxer; extern const AVInputFormat ff_ico_demuxer; extern const AVOutputFormat ff_ico_muxer; extern const AVInputFormat ff_idcin_demuxer; diff --git a/libavformat/hvqm4dec.c b/libavformat/hvqm4dec.c new file mode 100644 index 00..9d51947f4e --- /dev/null +++ b/libavformat/hvqm4dec.c @@ -0,0 +1,265 @@ +/* + * HVQM4 demuxer + * Copyright (c) 2021-2022 Paul B Mahol + * + * 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 + */ + +#include "libavutil/intreadwrite.h" + +#include "avformat.h" +#include "internal.h" + +typedef struct HVQM4Context { +uint32_t nb_blocks; +uint32_t current_block; +uint32_t current_block_size; +int64_t previous_block_size; +int64_t current_block_offset; +int64_t pos; +int64_t pts; +} HVQM4Context; + +static int hvqm4_probe(const AVProbeData *p) +{ +if (memcmp(p->buf, "HVQM4 1.3", 9) && +memcmp(p->buf, "HVQM4 1.5", 9)) +return 0; + +return AVPROBE_SCORE_MAX; +} + +static int hvqm4_read_header(AVFormatContext *s) +{ +HVQM4Context *hvqm4 = s->priv_data; +AVIOContext *pb = s->pb; +AVStream *vst, *ast; +uint32_t header_size, usec_per_frame; +uint32_t video_frames, audio_frames; +int audio_format; + +vst = avformat_new_stream(s, NULL); +if (!vst) +return AVERROR(ENOMEM); + +avio_skip(pb, 16); + +header_size = avio_rb32(pb); +avio_skip(pb, 4); +hvqm4->nb_blocks = avio_rb32(pb); +video_frames = avio_rb32(pb); +audio_frames = avio_rb32(pb); +usec_per_frame = avio_rb32(pb); +avio_skip(pb, 12); + +vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; +vst->codecpar->codec_id = AV_CODEC_ID_HVQM4; +vst->codecpar->width = avio_rb16(pb); +vst->codecpar->height = avio_rb16(pb); +vst->start_time = 0; +vst->duration = +vst->nb_frames= video_frames; + +avio_skip(pb, 2); +avio_skip(pb, 2); + +avpriv_set_pts_info(vst, 64, usec_per_frame, 100); + +ast = avformat_new_stream(s, NULL); +if (!ast) +return AVERROR(ENOMEM); + +ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; +ast->codecpar->channels = avio_r8(pb); +ast->codecpar->bits_per_coded_sample = avio_r8(pb); +ast->nb_frames= audio_frames; +ast->start_time = 0; +audio_format = avio_r8(pb); +switch (audio_format) { +case 0: +ast->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_HVQM4; +break; +case 1: +ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; +break; +} +avio_skip(pb, 1); +ast->codecpar->sample_rate = avio_rb32(pb); + +avpriv_set_pts_info(ast, 64, 1, ast->codecpar->sample_rate); + +avio_skip(pb, header_size - avio_tell(pb)); + +return 0; +} + +static int hvqm4_read_packet(AVFormatContext *s, AVPacket *pkt) +{ +HVQM4Context *hvqm4 = s->priv_data; +int media_type, frame_type, ret; +AVStream *vst = s->streams[0]; +AVI
[FFmpeg-devel] [PATCH v3] create av_media_type_get_string()
Identical to v2, but I reworded the second commit's message to add a context. ___ 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 v3 1/2] libavutil: create av_media_type_get_string()
This deprecates av_get_media_type_string() which does return NULL. printf %s with a null pointer is undefined behavior This also matches behavior with avcodec_get_name() which never returns NULL, instead it returns "unknown_codec". --- doc/APIchanges | 3 +++ libavutil/avutil.h | 7 +++ libavutil/utils.c | 13 + 3 files changed, 23 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index ea402f6118..7733de8dea 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-02-XX - xxx - lavu 57.19.100 - avutil.h + Add av_media_type_get_string() which deprecates av_get_media_type_string(). + 2022-02-07 - xx - lavu 57.21.100 - fifo.h Deprecate AVFifoBuffer and the API around it, namely av_fifo_alloc(), av_fifo_alloc_array(), av_fifo_free(), av_fifo_freep(), av_fifo_reset(), diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 4d633156d1..6cabeb405a 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -209,9 +209,16 @@ enum AVMediaType { /** * Return a string describing the media_type enum, NULL if media_type * is unknown. + * + * @deprecated Use av_media_type_get_string() instead. */ const char *av_get_media_type_string(enum AVMediaType media_type); +/** + * Return a string describing the media_type enum, never NULL. + */ +const char *av_media_type_get_string(enum AVMediaType media_type); + /** * @defgroup lavu_const Constants * @{ diff --git a/libavutil/utils.c b/libavutil/utils.c index ea9b5097b8..92d242f678 100644 --- a/libavutil/utils.c +++ b/libavutil/utils.c @@ -80,6 +80,19 @@ const char *av_get_media_type_string(enum AVMediaType media_type) } } +const char *av_media_type_get_string(enum AVMediaType media_type) +{ +switch (media_type) { +case AVMEDIA_TYPE_UNKNOWN:return "unknown"; +case AVMEDIA_TYPE_VIDEO: return "video"; +case AVMEDIA_TYPE_AUDIO: return "audio"; +case AVMEDIA_TYPE_DATA: return "data"; +case AVMEDIA_TYPE_SUBTITLE: return "subtitle"; +case AVMEDIA_TYPE_ATTACHMENT: return "attachment"; +default: return "invalid_media_type"; +} +} + char av_get_picture_type_char(enum AVPictureType pict_type) { switch (pict_type) { -- 2.32.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 v3 2/2] av_get_media_type_string(): replace with av_media_type_get_string()
printf %s with a null pointer is undefined behavior. --- doc/examples/demuxing_decoding.c | 10 +- doc/examples/extract_mvs.c | 4 ++-- fftools/cmdutils.c | 7 +++ fftools/cmdutils.h | 2 -- fftools/ffmpeg.c | 14 +++--- fftools/ffmpeg_opt.c | 2 +- fftools/ffplay.c | 4 ++-- fftools/ffprobe.c| 13 +++-- libavcodec/avcodec.c | 2 +- libavcodec/tests/avcodec.c | 10 ++ libavdevice/dshow.c | 4 ++-- libavfilter/avfilter.c | 4 ++-- libavfilter/avfiltergraph.c | 4 ++-- libavfilter/src_movie.c | 6 +++--- libavformat/avienc.c | 2 +- libavformat/flvenc.c | 2 +- libavformat/framehash.c | 2 +- libavformat/mov.c| 2 +- libavformat/mpegenc.c| 2 +- libavformat/mpegts.c | 2 +- libavformat/mxfdec.c | 2 +- libavformat/segment.c| 2 +- libavformat/tee.c| 2 +- libavformat/uncodedframecrcenc.c | 4 +--- 24 files changed, 45 insertions(+), 63 deletions(-) diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c index 8520d5b660..670f08779d 100644 --- a/doc/examples/demuxing_decoding.c +++ b/doc/examples/demuxing_decoding.c @@ -155,7 +155,7 @@ static int open_codec_context(int *stream_idx, ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0); if (ret < 0) { fprintf(stderr, "Could not find %s stream in input file '%s'\n", -av_get_media_type_string(type), src_filename); +av_media_type_get_string(type), src_filename); return ret; } else { stream_index = ret; @@ -165,7 +165,7 @@ static int open_codec_context(int *stream_idx, dec = avcodec_find_decoder(st->codecpar->codec_id); if (!dec) { fprintf(stderr, "Failed to find %s codec\n", -av_get_media_type_string(type)); +av_media_type_get_string(type)); return AVERROR(EINVAL); } @@ -173,21 +173,21 @@ static int open_codec_context(int *stream_idx, *dec_ctx = avcodec_alloc_context3(dec); if (!*dec_ctx) { fprintf(stderr, "Failed to allocate the %s codec context\n", -av_get_media_type_string(type)); +av_media_type_get_string(type)); return AVERROR(ENOMEM); } /* Copy codec parameters from input stream to output codec context */ if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) < 0) { fprintf(stderr, "Failed to copy %s codec parameters to decoder context\n", -av_get_media_type_string(type)); +av_media_type_get_string(type)); return ret; } /* Init the decoders */ if ((ret = avcodec_open2(*dec_ctx, dec, NULL)) < 0) { fprintf(stderr, "Failed to open %s codec\n", -av_get_media_type_string(type)); +av_media_type_get_string(type)); return ret; } *stream_idx = stream_index; diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c index cc1311da91..2fb5517708 100644 --- a/doc/examples/extract_mvs.c +++ b/doc/examples/extract_mvs.c @@ -85,7 +85,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) ret = av_find_best_stream(fmt_ctx, type, -1, -1, &dec, 0); if (ret < 0) { fprintf(stderr, "Could not find %s stream in input file '%s'\n", -av_get_media_type_string(type), src_filename); +av_media_type_get_string(type), src_filename); return ret; } else { int stream_idx = ret; @@ -109,7 +109,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) av_dict_free(&opts); if (ret < 0) { fprintf(stderr, "Failed to open %s codec\n", -av_get_media_type_string(type)); +av_media_type_get_string(type)); return ret; } diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 4b50e15eef..4504d2711c 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1961,7 +1961,7 @@ static void show_help_filter(const char *name) count = avfilter_filter_pad_count(f, 0); for (i = 0; i < count; i++) { printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i), - media_type_string(avfilter_pad_get_type(f->inputs, i))); + av_media_type_get_string(avfilter_pad_get_type(f->inputs, i))); } if (f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS) printf("dynamic (depending on the options)\n"); @@ -1972,7 +1972,7 @@ static void show_help_filter(const char *name) count = avfilter_filter_pad_count(f,
[FFmpeg-devel] [PATCH] lavf/mpeg.c: improve readability of packet identification logic
switch-case over es_type and then perform a linear search over startcode. --- libavformat/mpeg.c | 215 - 1 file changed, 132 insertions(+), 83 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index ca15d9f241..c1b1c7e7de 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "libavutil/channel_layout.h" #include "avformat.h" #include "avio_internal.h" @@ -480,6 +482,7 @@ static int mpegps_read_packet(AVFormatContext *s, AVStream *st; FFStream *sti; int len, startcode, i, es_type, ret; +bool identified = false; int pcm_dvd = 0; int request_probe= 0; enum AVCodecID codec_id = AV_CODEC_ID_NONE; @@ -520,92 +523,138 @@ redo: goto found; } +// identify packet encoding +identified = true; es_type = m->psm_es_type[startcode & 0xff]; -if (es_type == STREAM_TYPE_VIDEO_MPEG1) { -codec_id = AV_CODEC_ID_MPEG2VIDEO; -type = AVMEDIA_TYPE_VIDEO; -} else if (es_type == STREAM_TYPE_VIDEO_MPEG2) { -codec_id = AV_CODEC_ID_MPEG2VIDEO; -type = AVMEDIA_TYPE_VIDEO; -} else if (es_type == STREAM_TYPE_AUDIO_MPEG1 || - es_type == STREAM_TYPE_AUDIO_MPEG2) { -codec_id = AV_CODEC_ID_MP3; -type = AVMEDIA_TYPE_AUDIO; -} else if (es_type == STREAM_TYPE_AUDIO_AAC) { -codec_id = AV_CODEC_ID_AAC; -type = AVMEDIA_TYPE_AUDIO; -} else if (es_type == STREAM_TYPE_VIDEO_MPEG4) { -codec_id = AV_CODEC_ID_MPEG4; -type = AVMEDIA_TYPE_VIDEO; -} else if (es_type == STREAM_TYPE_VIDEO_H264) { -codec_id = AV_CODEC_ID_H264; -type = AVMEDIA_TYPE_VIDEO; -} else if (es_type == STREAM_TYPE_VIDEO_HEVC) { -codec_id = AV_CODEC_ID_HEVC; -type = AVMEDIA_TYPE_VIDEO; -} else if (es_type == STREAM_TYPE_AUDIO_AC3) { -codec_id = AV_CODEC_ID_AC3; -type = AVMEDIA_TYPE_AUDIO; -} else if (m->imkh_cctv && es_type == 0x91) { -codec_id = AV_CODEC_ID_PCM_MULAW; -type = AVMEDIA_TYPE_AUDIO; -} else if (startcode >= 0x1e0 && startcode <= 0x1ef) { -static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; -unsigned char buf[8]; - -avio_read(s->pb, buf, 8); -avio_seek(s->pb, -8, SEEK_CUR); -if (!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) -codec_id = AV_CODEC_ID_CAVS; -else -request_probe= 1; -type = AVMEDIA_TYPE_VIDEO; -} else if (startcode == PRIVATE_STREAM_2) { -type = AVMEDIA_TYPE_DATA; -codec_id = AV_CODEC_ID_DVD_NAV; -} else if (startcode >= 0x1c0 && startcode <= 0x1df) { -type = AVMEDIA_TYPE_AUDIO; -if (m->sofdec > 0) { -codec_id = AV_CODEC_ID_ADPCM_ADX; -// Auto-detect AC-3 -request_probe = 50; -} else if (m->imkh_cctv && startcode == 0x1c0 && len > 80) { -codec_id = AV_CODEC_ID_PCM_ALAW; -request_probe = 50; -} else { -codec_id = AV_CODEC_ID_MP2; -if (m->imkh_cctv) -request_probe = 25; +switch (es_type) { +case STREAM_TYPE_VIDEO_MPEG1: // 0x01 +case STREAM_TYPE_VIDEO_MPEG2: // 0x02 +codec_id = AV_CODEC_ID_MPEG2VIDEO; +type = AVMEDIA_TYPE_VIDEO; +break; +case STREAM_TYPE_VIDEO_MPEG4: // 0x10 +codec_id = AV_CODEC_ID_MPEG4; +type = AVMEDIA_TYPE_VIDEO; +break; +case STREAM_TYPE_VIDEO_H264: // 0x1B +codec_id = AV_CODEC_ID_H264; +type = AVMEDIA_TYPE_VIDEO; +break; +case STREAM_TYPE_VIDEO_HEVC: // 0x24 +codec_id = AV_CODEC_ID_HEVC; +type = AVMEDIA_TYPE_VIDEO; +break; +case STREAM_TYPE_AUDIO_MPEG1: // 0x03 +case STREAM_TYPE_AUDIO_MPEG2: // 0x04 +codec_id = AV_CODEC_ID_MP3; +type = AVMEDIA_TYPE_AUDIO; +break; +case STREAM_TYPE_AUDIO_AAC: // 0x0F +codec_id = AV_CODEC_ID_AAC; +type = AVMEDIA_TYPE_AUDIO; +break; +case STREAM_TYPE_AUDIO_AC3: // 0x81 +codec_id = AV_CODEC_ID_AC3; +type = AVMEDIA_TYPE_AUDIO; +break; +default: +if (m->imkh_cctv && es_type == 0x91) { +codec_id = AV_CODEC_ID_PCM_MULAW; +type = AVMEDIA_TYPE_AUDIO; +break; +} +identified = false; +break; +} +if (!identified) { +identified = true; +if (startcode < 0x20) { +identified = false; } -} else if (startcode >= 0x80 && startcode <= 0x87) { -type = AVMEDIA_TYPE_A
Re: [FFmpeg-devel] [PATCH 1/3] avisynth: corrected interlace detection
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: From: emcodem AviSynth works on frame-based video by default, which can be either progressive or interlaced. Some filters can break frames into half-height fields, at which point it considers the clip to be field-based (avs_is_field_based can be used to check for this situation). To properly detect the field order of a typical video clip, the frame needs to have been weaved back together already, so avs_is_field_based should actually report 'false' when checked. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 350ac6d11d..1e862a6a85 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -250,15 +250,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); -av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); -av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); -/* The following typically only works when assumetff (-bff) and - * assumefieldbased is used in-script. Additional - * logic using GetParity() could deliver more accurate results - * but also decodes a frame which we want to avoid. */ st->codecpar->field_order = AV_FIELD_UNKNOWN; -if (avs_is_field_based(avs->vi)) { +/* AviSynth works with frame-based video, detecting field order can + * only work when avs_is_field_based returns 'false'. */ +av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); +if (avs_is_field_based(avs->vi) == 0) { if (avs_is_tff(avs->vi)) { st->codecpar->field_order = AV_FIELD_TT; } Pushed. ___ 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] avisynth: use AviSynth+'s frame properties to set various fields
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: * Field Order * Chroma Location * Color Transfer Characteristics * Color Range * Color Primaries * Matrix Coefficients The existing TFF/BFF detection is retained as a fallback for older versions of AviSynth that can't access frame properties. The other properties have no legacy equivalent to detect them. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 263 +++-- 1 file changed, 250 insertions(+), 13 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 1e862a6a85..8bc39869a3 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "libavutil/attributes.h" #include "libavutil/internal.h" @@ -76,6 +78,9 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); +AVSC_DECLARE_FUNC(avs_get_frame_props_ro); +AVSC_DECLARE_FUNC(avs_prop_get_int); +AVSC_DECLARE_FUNC(avs_get_env_property); #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -153,6 +158,9 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); +LOAD_AVS_FUNC(avs_get_frame_props_ro, 1); +LOAD_AVS_FUNC(avs_prop_get_int, 1); +LOAD_AVS_FUNC(avs_get_env_property, 1); #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -236,6 +244,10 @@ static av_cold void avisynth_atexit_handler(void) static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) { AviSynthContext *avs = s->priv_data; +const AVS_Map *avsmap; +AVS_VideoFrame *frame; +int framedata, error; +bool frameprop; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -251,19 +263,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); -st->codecpar->field_order = AV_FIELD_UNKNOWN; -/* AviSynth works with frame-based video, detecting field order can - * only work when avs_is_field_based returns 'false'. */ -av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); -if (avs_is_field_based(avs->vi) == 0) { -if (avs_is_tff(avs->vi)) { -st->codecpar->field_order = AV_FIELD_TT; -} -else if (avs_is_bff(avs->vi)) { -st->codecpar->field_order = AV_FIELD_BB; -} -} - switch (avs->vi->pixel_type) { /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: @@ -499,6 +498,244 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 1; avs->planes = avs_planes_packed; } + +/* Read AviSynth+'s frame properties to set additional info. + * + * Due to a bug preventing the C interface from accessing frame + * properties in earlier versions of interface version 8, only + * enable this if we detect version 8.1 at the minimum. */ + +if (!avs_library.avs_get_env_property) { +av_log(s, AV_LOG_TRACE, "%s\n", + "avs_get_env_property does not exist in AviSynth library; frame properties won't be checked."); +frameprop = false; +} else { +if (avs_library.avs_get_env_property(avs->env, AVS_AEP_INTERFACE_BUGFIX)) { +av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.1 or higher, reading frame properties."); +frameprop = true; +} else { +av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.0, need 8.1+ to read frame properties."); +frameprop = false; +} +} + +if (frameprop = true) { + +frame = avs_library.avs_get_frame(avs->clip, framedata); +avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); + +/* Field order */ +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, &error)) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} + +/* Color Range */ +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, &error)) { +case 0: +st->codecpar->color_range = AVCOL_RANGE_JPEG; +break; +case 1: +st->codecpar->color_range = AVCOL_RANGE_MPEG
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: The headers from version 3.7.1 are needed in order to support parsing of frame properties. avs/version.h has been generated as part of the AviSynth+ build process for a long time, but was never installed with the includes until version 3.7.1a. Checking for the presence of avs/version.h might have been sufficient, but a version check mechanism might be useful in the future. This does not change the version compatibility with the library itself; previous 3.x versions of AviSynth+ as well as AviSynth 2.6 can still be used with the demuxer. Signed-off-by: Stephen Hutchinson --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 493493b4c5..544d341b49 100755 --- a/configure +++ b/configure @@ -6508,7 +6508,9 @@ for func in $COMPLEX_FUNCS; do done # these are off by default, so fail if requested and not available -enabled avisynth && require_headers "avisynth/avisynth_c.h" +enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/avs/version.h" && + { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || + die "ERROR: AviSynth+ header version must be >= 3.7.1"; } } enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { require_headers DeckLinkAPI.h && Pushed. ___ 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/videotoolbox: add internal.h for header depenedency
From: Limin Wang Fixes build failures for videotoolbox Signed-off-by: Limin Wang --- libavcodec/videotoolbox.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 51d4eac..29c781c 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -29,6 +29,7 @@ #include "libavutil/pixdesc.h" #include "bytestream.h" #include "decode.h" +#include "internal.h" #include "h264dec.h" #include "hevcdec.h" #include "mpegvideo.h" -- 1.8.3.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] Long path support for Windows (fixes #8885)
On 2022-02-14 01:56 am, nihil-admir...@tutanota.com wrote: BASE64 encoded. Rebase against current HEAD and submit via git send-email. If not possible, export mbox patch using git format-patch, test with git am locally. Then send as attachment. Regards, Gyan Feb 13, 2022, 19:54 by nihil-admir...@tutanota.com: Let's try once again with .txt Feb 13, 2022, 19:52 by nihil-admir...@tutanota.com: Let's try once again with .diff extension. Feb 13, 2022, 19:48 by nihil-admir...@tutanota.com: Previous patch got corrupted with lots of unbreakable spaces C2 A0, so it does not apply: >>> https://patchwork.ffmpeg.org/project/ffmpeg/patch/mvn2tlp--...@tutanota.com/>>> . Let's retry with an attachment. > ___ 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".
[FFmpeg-devel] [PATCH] libavcodec/qsvenc_hevc: encode RGB format rawvideo
Add support for hevc_qsv to input RGB format frame. It will transform frame to yuv inside MediaSDK instead of using auto scale. Now hevc_qsv supports directly encoding BGRA and X2RGB10 format. X2RGB10 is only supported in VDENC (-low_power 1). The X2RGB10 correspond to the A2RGB20 format in MediaSDK. Sigend-off-by: Wenbin Chen --- libavcodec/qsv.c | 16 libavcodec/qsvenc.c | 15 +++ libavcodec/qsvenc_hevc.c | 6 ++ 3 files changed, 37 insertions(+) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 1a432dbd82..b75877e698 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -189,6 +189,12 @@ enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc) case MFX_FOURCC_NV12: return AV_PIX_FMT_NV12; case MFX_FOURCC_P010: return AV_PIX_FMT_P010; case MFX_FOURCC_P8: return AV_PIX_FMT_PAL8; +#if QSV_VERSION_ATLEAST(1, 9) +case MFX_FOURCC_A2RGB10: return AV_PIX_FMT_X2RGB10; +#endif +#if QSV_VERSION_ATLEAST(1, 17) +case MFX_FOURCC_RGB4: return AV_PIX_FMT_BGRA; +#endif #if CONFIG_VAAPI case MFX_FOURCC_YUY2: return AV_PIX_FMT_YUYV422; #if QSV_VERSION_ATLEAST(1, 27) @@ -211,6 +217,16 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) case AV_PIX_FMT_P010: *fourcc = MFX_FOURCC_P010; return AV_PIX_FMT_P010; +#if QSV_VERSION_ATLEAST(1, 9) +case AV_PIX_FMT_X2RGB10: +*fourcc = MFX_FOURCC_A2RGB10; +return AV_PIX_FMT_X2RGB10; +#endif +#if QSV_VERSION_ATLEAST(1, 17) +case AV_PIX_FMT_BGRA: +*fourcc = MFX_FOURCC_RGB4; +return AV_PIX_FMT_BGRA; +#endif #if CONFIG_VAAPI case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUYV422: diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 07be4287b7..f834691d1a 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -776,6 +776,13 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) brc_param_multiplier = (FFMAX(FFMAX3(target_bitrate_kbps, max_bitrate_kbps, buffer_size_in_kilobytes), initial_delay_in_kilobytes) + 0x1) / 0x1; +#if QSV_VERSION_ATLEAST(1, 9) +if (sw_format == AV_PIX_FMT_X2RGB10 && q->low_power != 1) { +av_log(avctx, AV_LOG_ERROR, "Only VDENC support encoding x2rgb10\n"); +return AVERROR(EINVAL); +} +#endif + switch (q->param.mfx.RateControlMethod) { case MFX_RATECONTROL_CBR: case MFX_RATECONTROL_VBR: @@ -1616,6 +1623,14 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame, qf->surface.Data.V = qf->surface.Data.UV + 2; break; +case AV_PIX_FMT_X2RGB10: +case AV_PIX_FMT_BGRA: +qf->surface.Data.B = qf->frame->data[0]; +qf->surface.Data.G = qf->frame->data[0] + 1; +qf->surface.Data.R = qf->frame->data[0] + 2; +qf->surface.Data.A = qf->frame->data[0] + 3; +break; + default: /* should not reach here */ av_assert0(0); diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 5cac141c4d..ade546d4ca 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -304,6 +304,12 @@ const AVCodec ff_hevc_qsv_encoder = { .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, AV_PIX_FMT_P010, AV_PIX_FMT_QSV, +#if QSV_VERSION_ATLEAST(1, 17) +AV_PIX_FMT_BGRA, +#endif +#if QSV_VERSION_ATLEAST(1, 9) +AV_PIX_FMT_X2RGB10, +#endif AV_PIX_FMT_NONE }, .priv_class = &class, .defaults = qsv_enc_defaults, -- 2.32.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] libavcodec/videotoolbox.c : fix missing AVCodecInternal
attached. Just a missing include. skal/ 0001-fix-missing-AVCodecInternal-definition.patch Description: Binary data ___ 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".