Re: [FFmpeg-devel] [PATCH v16 08/16] fftools/ffmpeg: Replace sub2video with subtitle frame filtering

2021-11-26 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Soft Works
> Sent: Saturday, November 27, 2021 8:19 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v16 08/16] fftools/ffmpeg: Replace
> sub2video with subtitle frame filtering
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Andreas
> > Rheinhardt
> > Sent: Friday, November 26, 2021 2:02 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v16 08/16] fftools/ffmpeg: Replace
> > sub2video with subtitle frame filtering
> >
> > > -int subtitle_out_max_size = 1024 * 1024;
> > > +const int subtitle_out_max_size = 1024 * 1024;
> > >  int subtitle_out_size, nb, i;
> > >  AVCodecContext *enc;
> > >  AVPacket *pkt = ost->pkt;
> > > +AVSubtitle out_sub = { 0 };
> >
> > You are adding some stuff here which is removed in patch 16. These
> > patches should be merged.
> 
> Done. I had to move the encoding API commit to an earlier position for this.
> 
> 
> > > +pts = heartbeat_pts; //av_rescale_q(frame->subtitle_pts +
> > frame->subtitle_start_time * 1000LL, AV_TIME_BASE_Q, ist->st->time_base);
> > > +end_pts = av_rescale_q(frame->subtitle_pts + frame-
> > >subtitle_end_time   * 1000LL, AV_TIME_BASE_Q, ist->st->time_base);
> > > +}
> > > +else {
> >
> > Put this on the same line as }.
> >
> > > +frame = av_frame_alloc();
> >
> > Is it actually certain that we need a new frame and can't reuse
> > decoded_frame like the other functions that ultimately call
> > send_frame_to_filters() do?
> 
> This is typically only happening at the start when no subtitle frames have
> been decoded yet. Also those are empty frames, nothing like video frames
> with a large buffer allocated.
> 
> > >
> > > -do_subtitle_out(output_files[ost->file_index], ost, &subtitle);
> > > +if (ist->nb_filters > 0) {
> > > +AVFrame *filter_frame = av_frame_clone(decoded_frame);
> >
> > If I see this correctly, then the reason that one has to do something
> > besides send_frame_to_filters() is that we do not add a dummy
> > filtergraph like is done in line 2645 of ffmpeg_opt.c for audio and video?
> 
> IIRC this is to avoid the heartbeat frames arriving at the encoder when no
> filtering is done (or a source subtitle stream is both going through
> filtering
> but at the same time encoded directly as an output stream.
> 
> > > +if (!(w && h) && ist->dec_ctx->subtitle_header) {
> > > +ASSSplitContext *ass_ctx = avpriv_ass_split((char *)ist-
> >dec_ctx-
> > >subtitle_header);
> >
> > avpriv functions must not be used in fftools.
> 
> I wanted to make this part of the public API, but you an/or Hendrik objected
> IIRC. I had made some suggestions for how this could be done, but it remained
> unresponded (I had asked multiple times about this).
> 
> > And what makes you so
> > certain that subtitle_header will only be used by ass subtitles?
> 
> Because ASS is the defined internal format for text subtitles.
> 
> - Each text subtitle decoder outputs ASS subtitles
> - Each text subtitle encoder gets ASS subtitles as input
> - Text subtitle filters work on ASS subtitle data
> (there's a hardly used exception: AV_SUBTITLE_FMT_TEXT, but that doesn’t use
> any
> header)
> 
> > Furthermore, missing check.
> > (Maybe ass subtitle based codecs should set AVCodecContext.width and
> > height based upon this play_res_x/y?
> 
> Breaks the decoder API. Anyway, the full header needs to be parsed by certain
> filters.
> Also the other ass functions needs to be available for filters (e.g. for
> parsing dialogs).
> 
> Due to the fact that ASS is not just an encoding output or decoding input,
> but
> internally used as transport format, those ass functions need to be available
> outside
> of libavcodec.
> I'm totally open for suggestions regarding _how_ this should be done.
> 
> 
> > >  av_freep(&ifilter->displaymatrix);
> > >  sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
> > > diff --git a/fftools/ffmpeg_hw.c b/fftools/ffmpeg_hw.c
> > > index 14e702bd92..be69d54aaf 100644
> > > --- a/fftools/ffmpeg_hw.c
> > > +++ b/fftools/ffmpeg_hw.c
> > > @@ -449,7 +449,7 @@ int hw_device_setup_for_encode(OutputStream *ost)
> > >  AVBufferRef *frames_ref = NULL;
> > >  int i;
> > >
> > > -if (ost->filter) {
> > > +if (ost->filter && ost->filter->filter) {
> >
> > I don't think that your patches make it necessary to add this (or have
> > you already added hardware accelerated subtitle encoding?), so it is
> > either already necessary in master and should be sent as a separate
> > commit or it is unnecessary and should be dropped.
> 
> Using ffmpeg with hw acceleration is my primary use case, that's why I'm
> rather sure that it isn't required before this patchset.
> 
> While working on this patchset I've also tested various scenarios with hw
> acceleration, so it might be possible that I've run into this in

Re: [FFmpeg-devel] [PATCH v16 08/16] fftools/ffmpeg: Replace sub2video with subtitle frame filtering

2021-11-26 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Andreas
> Rheinhardt
> Sent: Friday, November 26, 2021 2:02 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v16 08/16] fftools/ffmpeg: Replace
> sub2video with subtitle frame filtering
> 
> > -int subtitle_out_max_size = 1024 * 1024;
> > +const int subtitle_out_max_size = 1024 * 1024;
> >  int subtitle_out_size, nb, i;
> >  AVCodecContext *enc;
> >  AVPacket *pkt = ost->pkt;
> > +AVSubtitle out_sub = { 0 };
> 
> You are adding some stuff here which is removed in patch 16. These
> patches should be merged.

Done. I had to move the encoding API commit to an earlier position for this.


> > +pts = heartbeat_pts; //av_rescale_q(frame->subtitle_pts +
> frame->subtitle_start_time * 1000LL, AV_TIME_BASE_Q, ist->st->time_base);
> > +end_pts = av_rescale_q(frame->subtitle_pts + frame-
> >subtitle_end_time   * 1000LL, AV_TIME_BASE_Q, ist->st->time_base);
> > +}
> > +else {
> 
> Put this on the same line as }.
> 
> > +frame = av_frame_alloc();
> 
> Is it actually certain that we need a new frame and can't reuse
> decoded_frame like the other functions that ultimately call
> send_frame_to_filters() do?

This is typically only happening at the start when no subtitle frames have
been decoded yet. Also those are empty frames, nothing like video frames
with a large buffer allocated.

> >
> > -do_subtitle_out(output_files[ost->file_index], ost, &subtitle);
> > +if (ist->nb_filters > 0) {
> > +AVFrame *filter_frame = av_frame_clone(decoded_frame);
> 
> If I see this correctly, then the reason that one has to do something
> besides send_frame_to_filters() is that we do not add a dummy
> filtergraph like is done in line 2645 of ffmpeg_opt.c for audio and video?

IIRC this is to avoid the heartbeat frames arriving at the encoder when no 
filtering is done (or a source subtitle stream is both going through filtering
but at the same time encoded directly as an output stream.

> > +if (!(w && h) && ist->dec_ctx->subtitle_header) {
> > +ASSSplitContext *ass_ctx = avpriv_ass_split((char *)ist->dec_ctx-
> >subtitle_header);
> 
> avpriv functions must not be used in fftools. 

I wanted to make this part of the public API, but you an/or Hendrik objected
IIRC. I had made some suggestions for how this could be done, but it remained
unresponded (I had asked multiple times about this).

> And what makes you so
> certain that subtitle_header will only be used by ass subtitles?

Because ASS is the defined internal format for text subtitles.

- Each text subtitle decoder outputs ASS subtitles
- Each text subtitle encoder gets ASS subtitles as input
- Text subtitle filters work on ASS subtitle data
(there's a hardly used exception: AV_SUBTITLE_FMT_TEXT, but that doesn’t use any
header)

> Furthermore, missing check.
> (Maybe ass subtitle based codecs should set AVCodecContext.width and
> height based upon this play_res_x/y?

Breaks the decoder API. Anyway, the full header needs to be parsed by certain 
filters.
Also the other ass functions needs to be available for filters (e.g. for 
parsing dialogs).

Due to the fact that ASS is not just an encoding output or decoding input, but 
internally used as transport format, those ass functions need to be available 
outside 
of libavcodec.
I'm totally open for suggestions regarding _how_ this should be done.


> >  av_freep(&ifilter->displaymatrix);
> >  sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
> > diff --git a/fftools/ffmpeg_hw.c b/fftools/ffmpeg_hw.c
> > index 14e702bd92..be69d54aaf 100644
> > --- a/fftools/ffmpeg_hw.c
> > +++ b/fftools/ffmpeg_hw.c
> > @@ -449,7 +449,7 @@ int hw_device_setup_for_encode(OutputStream *ost)
> >  AVBufferRef *frames_ref = NULL;
> >  int i;
> >
> > -if (ost->filter) {
> > +if (ost->filter && ost->filter->filter) {
> 
> I don't think that your patches make it necessary to add this (or have
> you already added hardware accelerated subtitle encoding?), so it is
> either already necessary in master and should be sent as a separate
> commit or it is unnecessary and should be dropped.

Using ffmpeg with hw acceleration is my primary use case, that's why I'm 
rather sure that it isn't required before this patchset.

While working on this patchset I've also tested various scenarios with hw
acceleration, so it might be possible that I've run into this in combination
with hw acceleration. Anyway - why should adding this check be unnecessary 
or even wrong?

When ost->filter->filter is NULL, then av_buffersink_get_hw_frames_ctx()
will crash.


Kind regards,
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".


[FFmpeg-devel] 回复: [PATCH v4 2/2] avfilter: add a flip_vulkan filter

2021-11-26 Thread Wu Jianhua
Lynne:
>>ffm...@gyani.pro:
>>> On 2021-11-26 04:33 pm, Lynne wrote:
>>>
 26 Nov 2021, 11:37 by ffm...@gyani.pro:

>
> On 2021-11-26 03:08 pm, Lynne wrote:
>
>> 26 Nov 2021, 10:10 by jianhua...@intel.com:
>>
>> This filter flips the input video both horizontally and vertically
>> in one compute pipeline, and it's no need to use two pipelines for
>> hflip_vulkan,vflip_vulkan anymore.
>>
>> Signed-off-by: Wu Jianhua 
>> ---
>>  configure|  1 +
>>  libavfilter/allfilters.c |  1 +
>>  libavfilter/vf_flip_vulkan.c | 61 +---
>>  3 files changed, 51 insertions(+), 12 deletions(-)
>>
> I'll push this tonight if there are no further objections to the name.
>
 Will other flip modes be added to this filter?


Hi Gyan:

There are no more flip modes anymore. I add this filter is inspired by OpenCV,
which offers three flip modes for horizontal, vertical, and both. When a person
specifies hflip, it means that he is desired on horizontal flipping. If the flip
is specified without 'v' or 'h', it means there is no desire on specifying the
direction. So, I think it may be fine to use flip for both directions then we
don't need to construct a new name.

Thanks,
Jianhua

>>> No. Other flip modes are already separate filters, and transposition
>>> would be another filter. Our transpose filter doesn't support flipping
>>> the image, and to keep options compatible between software and
>>> hardware filters, we can't add it. So the most appropriate filter for
>>> this is a standalone one.
>>>
>>
>> If modes can be added, you can add them here, and deprecate the single mode 
>> variants.
>> Since these filters are very new, there are no legacy users to accommodate 
>> and now would be the best time they come become present in a release branch.
>>
>
>There are no more modes to be added, flipping != transpose != rotate,
>according to ffmpeg nomenclature, since we have separate filters for each.
>



发件人: ffmpeg-devel  代表 Lynne 
发送时间: 2021年11月26日 3:45
收件人: FFmpeg development discussions and patches
主题: Re: [FFmpeg-devel] [PATCH v4 2/2] avfilter: add a flip_vulkan filter

26 Nov 2021, 12:20 by ffm...@gyani.pro:

>
>
> On 2021-11-26 04:33 pm, Lynne wrote:
>
>> 26 Nov 2021, 11:37 by ffm...@gyani.pro:
>>
>>>
>>> On 2021-11-26 03:08 pm, Lynne wrote:
>>>
 26 Nov 2021, 10:10 by jianhua...@intel.com:

> This filter flips the input video both horizontally and vertically
> in one compute pipeline, and it's no need to use two pipelines for
> hflip_vulkan,vflip_vulkan anymore.
>
> Signed-off-by: Wu Jianhua 
> ---
>  configure|  1 +
>  libavfilter/allfilters.c |  1 +
>  libavfilter/vf_flip_vulkan.c | 61 +---
>  3 files changed, 51 insertions(+), 12 deletions(-)
>
 I'll push this tonight if there are no further objections to the name.

>>> Will other flip modes be added to this filter?
>>>
>> No. Other flip modes are already separate filters, and transposition
>> would be another filter. Our transpose filter doesn't support flipping
>> the image, and to keep options compatible between software and
>> hardware filters, we can't add it. So the most appropriate filter for
>> this is a standalone one.
>>
>
> If modes can be added, you can add them here, and deprecate the single mode 
> variants.
> Since these filters are very new, there are no legacy users to accommodate 
> and now would be the best time they come become present in a release branch.
>

There are no more modes to be added, flipping != transpose != rotate,
according to ffmpeg nomenclature, since we have separate filters for each.
___
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 v16 06/16] avfilter/sbuffer: Add sbuffersrc and sbuffersink filters

2021-11-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Andreas
> Rheinhardt
> Sent: Friday, November 26, 2021 12:14 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v16 06/16] avfilter/sbuffer: Add
> sbuffersrc and sbuffersink filters
> 
> > +#include "libavcodec/avcodec.h"
> > +
> >  #define FF_INTERNAL_FIELDS 1
> >  #include "framequeue.h"
> >
> > @@ -57,6 +59,10 @@ typedef struct BufferSinkContext {
> >  int *sample_rates;  ///< list of accepted sample
> rates, terminated by -1
> >  int sample_rates_size;
> >
> > +/* only used for subtitles */
> > +enum AVSubtitleType *subtitle_types; ///< list of accepted
> subtitle types, must be terminated with -1
> 
> subtitle_types is not terminated by -1 at all; it uses the size field
> below instead of a sentinel. The same is true for the other arrays.

My patch does things just analog to the video and audio implementation.
I have no idea in which direction this is intended to go and I think it
is outside the scope of this patch to make any assumptions about
it. Even when it would be clear in which way this should be changed in the 
future - I don't think such change should be part of this patch. 
Also whatever I'd do, I'm sure it would take multiple additional patch 
revisions until everybody is satisfied.
This can be changed later (consistently for all three media types at once),
or - if you see some urgency in this - please change it in the main tree, 
then I'll adapt my patch. 

All other suggestions done.

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".


[FFmpeg-devel] [PATCH v2] avformat/scd: add demuxer

2021-11-26 Thread Zane van Iperen
Adds demuxer for Square Enux SCD files.

Based off [1] and personal investigation.

This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files
(big-endian). As it is highly likely that FFXIV (PC) files are little-endian,
this demuxer is marked as experimental until this can be confirmed.

[1]: http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt

Signed-off-by: Zane van Iperen 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/scd.c| 378 +++
 3 files changed, 380 insertions(+)
 create mode 100644 libavformat/scd.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index a19d2e0c88..2b5caf9d33 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -501,6 +501,7 @@ OBJS-$(CONFIG_SBC_MUXER) += rawenc.o
 OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
 OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
 OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
+OBJS-$(CONFIG_SCD_DEMUXER)   += scd.o
 OBJS-$(CONFIG_SDP_DEMUXER)   += rtsp.o
 OBJS-$(CONFIG_SDR2_DEMUXER)  += sdr2.o
 OBJS-$(CONFIG_SDS_DEMUXER)   += sdsdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index cbfadcb639..1054ac9667 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -392,6 +392,7 @@ extern const AVOutputFormat ff_sbc_muxer;
 extern const AVInputFormat  ff_sbg_demuxer;
 extern const AVInputFormat  ff_scc_demuxer;
 extern const AVOutputFormat ff_scc_muxer;
+extern const AVInputFormat  ff_scd_demuxer;
 extern const AVInputFormat  ff_sdp_demuxer;
 extern const AVInputFormat  ff_sdr2_demuxer;
 extern const AVInputFormat  ff_sds_demuxer;
diff --git a/libavformat/scd.c b/libavformat/scd.c
new file mode 100644
index 00..0ed5322a14
--- /dev/null
+++ b/libavformat/scd.c
@@ -0,0 +1,378 @@
+/*
+ * Square Enix SCD demuxer
+ * Copyright (C) 2021 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * Based off documentation:
+ *   http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt
+ *
+ * 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/avstring.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/internal.h"
+#include "libavutil/macros.h"
+#include "libavutil/avassert.h"
+#include "libavformat/internal.h"
+#include "avformat.h"
+
+#define SCD_MAGIC  ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
+  MKBETAG('S', 'S', 'C', 'F'))
+#define SCD_MIN_HEADER_SIZE20
+#define SCD_OFFSET_HEADER_SIZE 28
+#define SCD_TRACK_HEADER_SIZE  32
+
+#define SCD_TRACK_ID_PCM0
+#define SCD_TRACK_ID_OGG6
+#define SCD_TRACK_ID_MP37
+#define SCD_TRACK_ID_MS_ADPCM  12
+
+typedef struct SCDOffsetTable {
+uint16_t  count;
+uint32_t  offset;
+uint32_t *entries;
+} SCDOffsetTable;
+
+typedef struct SCDHeader {
+uint64_t magic; /* SEDBSSCF */
+uint32_t version;   /* Verison number. We only know about 3.*/
+uint16_t unk1;  /* Unknown, 260 in Drakengard 3, 1024 in FFXIV. */
+uint16_t header_size;   /* Total size of this header.   */
+uint32_t file_size; /* Is often 0, just ignore it.  */
+
+SCDOffsetTable table0;  /* Table 0, no idea. 56 uint32's/entry. */
+SCDOffsetTable table1;  /* Table 1, contains the track info.*/
+SCDOffsetTable table2;  /* Table 2, no idea. 40 uint32's/entry. */
+uint16_t unk2;  /* Unknown, not a count.*/
+uint32_t unk3;  /* Unknown, not an offset.  */
+uint32_t unk4;  /* Unknown, offset to offset.   */
+} SCDHeader;
+
+typedef struct SCDTrackHeader {
+uint32_t length;
+uint32_t num_channels;
+uint32_t sample_rate;
+uint32_t data_type;
+uint32_t loop_start;
+uint32_t loop_end;
+uint32_t data_offset; /* Offset to data + this header. */
+uint32_t aux_count;
+
+uint32_t absolute_offset;
+uint32_t bytes_read;
+} SCDTrackHeader;
+
+typedef struct SCDDemuxContext {
+SCDHeader 

Re: [FFmpeg-devel] [PATCH v16 01/16] global: Prepare AVFrame for subtitle handling

2021-11-26 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Andreas
> Rheinhardt
> Sent: Friday, November 26, 2021 11:35 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v16 01/16] global: Prepare AVFrame for
> subtitle handling

Hi Andreas,

thanks for the detailed review. There was hardly anything to object or disagree.
Everything I don't respond to is implemented as suggested.

> As has already been said by others, this should be split: One patch for
> the actual new libavutil additions, one patch for the lavc decoding API,
> one patch for the encoding API, one patch for every user that is made to
> use the new APIs.

By keeping the AVSubtitle definition in its original location, it was 
possible to split this as suggested on IRC.
Thanks.

> This is not how you deprecate something: You have to add a @deprecated
> doxygen comment as well as the attribute_deprecated to make some noise.

I didn’t want the noise before things get serious ;-)

> 
> Actually, you should deprecate the whole AVSubtitle API.

Done. Do we deprecate structs as well?

Also, there's a function avcodec_get_subtitle_rect_class().

I have no idea whether it ever had any practical use. A similar function
above (avcodec_get_frame_class) is deprecated.


> > +/**
> > + * Return subtitle format from a codec descriptor
> > + *
> > + * @param codec_descriptor codec descriptor
> > + * @return the subtitle type (e.g. bitmap, text)
> > + */
> > +enum AVSubtitleType av_get_subtitle_format_from_codecdesc(const
> AVCodecDescriptor *codec_descriptor);
> 
> Do we need this function? It seems too trivial and as Anton has pointed
> out is flawed. And anyway, this would belong into codec_desc.h.

I had replied to Anton why it's not flawed. Moved it to codec_desc and
named it as Anton had suggested.


> >  int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const
> AVPacket *avpkt)
> >  {
> >  AVCodecInternal *avci = avctx->internal;
> > @@ -590,6 +618,9 @@ int attribute_align_arg
> avcodec_send_packet(AVCodecContext *avctx, const AVPacke
> >  if (avpkt && !avpkt->size && avpkt->data)
> >  return AVERROR(EINVAL);
> >
> > +if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE)
> > +return decode_subtitle_shim(avctx, avci->buffer_frame, avpkt);
> 
> 1. This is missing a check whether buffer_frame is empty or not; in the
> latter case, you need to return AVERROR(EAGAIN); instead
> decode_subtitle_shim() destroys what is already there.
> (Said check is currently offloaded to the BSF API in the audio/video
> codepath. This is actually a violation of the BSF API.)

Added that check.

> 2. Flushing is not really implemented well:
> a) It is legal to call avcodec_send_packet() with avpkt == NULL to
> indicate EOF. If I am not mistaken, decode_subtitle2_priv() will just
> crash in this case.

Like all subtitle decoders would when supplying a NULL packet.
What should I return when a null packet is supplied?
EAGAIN or EOF?

> b) avcodec_receive_frame() only returns what is in buffer_frame; it
> never calls decode_subtitle2_priv() or the underlying decode function at
> all. This basically presumes that a subtitle decoder can only return one
> subtitle after flushing. I don't know whether this is true for our
> decoders with the delay cap.

The only one I could see with that flag is cc_dec, which is a special case
anyway as it doesn't work on regular streams.
(even this one would crash when providing a NULL packet)

> c) avcodec_receive_frame() seems to never return AVERROR_EOF after
> flushing, but always AVERROR(EAGAIN) (if the delay cap is set, the first
> call to avcodec_receive_frame() after flushing can also result in a
> frame being returned). Yet this makes no sense and is IMO an API
> violation on lavc's part.
> (While we have subtitle decoders with the delay cap, I don't know
> whether this is actually tested by fate and whether all code actually
> flushes subtitle decoders at all.)

I don't think so.


> > diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
> > index 377160c72b..6b54cf669b 100644
> > --- a/libavfilter/vf_subtitles.c
> > +++ b/libavfilter/vf_subtitles.c
> > @@ -35,14 +35,12 @@
> >  # include "libavformat/avformat.h"
> >  #endif
> >  #include "libavutil/avstring.h"
> > -#include "libavutil/imgutils.h"
> >  #include "libavutil/opt.h"
> >  #include "libavutil/parseutils.h"
> >  #include "drawutils.h"
> >  #include "avfilter.h"
> >  #include "internal.h"
> >  #include "formats.h"
> > -#include "video.h"
> >
> >  typedef struct AssContext {
> >  const AVClass *class;
> > @@ -292,6 +290,29 @@ static int attachment_is_font(AVStream * st)
> >  return 0;
> >  }
> >
> > +static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame,
> AVPacket *pkt)
> > +{
> > +int ret;
> > +
> > +*got_frame = 0;
> 
> You don't really need this: You could just return 0 if no frame was
> returned, 1 if a frame was returned and < 0 on (actual, not 

Re: [FFmpeg-devel] [PATCH v3 1/1] fftools/ffprobe: print size of attachment streams (extradata_size)

2021-11-26 Thread Michael Niedermayer
On Fri, Nov 26, 2021 at 10:01:23PM +, Soft Works wrote:
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Michael
> > Niedermayer
> > Sent: Friday, November 26, 2021 10:26 PM
> > To: FFmpeg development discussions and patches 
> > Subject: Re: [FFmpeg-devel] [PATCH v3 1/1] fftools/ffprobe: print size of
> > attachment streams (extradata_size)
> > 
> > On Fri, Nov 26, 2021 at 07:55:40PM +, Soft Works wrote:
> > >
> > >
> > > > -Original Message-
> > > > From: ffmpeg-devel  On Behalf Of 
> > > > Michael
> > > > Niedermayer
> > > > Sent: Friday, November 26, 2021 7:50 PM
> > > > To: FFmpeg development discussions and patches 
> > > > Subject: Re: [FFmpeg-devel] [PATCH v3 1/1] fftools/ffprobe: print size 
> > > > of
> > > > attachment streams (extradata_size)
> > > >
> > > > On Thu, Nov 25, 2021 at 04:59:41PM +, Soft Works wrote:
> > > > > Another attempt: Created on Linux and zipped...
> > > >
> > > > tested and works
> > > > LGTM
> > >
> > > Thanks.
> > >
> > > Today I've seen that the v3 version with the patch as an attachment has
> > > been processed by patchwork:
> > >
> > >
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/CH0P223MB03639F30A548FA85C1
> > 7e8855ba...@ch0p223mb0363.namp223.prod.outlook.com/
> > >
> > > I've also verified that the output from git format-patch on Linux was the
> > > same as on Windows. Also, I sent e-mails with the attached patch to myself
> > > (google-to-google and google-to-ms) and verified that the attachments were
> > > unchanged.
> > >
> > > My preliminary conclusion for patches containing long lines:
> > >
> > > For patchwork: Use the --attach param for git send-patch
> > > For Michael and maybe others: send as zip attachment 😊
> > > (not that I could tell the reason)
> > >
> > > Might be interesting to check whether there's a difference between the
> > > e-mail you get and the file you get when downloading the mbox from
> > patchwork.
> > 
> > The attachemnt after the mailing list is broken:
> > https://ffmpeg.org/pipermail/ffmpeg-
> > devel/attachments/20211125/daa80b4e/attachment.bin
> > 
> > if you want to help fix this, thats welcome
> > 
> > That patchwork has a working patch is interresting but iam not sure if the
> > awnser to this will help, the problem seems before. So we need a fix before
> > if you are interrested in helping, there was some prior occurance of this
> > maybe there was some additional information in that thread
> 
> There are two problems - I'm not sure which one you are talking about:

theres a problem which has occured previously, for which there is one
or more threads on the ML
if you want to help, find these threads. Throwing out ideas which are
not even consistent with the current facts causes people like me to
waste time looking at the wrong places.
Let alone the problem was not that we didnt know where the bug was
IIRC it was that someone had to fix it 
It is true that the new instance here has some currently unexplained
behaviours but neither your 1. or 2. works at explaining them


[...]

> 2. You didn't correctly receive the patch sent as attachment
> 
> I just double-checked: The ML software didn't modify the patch when attached
> (as plain-text .patch)

how did you check that ?
it is broken on my side and it is broken on the server as you can see by
looking at the link i posted
Also i mailed the correct patch to myself as plain/text attachment and
its perfectly fine. Neither my SMTP server not my local mail handling
did anything odd to the long line
OTOH the mail i received from the ML though contains a base64 encoded
attachment and inside that is a broken patch
if you say you have received a good one then my first intuition is to
ask you to check that again
i took the attachment decoded it with command line base64 -d and it
was not good


> 
> Patchwork could apply this correctly, so I'm not sure what went wrong 
> in that case when you couldn't apply it?

Your attachment is broken on the server already, again 
your mail with the attachment:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-November/288260.html
and the attachment:
https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20211125/daa80b4e/attachment.bin
a954c4f6237453e91ab3e0327ec5eae9  attachment.bin <-- this is the broken one

patch --dry-run -p1 

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 v15 01/16] global: Prepare AVFrame for subtitle handling

2021-11-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Anton
> Khirnov
> Sent: Thursday, November 25, 2021 4:56 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v15 01/16] global: Prepare AVFrame for
> subtitle handling
> 
> Quoting Soft Works (2021-11-25 01:48:11)
> > Root commit for adding subtitle filtering capabilities.
> > In detail:
> >
> > - Add type (AVMediaType) field to AVFrame
> >   Replaces previous way of distinction which was based on checking
> >   width and height to determine whether a frame is audio or video
> > - Add subtitle fields to AVFrame
> > - Add new struct AVSubtitleArea, similar to AVSubtitleRect, but different
> >   allocation logic. Cannot and must not be used interchangeably, hence
> >   the new struct
> > - Move enum AVSubtitleType, AVSubtitle and AVSubtitleRect to avutil
> > - Add public-named members to enum AVSubtitleType (AV_SUBTITLE_FMT_)
> > - Add avcodec_decode_subtitle3 which takes subtitle frames,
> >   serving as compatibility shim to legacy subtitle decoding
> > - Add additional methods for conversion between old and new API
> >
> > Signed-off-by: softworkz 
> > ---
> >  libavcodec/avcodec.c   |  19 ---
> >  libavcodec/avcodec.h   |  75 ++--
> >  libavcodec/decode.c|  53 ++--
> >  libavcodec/pgssubdec.c |   1 +
> >  libavcodec/utils.c |  11 ++
> >  libavfilter/vf_subtitles.c |  50 ++--
> >  libavformat/utils.c|   1 +
> >  libavutil/Makefile |   2 +
> >  libavutil/frame.c  | 194 ++---
> >  libavutil/frame.h  |  93 +-
> >  libavutil/subfmt.c | 243 +
> >  libavutil/subfmt.h | 185 
> >  12 files changed, 802 insertions(+), 125 deletions(-)
> >  create mode 100644 libavutil/subfmt.c
> >  create mode 100644 libavutil/subfmt.h
> 
> First of all, this should be split. It does way way more than just
> "prepare AVFrame". It adds random things all over the place, some of
> them completely spurious (like the single include in pgssubdec).

Andreas hinted me that this could work without moving AVSubtitle symbols
at all. This allowed me to split these changes without breaking compilation.

Thanks.


> 
> >
> > +/**
> > + * Return subtitle format from a codec descriptor
> > + *
> > + * @param codec_descriptor codec descriptor
> > + * @return the subtitle type (e.g. bitmap, text)
> > + */
> > +enum AVSubtitleType av_get_subtitle_format_from_codecdesc(const
> AVCodecDescriptor *codec_descriptor);
> 
> New functions should be namespaced along the lines of av(_)_
> In this case, something like avcodec_descriptor_get_subtitle_format()

Thanks for the hint, I changed the name appropriately.


> Also, it seems to introduce an assumption that bitmap and text are
> mutually exclusive, while descriptors treat them as flags.

The assumption that bitmap and text subtitle formats are mutually exclusive
is not introduced here. It is already being made virtually everywhere in 
the code where it is dealing with subtitles.
Most simple example: AVSubtitle.format

The flags you are referring to are also used for indicating other things
(e.g. film grain) than subtitle formats, so you can't conclude that this 
is intending to imply the possibility of "hybrid" or "dual" subtitle formats.


> > +/**
> > + * Header containing style information for text subtitles.
> > + */
> > +AVBufferRef *subtitle_header;

> This is breaking ABI.

>From earlier discussions, I think it's clear that the whole patchset cannot
go without breakage.


Kind regards,
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 v3 1/1] fftools/ffprobe: print size of attachment streams (extradata_size)

2021-11-26 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Michael
> Niedermayer
> Sent: Friday, November 26, 2021 10:26 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v3 1/1] fftools/ffprobe: print size of
> attachment streams (extradata_size)
> 
> On Fri, Nov 26, 2021 at 07:55:40PM +, Soft Works wrote:
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of Michael
> > > Niedermayer
> > > Sent: Friday, November 26, 2021 7:50 PM
> > > To: FFmpeg development discussions and patches 
> > > Subject: Re: [FFmpeg-devel] [PATCH v3 1/1] fftools/ffprobe: print size of
> > > attachment streams (extradata_size)
> > >
> > > On Thu, Nov 25, 2021 at 04:59:41PM +, Soft Works wrote:
> > > > Another attempt: Created on Linux and zipped...
> > >
> > > tested and works
> > > LGTM
> >
> > Thanks.
> >
> > Today I've seen that the v3 version with the patch as an attachment has
> > been processed by patchwork:
> >
> >
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/CH0P223MB03639F30A548FA85C1
> 7e8855ba...@ch0p223mb0363.namp223.prod.outlook.com/
> >
> > I've also verified that the output from git format-patch on Linux was the
> > same as on Windows. Also, I sent e-mails with the attached patch to myself
> > (google-to-google and google-to-ms) and verified that the attachments were
> > unchanged.
> >
> > My preliminary conclusion for patches containing long lines:
> >
> > For patchwork: Use the --attach param for git send-patch
> > For Michael and maybe others: send as zip attachment 😊
> > (not that I could tell the reason)
> >
> > Might be interesting to check whether there's a difference between the
> > e-mail you get and the file you get when downloading the mbox from
> patchwork.
> 
> The attachemnt after the mailing list is broken:
> https://ffmpeg.org/pipermail/ffmpeg-
> devel/attachments/20211125/daa80b4e/attachment.bin
> 
> if you want to help fix this, thats welcome
> 
> That patchwork has a working patch is interresting but iam not sure if the
> awnser to this will help, the problem seems before. So we need a fix before
> if you are interrested in helping, there was some prior occurance of this
> maybe there was some additional information in that thread

There are two problems - I'm not sure which one you are talking about:

1. Long lines are wrapped when patches are sent inline

The maximum line length for e-mails is 998 chars.
(RFC5322 Section 2.1.1, https://tools.ietf.org/html/rfc5322#section-2.1.1)

Probably not a bug, neither from patchwork nor from the mailing list software.
Conclusion is IMO that patches with long lines need to be sent as attachments
instead.


2. You didn't correctly receive the patch sent as attachment

I just double-checked: The ML software didn't modify the patch when attached
(as plain-text .patch)

Patchwork could apply this correctly, so I'm not sure what went wrong 
in that case when you couldn't apply it?

Kind regards,
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 v3 1/1] fftools/ffprobe: print size of attachment streams (extradata_size)

2021-11-26 Thread Michael Niedermayer
On Fri, Nov 26, 2021 at 07:55:40PM +, Soft Works wrote:
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Michael
> > Niedermayer
> > Sent: Friday, November 26, 2021 7:50 PM
> > To: FFmpeg development discussions and patches 
> > Subject: Re: [FFmpeg-devel] [PATCH v3 1/1] fftools/ffprobe: print size of
> > attachment streams (extradata_size)
> > 
> > On Thu, Nov 25, 2021 at 04:59:41PM +, Soft Works wrote:
> > > Another attempt: Created on Linux and zipped...
> > 
> > tested and works
> > LGTM
> 
> Thanks. 
> 
> Today I've seen that the v3 version with the patch as an attachment has
> been processed by patchwork:
> 
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/ch0p223mb03639f30a548fa85c17e8855ba...@ch0p223mb0363.namp223.prod.outlook.com/
> 
> I've also verified that the output from git format-patch on Linux was the 
> same as on Windows. Also, I sent e-mails with the attached patch to myself
> (google-to-google and google-to-ms) and verified that the attachments were 
> unchanged.
> 
> My preliminary conclusion for patches containing long lines:
> 
> For patchwork: Use the --attach param for git send-patch
> For Michael and maybe others: send as zip attachment 😊
> (not that I could tell the reason)
> 
> Might be interesting to check whether there's a difference between the
> e-mail you get and the file you get when downloading the mbox from patchwork.

The attachemnt after the mailing list is broken:
https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20211125/daa80b4e/attachment.bin

if you want to help fix this, thats welcome

That patchwork has a working patch is interresting but iam not sure if the
awnser to this will help, the problem seems before. So we need a fix before
if you are interrested in helping, there was some prior occurance of this
maybe there was some additional information in that thread

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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 v3 1/1] fftools/ffprobe: print size of attachment streams (extradata_size)

2021-11-26 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Michael
> Niedermayer
> Sent: Friday, November 26, 2021 7:50 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v3 1/1] fftools/ffprobe: print size of
> attachment streams (extradata_size)
> 
> On Thu, Nov 25, 2021 at 04:59:41PM +, Soft Works wrote:
> > Another attempt: Created on Linux and zipped...
> 
> tested and works
> LGTM

Thanks. 

Today I've seen that the v3 version with the patch as an attachment has
been processed by patchwork:

https://patchwork.ffmpeg.org/project/ffmpeg/patch/ch0p223mb03639f30a548fa85c17e8855ba...@ch0p223mb0363.namp223.prod.outlook.com/

I've also verified that the output from git format-patch on Linux was the 
same as on Windows. Also, I sent e-mails with the attached patch to myself
(google-to-google and google-to-ms) and verified that the attachments were 
unchanged.

My preliminary conclusion for patches containing long lines:

For patchwork: Use the --attach param for git send-patch
For Michael and maybe others: send as zip attachment 😊
(not that I could tell the reason)

Might be interesting to check whether there's a difference between the
e-mail you get and the file you get when downloading the mbox from patchwork.

Kind regards,
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 1/2] avcodec/txd: Move input size checks before allocation

2021-11-26 Thread Michael Niedermayer
On Sun, Nov 14, 2021 at 08:30:28PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 40882/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-4893364584054784
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/txd.c | 30 +++---
>  1 file changed, 19 insertions(+), 11 deletions(-)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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 2/2] avformat/avidec: Check read_odml_index() for failure

2021-11-26 Thread Michael Niedermayer
On Sun, Nov 14, 2021 at 08:30:29PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 40950/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6478873068437504
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/avidec.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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 v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2021-11-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Soft Works
> Sent: Friday, November 26, 2021 8:29 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a
> hwdevice, search for existing device in both directions
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Anton
> > Khirnov
> > Sent: Friday, November 26, 2021 8:12 PM
> > To: FFmpeg development discussions and patches 
> > Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving
> a
> > hwdevice, search for existing device in both directions
> >
> > Quoting Soft Works (2021-11-26 19:43:58)
> > > Maybe I'm missing something, but hw device contexts are refcounted.
> > > What happens in hwdevice_ctx_free() is this:
> > >
> > > av_buffer_unref(&ctx->internal->source_device);
> >
> > IIUC this only happens after the parent device is freed. My concern is
> > the following situation:
> > - the caller creates a parent hwdevice
> > - the caller derives a child from it, which may acquire some additional
> >   resources beyond what the parent holds
> > - the caller unrefs all his references to the child, but the child does
> >   not get freed because the parent still holds a reference to it

BTW, that's the current behavior anyway. The only change that this patch 
is adding is to find _all_ existing derived contexts, by iterating through
the whole tree of derivations instead of just following the parent direction.

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 v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2021-11-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Anton
> Khirnov
> Sent: Friday, November 26, 2021 8:12 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a
> hwdevice, search for existing device in both directions
> 
> Quoting Soft Works (2021-11-26 19:43:58)
> > Maybe I'm missing something, but hw device contexts are refcounted.
> > What happens in hwdevice_ctx_free() is this:
> >
> > av_buffer_unref(&ctx->internal->source_device);
> 
> IIUC this only happens after the parent device is freed. My concern is
> the following situation:
> - the caller creates a parent hwdevice
> - the caller derives a child from it, which may acquire some additional
>   resources beyond what the parent holds
> - the caller unrefs all his references to the child, but the child does
>   not get freed because the parent still holds a reference to it
> 
> Since av_hwdevice_ctx_create_derived() has a flags parameter, we might
> want to introduce a flag to control this behavior.

I understand what you mean. I'm just not sure whether a practical case
with such a requirement exists. Should that turn out to be required,
such flag can be added at any time, IMO.

Kind regards,
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".


[FFmpeg-devel] [PATCH] fftools/ffmpeg_opt: Don't duplicate array unnecessarily

2021-11-26 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg.c |  3 ---
 fftools/ffmpeg.h |  7 ---
 fftools/ffmpeg_opt.c | 43 ---
 3 files changed, 12 insertions(+), 41 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index c838e2604c..0bc11949f2 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -555,9 +555,6 @@ static void ffmpeg_cleanup(int ret)
 
 avfilter_inout_free(&ofilter->out_tmp);
 av_freep(&ofilter->name);
-av_freep(&ofilter->formats);
-av_freep(&ofilter->channel_layouts);
-av_freep(&ofilter->sample_rates);
 av_freep(&fg->outputs[j]);
 }
 av_freep(&fg->outputs);
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 1728010f56..f10b63c21f 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -281,9 +281,10 @@ typedef struct OutputFilter {
 uint64_t channel_layout;
 
 // those are only set if no format is specified and the encoder gives us 
multiple options
-int *formats;
-uint64_t *channel_layouts;
-int *sample_rates;
+// They point directly to the relevant lists of the encoder.
+const int *formats;
+const uint64_t *channel_layouts;
+const int *sample_rates;
 } OutputFilter;
 
 typedef struct FilterGraph {
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index feed772452..8a0cad3f62 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2631,7 +2631,6 @@ loop_end:
 /* set the filter output constraints */
 if (ost->filter) {
 OutputFilter *f = ost->filter;
-int count;
 switch (ost->enc_ctx->codec_type) {
 case AVMEDIA_TYPE_VIDEO:
 f->frame_rate = ost->frame_rate;
@@ -2639,51 +2638,25 @@ loop_end:
 f->height = ost->enc_ctx->height;
 if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
 f->format = ost->enc_ctx->pix_fmt;
-} else if (ost->enc->pix_fmts) {
-count = 0;
-while (ost->enc->pix_fmts[count] != AV_PIX_FMT_NONE)
-count++;
-f->formats = av_calloc(count + 1, sizeof(*f->formats));
-if (!f->formats)
-exit_program(1);
-memcpy(f->formats, ost->enc->pix_fmts, (count + 1) * 
sizeof(*f->formats));
+} else {
+f->formats = ost->enc->pix_fmts;
 }
 break;
 case AVMEDIA_TYPE_AUDIO:
 if (ost->enc_ctx->sample_fmt != AV_SAMPLE_FMT_NONE) {
 f->format = ost->enc_ctx->sample_fmt;
-} else if (ost->enc->sample_fmts) {
-count = 0;
-while (ost->enc->sample_fmts[count] != AV_SAMPLE_FMT_NONE)
-count++;
-f->formats = av_calloc(count + 1, sizeof(*f->formats));
-if (!f->formats)
-exit_program(1);
-memcpy(f->formats, ost->enc->sample_fmts, (count + 1) * 
sizeof(*f->formats));
+} else {
+f->formats = ost->enc->sample_fmts;
 }
 if (ost->enc_ctx->sample_rate) {
 f->sample_rate = ost->enc_ctx->sample_rate;
-} else if (ost->enc->supported_samplerates) {
-count = 0;
-while (ost->enc->supported_samplerates[count])
-count++;
-f->sample_rates = av_calloc(count + 1, 
sizeof(*f->sample_rates));
-if (!f->sample_rates)
-exit_program(1);
-memcpy(f->sample_rates, ost->enc->supported_samplerates,
-   (count + 1) * sizeof(*f->sample_rates));
+} else {
+f->sample_rates = ost->enc->supported_samplerates;
 }
 if (ost->enc_ctx->channels) {
 f->channel_layout = 
av_get_default_channel_layout(ost->enc_ctx->channels);
-} else if (ost->enc->channel_layouts) {
-count = 0;
-while (ost->enc->channel_layouts[count])
-count++;
-f->channel_layouts = av_calloc(count + 1, 
sizeof(*f->channel_layouts));
-if (!f->channel_layouts)
-exit_program(1);
-memcpy(f->channel_layouts, ost->enc->channel_layouts,
-   (count + 1) * sizeof(*f->channel_layouts));
+} else {
+f->channel_layouts = ost->enc->channel_layouts;
 }
 break;
 }
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffm

[FFmpeg-devel] [PATCH] avcodec/vqavideo: Remove dead code

2021-11-26 Thread Andreas Rheinhardt
Fixes Coverity issue #1493344.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/vqavideo.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 5466e25cdf..61f0a2c950 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -692,11 +692,6 @@ static int vqa_decode_frame_hicolor(VqaContext *s, AVFrame 
*frame)
 bytestream2_get_buffer(&s->gb, s->codebook, chunk_size);
 }
 
-if (vprz_chunk == -1 && vptr_chunk == -1) {
-av_log(s->avctx, AV_LOG_ERROR, "frame has no block data\n");
-return AVERROR_INVALIDDATA;
-}
-
 /* decode the frame */
 
 if (vptr_chunk != -1) {
@@ -716,7 +711,7 @@ static int vqa_decode_frame_hicolor(VqaContext *s, AVFrame 
*frame)
 if ((res = decode_format80(s, chunk_size, s->decode_buffer, 
s->decode_buffer_size, 0)) < 0)
 return res;
 } else {
-av_log(s->avctx, AV_LOG_ERROR, "expected either VPTR or VPRZ chunk\n");
+av_log(s->avctx, AV_LOG_ERROR, "frame has no block data\n");
 return AVERROR_INVALIDDATA;
 }
 
-- 
2.30.2

___
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 v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2021-11-26 Thread Anton Khirnov
Quoting Soft Works (2021-11-26 19:43:58)
> Maybe I'm missing something, but hw device contexts are refcounted.
> What happens in hwdevice_ctx_free() is this:
> 
> av_buffer_unref(&ctx->internal->source_device);

IIUC this only happens after the parent device is freed. My concern is
the following situation:
- the caller creates a parent hwdevice
- the caller derives a child from it, which may acquire some additional
  resources beyond what the parent holds
- the caller unrefs all his references to the child, but the child does
  not get freed because the parent still holds a reference to it

Since av_hwdevice_ctx_create_derived() has a flags parameter, we might
want to introduce a flag to control this behavior.

-- 
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] webp: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM

2021-11-26 Thread Michael Niedermayer
On Thu, Nov 25, 2021 at 02:45:26PM -0500, Alex Xu (Hello71) wrote:
> Roughly doubles webp performance for common applications (ffmpeg,
> ffprobe, mpv) due to speeding up avformat_find_stream_info.
> 
> Lossy needs no patches since vp8.c already implements skip_frame.
> Lossless needs hook to understand skip_frame. Also the "image data not
> found" message is fixed, which was already broken with manual
> -skip_frame but would now be exposed in default operation.
> ---
>  libavcodec/webp.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/webp.c b/libavcodec/webp.c
> index d5a81fd527..f24aa979ac 100644
> --- a/libavcodec/webp.c
> +++ b/libavcodec/webp.c
> @@ -1126,6 +1126,9 @@ static int vp8_lossless_decode_frame(AVCodecContext 
> *avctx, AVFrame *p,
>  h = s->height;
>  }
>  
> +if (avctx->skip_frame == AVDISCARD_ALL)
> +return data_size;
> +
>  /* parse transformations */
>  s->nb_transforms = 0;
>  s->reduced_width = s->width;
> @@ -1524,7 +1527,7 @@ exif_end:
>  }
>  }
>  
> -if (!*got_frame) {
> +if (!*got_frame && avctx->skip_frame < 0) {
>  av_log(avctx, AV_LOG_ERROR, "image data not found\n");
>  return AVERROR_INVALIDDATA;
>  }

there are more possibilities than AVDISCARD_ALL and NONE
maybe iam missing something but this would probably not show this
error for them even when the error occured

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



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 v3 1/1] fftools/ffprobe: print size of attachment streams (extradata_size)

2021-11-26 Thread Michael Niedermayer
On Thu, Nov 25, 2021 at 04:59:41PM +, Soft Works wrote:
> Another attempt: Created on Linux and zipped...

tested and works
LGTM

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 v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2021-11-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Anton
> Khirnov
> Sent: Friday, November 26, 2021 5:15 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a
> hwdevice, search for existing device in both directions
> 
> Quoting Soft Works (2021-11-25 18:02:54)
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of Anton
> > > Khirnov
> > > Sent: Thursday, November 25, 2021 5:40 PM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When
> deriving a
> > > hwdevice, search for existing device in both directions
> > >
> > > Quoting Soft Works (2021-11-25 03:41:32)
> > > > @@ -687,6 +720,11 @@ int
> av_hwdevice_ctx_create_derived_opts(AVBufferRef
> > > **dst_ref_ptr,
> > > >  ret = AVERROR(ENOMEM);
> > > >  goto fail;
> > > >  }
> > > > +tmp_ctx->internal->derived_devices[type] =
> > > av_buffer_ref(dst_ref);
> > > > +if (!tmp_ctx->internal->derived_devices[type]) {
> > > > +ret = AVERROR(ENOMEM);
> > > > +goto fail;
> > > > +}
> > >
> > > This means that once you derive a device of a certain type, you can
> > > never truly close it without also killing the parent device. That

Maybe I'm missing something, but hw device contexts are refcounted.
What happens in hwdevice_ctx_free() is this:

av_buffer_unref(&ctx->internal->source_device);





___
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 v16 01/16] global: Prepare AVFrame for subtitle handling

2021-11-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Anton
> Khirnov
> Sent: Friday, November 26, 2021 5:21 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v16 01/16] global: Prepare AVFrame for
> subtitle handling
> 
> You have completely disregarded my comments on the previous patch. Stop
> doing that, it is rude.

I value everyone's time taken to review the patches I'm submitting.
Rest assured that I'm going over every single comment and try to address 
each one appropriately.

I think you misunderstood because I had answered one of your comments
immediately. Right now I'm re-working the patchset to address all suggestions
and eventually I'll respond to all those that I haven't addressed, 
explaining why.

Thank you very much for reviewing my code!

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 v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2021-11-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Anton
> Khirnov
> Sent: Friday, November 26, 2021 5:15 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a
> hwdevice, search for existing device in both directions
> 
> Quoting Soft Works (2021-11-25 18:02:54)
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of Anton
> > > Khirnov
> > > Sent: Thursday, November 25, 2021 5:40 PM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When
> deriving a
> > > hwdevice, search for existing device in both directions
> > >
> > > Quoting Soft Works (2021-11-25 03:41:32)
> > > > @@ -687,6 +720,11 @@ int
> av_hwdevice_ctx_create_derived_opts(AVBufferRef
> > > **dst_ref_ptr,
> > > >  ret = AVERROR(ENOMEM);
> > > >  goto fail;
> > > >  }
> > > > +tmp_ctx->internal->derived_devices[type] =
> > > av_buffer_ref(dst_ref);
> > > > +if (!tmp_ctx->internal->derived_devices[type]) {
> > > > +ret = AVERROR(ENOMEM);
> > > > +goto fail;
> > > > +}
> > >
> > > This means that once you derive a device of a certain type, you can
> > > never truly close it without also killing the parent device. That
> > > strikes me as
> > > - potentially troublesome
> > > - a behavior change
> > >
> > > Also, I don't see it as completely obvious that all derivations should
> > > always return the same child instance.
> >
> >
> > It creates the behavior that everybody wants and expects who is working
> > with HW devices derivation.
> 
> What qualifies you to speak for "everybody"? I would expect to hear some
> practical arguments for such a strong claim.

I meant "everybody who has been dealing with multi-level hw context 
derivation and talked about it here".

All of them had given specific examples of problems they were running into
or considering problematic:

- Haihao Xiang
- Wenbin Chen
- Guangxin Xu
- Lynne
- Mark Thompson
  (https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg117373.html)

Do you have any example that would be negatively affected by this patch?

Thanks,
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 1/5] avformat/avformat: Add AVStream parameter to check_bitstream() sig

2021-11-26 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> For most check_bitstream() functions this just avoids having
> to dereference s->streams[pkt->stream_index] themselves; but for
> meta-muxers it will allow to forward the packet to stream with
> a different stream_index (belonging to a different AVFormatContext)
> without using a spare packet.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/avformat.h|  7 ++-
>  libavformat/dashenc.c | 12 +++-
>  libavformat/flvenc.c  |  4 ++--
>  libavformat/latmenc.c |  4 ++--
>  libavformat/matroskaenc.c |  4 ++--
>  libavformat/movenc.c  |  4 ++--
>  libavformat/mpegtsenc.c   |  4 ++--
>  libavformat/mux.c |  2 +-
>  libavformat/rawenc.c  | 12 ++--
>  libavformat/segment.c | 10 ++
>  10 files changed, 36 insertions(+), 27 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 0343825aa0..75699f3a32 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -322,6 +322,7 @@
>  #include "libavformat/version.h"
>  
>  struct AVFormatContext;
> +struct AVStream;
>  
>  struct AVDeviceInfoList;
>  struct AVDeviceCapabilitiesQuery;
> @@ -623,9 +624,13 @@ typedef struct AVOutputFormat {
>  /**
>   * Set up any necessary bitstream filtering and extract any extra data 
> needed
>   * for the global header.
> + *
> + * @note pkt might have been directly forwarded by a meta-muxer; 
> therefore
> + *   pkt->stream_index as well as the pkt's timebase might be 
> invalid.
>   * Return 0 if more packets from this stream must be checked; 1 if not.
>   */
> -int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt);
> +int (*check_bitstream)(struct AVFormatContext *s, struct AVStream *st,
> +   const AVPacket *pkt);
>  } AVOutputFormat;
>  /**
>   * @}
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 5faf06e11d..dd2b34afbb 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -2333,19 +2333,21 @@ static int dash_write_trailer(AVFormatContext *s)
>  return 0;
>  }
>  
> -static int dash_check_bitstream(struct AVFormatContext *s, const AVPacket 
> *avpkt)
> +static int dash_check_bitstream(AVFormatContext *s, AVStream *st,
> +const AVPacket *avpkt)
>  {
>  DASHContext *c = s->priv_data;
> -OutputStream *os = &c->streams[avpkt->stream_index];
> +OutputStream *os = &c->streams[st->index];
>  AVFormatContext *oc = os->ctx;
>  if (oc->oformat->check_bitstream) {
> +AVStream *const ost = oc->streams[0];
>  int ret;
>  AVPacket pkt = *avpkt;
>  pkt.stream_index = 0;
> -ret = oc->oformat->check_bitstream(oc, &pkt);
> +ret = oc->oformat->check_bitstream(oc, ost, &pkt);
>  if (ret == 1) {
> -FFStream *const  sti = ffstream(s->streams[avpkt->stream_index]);
> -FFStream *const osti = ffstream(oc->streams[0]);
> +FFStream *const  sti = ffstream(st);
> +FFStream *const osti = ffstream(ost);
>   sti->bsfc = osti->bsfc;
>  osti->bsfc = NULL;
>  }
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 3f24c7e192..c5926575a1 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -1083,10 +1083,10 @@ fail:
>  return ret;
>  }
>  
> -static int flv_check_bitstream(struct AVFormatContext *s, const AVPacket 
> *pkt)
> +static int flv_check_bitstream(AVFormatContext *s, AVStream *st,
> +   const AVPacket *pkt)
>  {
>  int ret = 1;
> -AVStream *st = s->streams[pkt->stream_index];
>  
>  if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
>  if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0)
> diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
> index 21bb614f67..72865c9565 100644
> --- a/libavformat/latmenc.c
> +++ b/libavformat/latmenc.c
> @@ -245,10 +245,10 @@ too_large:
>  return AVERROR_INVALIDDATA;
>  }
>  
> -static int latm_check_bitstream(struct AVFormatContext *s, const AVPacket 
> *pkt)
> +static int latm_check_bitstream(AVFormatContext *s, AVStream *st,
> +const AVPacket *pkt)
>  {
>  int ret = 1;
> -AVStream *st = s->streams[pkt->stream_index];
>  
>  if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
>  if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0)
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 6945c26f5a..f08ead0a96 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2731,10 +2731,10 @@ static int mkv_init(struct AVFormatContext *s)
>  return 0;
>  }
>  
> -static int mkv_check_bitstream(struct AVFormatContext *s, const AVPacket 
> *pkt)
> +static int mkv_check_bitstream(AVFormatContext *s, AVStream *st,
> +   const AVPacket *pkt)
>  {
>  int r

Re: [FFmpeg-devel] [PATCH 7/9] lavf/img2enc: avoid a useless copy of the url

2021-11-26 Thread Andreas Rheinhardt
Anton Khirnov:
> img2enc keeps a private (and possibly truncated) copy of the url that is
> never modified. Just use AVFormatContext.url instead.
> ---
>  libavformat/img2enc.c | 15 ++-
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
> index 62202de9f4..44895490e6 100644
> --- a/libavformat/img2enc.c
> +++ b/libavformat/img2enc.c
> @@ -36,7 +36,6 @@ typedef struct VideoMuxData {
>  const AVClass *class;  /**< Class for private options. */
>  int img_number;
>  int split_planes;   /**< use independent file for each Y, U, V plane 
> */
> -char path[1024];
>  char tmp[4][1024];
>  char target[4][1024];
>  int update;
> @@ -53,14 +52,12 @@ static int write_header(AVFormatContext *s)
>  AVStream *st = s->streams[0];
>  const AVPixFmtDescriptor *desc = 
> av_pix_fmt_desc_get(st->codecpar->format);
>  
> -av_strlcpy(img->path, s->url, sizeof(img->path));
> -
>  if (st->codecpar->codec_id == AV_CODEC_ID_GIF) {
>  img->muxer = "gif";
>  } else if (st->codecpar->codec_id == AV_CODEC_ID_FITS) {
>  img->muxer = "fits";
>  } else if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
> -const char *str = strrchr(img->path, '.');
> +const char *str = strrchr(s->url, '.');
>  img->split_planes = str
>   && !av_strcasecmp(str + 1, "y")
>   && s->nb_streams == 1
> @@ -136,29 +133,29 @@ static int write_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  AVDictionary *options = NULL;
>  
>  if (img->update) {
> -av_strlcpy(filename, img->path, sizeof(filename));
> +av_strlcpy(filename, s->url, sizeof(filename));
>  } else if (img->use_strftime) {
>  time_t now0;
>  struct tm *tm, tmpbuf;
>  time(&now0);
>  tm = localtime_r(&now0, &tmpbuf);
> -if (!strftime(filename, sizeof(filename), img->path, tm)) {
> +if (!strftime(filename, sizeof(filename), s->url, tm)) {
>  av_log(s, AV_LOG_ERROR, "Could not get frame filename with 
> strftime\n");
>  return AVERROR(EINVAL);
>  }
>  } else if (img->frame_pts) {
> -if (av_get_frame_filename2(filename, sizeof(filename), img->path, 
> pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
> +if (av_get_frame_filename2(filename, sizeof(filename), s->url, 
> pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
>  av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the 
> frames.");
>  return AVERROR(EINVAL);
>  }
> -} else if (av_get_frame_filename2(filename, sizeof(filename), img->path,
> +} else if (av_get_frame_filename2(filename, sizeof(filename), s->url,
>img->img_number,
>AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 
> &&
> img->img_number > 1) {
>  av_log(s, AV_LOG_ERROR,
> "Could not get frame filename number %d from pattern '%s'. "
> "Use '-frames:v 1' for a single image, or '-update' option, 
> or use a pattern such as %%03d within the filename.\n",
> -   img->img_number, img->path);
> +   img->img_number, s->url);
>  return AVERROR(EINVAL);
>  }
>  for (i = 0; i < 4; i++) {
> 

LGTM.

- 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 3/9] lavd/v4l2: reduce variable scope

2021-11-26 Thread Andreas Rheinhardt
Anton Khirnov:
> device and cap are local to the loop iteration, there is no need for
> them to retain their values. Especially for device it may be dangerous,
> since it points to av_malloc'ed data.
> ---
>  libavdevice/v4l2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index 777867db86..c286b31c69 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -1019,8 +1019,6 @@ static int v4l2_get_device_list(AVFormatContext *ctx, 
> AVDeviceInfoList *device_l
>  struct video_data *s = ctx->priv_data;
>  DIR *dir;
>  struct dirent *entry;
> -AVDeviceInfo *device = NULL;
> -struct v4l2_capability cap;
>  int ret = 0;
>  
>  if (!device_list)
> @@ -1033,6 +1031,8 @@ static int v4l2_get_device_list(AVFormatContext *ctx, 
> AVDeviceInfoList *device_l
>  return ret;
>  }
>  while ((entry = readdir(dir))) {
> +AVDeviceInfo *device = NULL;
> +struct v4l2_capability cap;
>  int fd = -1;
>  char device_name[256];
>  
> 

LGTM.

- 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 2/9] lavf/v4l2: do not use a context variable unnecessarily

2021-11-26 Thread Andreas Rheinhardt
Anton Khirnov:
> fd is local to the loop iteration, it is better to store it on stack
> than modify the context.
> ---
>  libavdevice/v4l2.c | 13 ++---
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index b5997fba33..777867db86 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -1033,16 +1033,17 @@ static int v4l2_get_device_list(AVFormatContext *ctx, 
> AVDeviceInfoList *device_l
>  return ret;
>  }
>  while ((entry = readdir(dir))) {
> +int fd = -1;
>  char device_name[256];
>  
>  if (!v4l2_is_v4l_dev(entry->d_name))
>  continue;
>  
>  snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
> -if ((s->fd = device_open(ctx, device_name)) < 0)
> +if ((fd = device_open(ctx, device_name)) < 0)
>  continue;
>  
> -if (v4l2_ioctl(s->fd, VIDIOC_QUERYCAP, &cap) < 0) {
> +if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0) {
>  ret = AVERROR(errno);
>  av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", 
> av_err2str(ret));
>  goto fail;
> @@ -1064,8 +1065,7 @@ static int v4l2_get_device_list(AVFormatContext *ctx, 
> AVDeviceInfoList *device_l
>&device_list->nb_devices, device)) 
> < 0)
>  goto fail;
>  
> -v4l2_close(s->fd);
> -s->fd = -1;
> +v4l2_close(fd);
>  continue;
>  
>fail:
> @@ -1074,9 +1074,8 @@ static int v4l2_get_device_list(AVFormatContext *ctx, 
> AVDeviceInfoList *device_l
>  av_freep(&device->device_description);
>  av_freep(&device);
>  }
> -if (s->fd >= 0)
> -v4l2_close(s->fd);
> -s->fd = -1;
> +if (fd >= 0)

This checks is unnecessary: One only goes to fail after the device has
been successfully opened.

> +v4l2_close(fd);
>  break;
>  }
>  closedir(dir);
> 

1. Commit title is wrong: This is lavd.
2. Given that there is no equivalent of avformat_alloc_output_context2()
one has to use avformat_open_input() to use avdevice_list_devices().
This means that it is possible for read_header to have been called
before v4l2_get_device_list() and in this case this commit fixes a file
descriptor leak; it also avoids closing an invalid (-1) file descriptor
v4l2_read_close(). This should be mentioned in the commit message; in
fact, this is the main advantage of this commit.
(I have not checked what would have happened had I actually used this
context with the invalid file descriptor afterwards to read data.)

- 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] avformat/scd: add demuxer

2021-11-26 Thread Andreas Rheinhardt
Zane van Iperen:
> 
> 
> On 27/11/21 01:32, Andreas Rheinhardt wrote:
>> Zane van Iperen:
>>> +
>>> +static int scd_seek(AVFormatContext *s, int stream_index,
>>> +    int64_t pts, int flags)
>>> +{
>>> +    SCDDemuxContext *ctx = s->priv_data;
>>> +    SCDTrackHeader  *trk = ctx->tracks + stream_index;
>>> +
>>> +    if (pts != 0)
>>> +    return AVERROR(EINVAL);
>>> +
>>> +    trk->bytes_read = 0;
>>
>> You are only resetting the one track that the user explicitly specified.
>> This is not in line with how this flag is generally understood.
>>
> 
> How it it meant to be understood? Do I reset the entire file, regardless
> of what's in stream_index?
> 

Yes. You only use stream_index to know what timebase pts is in and to
know which streams' keyframes to use when seeking is done by keyframes.

- 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] [PATCH] fate: Add regression tests for AVDOVIDecoderConfigurationRecord side data

2021-11-26 Thread quietvoid
Signed-off-by: quietvoid 
---
Files are available here: 
https://drive.google.com/drive/folders/1NDhtSoJ-mP5Yi62V6j1wjjPJNq84nP3J

They're all blank frames encoded with x265, remuxed with FFmpeg
after the mov box is added by dlb_mp4base.

Let me know if the hosting is not appropriate.
I thought it was better than zipping everything.
---
 tests/fate/mov.mak | 17 
 tests/fate/mpegts.mak  |  2 +
 tests/ref/fate/mov-dovi-config-profile5| 13 ++
 tests/ref/fate/mov-dovi-config-profile7| 15 +++
 tests/ref/fate/mov-dovi-config-profile81   | 13 ++
 tests/ref/fate/mov-dovi-config-profile84   | 22 ++
 tests/ref/fate/mov-dovi-write-config   | 49 ++
 tests/ref/fate/mpegts-dovi-config-profile7 | 15 +++
 8 files changed, 146 insertions(+)
 create mode 100644 tests/ref/fate/mov-dovi-config-profile5
 create mode 100644 tests/ref/fate/mov-dovi-config-profile7
 create mode 100644 tests/ref/fate/mov-dovi-config-profile81
 create mode 100644 tests/ref/fate/mov-dovi-config-profile84
 create mode 100644 tests/ref/fate/mov-dovi-write-config
 create mode 100644 tests/ref/fate/mpegts-dovi-config-profile7

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 5ca992e181..8ef7cb1edf 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -145,6 +145,23 @@ FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL 
PIPE_PROTOCOL \
   += fate-mov-mp4-disposition-mpegts-remux
 fate-mov-mp4-disposition-mpegts-remux: CMD = transcode mpegts 
$(TARGET_SAMPLES)/mpegts/pmtchange.ts mp4 "-map 0:1 -map 0:2 -c copy 
-disposition:a:0 +hearing_impaired" "-map 0 -c copy" "" "-of json -show_entries 
stream_disposition:stream=index"
 
+# Tests for AVDOVIDecoderConfigurationRecord parsing in mov
+FATE_MOV_FFMPEG_FFPROBE-$(call DEMDEC, MOV) \
+  += fate-mov-dovi-config-profile5 \
+ fate-mov-dovi-config-profile7 \
+ fate-mov-dovi-config-profile81 \
+ fate-mov-dovi-config-profile84
+fate-mov-dovi-config-profile5: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/mov/dovi-p5.mp4
+fate-mov-dovi-config-profile7: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/mov/dovi-p7.mp4
+fate-mov-dovi-config-profile81: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/mov/dovi-p81.mp4
+fate-mov-dovi-config-profile84: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/hevc/dv84.mov
+
+FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \
+   MPEGTS_DEMUXER MOV_DEMUXER \
+   MP4_MUXER FRAMECRC_MUXER) \
+  += fate-mov-dovi-write-config
+fate-mov-dovi-write-config: CMD = transcode mpegts 
$(TARGET_SAMPLES)/mpegts/dovi-p7.ts mp4 "-map 0:0 -map 0:1 -c copy -strict 
unofficial" "-map 0 -c copy" "" "-show_entries stream_side_data_list 
-select_streams v -v 0"
+
 FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MOV_FFMPEG_FFPROBE-yes)
 
 fate-mov: $(FATE_MOV) $(FATE_MOV_FFPROBE) $(FATE_MOV_FASTSTART) 
$(FATE_MOV_FFMPEG_FFPROBE-yes)
diff --git a/tests/fate/mpegts.mak b/tests/fate/mpegts.mak
index bbcbfc47b2..1ee44ff2a0 100644
--- a/tests/fate/mpegts.mak
+++ b/tests/fate/mpegts.mak
@@ -19,6 +19,8 @@ FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS) += 
fate-mpegts-probe-pmt-merge
 fate-mpegts-probe-pmt-merge: SRC = $(TARGET_SAMPLES)/mpegts/pmtchange.ts
 fate-mpegts-probe-pmt-merge: CMD = run $(PROBE_CODEC_NAME_COMMAND) 
-merge_pmt_versions 1 -i "$(SRC)"
 
+FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS) += fate-mpegts-dovi-config-profile7
+fate-mpegts-dovi-config-profile7: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/mpegts/dovi-p7.ts
 
 FATE_SAMPLES_FFPROBE += $(FATE_MPEGTS_PROBE-yes)
 
diff --git a/tests/ref/fate/mov-dovi-config-profile5 
b/tests/ref/fate/mov-dovi-config-profile5
new file mode 100644
index 00..a27976b71a
--- /dev/null
+++ b/tests/ref/fate/mov-dovi-config-profile5
@@ -0,0 +1,13 @@
+[STREAM]
+[SIDE_DATA]
+side_data_type=DOVI configuration record
+dv_version_major=1
+dv_version_minor=0
+dv_profile=5
+dv_level=4
+rpu_present_flag=1
+el_present_flag=0
+bl_present_flag=1
+dv_bl_signal_compatibility_id=0
+[/SIDE_DATA]
+[/STREAM]
diff --git a/tests/ref/fate/mov-dovi-config-profile7 
b/tests/ref/fate/mov-dovi-config-profile7
new file mode 100644
index 00..1d8a4b6828
--- /dev/null
+++ b/tests/ref/fate/mov-dovi-config-profile7
@@ -0,0 +1,15 @@
+[STREAM]
+[/STREAM]
+[STREAM]
+[SIDE_DATA]
+side_data_type=DOVI configuration record
+dv_version_major=1
+dv_version_minor=0
+dv_profile=7
+dv_level=4
+rpu_pre

Re: [FFmpeg-devel] [PATCH] avformat/scd: add demuxer

2021-11-26 Thread Zane van Iperen




On 27/11/21 01:32, Andreas Rheinhardt wrote:

Zane van Iperen:

+
+static int scd_seek(AVFormatContext *s, int stream_index,
+int64_t pts, int flags)
+{
+SCDDemuxContext *ctx = s->priv_data;
+SCDTrackHeader  *trk = ctx->tracks + stream_index;
+
+if (pts != 0)
+return AVERROR(EINVAL);
+
+trk->bytes_read = 0;


You are only resetting the one track that the user explicitly specified.
This is not in line with how this flag is generally understood.



How it it meant to be understood? Do I reset the entire file, regardless
of what's in stream_index?



+return 0;
+
+}


Weird empty lines.



Fixed, my bad.

___
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 v16 01/16] global: Prepare AVFrame for subtitle handling

2021-11-26 Thread Anton Khirnov
You have completely disregarded my comments on the previous patch. Stop
doing that, it is rude.

Your patchset is unacceptable until you deal with them.

-- 
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 v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

2021-11-26 Thread Anton Khirnov
Quoting Soft Works (2021-11-25 18:02:54)
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Anton
> > Khirnov
> > Sent: Thursday, November 25, 2021 5:40 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving 
> > a
> > hwdevice, search for existing device in both directions
> > 
> > Quoting Soft Works (2021-11-25 03:41:32)
> > > @@ -687,6 +720,11 @@ int av_hwdevice_ctx_create_derived_opts(AVBufferRef
> > **dst_ref_ptr,
> > >  ret = AVERROR(ENOMEM);
> > >  goto fail;
> > >  }
> > > +tmp_ctx->internal->derived_devices[type] =
> > av_buffer_ref(dst_ref);
> > > +if (!tmp_ctx->internal->derived_devices[type]) {
> > > +ret = AVERROR(ENOMEM);
> > > +goto fail;
> > > +}
> > 
> > This means that once you derive a device of a certain type, you can
> > never truly close it without also killing the parent device. That
> > strikes me as
> > - potentially troublesome
> > - a behavior change
> > 
> > Also, I don't see it as completely obvious that all derivations should
> > always return the same child instance.
> 
> 
> It creates the behavior that everybody wants and expects who is working 
> with HW devices derivation.

What qualifies you to speak for "everybody"? I would expect to hear some
practical arguments for such a strong claim.

-- 
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 v15 01/16] global: Prepare AVFrame for subtitle handling

2021-11-26 Thread Anton Khirnov
Quoting Soft Works (2021-11-25 18:20:31)
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Anton
> > Khirnov
> > Sent: Thursday, November 25, 2021 4:56 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v15 01/16] global: Prepare AVFrame for
> > subtitle handling
> > 
> > Quoting Soft Works (2021-11-25 01:48:11)
> > > Root commit for adding subtitle filtering capabilities.
> > > In detail:
> > >
> > > - Add type (AVMediaType) field to AVFrame
> > >   Replaces previous way of distinction which was based on checking
> > >   width and height to determine whether a frame is audio or video
> > > - Add subtitle fields to AVFrame
> > > - Add new struct AVSubtitleArea, similar to AVSubtitleRect, but different
> > >   allocation logic. Cannot and must not be used interchangeably, hence
> > >   the new struct
> > > - Move enum AVSubtitleType, AVSubtitle and AVSubtitleRect to avutil
> > > - Add public-named members to enum AVSubtitleType (AV_SUBTITLE_FMT_)
> > > - Add avcodec_decode_subtitle3 which takes subtitle frames,
> > >   serving as compatibility shim to legacy subtitle decoding
> > > - Add additional methods for conversion between old and new API
> > >
> > > Signed-off-by: softworkz 
> > > ---
> > >  libavcodec/avcodec.c   |  19 ---
> > >  libavcodec/avcodec.h   |  75 ++--
> > >  libavcodec/decode.c|  53 ++--
> > >  libavcodec/pgssubdec.c |   1 +
> > >  libavcodec/utils.c |  11 ++
> > >  libavfilter/vf_subtitles.c |  50 ++--
> > >  libavformat/utils.c|   1 +
> > >  libavutil/Makefile |   2 +
> > >  libavutil/frame.c  | 194 ++---
> > >  libavutil/frame.h  |  93 +-
> > >  libavutil/subfmt.c | 243 +
> > >  libavutil/subfmt.h | 185 
> > >  12 files changed, 802 insertions(+), 125 deletions(-)
> > >  create mode 100644 libavutil/subfmt.c
> > >  create mode 100644 libavutil/subfmt.h
> > 
> > First of all, this should be split. It does way way more than just
> > "prepare AVFrame". It adds random things all over the place, some of
> > them completely spurious (like the single include in pgssubdec).
> 
> 
> I double-checked. It cannot be split without breaking compilation.

This cannot be true. And if you really want to claim that it is, you
better present some arguments.

At the very least, adding new functions and AVFrame fields cannot affect
any other code and can be done in its own patch. I'm pretty sure other
things can be split as well.

-- 
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 v16 15/16] avcodec/subtitles: Migrate subtitle encoders to frame-based API and provide a compatibility shim for the legacy api

2021-11-26 Thread Hendrik Leppkes
On Fri, Nov 26, 2021 at 4:09 PM Andreas Rheinhardt
 wrote:
>
> Soft Works:
> > Also introduce deferred loading of ass headers for all cases where it can't 
> > be taken from the context of a decoder.
>
> This should be a commit of its own.
>
> >
> > Signed-off-by: softworkz 
> > ---
> >  libavcodec/assenc.c|  81 -
> >  libavcodec/avcodec.h   |   7 +++
> >  libavcodec/dvbsubenc.c |  85 +++---
> >  libavcodec/dvdsubenc.c |  89 +---
> >  libavcodec/encode.c|  98 ++-
> >  libavcodec/movtextenc.c| 103 +
> >  libavcodec/srtenc.c|  96 ++
> >  libavcodec/tests/avcodec.c |   2 -
> >  libavcodec/ttmlenc.c   |  82 +++--
> >  libavcodec/webvttenc.c |  73 +++---
> >  libavcodec/xsubenc.c   |  65 ---
> >  11 files changed, 541 insertions(+), 240 deletions(-)
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 0c5819b116..304b35ba86 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -2949,10 +2949,17 @@ void av_parser_close(AVCodecParserContext *s);
> >   * @{
> >   */
> >
> > + /**
> > +  * @deprecated Use @ref avcodec_encode_subtitle2() instead.
> > +  */
> > +attribute_deprecated
> >  int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int 
> > buf_size,
> >  const AVSubtitle *sub);
> >
> >
> > +int avcodec_encode_subtitle2(AVCodecContext* avctx, struct AVPacket* avpkt,
> > +AVFrame* frame, int* got_packet);
> > +
>
> Missing documentation. The signature and the implementation shows that
> you have recreated the old encode API avcodec_encode_(audio2|video2)
> with the difference that you (like the current subtitle API) require
> preallocated (not necessarily refcounted) buffers in avpkt. Why not use
> the ordinary encode API?

I concur on that question. We have a generic encode/decode API without
dependency on any media type, that should be used going forward for
all media types, and not anything else being introduced now.

- 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 1/9] lavd/jack: increase buffer size for snprintf()

2021-11-26 Thread Andreas Rheinhardt
Anton Khirnov:
> Maximum output size with a 32-bit int is 17 bytes, or 26 with a 64-bit
> int.
> 
> Silences the following gcc 10 warning:
> src/libavdevice/jack.c: In function ‘audio_read_header’:
> src/libavdevice/jack.c:171:45: warning: ‘snprintf’ output may be truncated 
> before the last format character [-Wformat-truncation=]
>   171 | snprintf(str, sizeof(str), "input_%d", i + 1);
>   | ^
> src/libavdevice/jack.c:171:9: note: ‘snprintf’ output between 8 and 17 bytes 
> into a destination of size 16
>   171 | snprintf(str, sizeof(str), "input_%d", i + 1);
>   | ^
> ---
>  libavdevice/jack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavdevice/jack.c b/libavdevice/jack.c
> index 31534134f3..0d5465e407 100644
> --- a/libavdevice/jack.c
> +++ b/libavdevice/jack.c
> @@ -167,7 +167,7 @@ static int start_jack(AVFormatContext *context)
>  
>  /* Register JACK ports */
>  for (i = 0; i < self->nports; i++) {
> -char str[16];
> +char str[32];
>  snprintf(str, sizeof(str), "input_%d", i + 1);
>  self->ports[i] = jack_port_register(self->client, str,
>  JACK_DEFAULT_AUDIO_TYPE,
> 

LGTM.

- 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] avformat/scd: add demuxer

2021-11-26 Thread Andreas Rheinhardt
Zane van Iperen:
> +
> +static int scd_seek(AVFormatContext *s, int stream_index,
> +int64_t pts, int flags)
> +{
> +SCDDemuxContext *ctx = s->priv_data;
> +SCDTrackHeader  *trk = ctx->tracks + stream_index;
> +
> +if (pts != 0)
> +return AVERROR(EINVAL);
> +
> +trk->bytes_read = 0;

You are only resetting the one track that the user explicitly specified.
This is not in line with how this flag is generally understood.

> +return 0;
> +
> +}

Weird empty lines.

> +static int scd_read_close(AVFormatContext *s)
> +{
> +SCDDemuxContext *ctx = s->priv_data;
> +
> +av_freep(&ctx->hdr.table0.entries);
> +av_freep(&ctx->hdr.table1.entries);
> +av_freep(&ctx->hdr.table2.entries);
> +av_freep(&ctx->tracks);
> +return 0;
> +}
> +
> +const AVInputFormat ff_scd_demuxer = {
> +.name   = "scd",
> +.long_name  = NULL_IF_CONFIG_SMALL("Square Enix SCD"),
> +.priv_data_size = sizeof(SCDDemuxContext),
> +.flags_internal = FF_FMT_INIT_CLEANUP,
> +.read_probe = scd_probe,
> +.read_header= scd_read_header,
> +.read_packet= scd_read_packet,
> +.read_seek  = scd_seek,
> +.read_close = scd_read_close,
> +};
> 

___
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 v16 15/16] avcodec/subtitles: Migrate subtitle encoders to frame-based API and provide a compatibility shim for the legacy api

2021-11-26 Thread Andreas Rheinhardt
Soft Works:
> Also introduce deferred loading of ass headers for all cases where it can't 
> be taken from the context of a decoder.

This should be a commit of its own.

> 
> Signed-off-by: softworkz 
> ---
>  libavcodec/assenc.c|  81 -
>  libavcodec/avcodec.h   |   7 +++
>  libavcodec/dvbsubenc.c |  85 +++---
>  libavcodec/dvdsubenc.c |  89 +---
>  libavcodec/encode.c|  98 ++-
>  libavcodec/movtextenc.c| 103 +
>  libavcodec/srtenc.c|  96 ++
>  libavcodec/tests/avcodec.c |   2 -
>  libavcodec/ttmlenc.c   |  82 +++--
>  libavcodec/webvttenc.c |  73 +++---
>  libavcodec/xsubenc.c   |  65 ---
>  11 files changed, 541 insertions(+), 240 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 0c5819b116..304b35ba86 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2949,10 +2949,17 @@ void av_parser_close(AVCodecParserContext *s);
>   * @{
>   */
>  
> + /**
> +  * @deprecated Use @ref avcodec_encode_subtitle2() instead.
> +  */
> +attribute_deprecated
>  int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int 
> buf_size,
>  const AVSubtitle *sub);
>  
>  
> +int avcodec_encode_subtitle2(AVCodecContext* avctx, struct AVPacket* avpkt,
> +AVFrame* frame, int* got_packet);
> +

Missing documentation. The signature and the implementation shows that
you have recreated the old encode API avcodec_encode_(audio2|video2)
with the difference that you (like the current subtitle API) require
preallocated (not necessarily refcounted) buffers in avpkt. Why not use
the ordinary encode API?
(Why is frame not const?)
Apart from that: You never zero the packet padding. I don't even know
whether you expect the buffer to be padded.

>  /**
>   * @}
>   */
> diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
> index ff4fbed39d..74fefe5664 100644
> --- a/libavcodec/dvdsubenc.c
> +++ b/libavcodec/dvdsubenc.c
> @@ -114,15 +114,14 @@ static int color_distance(uint32_t a, uint32_t b)
>   * Count colors used in a rectangle, quantizing alpha and grouping by
>   * nearest global palette entry.
>   */
> -static void count_colors(AVCodecContext *avctx, unsigned hits[33],
> - const AVSubtitleRect *r)
> +static void count_colors(const AVCodecContext *avctx, unsigned hits[33],
> + const AVSubtitleArea *r)
>  {
>  DVDSubtitleContext *dvdc = avctx->priv_data;
>  unsigned count[256] = { 0 };
> -uint32_t *palette = (uint32_t *)r->data[1];
>  uint32_t color;
>  int x, y, i, j, match, d, best_d, av_uninit(best_j);
> -uint8_t *p = r->data[0];
> +uint8_t *p = r->buf[0]->data;
>  
>  for (y = 0; y < r->h; y++) {
>  for (x = 0; x < r->w; x++)
> @@ -132,7 +131,7 @@ static void count_colors(AVCodecContext *avctx, unsigned 
> hits[33],
>  for (i = 0; i < 256; i++) {
>  if (!count[i]) /* avoid useless search */
>  continue;
> -color = palette[i];
> +color = r->pal[i];
>  /* 0: transparent, 1-16: semi-transparent, 17-33 opaque */
>  match = color < 0x3300 ? 0 : color < 0xCC00 ? 1 : 17;
>  if (match) {
> @@ -232,13 +231,13 @@ static void build_color_map(AVCodecContext *avctx, int 
> cmap[],
>  }
>  }
>  
> -static void copy_rectangle(AVSubtitleRect *dst, AVSubtitleRect *src, int 
> cmap[])
> +static void copy_rectangle(AVSubtitleArea*dst, AVSubtitleArea *src, int 
> cmap[])
>  {
>  int x, y;
>  uint8_t *p, *q;
>  
> -p = src->data[0];
> -q = dst->data[0] + (src->x - dst->x) +
> +p = src->buf[0]->data;
> +q = dst->buf[0]->data + (src->x - dst->x) +
>  (src->y - dst->y) * dst->linesize[0];
>  for (y = 0; y < src->h; y++) {
>  for (x = 0; x < src->w; x++)
> @@ -248,51 +247,56 @@ static void copy_rectangle(AVSubtitleRect *dst, 
> AVSubtitleRect *src, int cmap[])
>  }
>  }
>  
> -static int encode_dvd_subtitles(AVCodecContext *avctx,
> -uint8_t *outbuf, int outbuf_size,
> -const AVSubtitle *h)
> +static int encode_dvd_subtitles(AVCodecContext* avctx, AVPacket* avpkt,
> +const AVFrame* frame, int* got_packet)
>  {
>  DVDSubtitleContext *dvdc = avctx->priv_data;
>  uint8_t *q, *qq;
>  int offset1, offset2;
> -int i, rects = h->num_rects, ret;
> +int ret = 0;
> +unsigned i, rects = frame->num_subtitle_areas;
>  unsigned global_palette_hits[33] = { 0 };
>  int cmap[256];
>  int out_palette[4];
>  int out_alpha[4];
> -AVSubtitleRect vrect;
> -uint8_t *vrect_data = NULL;
> +AVSubtitleArea vrect;

Ok, seems

Re: [FFmpeg-devel] [PATCH v16 09/16] avfilter/overlaytextsubs: Add overlaytextsubs and textsubs2video filters

2021-11-26 Thread Andreas Rheinhardt
Soft Works:
> - overlaytextsubs {VS -> V)
>   Overlay text subtitles onto a video stream.
> 
> - textsubs2video {S -> V)
>   Converts text subtitles to video frames
> 
> Signed-off-by: softworkz 
> ---
>  configure|   2 +
>  doc/filters.texi | 113 ++
>  libavfilter/Makefile |   2 +
>  libavfilter/allfilters.c |   4 +-
>  libavfilter/avfilter.c   |  18 +-
>  libavfilter/vf_overlaytextsubs.c | 624 +++

Changes to the framework and modifying/adding a filter should not be
done in the same commit.

>  6 files changed, 757 insertions(+), 6 deletions(-)
>  create mode 100644 libavfilter/vf_overlaytextsubs.c
> 
> diff --git a/configure b/configure
> index e4d1443237..db1db0a0a6 100755
> --- a/configure
> +++ b/configure
> @@ -3642,6 +3642,7 @@ overlay_opencl_filter_deps="opencl"
>  overlay_qsv_filter_deps="libmfx"
>  overlay_qsv_filter_select="qsvvpp"
>  overlay_vulkan_filter_deps="vulkan spirv_compiler"
> +overlaytextsubs_filter_deps="avcodec libass"
>  owdenoise_filter_deps="gpl"
>  pad_opencl_filter_deps="opencl"
>  pan_filter_deps="swresample"
> @@ -3686,6 +3687,7 @@ superequalizer_filter_deps="avcodec"
>  superequalizer_filter_select="rdft"
>  surround_filter_deps="avcodec"
>  surround_filter_select="rdft"
> +textsub2video_filter_deps="avcodec libass"
>  tinterlace_filter_deps="gpl"
>  tinterlace_merge_test_deps="tinterlace_filter"
>  tinterlace_pad_test_deps="tinterlace_filter"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index dcbe718664..fedd907185 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -25659,6 +25659,119 @@ Overlay PGS subtitles
>  ffmpeg -i 
> "https://streams.videolan.org/samples/sub/PGS/Girl_With_The_Dragon_Tattoo_2%3A23%3A56.mkv";
>  -filter_complex "[0:0][0:1]overlaygraphicsubs" output.mp4
>  @end example
>  @end itemize
> +
> +@section overlaytextsubs
> +
> +Overlay text subtitles onto a video stream.
> +
> +This filter supersedes the classic @ref{subtitles} filter opposed to which 
> it does no longer require to open and access the source stream separately, 
> which is often causing problems or doesn't even work for non-local or slow 
> sources.
> +
> +Inputs:
> +@itemize
> +@item 0: Video [YUV420P, YUV422P, YUV444P, ARGB, RGBA, ABGR, BGRA, RGB24, 
> BGR24]
> +@item 1: Subtitles [TEXT]
> +@end itemize
> +
> +Outputs:
> +@itemize
> +@item 0: Video (same as input)
> +@end itemize
> +
> +It accepts the following parameters:
> +
> +@table @option
> +
> +@item alpha
> +Process alpha channel, by default alpha channel is untouched.
> +
> +@item fonts_dir
> +Set a directory path containing fonts that can be used by the filter.
> +These fonts will be used in addition to whatever the font provider uses.
> +
> +@item default_font_path
> +Path to a font file to be used as the default font.
> +
> +@item font_size
> +Set the default font size.
> +
> +@item fontconfig_file
> +Path to ASS fontconfig configuration file.
> +
> +@item force_style
> +Override default style or script info parameters of the subtitles. It 
> accepts a
> +string containing ASS style format @code{KEY=VALUE} couples separated by ",".
> +
> +@item margin
> +Set the rendering margin in pixels.
> +
> +@item render_latest_only
> +For rendering, alway use the latest event only, which is covering the given 
> point in time
> +@end table
> +
> +@subsection Examples
> +
> +@itemize
> +@item
> +Overlay ASS subtitles with animations:
> +@example
> +ffmpeg -i 
> "http://streams.videolan.org/samples/sub/SSA/subtitle_testing_complex.mkv"; 
> -filter_complex "[0:v]overlaytextsubs" -map 0 -y out.mkv
> +@end example
> +@end itemize
> +
> +@section textsub2video
> +
> +Converts text subtitles to video frames.
> +
> +For overlaying text subtitles onto video frames it is recommended to use the 
> overlay_textsubs filter.
> +The textsub2video is useful for for creating transparent text-frames when 
> overlay is done via hw acceleration
> +
> +Inputs:
> +@itemize
> +@item 0: Subtitles [TEXT]
> +@end itemize
> +
> +Outputs:
> +@itemize
> +@item 0: Video [RGB32]
> +@end itemize
> +
> +It accepts the following parameters:
> +
> +@table @option
> +
> +@item rate, r
> +Set the framerate for updating overlay frames.
> +Normally, overlay frames will only be updated each time when the subtitles 
> to display are changing.
> +In cases where subtitles include advanced features (like animation), this 
> parameter determines the frequency by which the overlay frames should be 
> updated.
> +
> +@item size, s
> +Set the output frame size.
> +Allows to override the size of output video frames.
> +
> +@item fonts_dir
> +Set a directory path containing fonts that can be used by the filter.
> +These fonts will be used in addition to whatever the font provider uses.
> +
> +@item default_font_path
> +Path to a font file to be used as the default font.
> +
> +@item font_size
> +Set the default font size.
> +
> +@item fontconfig_file
> +Path to ASS fon

[FFmpeg-devel] [PATCH] configure: Include -fPIC also in the LDFLAGS

2021-11-26 Thread Cristian Morales Vega
The same flags should be used when linking than when compiling.
Without this actual errors have been observed when using LTO.
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index e6cee21142..97c51f20a7 100755
--- a/configure
+++ b/configure
@@ -5805,6 +5805,7 @@ enable_weak_pic() {
 *)
 add_cflags -fPIC
 add_asflags -fPIC
+add_ldflags -fPIC
 ;;
 esac
 }
-- 
2.33.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 v16 08/16] fftools/ffmpeg: Replace sub2video with subtitle frame filtering

2021-11-26 Thread Andreas Rheinhardt
Soft Works:
> This commit actually enables subtitle filtering in ffmpeg by
> sending and receiving subtitle frames to and from a filtergraph.
> 
> The heartbeat functionality from the previous sub2video implementation
> is retained and applied to all subtitle frames (bitmap, text, ..).
> 
> The other part of sub2video functionality is retained by
> auto-insertion of the new graphicsub2video filter.
> 
> Justification for changed test refs:
> 
> - sub2video
>   The new results are identical excepting the last frame which
>   is due to the implementation changes
> 
> - sub2video_basic
>   The previous results had some incorrect output because multiple
>   frames had the same dts
>   The non-empty content frames are visually identical, the different
>   CRC is due to the different blending algorithm that is being used.
> 
> - sub2video_time_limited
>   The third frame in the previous ref was a repetition, which doesn't
>   happen anymore with the new subtitle filtering.
> 
> - sub-dvb
>   Running ffprobe -show_frames on the source file shows that there
>   are 7 subtitle frames with 0 rects in the source at the start
>   and 2 at the end. This translates to the 14 and 4 additional
>   entries in the new test results.
> 
> - filter-overlay-dvdsub-2397
>   Overlay results have slightly different CRCs due to different
>   blending implementation
> 
> Signed-off-by: softworkz 
> ---
>  fftools/ffmpeg.c  | 523 +++---
>  fftools/ffmpeg.h  |  15 +-
>  fftools/ffmpeg_filter.c   | 217 ++---
>  fftools/ffmpeg_hw.c   |   2 +-
>  fftools/ffmpeg_opt.c  |   3 +-
>  tests/ref/fate/filter-overlay-dvdsub-2397 | 181 
>  tests/ref/fate/sub-dvb| 162 ---
>  tests/ref/fate/sub2video  | 116 ++---
>  tests/ref/fate/sub2video_basic| 135 ++
>  tests/ref/fate/sub2video_time_limited |   4 +-
>  10 files changed, 684 insertions(+), 674 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 3761ea0c38..c697c12777 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -169,163 +169,6 @@ static int restore_tty;
>  static void free_input_threads(void);
>  #endif
>  
> -/* sub2video hack:
> -   Convert subtitles to video with alpha to insert them in filter graphs.
> -   This is a temporary solution until libavfilter gets real subtitles 
> support.
> - */
> -
> -static int sub2video_get_blank_frame(InputStream *ist)
> -{
> -int ret;
> -AVFrame *frame = ist->sub2video.frame;
> -
> -av_frame_unref(frame);
> -ist->sub2video.frame->width  = ist->dec_ctx->width  ? 
> ist->dec_ctx->width  : ist->sub2video.w;
> -ist->sub2video.frame->height = ist->dec_ctx->height ? 
> ist->dec_ctx->height : ist->sub2video.h;
> -ist->sub2video.frame->format = AV_PIX_FMT_RGB32;
> -if ((ret = av_frame_get_buffer(frame, 0)) < 0)
> -return ret;
> -memset(frame->data[0], 0, frame->height * frame->linesize[0]);
> -return 0;
> -}
> -
> -static void sub2video_copy_rect(uint8_t *dst, int dst_linesize, int w, int h,
> -AVSubtitleRect *r)
> -{
> -uint32_t *pal, *dst2;
> -uint8_t *src, *src2;
> -int x, y;
> -
> -if (r->type != SUBTITLE_BITMAP) {
> -av_log(NULL, AV_LOG_WARNING, "sub2video: non-bitmap subtitle\n");
> -return;
> -}
> -if (r->x < 0 || r->x + r->w > w || r->y < 0 || r->y + r->h > h) {
> -av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle (%d %d %d %d) 
> overflowing %d %d\n",
> -r->x, r->y, r->w, r->h, w, h
> -);
> -return;
> -}
> -
> -dst += r->y * dst_linesize + r->x * 4;
> -src = r->data[0];
> -pal = (uint32_t *)r->data[1];
> -for (y = 0; y < r->h; y++) {
> -dst2 = (uint32_t *)dst;
> -src2 = src;
> -for (x = 0; x < r->w; x++)
> -*(dst2++) = pal[*(src2++)];
> -dst += dst_linesize;
> -src += r->linesize[0];
> -}
> -}
> -
> -static void sub2video_push_ref(InputStream *ist, int64_t pts)
> -{
> -AVFrame *frame = ist->sub2video.frame;
> -int i;
> -int ret;
> -
> -av_assert1(frame->data[0]);
> -ist->sub2video.last_pts = frame->pts = pts;
> -for (i = 0; i < ist->nb_filters; i++) {
> -ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
> -   AV_BUFFERSRC_FLAG_KEEP_REF |
> -   AV_BUFFERSRC_FLAG_PUSH);
> -if (ret != AVERROR_EOF && ret < 0)
> -av_log(NULL, AV_LOG_WARNING, "Error while add the frame to 
> buffer source(%s).\n",
> -   av_err2str(ret));
> -}
> -}
> -
> -void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle 
> *sub)
> -{
> -AVFrame *frame = ist->sub2video.frame;
> -int8_t *dst;
> -int dst_linesize;
> -int num_rects, i;
> -

Re: [FFmpeg-devel] [PATCH v2] avformat/rtp: add localaddr for network interface selection

2021-11-26 Thread lance . lmwang
On Fri, Nov 26, 2021 at 01:50:33PM +0200, Martin Storsjö wrote:
> On Fri, 26 Nov 2021, lance.lmw...@gmail.com wrote:
> 
> > From: Limin Wang 
> > 
> > Reviewed-by: Martin Storsjö 
> 
> Technically, I haven't reviewed this version yet - including such a header
> would indicate that I have approvd it, which I haven't.

Sorry, at first, I update by suggestion completely so I think it's fine by you.
After adding, I think it should be OK for rtp options, so I add some code and
forget to remove the Reviewed.

> 
> Although in practice, this version looks fine to me, so yeah I'm ok with
> this.
> 
> // Martin


-- 
Thanks,
Limin Wang
___
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] avfilter/src_movie: add format_opts for the opened file

2021-11-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 doc/filters.texi| 9 +
 libavfilter/src_movie.c | 4 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 3731a14..3b70aca 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -28395,6 +28395,15 @@ timestamps.
 
 @item dec_threads
 Specifies the number of threads for decoding
+
+@item format_opts
+Specify format options for the opened file. Format options can be specified
+as a list of @var{key}=@var{value} pairs separated by ':'. The following 
example
+shows how to add protocol_whitelist and protocol_blacklist options:
+@example
+./ffplay -f lavfi
+"movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
+@end example
 @end table
 
 It allows overlaying a second video on top of the main input of
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 220a43c..b89a680 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -74,6 +74,7 @@ typedef struct MovieContext {
 int max_stream_index; /**< max stream # actually used for output */
 MovieStream *st; /**< array of all streams, one per output */
 int *out_index; /**< stream number -> output number map, or -1 */
+AVDictionary *format_opts;
 } MovieContext;
 
 #define OFFSET(x) offsetof(MovieContext, x)
@@ -92,6 +93,7 @@ static const AVOption movie_options[]= {
 { "loop", "set loop count",  OFFSET(loop_count),   
AV_OPT_TYPE_INT,{.i64 =  1},  0,INT_MAX, FLAGS },
 { "discontinuity", "set discontinuity threshold", 
OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, 
INT64_MAX, FLAGS },
 { "dec_threads",  "set the number of threads for decoding", 
OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 =  0}, 0, INT_MAX, FLAGS },
+{ "format_opts",  "set format options for the opened file", 
OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
 { NULL },
 };
 
@@ -243,7 +245,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
 iformat = movie->format_name ? av_find_input_format(movie->format_name) : 
NULL;
 
 movie->format_ctx = NULL;
-if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, 
iformat, NULL)) < 0) {
+if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, 
iformat, &movie->format_opts)) < 0) {
 av_log(ctx, AV_LOG_ERROR,
"Failed to avformat_open_input '%s'\n", movie->file_name);
 return ret;
-- 
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".


[FFmpeg-devel] [PATCH] Include -fPIC also in the LDFLAGS

2021-11-26 Thread Cristian Morales Vega
The same flags should be used when linking than when compiling.
Without this actual errors have been observed when using LTO.
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index e6cee21142..97c51f20a7 100755
--- a/configure
+++ b/configure
@@ -5805,6 +5805,7 @@ enable_weak_pic() {
 *)
 add_cflags -fPIC
 add_asflags -fPIC
+add_ldflags -fPIC
 ;;
 esac
 }
-- 
2.33.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 v2] avformat/rtp: add localaddr for network interface selection

2021-11-26 Thread Martin Storsjö

On Fri, 26 Nov 2021, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Reviewed-by: Martin Storsjö 


Technically, I haven't reviewed this version yet - including such a header 
would indicate that I have approvd it, which I haven't.


Although in practice, this version looks fine to me, so yeah I'm ok with 
this.


// 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 v4 2/2] avfilter: add a flip_vulkan filter

2021-11-26 Thread Lynne
26 Nov 2021, 12:20 by ffm...@gyani.pro:

>
>
> On 2021-11-26 04:33 pm, Lynne wrote:
>
>> 26 Nov 2021, 11:37 by ffm...@gyani.pro:
>>
>>>
>>> On 2021-11-26 03:08 pm, Lynne wrote:
>>>
 26 Nov 2021, 10:10 by jianhua...@intel.com:

> This filter flips the input video both horizontally and vertically
> in one compute pipeline, and it's no need to use two pipelines for
> hflip_vulkan,vflip_vulkan anymore.
>
> Signed-off-by: Wu Jianhua 
> ---
>  configure|  1 +
>  libavfilter/allfilters.c |  1 +
>  libavfilter/vf_flip_vulkan.c | 61 +---
>  3 files changed, 51 insertions(+), 12 deletions(-)
>
 I'll push this tonight if there are no further objections to the name.

>>> Will other flip modes be added to this filter?
>>>
>> No. Other flip modes are already separate filters, and transposition
>> would be another filter. Our transpose filter doesn't support flipping
>> the image, and to keep options compatible between software and
>> hardware filters, we can't add it. So the most appropriate filter for
>> this is a standalone one.
>>
>
> If modes can be added, you can add them here, and deprecate the single mode 
> variants.
> Since these filters are very new, there are no legacy users to accommodate 
> and now would be the best time they come become present in a release branch.
>

There are no more modes to be added, flipping != transpose != rotate,
according to ffmpeg nomenclature, since we have separate filters for each.
___
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 v4 2/2] avfilter: add a flip_vulkan filter

2021-11-26 Thread Gyan Doshi




On 2021-11-26 04:33 pm, Lynne wrote:

26 Nov 2021, 11:37 by ffm...@gyani.pro:



On 2021-11-26 03:08 pm, Lynne wrote:


26 Nov 2021, 10:10 by jianhua...@intel.com:


This filter flips the input video both horizontally and vertically
in one compute pipeline, and it's no need to use two pipelines for
hflip_vulkan,vflip_vulkan anymore.

Signed-off-by: Wu Jianhua 
---
  configure|  1 +
  libavfilter/allfilters.c |  1 +
  libavfilter/vf_flip_vulkan.c | 61 +---
  3 files changed, 51 insertions(+), 12 deletions(-)


I'll push this tonight if there are no further objections to the name.


Will other flip modes be added to this filter?


No. Other flip modes are already separate filters, and transposition
would be another filter. Our transpose filter doesn't support flipping
the image, and to keep options compatible between software and
hardware filters, we can't add it. So the most appropriate filter for
this is a standalone one.


If modes can be added, you can add them here, and deprecate the single 
mode variants.
Since these filters are very new, there are no legacy users to 
accommodate and now would be the best time they come become present in a 
release branch.


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".


Re: [FFmpeg-devel] [PATCH v16 06/16] avfilter/sbuffer: Add sbuffersrc and sbuffersink filters

2021-11-26 Thread Andreas Rheinhardt
Soft Works:
> Signed-off-by: softworkz 
> ---
>  configure|  2 +-
>  libavfilter/allfilters.c |  2 ++
>  libavfilter/buffersink.c | 63 +++
>  libavfilter/buffersink.h | 15 +
>  libavfilter/buffersrc.c  | 72 
>  libavfilter/buffersrc.h  |  1 +
>  6 files changed, 154 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index d068b11073..e4d1443237 100755
> --- a/configure
> +++ b/configure
> @@ -7758,7 +7758,7 @@ print_enabled_components(){
>  fi
>  done
>  if [ "$name" = "filter_list" ]; then
> -for c in asrc_abuffer vsrc_buffer asink_abuffer vsink_buffer; do
> +for c in asrc_abuffer vsrc_buffer ssrc_sbuffer asink_abuffer 
> vsink_buffer ssink_sbuffer; do
>  printf "&ff_%s,\n" $c >> $TMPH
>  done
>  fi
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 4bf17ef292..4072f08385 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -550,8 +550,10 @@ extern const AVFilter ff_avsrc_movie;
>   * being the same while having different 'types'). */
>  extern  const AVFilter ff_asrc_abuffer;
>  extern  const AVFilter ff_vsrc_buffer;
> +extern  const AVFilter ff_ssrc_sbuffer;
>  extern  const AVFilter ff_asink_abuffer;
>  extern  const AVFilter ff_vsink_buffer;
> +extern  const AVFilter ff_ssink_sbuffer;
>  extern const AVFilter ff_af_afifo;
>  extern const AVFilter ff_vf_fifo;
>  
> diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
> index b8ddafec35..8306312acc 100644
> --- a/libavfilter/buffersink.c
> +++ b/libavfilter/buffersink.c
> @@ -29,6 +29,8 @@
>  #include "libavutil/internal.h"
>  #include "libavutil/opt.h"
>  
> +#include "libavcodec/avcodec.h"
> +
>  #define FF_INTERNAL_FIELDS 1
>  #include "framequeue.h"
>  
> @@ -57,6 +59,10 @@ typedef struct BufferSinkContext {
>  int *sample_rates;  ///< list of accepted sample 
> rates, terminated by -1
>  int sample_rates_size;
>  
> +/* only used for subtitles */
> +enum AVSubtitleType *subtitle_types; ///< list of accepted subtitle 
> types, must be terminated with -1

subtitle_types is not terminated by -1 at all; it uses the size field
below instead of a sentinel. The same is true for the other arrays.

> +int subtitle_types_size;
> +
>  AVFrame *peeked_frame;
>  } BufferSinkContext;
>  
> @@ -168,6 +174,15 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void)
>  return NULL;
>  return params;
>  }
> +
> +AVSBufferSinkParams *av_sbuffersink_params_alloc(void)
> +{
> +AVSBufferSinkParams *params = av_mallocz(sizeof(AVSBufferSinkParams));
> +
> +if (!params)
> +return NULL;
> +return params;
> +}
>  #endif
>  
>  static av_cold int common_init(AVFilterContext *ctx)
> @@ -305,6 +320,28 @@ static int asink_query_formats(AVFilterContext *ctx)
>  return 0;
>  }
>  
> +static int ssink_query_formats(AVFilterContext *ctx)
> +{
> +BufferSinkContext *buf = ctx->priv;
> +AVFilterFormats *formats = NULL;
> +unsigned i;
> +int ret;
> +
> +CHECK_LIST_SIZE(subtitle_types)
> +if (buf->subtitle_types_size) {
> +for (i = 0; i < NB_ITEMS(buf->subtitle_types); i++)
> +if ((ret = ff_add_subtitle_type(&formats, 
> buf->subtitle_types[i])) < 0)
> +return ret;
> +if ((ret = ff_set_common_formats(ctx, formats)) < 0)
> +return ret;
> +} else {
> +if ((ret = ff_default_query_formats(ctx)) < 0)
> +return ret;
> +}
> +
> +return 0;
> +}
> +
>  #define OFFSET(x) offsetof(BufferSinkContext, x)
>  #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
>  static const AVOption buffersink_options[] = {
> @@ -322,9 +359,16 @@ static const AVOption abuffersink_options[] = {
>  { NULL },
>  };
>  #undef FLAGS
> +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_SUBTITLE_PARAM
> +static const AVOption sbuffersink_options[] = {
> +{ "subtitle_types", "set the supported subtitle formats", 
> OFFSET(subtitle_types), AV_OPT_TYPE_BINARY, .flags = FLAGS },
> +{ NULL },
> +};
> +#undef FLAGS
>  
>  AVFILTER_DEFINE_CLASS(buffersink);
>  AVFILTER_DEFINE_CLASS(abuffersink);
> +AVFILTER_DEFINE_CLASS(sbuffersink);
>  
>  static const AVFilterPad avfilter_vsink_buffer_inputs[] = {
>  {
> @@ -363,3 +407,22 @@ const AVFilter ff_asink_abuffer = {
>  .outputs   = NULL,
>  FILTER_QUERY_FUNC(asink_query_formats),
>  };
> +
> +static const AVFilterPad avfilter_ssink_sbuffer_inputs[] = {
> +{
> +.name = "default",
> +.type = AVMEDIA_TYPE_SUBTITLE,
> +},
> +};
> +
> +const AVFilter ff_ssink_sbuffer = {
> +.name  = "sbuffersink",
> +.description   = NULL_IF_CONFIG_SMALL("Buffer subtitle frames, and make 
> them available to the end of the filter graph."),
> +.priv_class= &sbuffersink_class,
> +.priv_

Re: [FFmpeg-devel] [PATCH v4 2/2] avfilter: add a flip_vulkan filter

2021-11-26 Thread Lynne
26 Nov 2021, 11:37 by ffm...@gyani.pro:

>
>
> On 2021-11-26 03:08 pm, Lynne wrote:
>
>> 26 Nov 2021, 10:10 by jianhua...@intel.com:
>>
>>> This filter flips the input video both horizontally and vertically
>>> in one compute pipeline, and it's no need to use two pipelines for
>>> hflip_vulkan,vflip_vulkan anymore.
>>>
>>> Signed-off-by: Wu Jianhua 
>>> ---
>>>  configure|  1 +
>>>  libavfilter/allfilters.c |  1 +
>>>  libavfilter/vf_flip_vulkan.c | 61 +---
>>>  3 files changed, 51 insertions(+), 12 deletions(-)
>>>
>> I'll push this tonight if there are no further objections to the name.
>>
>
> Will other flip modes be added to this filter?
>

No. Other flip modes are already separate filters, and transposition
would be another filter. Our transpose filter doesn't support flipping
the image, and to keep options compatible between software and
hardware filters, we can't add it. So the most appropriate filter for
this is a standalone one.
I agree the name isn't perfect. Maybe we can add a note in the
description this is equivalent to 180-degree rotation.
___
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 V3 3/5] libavutil/hwcontext_vulkan: Allocate vkFrame in one memory

2021-11-26 Thread Lynne
26 Nov 2021, 03:54 by wenbin.c...@intel.com:

> The vaapi can import external frame, but the planes of the external
> frames should be in the same drm object. A new option "contiguous_planes"
> is added to device. This flag tells device to allocate places in one
> memory. When device is derived from vaapi this flag will be enabled.
> A new flag frame_flag is also added to AVVulkanFramesContext. User
> can use this flag to force enable or disable this behaviour.
> A new variable "offset "is added to AVVKFrame. It describe describe the
> offset from the memory currently bound to the VkImage.
>
> Signed-off-by: Wenbin Chen 
>

Why is a new offset variable needed?
vkGetImageSubresourceLayout is valid for DRM tiled images.
According to the specs,
"If the image’s tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, then 
vkGetImageSubresourceLayout describes one memory plane of the image. If the 
image’s tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT and the image is 
non-linear, then the returned layout has an implementation-dependent meaning; 
the vendor of the image’s DRM format modifier may provide documentation that 
explains how to interpret the returned layout.".

Isn't this what you already have in the offset field?
___
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 v2] avfilter/src_movie: add format_opts for the opened file

2021-11-26 Thread Paul B Mahol
On Fri, Nov 26, 2021 at 11:12 AM  wrote:

> On Fri, Nov 26, 2021 at 10:48:07AM +0100, Paul B Mahol wrote:
> > On Fri, Nov 26, 2021 at 10:38 AM  wrote:
> >
> > > From: Limin Wang 
> > >
> > > Signed-off-by: Limin Wang 
> > > ---
> > >  doc/filters.texi| 5 +
> > >  libavfilter/src_movie.c | 4 +++-
> > >  2 files changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/doc/filters.texi b/doc/filters.texi
> > > index 3731a14..f2d5957 100644
> > > --- a/doc/filters.texi
> > > +++ b/doc/filters.texi
> > > @@ -28395,6 +28395,11 @@ timestamps.
> > >
> > >  @item dec_threads
> > >  Specifies the number of threads for decoding
> > > +
> > > +@item format_opts
> > > +Specify format options for the opened file. Format options can be
> > > specified
> > > +as a list of @var{key}=@var{value} pairs separated by ':'. For
> example,
> > > +some protocol you need to add protocol_whitelist for the opened file.
> > >  @end table
> > >
> > >  It allows overlaying a second video on top of the main input of
> > > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > > index 220a43c..b89a680 100644
> > > --- a/libavfilter/src_movie.c
> > > +++ b/libavfilter/src_movie.c
> > > @@ -74,6 +74,7 @@ typedef struct MovieContext {
> > >  int max_stream_index; /**< max stream # actually used for output
> */
> > >  MovieStream *st; /**< array of all streams, one per output */
> > >  int *out_index; /**< stream number -> output number map, or -1 */
> > > +AVDictionary *format_opts;
> > >  } MovieContext;
> > >
> > >  #define OFFSET(x) offsetof(MovieContext, x)
> > > @@ -92,6 +93,7 @@ static const AVOption movie_options[]= {
> > >  { "loop", "set loop count",  OFFSET(loop_count),
> > >  AV_OPT_TYPE_INT,{.i64 =  1},  0,INT_MAX, FLAGS },
> > >  { "discontinuity", "set discontinuity threshold",
> > > OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0,
> > > INT64_MAX, FLAGS },
> > >  { "dec_threads",  "set the number of threads for decoding",
> > > OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 =  0}, 0, INT_MAX, FLAGS },
> > > +{ "format_opts",  "set format options for the opened file",
> > > OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> > >  { NULL },
> > >  };
> > >
> > > @@ -243,7 +245,7 @@ static av_cold int
> movie_common_init(AVFilterContext
> > > *ctx)
> > >  iformat = movie->format_name ?
> > > av_find_input_format(movie->format_name) : NULL;
> > >
> > >  movie->format_ctx = NULL;
> > > -if ((ret = avformat_open_input(&movie->format_ctx,
> movie->file_name,
> > > iformat, NULL)) < 0) {
> > > +if ((ret = avformat_open_input(&movie->format_ctx,
> movie->file_name,
> > > iformat, &movie->format_opts)) < 0) {
> > >  av_log(ctx, AV_LOG_ERROR,
> > > "Failed to avformat_open_input '%s'\n",
> movie->file_name);
> > >  return ret;
> > > --
> > > 1.8.3.1
> > >
> > >
> > Missing documentation entry.
> >
> > How is one user supposed to use this option? If I'm not mistaken this can
> > only work to specify first value only, and because of ':' separator next
> > ones will be taken by filter itself.
> Yes, the : need to add \ before it, below is one example used, I don't
> know how to express it
> clearly in the document. Add one example?
>
> ./ffplay -f lavfi
> "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=rtmp'"
>

Cool, adding option example in filter documentation would be great.

>
> >
> > ___
> > > 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".
> > >
>
> --
> Thanks,
> Limin Wang
> ___
> 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 v2] avformat/rtp: add localaddr for network interface selection

2021-11-26 Thread lance . lmwang
From: Limin Wang 

Reviewed-by: Martin Storsjö 
Signed-off-by: Limin Wang 
---
support for both sdp and rtp for v2:
1, -localaddr xx.xx.xx.xx -i 1.sdp
2, -localaddr xx.xx.xx.xx -i rtp://xx.xx.xx.xx:xx
3, -i rtp://xx.xx.xx.xx:xx?localadd xx.xx.xx.xx

 doc/protocols.texi |  4 
 libavformat/rtpproto.c | 17 ++---
 libavformat/rtsp.c | 11 +++
 libavformat/rtsp.h |  1 +
 4 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index c100f23..d207df0 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1087,6 +1087,10 @@ set to 1) or to a default remote address (if set to 0).
 @item localport=@var{n}
 Set the local RTP port to @var{n}.
 
+@item localaddr=@var{addr}
+Local IP address of a network interface used for sending packets or joining
+multicast groups.
+
 @item timeout=@var{n}
 Set timeout (in microseconds) of socket I/O operations to @var{n}.
 
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 7dd6042..c92cda6 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -61,6 +61,7 @@ typedef struct RTPContext {
 char *block;
 char *fec_options_str;
 int64_t rw_timeout;
+char *localaddr;
 } RTPContext;
 
 #define OFFSET(x) offsetof(RTPContext, x)
@@ -80,6 +81,7 @@ static const AVOption options[] = {
 { "sources","Source list", 
 OFFSET(sources), AV_OPT_TYPE_STRING, { .str = NULL },  
 .flags = D|E },
 { "block",  "Block list",  
 OFFSET(block),   AV_OPT_TYPE_STRING, { .str = NULL },  
 .flags = D|E },
 { "fec","FEC", 
 OFFSET(fec_options_str), AV_OPT_TYPE_STRING, { .str = NULL },  
 .flags = E },
+{ "localaddr",  "Local address",   
 OFFSET(localaddr),   AV_OPT_TYPE_STRING, { .str = NULL },  
 .flags = D|E },
 { NULL }
 };
 
@@ -173,6 +175,7 @@ static av_printf_format(3, 4) void url_add_option(char 
*buf, int buf_size, const
 static void build_udp_url(RTPContext *s,
   char *buf, int buf_size,
   const char *hostname,
+  const char *localaddr,
   int port, int local_port,
   const char *include_sources,
   const char *exclude_sources)
@@ -195,6 +198,8 @@ static void build_udp_url(RTPContext *s,
 url_add_option(buf, buf_size, "sources=%s", include_sources);
 if (exclude_sources && exclude_sources[0])
 url_add_option(buf, buf_size, "block=%s", exclude_sources);
+if (localaddr && localaddr[0])
+url_add_option(buf, buf_size, "localaddr=%s", localaddr);
 }
 
 /**
@@ -284,6 +289,12 @@ static int rtp_open(URLContext *h, const char *uri, int 
flags)
 ff_ip_parse_blocks(h, s->block, &s->filters);
 block = s->block;
 }
+if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
+av_freep(&s->localaddr);
+s->localaddr = av_strdup(buf);
+if (!s->localaddr)
+goto fail;
+}
 }
 if (s->rw_timeout >= 0)
 h->rw_timeout = s->rw_timeout;
@@ -314,7 +325,7 @@ static int rtp_open(URLContext *h, const char *uri, int 
flags)
 
 for (i = 0; i < max_retry_count; i++) {
 build_udp_url(s, buf, sizeof(buf),
-  hostname, rtp_port, s->local_rtpport,
+  hostname, s->localaddr, rtp_port, s->local_rtpport,
   sources, block);
 if (ffurl_open_whitelist(&s->rtp_hd, buf, flags, 
&h->interrupt_callback,
  NULL, h->protocol_whitelist, 
h->protocol_blacklist, h) < 0)
@@ -328,7 +339,7 @@ static int rtp_open(URLContext *h, const char *uri, int 
flags)
 if (s->local_rtcpport < 0) {
 s->local_rtcpport = s->local_rtpport + 1;
 build_udp_url(s, buf, sizeof(buf),
-  hostname, s->rtcp_port, s->local_rtcpport,
+  hostname, s->localaddr, s->rtcp_port, 
s->local_rtcpport,
   sources, block);
 if (ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags,
  &h->interrupt_callback, NULL,
@@ -339,7 +350,7 @@ static int rtp_open(URLContext *h, const char *uri, int 
flags)
 break;
 }
 build_udp_url(s, buf, sizeof(buf),
-  hostname, s->rtcp_port, s->local_rtcpport,
+  hostname, s->localaddr, s->rtcp_port, s->local_rtcpport,
   sources, block);
 if (ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags, 
&h->interrupt_callback,
  NULL, h

Re: [FFmpeg-devel] [PATCH v4 1/2] avutil/hwcontext_vulkan: fully support customizable validation layers

2021-11-26 Thread Andreas Rheinhardt
Wu Jianhua:
> +user_layers_str = av_strdup(user_layers->value);
> +if (!user_layers_str) {
> +err = AVERROR(EINVAL);

Wrong error code.

> +goto fail;
> +}
> +

___
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/2] avformat/udp: remove local localaddr array

2021-11-26 Thread lance . lmwang
On Fri, Nov 26, 2021 at 11:26:39AM +0100, Andreas Rheinhardt wrote:
> lance.lmw...@gmail.com:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavformat/udp.c | 10 --
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavformat/udp.c b/libavformat/udp.c
> > index bbe5aec..b8b0e19 100644
> > --- a/libavformat/udp.c
> > +++ b/libavformat/udp.c
> > @@ -623,7 +623,7 @@ end:
> >  /* return non zero if error */
> >  static int udp_open(URLContext *h, const char *uri, int flags)
> >  {
> > -char hostname[1024], localaddr[1024] = "";
> > +char hostname[1024];
> >  int port, udp_fd = -1, tmp, bind_ret = -1, dscp = -1;
> >  UDPContext *s = h->priv_data;
> >  int is_output;
> > @@ -708,7 +708,8 @@ static int udp_open(URLContext *h, const char *uri, int 
> > flags)
> >  s->burst_bits = strtoll(buf, NULL, 10);
> >  }
> >  if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
> > -av_strlcpy(localaddr, buf, sizeof(localaddr));
> > +av_freep(&s->localaddr);
> > +s->localaddr = av_strdup(buf);
> 
> Missing check.

If the localaddr is NULL, it'll not be used, so I haven't consider to add 
checked.
If you think it's better to consider this is error, I'll add it.

> 
> >  }
> >  if (av_find_info_tag(buf, sizeof(buf), "sources", p)) {
> >  if ((ret = ff_ip_parse_sources(h, buf, &s->filters)) < 0)
> > @@ -748,10 +749,7 @@ static int udp_open(URLContext *h, const char *uri, 
> > int flags)
> >  if ((s->is_multicast || s->local_port <= 0) && (h->flags & 
> > AVIO_FLAG_READ))
> >  s->local_port = port;
> >  
> > -if (localaddr[0])
> > -udp_fd = udp_socket_create(h, &my_addr, &len, localaddr);
> > -else
> > -udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
> > +udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
> >  if (udp_fd < 0)
> >  goto fail;
> >  
> > 
> 
> ___
> 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".

-- 
Thanks,
Limin Wang
___
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 v4 2/2] avfilter: add a flip_vulkan filter

2021-11-26 Thread Gyan Doshi




On 2021-11-26 03:08 pm, Lynne wrote:

26 Nov 2021, 10:10 by jianhua...@intel.com:


This filter flips the input video both horizontally and vertically
in one compute pipeline, and it's no need to use two pipelines for
hflip_vulkan,vflip_vulkan anymore.

Signed-off-by: Wu Jianhua 
---
  configure|  1 +
  libavfilter/allfilters.c |  1 +
  libavfilter/vf_flip_vulkan.c | 61 +---
  3 files changed, 51 insertions(+), 12 deletions(-)


I'll push this tonight if there are no further objections to the name.


Will other flip modes be added to this filter?



___
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 v16 01/16] global: Prepare AVFrame for subtitle handling

2021-11-26 Thread Andreas Rheinhardt
Soft Works:
> Root commit for adding subtitle filtering capabilities.
> In detail:
> 
> - Add type (AVMediaType) field to AVFrame
>   Replaces previous way of distinction which was based on checking
>   width and height to determine whether a frame is audio or video
> - Add subtitle fields to AVFrame
> - Add new struct AVSubtitleArea, similar to AVSubtitleRect, but different
>   allocation logic. Cannot and must not be used interchangeably, hence
>   the new struct
> - Move enum AVSubtitleType, AVSubtitle and AVSubtitleRect to avutil
> - Add public-named members to enum AVSubtitleType (AV_SUBTITLE_FMT_)
> - Add avcodec_decode_subtitle3 which takes subtitle frames,
>   serving as compatibility shim to legacy subtitle decoding
> - Add additional methods for conversion between old and new API
> 
> Signed-off-by: softworkz 
> ---
>  libavcodec/avcodec.c |  19 ---
>  libavcodec/avcodec.h |  75 ++
>  libavcodec/decode.c  |  53 +--
>  libavcodec/libzvbi-teletextdec.c |   1 +
>  libavcodec/pgssubdec.c   |   1 +
>  libavcodec/utils.c   |  11 ++
>  libavfilter/vf_subtitles.c   |  50 +--
>  libavformat/utils.c  |   1 +
>  libavutil/Makefile   |   2 +
>  libavutil/frame.c| 194 +---
>  libavutil/frame.h|  93 +++-
>  libavutil/subfmt.c   | 243 +++
>  libavutil/subfmt.h   | 185 +++

As has already been said by others, this should be split: One patch for
the actual new libavutil additions, one patch for the lavc decoding API,
one patch for the encoding API, one patch for every user that is made to
use the new APIs.

>  13 files changed, 803 insertions(+), 125 deletions(-)
>  create mode 100644 libavutil/subfmt.c
>  create mode 100644 libavutil/subfmt.h
> 
> diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> index c00a9b2af8..13e3711b9c 100644
> --- a/libavcodec/avcodec.c
> +++ b/libavcodec/avcodec.c
> @@ -422,25 +422,6 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
>  av_bsf_flush(avci->bsf);
>  }
>  
> -void avsubtitle_free(AVSubtitle *sub)
> -{
> -int i;
> -
> -for (i = 0; i < sub->num_rects; i++) {
> -av_freep(&sub->rects[i]->data[0]);
> -av_freep(&sub->rects[i]->data[1]);
> -av_freep(&sub->rects[i]->data[2]);
> -av_freep(&sub->rects[i]->data[3]);
> -av_freep(&sub->rects[i]->text);
> -av_freep(&sub->rects[i]->ass);
> -av_freep(&sub->rects[i]);
> -}
> -
> -av_freep(&sub->rects);
> -
> -memset(sub, 0, sizeof(*sub));
> -}
> -
>  av_cold int avcodec_close(AVCodecContext *avctx)
>  {
>  int i;
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 7ee8bc2b7c..0c5819b116 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -35,6 +35,7 @@
>  #include "libavutil/frame.h"
>  #include "libavutil/log.h"
>  #include "libavutil/pixfmt.h"
> +#include "libavutil/subfmt.h"
>  #include "libavutil/rational.h"
>  
>  #include "codec.h"
> @@ -1674,7 +1675,7 @@ typedef struct AVCodecContext {
>  
>  /**
>   * Header containing style information for text subtitles.
> - * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
> + * For AV_SUBTITLE_FMT_ASS subtitle type, it should contain the whole ASS
>   * [Script Info] and [V4+ Styles] section, plus the [Events] line and
>   * the Format line following. It shouldn't include any Dialogue line.
>   * - encoding: Set/allocated/freed by user (before avcodec_open2())
> @@ -2238,63 +2239,8 @@ typedef struct AVHWAccel {
>   * @}
>   */
>  
> -enum AVSubtitleType {
> -SUBTITLE_NONE,
> -
> -SUBTITLE_BITMAP,///< A bitmap, pict will be set
> -
> -/**
> - * Plain text, the text field must be set by the decoder and is
> - * authoritative. ass and pict fields may contain approximations.
> - */
> -SUBTITLE_TEXT,
> -
> -/**
> - * Formatted text, the ass field must be set by the decoder and is
> - * authoritative. pict and text fields may contain approximations.
> - */
> -SUBTITLE_ASS,
> -};
> -
>  #define AV_SUBTITLE_FLAG_FORCED 0x0001
>  
> -typedef struct AVSubtitleRect {
> -int x; ///< top left corner  of pict, undefined when pict is not 
> set
> -int y; ///< top left corner  of pict, undefined when pict is not 
> set
> -int w; ///< widthof pict, undefined when pict is not 
> set
> -int h; ///< height   of pict, undefined when pict is not 
> set
> -int nb_colors; ///< number of colors in pict, undefined when pict is not 
> set
> -
> -/**
> - * data+linesize for the bitmap of this subtitle.
> - * Can be set for text/ass as well once they are rendered.
> - */
> -uint8_t *data[4];
> -int linesize[4];
> -
> -enum AVSubtitleType type;
> -
> -char

Re: [FFmpeg-devel] [PATCH 2/2] avformat/udp: remove local localaddr array

2021-11-26 Thread Andreas Rheinhardt
lance.lmw...@gmail.com:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/udp.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index bbe5aec..b8b0e19 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -623,7 +623,7 @@ end:
>  /* return non zero if error */
>  static int udp_open(URLContext *h, const char *uri, int flags)
>  {
> -char hostname[1024], localaddr[1024] = "";
> +char hostname[1024];
>  int port, udp_fd = -1, tmp, bind_ret = -1, dscp = -1;
>  UDPContext *s = h->priv_data;
>  int is_output;
> @@ -708,7 +708,8 @@ static int udp_open(URLContext *h, const char *uri, int 
> flags)
>  s->burst_bits = strtoll(buf, NULL, 10);
>  }
>  if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
> -av_strlcpy(localaddr, buf, sizeof(localaddr));
> +av_freep(&s->localaddr);
> +s->localaddr = av_strdup(buf);

Missing check.

>  }
>  if (av_find_info_tag(buf, sizeof(buf), "sources", p)) {
>  if ((ret = ff_ip_parse_sources(h, buf, &s->filters)) < 0)
> @@ -748,10 +749,7 @@ static int udp_open(URLContext *h, const char *uri, int 
> flags)
>  if ((s->is_multicast || s->local_port <= 0) && (h->flags & 
> AVIO_FLAG_READ))
>  s->local_port = port;
>  
> -if (localaddr[0])
> -udp_fd = udp_socket_create(h, &my_addr, &len, localaddr);
> -else
> -udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
> +udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
>  if (udp_fd < 0)
>  goto fail;
>  
> 

___
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 v2] avfilter/src_movie: add format_opts for the opened file

2021-11-26 Thread lance . lmwang
On Fri, Nov 26, 2021 at 10:48:07AM +0100, Paul B Mahol wrote:
> On Fri, Nov 26, 2021 at 10:38 AM  wrote:
> 
> > From: Limin Wang 
> >
> > Signed-off-by: Limin Wang 
> > ---
> >  doc/filters.texi| 5 +
> >  libavfilter/src_movie.c | 4 +++-
> >  2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 3731a14..f2d5957 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -28395,6 +28395,11 @@ timestamps.
> >
> >  @item dec_threads
> >  Specifies the number of threads for decoding
> > +
> > +@item format_opts
> > +Specify format options for the opened file. Format options can be
> > specified
> > +as a list of @var{key}=@var{value} pairs separated by ':'. For example,
> > +some protocol you need to add protocol_whitelist for the opened file.
> >  @end table
> >
> >  It allows overlaying a second video on top of the main input of
> > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > index 220a43c..b89a680 100644
> > --- a/libavfilter/src_movie.c
> > +++ b/libavfilter/src_movie.c
> > @@ -74,6 +74,7 @@ typedef struct MovieContext {
> >  int max_stream_index; /**< max stream # actually used for output */
> >  MovieStream *st; /**< array of all streams, one per output */
> >  int *out_index; /**< stream number -> output number map, or -1 */
> > +AVDictionary *format_opts;
> >  } MovieContext;
> >
> >  #define OFFSET(x) offsetof(MovieContext, x)
> > @@ -92,6 +93,7 @@ static const AVOption movie_options[]= {
> >  { "loop", "set loop count",  OFFSET(loop_count),
> >  AV_OPT_TYPE_INT,{.i64 =  1},  0,INT_MAX, FLAGS },
> >  { "discontinuity", "set discontinuity threshold",
> > OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0,
> > INT64_MAX, FLAGS },
> >  { "dec_threads",  "set the number of threads for decoding",
> > OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 =  0}, 0, INT_MAX, FLAGS },
> > +{ "format_opts",  "set format options for the opened file",
> > OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> >  { NULL },
> >  };
> >
> > @@ -243,7 +245,7 @@ static av_cold int movie_common_init(AVFilterContext
> > *ctx)
> >  iformat = movie->format_name ?
> > av_find_input_format(movie->format_name) : NULL;
> >
> >  movie->format_ctx = NULL;
> > -if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name,
> > iformat, NULL)) < 0) {
> > +if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name,
> > iformat, &movie->format_opts)) < 0) {
> >  av_log(ctx, AV_LOG_ERROR,
> > "Failed to avformat_open_input '%s'\n", movie->file_name);
> >  return ret;
> > --
> > 1.8.3.1
> >
> >
> Missing documentation entry.
> 
> How is one user supposed to use this option? If I'm not mistaken this can
> only work to specify first value only, and because of ':' separator next
> ones will be taken by filter itself.
Yes, the : need to add \ before it, below is one example used, I don't know how 
to express it
clearly in the document. Add one example?

./ffplay -f lavfi 
"movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=rtmp'"

> 
> ___
> > 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".
> >

-- 
Thanks,
Limin Wang
___
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 v15 00/16] *** SUBJECT HERE ***

2021-11-26 Thread Paul B Mahol
On Fri, Nov 26, 2021 at 9:17 AM Nicolas George  wrote:

> James Almer (12021-11-25):
> > Have all the concerns people had been addressed? I'm also certain the
> > design itself wasn't well received.
>
> Indeed. The whole libavfilter part is nowhere near anything acceptable.
> It should not be applied at all.
>

Facts nowhere to be seen.


>
> Regards,
>
> --
>   Nicolas George
> ___
> 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 v2] avfilter/src_movie: add format_opts for the opened file

2021-11-26 Thread Paul B Mahol
On Fri, Nov 26, 2021 at 10:38 AM  wrote:

> From: Limin Wang 
>
> Signed-off-by: Limin Wang 
> ---
>  doc/filters.texi| 5 +
>  libavfilter/src_movie.c | 4 +++-
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 3731a14..f2d5957 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -28395,6 +28395,11 @@ timestamps.
>
>  @item dec_threads
>  Specifies the number of threads for decoding
> +
> +@item format_opts
> +Specify format options for the opened file. Format options can be
> specified
> +as a list of @var{key}=@var{value} pairs separated by ':'. For example,
> +some protocol you need to add protocol_whitelist for the opened file.
>  @end table
>
>  It allows overlaying a second video on top of the main input of
> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index 220a43c..b89a680 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -74,6 +74,7 @@ typedef struct MovieContext {
>  int max_stream_index; /**< max stream # actually used for output */
>  MovieStream *st; /**< array of all streams, one per output */
>  int *out_index; /**< stream number -> output number map, or -1 */
> +AVDictionary *format_opts;
>  } MovieContext;
>
>  #define OFFSET(x) offsetof(MovieContext, x)
> @@ -92,6 +93,7 @@ static const AVOption movie_options[]= {
>  { "loop", "set loop count",  OFFSET(loop_count),
>  AV_OPT_TYPE_INT,{.i64 =  1},  0,INT_MAX, FLAGS },
>  { "discontinuity", "set discontinuity threshold",
> OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0,
> INT64_MAX, FLAGS },
>  { "dec_threads",  "set the number of threads for decoding",
> OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 =  0}, 0, INT_MAX, FLAGS },
> +{ "format_opts",  "set format options for the opened file",
> OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
>  { NULL },
>  };
>
> @@ -243,7 +245,7 @@ static av_cold int movie_common_init(AVFilterContext
> *ctx)
>  iformat = movie->format_name ?
> av_find_input_format(movie->format_name) : NULL;
>
>  movie->format_ctx = NULL;
> -if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name,
> iformat, NULL)) < 0) {
> +if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name,
> iformat, &movie->format_opts)) < 0) {
>  av_log(ctx, AV_LOG_ERROR,
> "Failed to avformat_open_input '%s'\n", movie->file_name);
>  return ret;
> --
> 1.8.3.1
>
>
Missing documentation entry.

How is one user supposed to use this option? If I'm not mistaken this can
only work to specify first value only, and because of ':' separator next
ones will be taken by filter itself.

___
> 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 v2] avfilter/src_movie: add format_opts for the opened file

2021-11-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 doc/filters.texi| 5 +
 libavfilter/src_movie.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 3731a14..f2d5957 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -28395,6 +28395,11 @@ timestamps.
 
 @item dec_threads
 Specifies the number of threads for decoding
+
+@item format_opts
+Specify format options for the opened file. Format options can be specified
+as a list of @var{key}=@var{value} pairs separated by ':'. For example,
+some protocol you need to add protocol_whitelist for the opened file.
 @end table
 
 It allows overlaying a second video on top of the main input of
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 220a43c..b89a680 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -74,6 +74,7 @@ typedef struct MovieContext {
 int max_stream_index; /**< max stream # actually used for output */
 MovieStream *st; /**< array of all streams, one per output */
 int *out_index; /**< stream number -> output number map, or -1 */
+AVDictionary *format_opts;
 } MovieContext;
 
 #define OFFSET(x) offsetof(MovieContext, x)
@@ -92,6 +93,7 @@ static const AVOption movie_options[]= {
 { "loop", "set loop count",  OFFSET(loop_count),   
AV_OPT_TYPE_INT,{.i64 =  1},  0,INT_MAX, FLAGS },
 { "discontinuity", "set discontinuity threshold", 
OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, 
INT64_MAX, FLAGS },
 { "dec_threads",  "set the number of threads for decoding", 
OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 =  0}, 0, INT_MAX, FLAGS },
+{ "format_opts",  "set format options for the opened file", 
OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
 { NULL },
 };
 
@@ -243,7 +245,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
 iformat = movie->format_name ? av_find_input_format(movie->format_name) : 
NULL;
 
 movie->format_ctx = NULL;
-if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, 
iformat, NULL)) < 0) {
+if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, 
iformat, &movie->format_opts)) < 0) {
 av_log(ctx, AV_LOG_ERROR,
"Failed to avformat_open_input '%s'\n", movie->file_name);
 return ret;
-- 
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 v4 2/2] avfilter: add a flip_vulkan filter

2021-11-26 Thread Lynne
26 Nov 2021, 10:10 by jianhua...@intel.com:

> This filter flips the input video both horizontally and vertically
> in one compute pipeline, and it's no need to use two pipelines for
> hflip_vulkan,vflip_vulkan anymore.
>
> Signed-off-by: Wu Jianhua 
> ---
>  configure|  1 +
>  libavfilter/allfilters.c |  1 +
>  libavfilter/vf_flip_vulkan.c | 61 +---
>  3 files changed, 51 insertions(+), 12 deletions(-)
>

I'll push this tonight if there are no further objections to the name.
___
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 v4 1/2] avutil/hwcontext_vulkan: fully support customizable validation layers

2021-11-26 Thread Lynne
26 Nov 2021, 10:10 by jianhua...@intel.com:

> Validation layer is an indispensable part of developing on Vulkan.
>
> The following commands is on how to enable validation layers:
>
> ffmpeg -init_hw_device 
> vulkan=0,debug=1,validation_layers=VK_LAYER_LUNARG_monitor+VK_LAYER_LUNARG_api_dump
>
> Signed-off-by: Wu Jianhua 
>

Pushed, thanks.
___
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] avfilter/src_movie: add format_opts for the opened file

2021-11-26 Thread lance . lmwang
On Fri, Nov 26, 2021 at 07:36:33AM +0100, Andreas Rheinhardt wrote:
> lance.lmw...@gmail.com:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  doc/filters.texi| 5 +
> >  libavfilter/src_movie.c | 8 +++-
> >  2 files changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index c3ccaf9..6c35788 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -28386,6 +28386,11 @@ timestamps.
> >  
> >  @item dec_threads
> >  Specifies the number of threads for decoding
> > +
> > +@item format_opts
> > +Specify format options for the opened file. Format options can be specified
> > +as a list of @var{key}=@var{value} pairs separated by ':'. For example,
> > +some protocol you need to add protocol_whitelist for the opened file.
> >  @end table
> >  
> >  It allows overlaying a second video on top of the main input of
> > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > index 220a43c..5e52015 100644
> > --- a/libavfilter/src_movie.c
> > +++ b/libavfilter/src_movie.c
> > @@ -74,6 +74,7 @@ typedef struct MovieContext {
> >  int max_stream_index; /**< max stream # actually used for output */
> >  MovieStream *st; /**< array of all streams, one per output */
> >  int *out_index; /**< stream number -> output number map, or -1 */
> > +AVDictionary *format_opts;
> >  } MovieContext;
> >  
> >  #define OFFSET(x) offsetof(MovieContext, x)
> > @@ -92,6 +93,7 @@ static const AVOption movie_options[]= {
> >  { "loop", "set loop count",  OFFSET(loop_count),   
> > AV_OPT_TYPE_INT,{.i64 =  1},  0,INT_MAX, FLAGS },
> >  { "discontinuity", "set discontinuity threshold", 
> > OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, 
> > INT64_MAX, FLAGS },
> >  { "dec_threads",  "set the number of threads for decoding", 
> > OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 =  0}, 0, INT_MAX, FLAGS },
> > +{ "format_opts",  "set format options for the opened file", 
> > OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> >  { NULL },
> >  };
> >  
> > @@ -214,6 +216,7 @@ static av_cold int movie_common_init(AVFilterContext 
> > *ctx)
> >  int nb_streams = 1, ret, i;
> >  char default_streams[16], *stream_specs, *spec, *cursor;
> >  AVStream *st;
> > +AVDictionary *options = NULL;
> >  
> >  if (!movie->file_name) {
> >  av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
> > @@ -243,11 +246,14 @@ static av_cold int movie_common_init(AVFilterContext 
> > *ctx)
> >  iformat = movie->format_name ? 
> > av_find_input_format(movie->format_name) : NULL;
> >  
> >  movie->format_ctx = NULL;
> > -if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, 
> > iformat, NULL)) < 0) {
> > +av_dict_copy(&options, movie->format_opts, 0);
> 
> Why are you copying the options instead of just using them?

yes, it's better to use it directly, maybe I'm afraid of format_opts may be 
changed by avformat_open_input when
add it. Will update the patch.

> 
> > +if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, 
> > iformat, &options)) < 0) {
> >  av_log(ctx, AV_LOG_ERROR,
> > "Failed to avformat_open_input '%s'\n", movie->file_name);
> 
> Your copy of options leaks here; it would not leak if there were no copy.
> 
> >  return ret;
> >  }
> > +av_dict_free(&options);
> > +
> >  if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
> >  av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
> >  
> > 
> 
> ___
> 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".

-- 
Thanks,
Limin Wang
___
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 v4 2/2] avfilter: add a flip_vulkan filter

2021-11-26 Thread Wu Jianhua
This filter flips the input video both horizontally and vertically
in one compute pipeline, and it's no need to use two pipelines for
hflip_vulkan,vflip_vulkan anymore.

Signed-off-by: Wu Jianhua 
---
 configure|  1 +
 libavfilter/allfilters.c |  1 +
 libavfilter/vf_flip_vulkan.c | 61 +---
 3 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/configure b/configure
index d068b11073..7112d830c9 100755
--- a/configure
+++ b/configure
@@ -3608,6 +3608,7 @@ fftdnoiz_filter_select="fft"
 find_rect_filter_deps="avcodec avformat gpl"
 firequalizer_filter_deps="avcodec"
 firequalizer_filter_select="rdft"
+flip_vulkan_filter_deps="vulkan spirv_compiler"
 flite_filter_deps="libflite"
 framerate_filter_select="scene_sad"
 freezedetect_filter_select="scene_sad"
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 4bf17ef292..e014833bea 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -263,6 +263,7 @@ extern const AVFilter ff_vf_fieldmatch;
 extern const AVFilter ff_vf_fieldorder;
 extern const AVFilter ff_vf_fillborders;
 extern const AVFilter ff_vf_find_rect;
+extern const AVFilter ff_vf_flip_vulkan;
 extern const AVFilter ff_vf_floodfill;
 extern const AVFilter ff_vf_format;
 extern const AVFilter ff_vf_fps;
diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c
index e9e04db91b..0223786ef1 100644
--- a/libavfilter/vf_flip_vulkan.c
+++ b/libavfilter/vf_flip_vulkan.c
@@ -26,7 +26,8 @@
 
 enum FlipType {
 FLIP_VERTICAL,
-FLIP_HORIZONTAL
+FLIP_HORIZONTAL,
+FLIP_BOTH
 };
 
 typedef struct FlipVulkanContext {
@@ -104,6 +105,9 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in, enum FlipType
 case FLIP_VERTICAL:
 GLSLF(2, vec4 res = texture(input_image[%i], ivec2(pos.x, 
size.y - pos.y));   ,i);
 break;
+case FLIP_BOTH:
+GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.xy - 
pos.xy));, i);
+break;
 default:
 GLSLF(2, vec4 res = texture(input_image[%i], pos); 
   ,i);
 break;
@@ -226,7 +230,7 @@ fail:
 return err;
 }
 
-static int flip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in, enum 
FlipType type)
+static int filter_frame(AVFilterLink *link, AVFrame *in, enum FlipType type)
 {
 int err;
 AVFrame *out = NULL;
@@ -259,14 +263,27 @@ fail:
 
 static int hflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
 {
-return flip_vulkan_filter_frame(link, in, FLIP_HORIZONTAL);
+return filter_frame(link, in, FLIP_HORIZONTAL);
 }
 
 static int vflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
 {
-return flip_vulkan_filter_frame(link, in, FLIP_VERTICAL);
+return filter_frame(link, in, FLIP_VERTICAL);
 }
 
+static int flip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
+{
+return filter_frame(link, in, FLIP_BOTH);
+}
+
+static const AVFilterPad flip_vulkan_outputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_VIDEO,
+.config_props = &ff_vk_filter_config_output,
+}
+};
+
 static const AVOption hflip_vulkan_options[] = {
 { NULL },
 };
@@ -282,14 +299,6 @@ static const AVFilterPad hflip_vulkan_inputs[] = {
 }
 };
 
-static const AVFilterPad flip_vulkan_outputs[] = {
-{
-.name = "default",
-.type = AVMEDIA_TYPE_VIDEO,
-.config_props = &ff_vk_filter_config_output,
-}
-};
-
 const AVFilter ff_vf_hflip_vulkan = {
 .name   = "hflip_vulkan",
 .description= NULL_IF_CONFIG_SMALL("Horizontally flip the input video 
in Vulkan"),
@@ -330,3 +339,31 @@ const AVFilter ff_vf_vflip_vulkan = {
 .priv_class = &vflip_vulkan_class,
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
+
+static const AVOption flip_vulkan_options[] = {
+{ NULL },
+};
+
+AVFILTER_DEFINE_CLASS(flip_vulkan);
+
+static const AVFilterPad flip_vulkan_inputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_VIDEO,
+.filter_frame = &flip_vulkan_filter_frame,
+.config_props = &ff_vk_filter_config_input,
+}
+};
+
+const AVFilter ff_vf_flip_vulkan = {
+.name   = "flip_vulkan",
+.description= NULL_IF_CONFIG_SMALL("Flip both horizontally and 
vertically"),
+.priv_size  = sizeof(FlipVulkanContext),
+.init   = &ff_vk_filter_init,
+.uninit = &flip_vulkan_uninit,
+FILTER_INPUTS(flip_vulkan_inputs),
+FILTER_OUTPUTS(flip_vulkan_outputs),
+FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN),
+.priv_class = &flip_vulkan_class,
+.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
+};
-- 
2.25.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, 

[FFmpeg-devel] [PATCH v4 1/2] avutil/hwcontext_vulkan: fully support customizable validation layers

2021-11-26 Thread Wu Jianhua
Validation layer is an indispensable part of developing on Vulkan.

The following commands is on how to enable validation layers:

ffmpeg -init_hw_device 
vulkan=0,debug=1,validation_layers=VK_LAYER_LUNARG_monitor+VK_LAYER_LUNARG_api_dump

Signed-off-by: Wu Jianhua 
---
 libavutil/hwcontext_vulkan.c | 163 ---
 libavutil/vulkan_functions.h |   1 +
 2 files changed, 135 insertions(+), 29 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 644ed947f8..870a6fc71b 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -146,6 +146,13 @@ typedef struct AVVkFrameInternal {
 }  
\
 } while(0)
 
+#define RELEASE_PROPS(props, count)
\
+if (props) {   
\
+for (int i = 0; i < count; i++)
\
+av_free((void *)((props)[i])); 
\
+av_free((void *)props);
\
+}
+
 static const struct {
 enum AVPixelFormat pixfmt;
 const VkFormat vkfmts[4];
@@ -511,25 +518,128 @@ static int check_extensions(AVHWDeviceContext *ctx, int 
dev, AVDictionary *opts,
 return 0;
 
 fail:
-if (extension_names)
-for (int i = 0; i < extensions_found; i++)
-av_free((void *)extension_names[i]);
-av_free(extension_names);
+RELEASE_PROPS(extension_names, extensions_found);
 av_free(user_exts_str);
 av_free(sup_ext);
 return err;
 }
 
+static int check_validation_layers(AVHWDeviceContext *ctx, AVDictionary *opts,
+   const char * const **dst, uint32_t *num, 
int *debug_mode)
+{
+static const char default_layer[] = { "VK_LAYER_KHRONOS_validation" };
+
+int found = 0, err = 0;
+VulkanDevicePriv *priv = ctx->internal->priv;
+FFVulkanFunctions *vk = &priv->vkfn;
+
+uint32_t sup_layer_count;
+VkLayerProperties *sup_layers;
+
+AVDictionaryEntry *user_layers;
+char *user_layers_str = NULL;
+char *save, *token;
+
+const char **enabled_layers = NULL;
+uint32_t enabled_layers_count = 0;
+
+AVDictionaryEntry *debug_opt = av_dict_get(opts, "debug", NULL, 0);
+int debug = debug_opt && strtol(debug_opt->value, NULL, 10);
+
+/* If `debug=0`, enable no layers at all. */
+if (debug_opt && !debug)
+return 0;
+
+vk->EnumerateInstanceLayerProperties(&sup_layer_count, NULL);
+sup_layers = av_malloc_array(sup_layer_count, sizeof(VkLayerProperties));
+if (!sup_layers)
+return AVERROR(ENOMEM);
+vk->EnumerateInstanceLayerProperties(&sup_layer_count, sup_layers);
+
+av_log(ctx, AV_LOG_VERBOSE, "Supported validation layers:\n");
+for (int i = 0; i < sup_layer_count; i++)
+av_log(ctx, AV_LOG_VERBOSE, "\t%s\n", sup_layers[i].layerName);
+
+/* If `debug=1` is specified, enable the standard validation layer 
extension */
+if (debug) {
+*debug_mode = debug;
+for (int i = 0; i < sup_layer_count; i++) {
+if (!strcmp(default_layer, sup_layers[i].layerName)) {
+found = 1;
+av_log(ctx, AV_LOG_VERBOSE,
+"Default validation layer %s is enabled\n", default_layer);
+ADD_VAL_TO_LIST(enabled_layers, enabled_layers_count, 
default_layer);
+break;
+}
+}
+}
+
+user_layers = av_dict_get(opts, "validation_layers", NULL, 0);
+if (!user_layers)
+goto end;
+
+user_layers_str = av_strdup(user_layers->value);
+if (!user_layers_str) {
+err = AVERROR(EINVAL);
+goto fail;
+}
+
+token = av_strtok(user_layers_str, "+", &save);
+while (token) {
+found = 0;
+if (!strcmp(default_layer, token)) {
+if (debug) {
+/* if the `debug=1`, default_layer is enabled, skip here */
+token = av_strtok(NULL, "+", &save);
+continue;
+} else {
+/* if the `debug=0`, enable debug mode to load its callback 
properly */
+*debug_mode = debug;
+}
+}
+for (int j = 0; j < sup_layer_count; j++) {
+if (!strcmp(token, sup_layers[j].layerName)) {
+found = 1;
+break;
+}
+}
+if (found) {
+av_log(ctx, AV_LOG_VERBOSE, "Requested Validation Layer: %s\n", 
token);
+ADD_VAL_TO_LIST(enabled_layers, enabled_layers_count, token);
+} else {
+av_log(ctx, AV_LOG_ERROR,
+   "Validation Layer \"%s\" not support.\n", token);
+err = AVERROR(EINVAL);
+goto fail;
+}
+token = av_strtok(NULL, "+", &save);
+}
+
+av_free(user_layers_st

Re: [FFmpeg-devel] [PATCH v15 00/16] *** SUBJECT HERE ***

2021-11-26 Thread Nicolas George
James Almer (12021-11-25):
> Have all the concerns people had been addressed? I'm also certain the
> design itself wasn't well received.

Indeed. The whole libavfilter part is nowhere near anything acceptable.
It should not be applied at all.

Regards,

-- 
  Nicolas George
___
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 v2] lavu/avframe: add a time_base field

2021-11-26 Thread Lynne
25 Nov 2021, 23:49 by c...@passwd.hu:

>
>
> On Thu, 25 Nov 2021, Lynne wrote:
>
>> This adds a time_base field (currently unused), analogue to the
>> AVPacket.time_base field.
>> This allows for API clients to exchange AVFrames directly, without
>> needing to plumb extra data from sources via side mechanisms.
>>
>
> The objections raised before still stand I believe, and again, the main 
> concern is that the API user won't know when to use the packet or frame 
> timebase and when to use the frame/packet source timebase.
>
> You write this in the doxy:
>
>> Time base for the timestamps in this frame. May be 0, in which case the
>> time_base from the frame source should be used.
>>
>
> One could easily think - based on this text alone - that every user of 
> avcodec_receive_frame should check if AVFrame->time_base is 0 to calculate 
> real PTS...
>
> I'd be a lot more willing to accept this if you could document explicitly 
> that AVFrame->time_base (and AVPacket->time_base) is not used by the API 
> right now, and is similar to e.g. *opaque field. And later, if by using some 
> magic flag or new API or whatever it turns out to make sense to actually use 
> AVPacket/AVFrame time base, the doxy text can be extended accordingly.
>

So you'd like for the field to either be fully opaque or fully working (by 
always
having the correct time_base value)?
That sounds fair, description changed:
"Time base for the timestamps in this frame. Currently unused by any API,
users can set this and use it as an opaque field. In the future, this field may
be set by the API for you, but its value will always be ignored."
___
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".