Re: [FFmpeg-devel] [PATCH] avformat/concatdec: add support for setting input options

2021-02-02 Thread Jan Ekström
On Mon, Jan 25, 2021 at 2:50 PM Nicolas George  wrote:
>
> Jan Ekström (12021-01-25):
> > I knew that would be useful, but opted out of it since:
> > 1. For now I didn't yet need it.
>
> That is not a good reason.
>
> > 2. I wanted to keep out of the actual playlist parsing code.
>
> I know, file parsing code is not nice. But this is what needs doing.
>
> > 3. Possible security ramifications (since we already have "safe" /
> > "unsafe" playlist entries).
>
> You are right, we need to treat options as unsave.
>
> >
> > It is a relatively simple extension yes, if you ignore the points 2/3.
> > You have an AVDictionary per file and after initializing the
> > AVDictionary in the opening function and applying global input options
> > - copy the contents of the per-file options there, too.
>
> Please, no half-baked solution.
>

I am pretty sure you mis-understood what I meant here. I meant that if
you exclude those bits that I was not interested in (namely, parsing
the playlist file and handling the "safe" flag), the extension would
be simple. Not meaning half-baked solutions.

Pushed a version last night which seems to now include the parsing
changes to a branch:
https://github.com/jeeb/ffmpeg/commits/add_input_options_to_concatdec

If this looks good, I'll just update the documentation and post it on
the mailing list.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 0/5] FIFO meta muxer related improvements

2021-02-02 Thread Jan Ekström
On Mon, Jan 25, 2021 at 10:01 AM Jan Ekström  wrote:
>
> On Mon, Jan 11, 2021 at 4:46 PM Jan Ekström  wrote:
> >
> > On Mon, Dec 7, 2020 at 12:08 PM Jan Ekström  wrote:
> > >
> > > The primary parts of this are patches 1,4,5. 2 and 3 were just noticed 
> > > when
> > > poking at the recovery timestamp logic, where the stream-time comparison 
> > > logic
> > > seemed somewhat weird (such as comparing the pts to last_recovery_ts only 
> > > if
> > > last_recovery_ts == AV_NOPTS_VALUE). If they seem incorrectly understood,
> > > they can be left out.
> > >
> > > As for the rest of the patches, they address the following issues:
> > > 1. Even if the header and the first packet get written out, the muxer 
> > > might
> > >still fail at writing to a server when it actually decides to do I/O.
> > >Currently (for example with the MP4 muxer) this leads to a constant 
> > > retry
> > >loop as each recovery is actually "successful". This patch makes sure 
> > > that
> > >even if a recovery is "successful", the following recovery will only 
> > > happen
> > >after the configured time, easing the load on any receiving server.
> > > 4. In case of avformat_write_header failing, the fifo muxer until now 
> > > would not
> > >close the avformat context and its underlying I/O. This is now added, 
> > > so
> > >that file sockets do not keep creeping up.
> > > 5. Unset a configured codec_tag if it is not supported by the underlying 
> > > muxer,
> > >as the API client has no visibility regarding whether a codec tag is
> > >acceptable in cases of meta-muxers such as fifo.
> > >
> > > Jan
> > >
> > > Bernard Boulay (1):
> > >   avformat/fifo: always wait recovery_wait_time between recoveries
> > >
> > > Jan Ekström (4):
> > >   avformat/fifo: fix handling of stream-time non-NOPTS recovery
> > >   avformat/fifo: cause immediate stream-time recovery if time went
> > > backwards
> > >   avformat/fifo: close IO in case header writing fails
> > >   avformat/fifo: unset codec tag if unsupported by underlying muxer
> > >
> > >  libavformat/fifo.c | 77 ++
> > >  1 file changed, 51 insertions(+), 26 deletions(-)
> > >
> >
> > Ping for this patch set.
>
> Ping for this patch set.

As there were no comments...

I think that while this is a behavioral change (you no longer get an
immediate retry in case you have recovery_wait_time set with the first
attempt):

1. the current way of doing recovery waits can cause DoS with muxers
such as movenc - which can return success initially (and thus the
retry counter is reset), but then fail to actually write actual data
out
2. I do not think we can ask from the muxer whether it actually sent
data out through the I/O or not.

Thus, just making the fifo meta muxer always wait for the
recovery_wait_time makes sense.

Additionally, there are some bug fixes that I found, such as the
forgotten closing of I/O, or unsetting the codec tag if it is not
supported by the actual underlying format (since the API client has no
visibility of the underlying format).

Jan
___
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/fifo: utilize a clone packet for muxing

2021-02-02 Thread Jan Ekström
On Mon, Jan 25, 2021 at 9:47 AM Jan Ekström  wrote:
>
> On Thu, Jan 14, 2021 at 2:13 AM Jan Ekström  wrote:
> >
> > On Tue, Jan 12, 2021 at 9:59 AM Jan Ekström  wrote:
> > >
> > > On Mon, Jan 11, 2021 at 10:53 PM Andreas Rheinhardt
> > >  wrote:
> > > >
> > > > Jan Ekström:
> > > > > On Tue, Dec 8, 2020 at 2:54 PM Jan Ekström  wrote:
> > > > >>
> > > > >> From: Jan Ekström 
> > > > >>
> > > > >> This way the timestamp adjustments do not have to be manually
> > > > >> undone in case of failure and need to recover/retry.
> > > > >>
> > > > >> Fixes an issue where the timestamp adjustment would be re-done over
> > > > >> and over again when recovery by muxing the same AVPacket again is
> > > > >> attempted. Would become visible if the fifo muxer's time base and
> > > > >> the output muxer's time base do not match (by the value either
> > > > >> becoming smaller and smaller, or larger and larger).
> > > > >>
> > > > >> Signed-off-by: Jan Ekström 
> > > > >
> > > > > Ping.
> > > > >
> > > > > Unless someone finds some disgruntling points in this patch, I will
> > > > > soon move towards applying this.
> > > > >
> > > > > My initial plan was to make a simplified v2 where the output AVPacket
> > > > > was on stack limited to the fifo_thread_write_packet context, but
> > > > > apparently gradual removal of stack usage of AVPackets is being
> > > > > planned, so I decided to not to.
> > > > >
> > > > > Best regards,
> > > > > Jan
> > > >
> > > > Can't you just record (in FifoMessage) whether the timestamps have
> > > > already been converted to the desired timebase?
> > >
> > > Back when I found this issue in this function that aligns the time
> > > bases and writes the packet on the underlying avformat context, I did
> > > not think of that, but I did think of reversing the time base scaling
> > > in case of failure. That I then opted not to do due to possibly being
> > > inaccurate unless I saved all of those values from the AVPacket that
> > > av_packet_rescale_ts touches. Thus, I settled on just utilizing a
> > > reference/copy for the actual muxing, so that it could be easily
> > > discarded and the original AVPacket's values were not lost.
> > >
> > > > (Or why not just copy
> > > > the timebase chosen by the internal muxer to the user-visible stream so
> > > > that we don't even have to convert it? This is how muxers always 
> > > > operate.)
> > >
> > > This one sounds more like the correct way in the end, if possible. My
> > > attempt for now was to just fix an issue within the current logic
> > > (time base handling in case of failure was forgotten). I am trying to
> > > remind myself at which point the AVStreams should no longer be
> > > poked/modified as far as time base is concerned... init or header?
> > > init seems to call init_pts in libavformat/mux.c, so my initial
> > > guesstimate is that where fifo.c is currently doing its things
> > > (fifo_mux_init), you could just add the time base sync. Most API
> > > clients tend to call only avformat_write_header so in that sense with
> > > various API clients you probably wouldn't even notice the difference
> > > :) .
> >
> > So I just double-checked the docs in avformat.h, and the point of
> > update given to the API user is the header writing, which in the fifo
> > muxer is being done asynchronously in its own thread. We would have to
> > basically make fifo_write_header wait until the first time
> > avformat_write_header gets successfully called in
> > fifo_thread_write_header.
> >
> > While possible - and could make the time base juggling unnecessary -
> > not sure if it would be my first attempt. :) I'd probably first want
> > to get the time base logic fixed since that would be limited to
> > fifo_thread_write_packet.
> >
> > If there were question marks on why I utilized a separate reference
> > AVPacket, it was mostly to keep the time related values original in
> > the fed AVPacket, thus backing up all of the time values that
> > av_packet_rescale_ts might touch (if new time fields were to be added
> > to AVPacket, and modified by av_packet_rescale_ts, then the code would
> > have to be updated if I had just backed up the values manually and
> > then passed them back). In addition to possibly causing a new buffer
> > to be allocated in case of a non-refcounted buffer (although the fifo
> > muxer does do an av_packet_ref for all input packets, so everything
> > fed in through the worker thread should be reference counted), It does
> > cause the side data etc to be copied as well, which is of course
> > unfortunate. In the testing that was done this did not seem to cause
> > major issues, though.
> >
> > If someone feels heavily about this, I can of course write
> > ff_packet_copy_ts(AVPacket *dst, const AVPacket *src), which could
> > then be utilized against the dummy AVPacket.
> >
>
> Ping on this case.
>
> 1. Currently since fifo muxer seems to already generate a refcounted
> AVPacket when taking in an AVPacket, doing another av_packet_ref is

Re: [FFmpeg-devel] [PATCH v2] ffmpeg: add -rmax to clamp output framerate

2021-02-02 Thread James Almer

On 2/3/2021 1:08 AM, Gyan Doshi wrote:

Plan to push this in a day.


It's been a day since you submitted this patch, so you can give people 
some more time to look at it. There's no hurry.




On 01-02-2021 06:52 pm, Gyan Doshi wrote:

Useful when encoding in batch or with aberrant inputs.
---
  doc/ffmpeg.texi  |  7 +++
  fftools/ffmpeg.c |  7 ++-
  fftools/ffmpeg.h |  3 +++
  fftools/ffmpeg_opt.c | 24 +---
  4 files changed, 37 insertions(+), 4 deletions(-)

Forgot to nullify rmax with r set.

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 8eb012b7c0..7726f25082 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -759,6 +759,13 @@ If in doubt use @option{-framerate} instead of 
the input option @option{-r}.
  As an output option, duplicate or drop input frames to achieve 
constant output

  frame rate @var{fps}.
+@item -rmax[:@var{stream_specifier}] @var{fps} 
(@emph{output,per-stream})

+Set maximum frame rate (Hz value, fraction or abbreviation).
+
+Clamps output frame rate when output framerate is auto-set and is 
higher than this value.
+Useful in batch processing or when input framerate is wrongly 
detected as very high.

+Ignored when either @code{-r} is set or during streamcopy.
+
  @item -s[:@var{stream_specifier}] @var{size} 
(@emph{input/output,per-stream})

  Set frame size.
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d7c833be63..add5a3e505 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3376,7 +3376,7 @@ static int 
init_output_stream_encode(OutputStream *ost, AVFrame *frame)

  ost->frame_rate = ist->framerate;
  if (ist && !ost->frame_rate.num)
  ost->frame_rate = ist->st->r_frame_rate;
-    if (ist && !ost->frame_rate.num) {
+    if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) {
  ost->frame_rate = (AVRational){25, 1};
  av_log(NULL, AV_LOG_WARNING,
 "No information "
@@ -3386,6 +3386,11 @@ static int 
init_output_stream_encode(OutputStream *ost, AVFrame *frame)

 ost->file_index, ost->index);
  }
+    if (ost->max_frame_rate.num &&
+    (av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) ||
+    !ost->frame_rate.den))
+    ost->frame_rate = ost->max_frame_rate;
+
  if (ost->enc->supported_framerates && !ost->force_fps) {
  int idx = av_find_nearest_q_idx(ost->frame_rate, 
ost->enc->supported_framerates);

  ost->frame_rate = ost->enc->supported_framerates[idx];
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 8046e75026..3662130da4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -108,6 +108,8 @@ typedef struct OptionsContext {
  int    nb_audio_sample_rate;
  SpecifierOpt *frame_rates;
  int    nb_frame_rates;
+    SpecifierOpt *max_frame_rates;
+    int    nb_max_frame_rates;
  SpecifierOpt *frame_sizes;
  int    nb_frame_sizes;
  SpecifierOpt *frame_pix_fmts;
@@ -479,6 +481,7 @@ typedef struct OutputStream {
  /* video only */
  AVRational frame_rate;
+    AVRational max_frame_rate;
  int is_cfr;
  int force_fps;
  int top_field_first;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index bf2eb26246..2080499e65 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -55,6 +55,7 @@ static const char *const 
opt_name_codec_names[]   = {"c", "codec", "
  static const char *const opt_name_audio_channels[]    = 
{"ac", NULL};
  static const char *const opt_name_audio_sample_rate[] = 
{"ar", NULL};
  static const char *const opt_name_frame_rates[]   = 
{"r", NULL};
+static const char *const opt_name_max_frame_rates[]   = 
{"rmax", NULL};
  static const char *const opt_name_frame_sizes[]   = 
{"s", NULL};
  static const char *const opt_name_frame_pix_fmts[]    = 
{"pix_fmt", NULL};
  static const char *const opt_name_ts_scale[]  = 
{"itsscale", NULL};
@@ -1688,7 +1689,7 @@ static OutputStream 
*new_video_stream(OptionsContext *o, AVFormatContext *oc, in

  AVStream *st;
  OutputStream *ost;
  AVCodecContext *video_enc;
-    char *frame_rate = NULL, *frame_aspect_ratio = NULL;
+    char *frame_rate = NULL, *max_frame_rate = NULL, 
*frame_aspect_ratio = NULL;

  ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index);
  st  = ost->st;
@@ -1699,8 +1700,22 @@ static OutputStream 
*new_video_stream(OptionsContext *o, AVFormatContext *oc, in
  av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", 
frame_rate);

  exit_program(1);
  }
-    if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
-    av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce 
invalid output files\n");

+
+    MATCH_PER_STREAM_OPT(max_frame_rates, str, max_frame_rate, oc, st);
+    if (max_frame_rate && 

Re: [FFmpeg-devel] [PATCH v2] ffmpeg: add -rmax to clamp output framerate

2021-02-02 Thread Gyan Doshi

Plan to push this in a day.

On 01-02-2021 06:52 pm, Gyan Doshi wrote:

Useful when encoding in batch or with aberrant inputs.
---
  doc/ffmpeg.texi  |  7 +++
  fftools/ffmpeg.c |  7 ++-
  fftools/ffmpeg.h |  3 +++
  fftools/ffmpeg_opt.c | 24 +---
  4 files changed, 37 insertions(+), 4 deletions(-)

Forgot to nullify rmax with r set.

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 8eb012b7c0..7726f25082 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -759,6 +759,13 @@ If in doubt use @option{-framerate} instead of the input 
option @option{-r}.
  As an output option, duplicate or drop input frames to achieve constant output
  frame rate @var{fps}.
  
+@item -rmax[:@var{stream_specifier}] @var{fps} (@emph{output,per-stream})

+Set maximum frame rate (Hz value, fraction or abbreviation).
+
+Clamps output frame rate when output framerate is auto-set and is higher than 
this value.
+Useful in batch processing or when input framerate is wrongly detected as very 
high.
+Ignored when either @code{-r} is set or during streamcopy.
+
  @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream})
  Set frame size.
  
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c

index d7c833be63..add5a3e505 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3376,7 +3376,7 @@ static int init_output_stream_encode(OutputStream *ost, 
AVFrame *frame)
  ost->frame_rate = ist->framerate;
  if (ist && !ost->frame_rate.num)
  ost->frame_rate = ist->st->r_frame_rate;
-if (ist && !ost->frame_rate.num) {
+if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) {
  ost->frame_rate = (AVRational){25, 1};
  av_log(NULL, AV_LOG_WARNING,
 "No information "
@@ -3386,6 +3386,11 @@ static int init_output_stream_encode(OutputStream *ost, 
AVFrame *frame)
 ost->file_index, ost->index);
  }
  
+if (ost->max_frame_rate.num &&

+(av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) ||
+!ost->frame_rate.den))
+ost->frame_rate = ost->max_frame_rate;
+
  if (ost->enc->supported_framerates && !ost->force_fps) {
  int idx = av_find_nearest_q_idx(ost->frame_rate, 
ost->enc->supported_framerates);
  ost->frame_rate = ost->enc->supported_framerates[idx];
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 8046e75026..3662130da4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -108,6 +108,8 @@ typedef struct OptionsContext {
  intnb_audio_sample_rate;
  SpecifierOpt *frame_rates;
  intnb_frame_rates;
+SpecifierOpt *max_frame_rates;
+intnb_max_frame_rates;
  SpecifierOpt *frame_sizes;
  intnb_frame_sizes;
  SpecifierOpt *frame_pix_fmts;
@@ -479,6 +481,7 @@ typedef struct OutputStream {
  
  /* video only */

  AVRational frame_rate;
+AVRational max_frame_rate;
  int is_cfr;
  int force_fps;
  int top_field_first;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index bf2eb26246..2080499e65 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -55,6 +55,7 @@ static const char *const opt_name_codec_names[]   = {"c", 
"codec", "
  static const char *const opt_name_audio_channels[]= {"ac", NULL};
  static const char *const opt_name_audio_sample_rate[] = {"ar", NULL};
  static const char *const opt_name_frame_rates[]   = {"r", NULL};
+static const char *const opt_name_max_frame_rates[]   = {"rmax", NULL};
  static const char *const opt_name_frame_sizes[]   = {"s", NULL};
  static const char *const opt_name_frame_pix_fmts[]= {"pix_fmt", 
NULL};
  static const char *const opt_name_ts_scale[]  = {"itsscale", 
NULL};
@@ -1688,7 +1689,7 @@ static OutputStream *new_video_stream(OptionsContext *o, 
AVFormatContext *oc, in
  AVStream *st;
  OutputStream *ost;
  AVCodecContext *video_enc;
-char *frame_rate = NULL, *frame_aspect_ratio = NULL;
+char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = 
NULL;
  
  ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index);

  st  = ost->st;
@@ -1699,8 +1700,22 @@ static OutputStream *new_video_stream(OptionsContext *o, 
AVFormatContext *oc, in
  av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", 
frame_rate);
  exit_program(1);
  }
-if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
-av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid 
output files\n");
+
+MATCH_PER_STREAM_OPT(max_frame_rates, str, max_frame_rate, oc, st);
+if (max_frame_rate && av_parse_video_rate(>max_frame_rate, 
max_frame_rate) < 0) {
+av_log(NULL, AV_LOG_FATAL, "Invalid maximum framerate value: %s\n", 
max_frame_rate);
+exit_program(1);
+}
+

[FFmpeg-devel] [PATCH 09/10] fftools/ffplay: use av_packet_alloc() to allocate packets

2021-02-02 Thread James Almer
Signed-off-by: James Almer 
---
 fftools/ffplay.c | 204 +--
 1 file changed, 127 insertions(+), 77 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 9ff0425163..d48edc0797 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -36,6 +36,7 @@
 #include "libavutil/pixdesc.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/dict.h"
+#include "libavutil/fifo.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/samplefmt.h"
 #include "libavutil/avassert.h"
@@ -111,13 +112,12 @@ const int program_birth_year = 2003;
 static unsigned sws_flags = SWS_BICUBIC;
 
 typedef struct MyAVPacketList {
-AVPacket pkt;
-struct MyAVPacketList *next;
+AVPacket *pkt;
 int serial;
 } MyAVPacketList;
 
 typedef struct PacketQueue {
-MyAVPacketList *first_pkt, *last_pkt;
+AVFifoBuffer *pkt_list;
 int nb_packets;
 int size;
 int64_t duration;
@@ -187,7 +187,8 @@ enum {
 };
 
 typedef struct Decoder {
-AVPacket pkt;
+AVPacket *pkt;
+AVPacket *tmp_pkt;
 PacketQueue *queue;
 AVCodecContext *avctx;
 int pkt_serial;
@@ -361,7 +362,7 @@ static int filter_nbthreads = 0;
 static int is_full_screen;
 static int64_t audio_callback_time;
 
-static AVPacket flush_pkt;
+static uint8_t flush_pkt;
 
 #define FF_QUIT_EVENT(SDL_USEREVENT + 2)
 
@@ -427,28 +428,25 @@ int64_t get_valid_channel_layout(int64_t channel_layout, 
int channels)
 
 static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
 {
-MyAVPacketList *pkt1;
+MyAVPacketList pkt1;
 
 if (q->abort_request)
return -1;
 
-pkt1 = av_malloc(sizeof(MyAVPacketList));
-if (!pkt1)
-return -1;
-pkt1->pkt = *pkt;
-pkt1->next = NULL;
-if (pkt == _pkt)
+if (av_fifo_space(q->pkt_list) < sizeof(pkt1)) {
+if (av_fifo_grow(q->pkt_list, sizeof(pkt1)) < 0)
+return -1;
+}
+
+if (pkt->data == _pkt)
 q->serial++;
-pkt1->serial = q->serial;
+pkt1.pkt = pkt;
+pkt1.serial = q->serial;
 
-if (!q->last_pkt)
-q->first_pkt = pkt1;
-else
-q->last_pkt->next = pkt1;
-q->last_pkt = pkt1;
+av_fifo_generic_write(q->pkt_list, , sizeof(pkt1), NULL);
 q->nb_packets++;
-q->size += pkt1->pkt.size + sizeof(*pkt1);
-q->duration += pkt1->pkt.duration;
+q->size += pkt1.pkt->size + sizeof(pkt1);
+q->duration += pkt1.pkt->duration;
 /* XXX: should duplicate packet data in DV case */
 SDL_CondSignal(q->cond);
 return 0;
@@ -456,32 +454,66 @@ static int packet_queue_put_private(PacketQueue *q, 
AVPacket *pkt)
 
 static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
 {
+AVPacket *pkt1;
 int ret;
 
+pkt1 = av_packet_clone(pkt);
+if (!pkt1)
+   return -1;
 SDL_LockMutex(q->mutex);
-ret = packet_queue_put_private(q, pkt);
+ret = packet_queue_put_private(q, pkt1);
 SDL_UnlockMutex(q->mutex);
-
-if (pkt != _pkt && ret < 0)
+if (ret < 0) {
+av_packet_free();
 av_packet_unref(pkt);
+}
+
+return ret;
+}
+
+static int packet_queue_put_flushpacket(PacketQueue *q)
+{
+AVPacket *pkt;
+int ret;
+
+pkt = av_packet_alloc();
+if (!pkt)
+   return -1;
+pkt->data = _pkt;
+SDL_LockMutex(q->mutex);
+ret = packet_queue_put_private(q, pkt);
+SDL_UnlockMutex(q->mutex);
+if (ret < 0)
+av_packet_free();
 
 return ret;
 }
 
 static int packet_queue_put_nullpacket(PacketQueue *q, int stream_index)
 {
-AVPacket pkt1, *pkt = 
-av_init_packet(pkt);
-pkt->data = NULL;
-pkt->size = 0;
+AVPacket *pkt;
+int ret;
+
+pkt = av_packet_alloc();
+if (!pkt)
+   return -1;
 pkt->stream_index = stream_index;
-return packet_queue_put(q, pkt);
+SDL_LockMutex(q->mutex);
+ret = packet_queue_put_private(q, pkt);
+SDL_UnlockMutex(q->mutex);
+if (ret < 0)
+av_packet_free();
+
+return ret;
 }
 
 /* packet queue handling */
 static int packet_queue_init(PacketQueue *q)
 {
 memset(q, 0, sizeof(PacketQueue));
+q->pkt_list = av_fifo_alloc(sizeof(MyAVPacketList));
+if (!q->pkt_list)
+return AVERROR(ENOMEM);
 q->mutex = SDL_CreateMutex();
 if (!q->mutex) {
 av_log(NULL, AV_LOG_FATAL, "SDL_CreateMutex(): %s\n", SDL_GetError());
@@ -498,16 +530,13 @@ static int packet_queue_init(PacketQueue *q)
 
 static void packet_queue_flush(PacketQueue *q)
 {
-MyAVPacketList *pkt, *pkt1;
+MyAVPacketList pkt1;
 
 SDL_LockMutex(q->mutex);
-for (pkt = q->first_pkt; pkt; pkt = pkt1) {
-pkt1 = pkt->next;
-av_packet_unref(>pkt);
-av_freep();
+while (av_fifo_size(q->pkt_list) >= sizeof(pkt1)) {
+av_fifo_generic_read(q->pkt_list, , sizeof(pkt1), NULL);
+av_packet_free();
 }
-q->last_pkt = NULL;
-q->first_pkt = NULL;
 q->nb_packets = 0;
 q->size = 0;
 q->duration = 0;
@@ -517,6 +546,7 @@ static 

Re: [FFmpeg-devel] [PATCH 5/7] avformat/mvdec: Sanity check SAMPLE_WIDTH

2021-02-02 Thread Peter Ross
On Wed, Feb 03, 2021 at 12:13:32AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 9 * 8 cannot be represented in type 
> 'int'
> Fixes: 
> 30048/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5864289917337600
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mvdec.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
> index d8f121bea5..ac96e4a808 100644
> --- a/libavformat/mvdec.c
> +++ b/libavformat/mvdec.c
> @@ -159,7 +159,10 @@ static int parse_audio_var(AVFormatContext *avctx, 
> AVStream *st,
>  st->codecpar->sample_rate = var_read_int(pb, size);
>  avpriv_set_pts_info(st, 33, 1, st->codecpar->sample_rate);
>  } else if (!strcmp(name, "SAMPLE_WIDTH")) {
> -st->codecpar->bits_per_coded_sample = var_read_int(pb, size) * 8;
> +uint64_t bpc = var_read_int(pb, size) * (uint64_t)8;
> +if (bpc > 100)
> +return AVERROR_INVALIDDATA;
> +st->codecpar->bits_per_coded_sample = bpc;
>  } else
>  return AVERROR_INVALIDDATA;

ok

could tighten it further.  realistically (audio) bits per codeded sample will 
never >16 here.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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 09/10] fftools/ffplay: use av_packet_alloc() to allocate packets

2021-02-02 Thread Marton Balint



On Mon, 1 Feb 2021, James Almer wrote:


Signed-off-by: James Almer 
---
fftools/ffplay.c | 222 ---
1 file changed, 135 insertions(+), 87 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 9ff0425163..ef954772ed 100644


[...]


-static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
+static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVPacket *pkt, 
AVSubtitle *sub) {
int ret = AVERROR(EAGAIN);

for (;;) {
-AVPacket pkt;
-


This pkt should be kept local, because there is no need for it to be a 
parameter of decoder_decode_frame. So I suggest you add a new Decoder 
attribure tmp_pkt, and initialize pkt with it:


AVPacket *pkt = d->tmp_pkt;

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] avformat: add binka demuxer

2021-02-02 Thread Andreas Rheinhardt
James Almer:
> On 2/2/2021 9:40 PM, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>   libavformat/Makefile |   1 +
>>   libavformat/allformats.c |   1 +
>>   libavformat/binka.c  | 107 +++
>>   3 files changed, 109 insertions(+)
>>   create mode 100644 libavformat/binka.c
>>
>> diff --git a/libavformat/Makefile b/libavformat/Makefile
>> index 85f432c8d9..b977fa0b1e 100644
>> --- a/libavformat/Makefile
>> +++ b/libavformat/Makefile
>> @@ -131,6 +131,7 @@ OBJS-$(CONFIG_AVS3_DEMUXER)  +=
>> avs3dec.o rawdec.o
>>   OBJS-$(CONFIG_BETHSOFTVID_DEMUXER)   += bethsoftvid.o
>>   OBJS-$(CONFIG_BFI_DEMUXER)   += bfi.o
>>   OBJS-$(CONFIG_BINK_DEMUXER)  += bink.o
>> +OBJS-$(CONFIG_BINKA_DEMUXER) += binka.o
>>   OBJS-$(CONFIG_BINTEXT_DEMUXER)   += bintext.o sauce.o
>>   OBJS-$(CONFIG_BIT_DEMUXER)   += bit.o
>>   OBJS-$(CONFIG_BIT_MUXER) += bit.o
>> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
>> index 6990af55f4..9628c726a7 100644
>> --- a/libavformat/allformats.c
>> +++ b/libavformat/allformats.c
>> @@ -94,6 +94,7 @@ extern AVInputFormat  ff_bethsoftvid_demuxer;
>>   extern AVInputFormat  ff_bfi_demuxer;
>>   extern AVInputFormat  ff_bintext_demuxer;
>>   extern AVInputFormat  ff_bink_demuxer;
>> +extern AVInputFormat  ff_binka_demuxer;
>>   extern AVInputFormat  ff_bit_demuxer;
>>   extern AVOutputFormat ff_bit_muxer;
>>   extern AVInputFormat  ff_bmv_demuxer;
>> diff --git a/libavformat/binka.c b/libavformat/binka.c
>> new file mode 100644
>> index 00..5ed0f17968
>> --- /dev/null
>> +++ b/libavformat/binka.c
>> @@ -0,0 +1,107 @@
>> +/*
>> + * Copyright (c) 2021 Paul B Mahol
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>> 02110-1301 USA
>> + */
>> +
>> +#include "libavutil/intreadwrite.h"
>> +#include "avformat.h"
>> +#include "internal.h"
>> +
>> +static int binka_probe(const AVProbeData *p)
>> +{
>> +    if (AV_RB32(p->buf) == MKBETAG('1', 'F', 'C', 'B'))
>> +    return AVPROBE_SCORE_MAX;
>> +    return 0;
>> +}
>> +
>> +static int binka_read_header(AVFormatContext *s)
>> +{
>> +    AVIOContext *pb = s->pb;
>> +    AVStream *st;
>> +    uint32_t samples;
>> +    int entries;
>> +    int64_t offset;
>> +    int ret;
>> +
>> +    st = avformat_new_stream(s, NULL);
>> +    if (!st)
>> +    return AVERROR(ENOMEM);
>> +
>> +    avio_skip(pb, 5);
>> +
>> +    st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
>> +    st->codecpar->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
>> +    st->codecpar->channels = avio_r8(pb);
>> +    st->codecpar->sample_rate = avio_rl16(pb);
>> +    st->duration = avio_rl32(pb);
>> +
>> +    avio_skip(pb, 4);
>> +    samples = avio_rl32(pb);
>> +    entries = avio_rl16(pb);
> 
> Is this a seek table? Why are you not using it?
> 
>> +
>> +    if ((ret = ff_get_extradata(s, st->codecpar, pb, 2)) < 0)
>> +    return ret;
>> +
>> +    offset = entries * 2;
>> +    avio_skip(pb, offset);
>> +
>> +    avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
>> +
>> +    s->internal->data_offset = avio_tell(pb);
>> +
>> +    return 0;
>> +}
>> +
>> +static int binka_read_packet(AVFormatContext *s, AVPacket *pkt)
>> +{
>> +    AVIOContext *pb = s->pb;
>> +    int64_t pos;
>> +    int pkt_size;
>> +    int ret;
>> +
>> +    if (avio_feof(pb))
>> +    return AVERROR_EOF;
>> +
>> +    pos = avio_tell(pb);
>> +    avio_skip(pb, 2);
>> +    pkt_size = avio_rl16(pb) + 4;
>> +    if (pkt_size <= 4)
>> +    return AVERROR(EIO);
> 
>> +    ret = av_new_packet(pkt, pkt_size);
>> +    if (ret < 0)
>> +    return ret;
>> +
>> +    avio_read(pb, pkt->data + 4, pkt_size - 4);
> 
> av_get_packet()
> 

Doesn't work when you want the data read to be put somewhere else than
the beginning of the packet.

>> +    AV_WL32(pkt->data, pkt_size);
>> +
>> +    pkt->pos = pos;
>> +    pkt->stream_index = 0;
>> +    pkt->flags |= AV_PKT_FLAG_KEY;
> 
> Timestamps and duration?
> 
>> +
>> +    return 0;
>> +}
>> +
>> +AVInputFormat ff_binka_demuxer = {
>> +    .name   = "binka",
>> +    .long_name  = NULL_IF_CONFIG_SMALL("Bink Audio"),
>> +    .read_probe = binka_probe,
>> +    

Re: [FFmpeg-devel] [PATCH v1] lavfi/qsvvpp: support async depth

2021-02-02 Thread Wang, Fei W
On Wed, 2021-01-27 at 09:42 +0800, Fei Wang wrote:
> Async depth will allow qsv filter cache few frames, and avoid force
> switch and end filter task frame by frame. This change will improve
> performance for some multi-task case, for example 1:N transcode(
> decode + vpp + encode) with all QSV plugins.
> 
> Signed-off-by: Fei Wang 
> ---
>  libavfilter/qsvvpp.c | 147 ++---
> --
>  libavfilter/qsvvpp.h |  42 -
>  libavfilter/vf_deinterlace_qsv.c |   8 --
>  libavfilter/vf_vpp_qsv.c |  75 +---
>  4 files changed, 187 insertions(+), 85 deletions(-)
> 
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index f216b3f248..2e824e67e7 100644
> --- a/libavfilter/qsvvpp.c
> +++ b/libavfilter/qsvvpp.c
> @@ -27,6 +27,7 @@
>  #include "libavutil/hwcontext_qsv.h"
>  #include "libavutil/time.h"
>  #include "libavutil/pixdesc.h"
> +#include "libavutil/fifo.h"
>  
>  #include "internal.h"
>  #include "qsvvpp.h"
> @@ -37,37 +38,6 @@
>  #define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME)
>  #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
>  
> -typedef struct QSVFrame {
> -AVFrame  *frame;
> -mfxFrameSurface1 *surface;
> -mfxFrameSurface1  surface_internal;  /* for system memory */
> -struct QSVFrame  *next;
> -} QSVFrame;
> -
> -/* abstract struct for all QSV filters */
> -struct QSVVPPContext {
> -mfxSession  session;
> -int (*filter_frame) (AVFilterLink *outlink, AVFrame *frame);/*
> callback */
> -enum AVPixelFormat  out_sw_format;   /* Real output format */
> -mfxVideoParam   vpp_param;
> -mfxFrameInfo   *frame_infos; /* frame info for each
> input */
> -
> -/* members related to the input/output surface */
> -int in_mem_mode;
> -int out_mem_mode;
> -QSVFrame   *in_frame_list;
> -QSVFrame   *out_frame_list;
> -int nb_surface_ptrs_in;
> -int nb_surface_ptrs_out;
> -mfxFrameSurface1  **surface_ptrs_in;
> -mfxFrameSurface1  **surface_ptrs_out;
> -
> -/* MFXVPP extern parameters */
> -mfxExtOpaqueSurfaceAlloc opaque_alloc;
> -mfxExtBuffer  **ext_buffers;
> -int nb_ext_buffers;
> -};
> -
>  static const mfxHandleType handle_types[] = {
>  MFX_HANDLE_VA_DISPLAY,
>  MFX_HANDLE_D3D9_DEVICE_MANAGER,
> @@ -336,9 +306,9 @@ static int fill_frameinfo_by_link(mfxFrameInfo
> *frameinfo, AVFilterLink *link)
>  static void clear_unused_frames(QSVFrame *list)
>  {
>  while (list) {
> -if (list->surface && !list->surface->Data.Locked) {
> -list->surface = NULL;
> +if (list->used && !list->queued && !list-
> >surface.Data.Locked) {
>  av_frame_free(>frame);
> +list->used = 0;
>  }
>  list = list->next;
>  }
> @@ -361,8 +331,10 @@ static QSVFrame *get_free_frame(QSVFrame **list)
>  QSVFrame *out = *list;
>  
>  for (; out; out = out->next) {
> -if (!out->surface)
> +if (!out->used) {
> +out->used = 1;
>  break;
> +}
>  }
>  
>  if (!out) {
> @@ -371,6 +343,7 @@ static QSVFrame *get_free_frame(QSVFrame **list)
>  av_log(NULL, AV_LOG_ERROR, "Can't alloc new output
> frame.\n");
>  return NULL;
>  }
> +out->used  = 1;
>  out->next  = *list;
>  *list  = out;
>  }
> @@ -402,7 +375,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s,
> AVFilterLink *inlink, AVFrame *p
>  return NULL;
>  }
>  qsv_frame->frame   = av_frame_clone(picref);
> -qsv_frame->surface = (mfxFrameSurface1 *)qsv_frame->frame-
> >data[3];
> +qsv_frame->surface = *(mfxFrameSurface1 *)qsv_frame->frame-
> >data[3];
>  } else {
>  /* make a copy if the input is not padded as libmfx requires
> */
>  if (picref->height & 31 || picref->linesize[0] & 31) {
> @@ -425,27 +398,26 @@ static QSVFrame *submit_frame(QSVVPPContext *s,
> AVFilterLink *inlink, AVFrame *p
>  qsv_frame->frame = av_frame_clone(picref);
>  
>  if (map_frame_to_surface(qsv_frame->frame,
> -_frame->surface_internal) < 0) {
> + _frame->surface) < 0) {
>  av_log(ctx, AV_LOG_ERROR, "Unsupported frame.\n");
>  return NULL;
>  }
> -qsv_frame->surface = _frame->surface_internal;
>  }
>  
> -qsv_frame->surface->Info   = s-
> >frame_infos[FF_INLINK_IDX(inlink)];
> -qsv_frame->surface->Data.TimeStamp = av_rescale_q(qsv_frame-
> >frame->pts,
> +qsv_frame->surface.Info   = s-
> >frame_infos[FF_INLINK_IDX(inlink)];
> +qsv_frame->surface.Data.TimeStamp = av_rescale_q(qsv_frame-
> >frame->pts,
>inlink-
> >time_base, 

Re: [FFmpeg-devel] [PATCH 1/2] avformat: add binka demuxer

2021-02-02 Thread James Almer

On 2/2/2021 9:40 PM, Paul B Mahol wrote:

Signed-off-by: Paul B Mahol 
---
  libavformat/Makefile |   1 +
  libavformat/allformats.c |   1 +
  libavformat/binka.c  | 107 +++
  3 files changed, 109 insertions(+)
  create mode 100644 libavformat/binka.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 85f432c8d9..b977fa0b1e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -131,6 +131,7 @@ OBJS-$(CONFIG_AVS3_DEMUXER)  += avs3dec.o 
rawdec.o
  OBJS-$(CONFIG_BETHSOFTVID_DEMUXER)   += bethsoftvid.o
  OBJS-$(CONFIG_BFI_DEMUXER)   += bfi.o
  OBJS-$(CONFIG_BINK_DEMUXER)  += bink.o
+OBJS-$(CONFIG_BINKA_DEMUXER) += binka.o
  OBJS-$(CONFIG_BINTEXT_DEMUXER)   += bintext.o sauce.o
  OBJS-$(CONFIG_BIT_DEMUXER)   += bit.o
  OBJS-$(CONFIG_BIT_MUXER) += bit.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6990af55f4..9628c726a7 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -94,6 +94,7 @@ extern AVInputFormat  ff_bethsoftvid_demuxer;
  extern AVInputFormat  ff_bfi_demuxer;
  extern AVInputFormat  ff_bintext_demuxer;
  extern AVInputFormat  ff_bink_demuxer;
+extern AVInputFormat  ff_binka_demuxer;
  extern AVInputFormat  ff_bit_demuxer;
  extern AVOutputFormat ff_bit_muxer;
  extern AVInputFormat  ff_bmv_demuxer;
diff --git a/libavformat/binka.c b/libavformat/binka.c
new file mode 100644
index 00..5ed0f17968
--- /dev/null
+++ b/libavformat/binka.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2021 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "internal.h"
+
+static int binka_probe(const AVProbeData *p)
+{
+if (AV_RB32(p->buf) == MKBETAG('1', 'F', 'C', 'B'))
+return AVPROBE_SCORE_MAX;
+return 0;
+}
+
+static int binka_read_header(AVFormatContext *s)
+{
+AVIOContext *pb = s->pb;
+AVStream *st;
+uint32_t samples;
+int entries;
+int64_t offset;
+int ret;
+
+st = avformat_new_stream(s, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+avio_skip(pb, 5);
+
+st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+st->codecpar->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
+st->codecpar->channels = avio_r8(pb);
+st->codecpar->sample_rate = avio_rl16(pb);
+st->duration = avio_rl32(pb);
+
+avio_skip(pb, 4);
+samples = avio_rl32(pb);
+entries = avio_rl16(pb);


Is this a seek table? Why are you not using it?


+
+if ((ret = ff_get_extradata(s, st->codecpar, pb, 2)) < 0)
+return ret;
+
+offset = entries * 2;
+avio_skip(pb, offset);
+
+avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
+
+s->internal->data_offset = avio_tell(pb);
+
+return 0;
+}
+
+static int binka_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+AVIOContext *pb = s->pb;
+int64_t pos;
+int pkt_size;
+int ret;
+
+if (avio_feof(pb))
+return AVERROR_EOF;
+
+pos = avio_tell(pb);
+avio_skip(pb, 2);
+pkt_size = avio_rl16(pb) + 4;
+if (pkt_size <= 4)
+return AVERROR(EIO);



+ret = av_new_packet(pkt, pkt_size);
+if (ret < 0)
+return ret;
+
+avio_read(pb, pkt->data + 4, pkt_size - 4);


av_get_packet()


+AV_WL32(pkt->data, pkt_size);
+
+pkt->pos = pos;
+pkt->stream_index = 0;
+pkt->flags |= AV_PKT_FLAG_KEY;


Timestamps and duration?


+
+return 0;
+}
+
+AVInputFormat ff_binka_demuxer = {
+.name   = "binka",
+.long_name  = NULL_IF_CONFIG_SMALL("Bink Audio"),
+.read_probe = binka_probe,
+.read_header= binka_read_header,
+.read_packet= binka_read_packet,
+.flags  = AVFMT_GENERIC_INDEX,
+.extensions = "binka",
+};



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] avformat: add binka demuxer

2021-02-02 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/binka.c  | 107 +++
 3 files changed, 109 insertions(+)
 create mode 100644 libavformat/binka.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 85f432c8d9..b977fa0b1e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -131,6 +131,7 @@ OBJS-$(CONFIG_AVS3_DEMUXER)  += avs3dec.o 
rawdec.o
 OBJS-$(CONFIG_BETHSOFTVID_DEMUXER)   += bethsoftvid.o
 OBJS-$(CONFIG_BFI_DEMUXER)   += bfi.o
 OBJS-$(CONFIG_BINK_DEMUXER)  += bink.o
+OBJS-$(CONFIG_BINKA_DEMUXER) += binka.o
 OBJS-$(CONFIG_BINTEXT_DEMUXER)   += bintext.o sauce.o
 OBJS-$(CONFIG_BIT_DEMUXER)   += bit.o
 OBJS-$(CONFIG_BIT_MUXER) += bit.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6990af55f4..9628c726a7 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -94,6 +94,7 @@ extern AVInputFormat  ff_bethsoftvid_demuxer;
 extern AVInputFormat  ff_bfi_demuxer;
 extern AVInputFormat  ff_bintext_demuxer;
 extern AVInputFormat  ff_bink_demuxer;
+extern AVInputFormat  ff_binka_demuxer;
 extern AVInputFormat  ff_bit_demuxer;
 extern AVOutputFormat ff_bit_muxer;
 extern AVInputFormat  ff_bmv_demuxer;
diff --git a/libavformat/binka.c b/libavformat/binka.c
new file mode 100644
index 00..5ed0f17968
--- /dev/null
+++ b/libavformat/binka.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2021 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "internal.h"
+
+static int binka_probe(const AVProbeData *p)
+{
+if (AV_RB32(p->buf) == MKBETAG('1', 'F', 'C', 'B'))
+return AVPROBE_SCORE_MAX;
+return 0;
+}
+
+static int binka_read_header(AVFormatContext *s)
+{
+AVIOContext *pb = s->pb;
+AVStream *st;
+uint32_t samples;
+int entries;
+int64_t offset;
+int ret;
+
+st = avformat_new_stream(s, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+avio_skip(pb, 5);
+
+st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+st->codecpar->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
+st->codecpar->channels = avio_r8(pb);
+st->codecpar->sample_rate = avio_rl16(pb);
+st->duration = avio_rl32(pb);
+
+avio_skip(pb, 4);
+samples = avio_rl32(pb);
+entries = avio_rl16(pb);
+
+if ((ret = ff_get_extradata(s, st->codecpar, pb, 2)) < 0)
+return ret;
+
+offset = entries * 2;
+avio_skip(pb, offset);
+
+avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
+
+s->internal->data_offset = avio_tell(pb);
+
+return 0;
+}
+
+static int binka_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+AVIOContext *pb = s->pb;
+int64_t pos;
+int pkt_size;
+int ret;
+
+if (avio_feof(pb))
+return AVERROR_EOF;
+
+pos = avio_tell(pb);
+avio_skip(pb, 2);
+pkt_size = avio_rl16(pb) + 4;
+if (pkt_size <= 4)
+return AVERROR(EIO);
+ret = av_new_packet(pkt, pkt_size);
+if (ret < 0)
+return ret;
+
+avio_read(pb, pkt->data + 4, pkt_size - 4);
+AV_WL32(pkt->data, pkt_size);
+
+pkt->pos = pos;
+pkt->stream_index = 0;
+pkt->flags |= AV_PKT_FLAG_KEY;
+
+return 0;
+}
+
+AVInputFormat ff_binka_demuxer = {
+.name   = "binka",
+.long_name  = NULL_IF_CONFIG_SMALL("Bink Audio"),
+.read_probe = binka_probe,
+.read_header= binka_read_header,
+.read_packet= binka_read_packet,
+.flags  = AVFMT_GENERIC_INDEX,
+.extensions = "binka",
+};
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] avcodec/utils: unbreak BINKAUDIO_DCT duration calculation

2021-02-02 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/utils.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a1ae9cab18..4d1909b581 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1668,14 +1668,10 @@ static int get_audio_frame_duration(enum AVCodecID id, 
int sr, int ch, int ba,
 return 256 * sr / 245;
 else if (id == AV_CODEC_ID_DST)
 return 588 * sr / 44100;
-
-if (ch > 0) {
-/* calc from sample rate and channels */
-if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
-if (sr / 22050 > 22)
-return 0;
-return (480 << (sr / 22050)) / ch;
-}
+else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
+if (sr / 22050 > 22)
+return 0;
+return (480 << (sr / 22050));
 }
 
 if (id == AV_CODEC_ID_MP3)
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v4] fate: Add test for namespace prefixes in libraries

2021-02-02 Thread Mark Thompson

Ensures that external symbols in the built static libraries either have
correct namespace prefixes or are on a known list of exceptions.

Does not run on Windows, because headers there introduce additional global
symbols which would cause this test to fail unhelpfully.
---
Now without exceptions and disabled on Windows.

Requires 
 from 
Andreas applied beforehand to fix namespace problems in swscale.

Does anyone know a cleaner way of filtering out Windows for testing?  It could 
go inside the ALLYES if there were a CONFIG_ option matching it, but as far as 
I can tell there isn't.

Thanks,

- Mark

 tests/Makefile   |  1 +
 tests/fate/namespace.mak | 26 ++
 tests/fate/namespace.sh  | 18 ++
 3 files changed, 45 insertions(+)
 create mode 100644 tests/fate/namespace.mak
 create mode 100755 tests/fate/namespace.sh

diff --git a/tests/Makefile b/tests/Makefile
index 7844901e53..94057eb81d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -173,6 +173,7 @@ include $(SRC_PATH)/tests/fate/mpeg4.mak
 include $(SRC_PATH)/tests/fate/mpegps.mak
 include $(SRC_PATH)/tests/fate/mpegts.mak
 include $(SRC_PATH)/tests/fate/mxf.mak
+include $(SRC_PATH)/tests/fate/namespace.mak
 include $(SRC_PATH)/tests/fate/opus.mak
 include $(SRC_PATH)/tests/fate/pcm.mak
 include $(SRC_PATH)/tests/fate/pixfmt.mak
diff --git a/tests/fate/namespace.mak b/tests/fate/namespace.mak
new file mode 100644
index 00..2c5e192ea5
--- /dev/null
+++ b/tests/fate/namespace.mak
@@ -0,0 +1,26 @@
+
+# These tests are disabled on Windows, because headers there additional
+# global symbols which would cause them to fail unhelpfully.
+ifneq ($(HAVE_WINDOWS_H),yes)
+
+define FATE_NAMESPACE
+# (library_name, config_option)
+FATE_NAMESPACE-$(call ALLYES, STATIC $(2)) += fate-namespace-$(1)
+fate-namespace-$(1): lib$(1)/$(LIBPREF)$(1)$(LIBSUF)
+fate-namespace-$(1): CMD = runlocal fate/namespace.sh "$(NM_CMD) -P 
lib$(1)/$(LIBPREF)$(1)$(LIBSUF)"
+fate-namespace-$(1): CMP = null
+endef
+
+$(eval $(call FATE_NAMESPACE,avutil, AVUTIL))
+$(eval $(call FATE_NAMESPACE,avcodec,AVCODEC))
+$(eval $(call FATE_NAMESPACE,avformat,   AVFORMAT))
+$(eval $(call FATE_NAMESPACE,avfilter,   AVFILTER))
+$(eval $(call FATE_NAMESPACE,avdevice,   AVDEVICE))
+$(eval $(call FATE_NAMESPACE,swscale,SWSCALE))
+$(eval $(call FATE_NAMESPACE,swresample, SWRESAMPLE))
+$(eval $(call FATE_NAMESPACE,postproc,   POSTPROC))
+
+FATE += $(FATE_NAMESPACE-yes)
+fate-namespace: $(FATE_NAMESPACE-yes)
+
+endif
diff --git a/tests/fate/namespace.sh b/tests/fate/namespace.sh
new file mode 100755
index 00..9a6df9783f
--- /dev/null
+++ b/tests/fate/namespace.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if $1 |
+   grep ' [TDBR] ' | # Filter to all global text/(ro)data/bss symbols.
+   grep -v '^ff_'  | # Internal-only globals.
+   grep -v '^av'   | # libav* external API.
+   grep -v '^sws'  | # libswscale external API.
+   grep -v '^swr'  | # libswresample external API.
+   grep -v '^\(postproc\|pp\)_' | # libpostproc external API.
+   grep -v '^\(ffio\|ffurl\)_'  | # libavformat internal ffio/ffurl APIs.
+   grep -v '^_[A-Z_]'   | # Reserved symbols added by the implementation.
+   grep '^[A-Za-z0-9_]* ' # Only consider normal symbol names.
+then
+# Any output is an error.
+exit 1
+else
+exit 0
+fi
--
2.29.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] GSoC 2021

2021-02-02 Thread Michael Niedermayer
On Tue, Feb 02, 2021 at 07:02:00PM +0800, Steven Liu wrote:
> 
> 
> > 2021年2月2日 下午5:48,Michael Niedermayer  写道:
> > 
> > Hi all
> > 
> > Most people probably already know but just to be sure everyone knows
> > GSoC 2021 is 175h not 350h
> > https://groups.google.com/g/google-summer-of-code-discuss/c/GgvbLrFBcUQ?pli=1
> > 
> > Some project ideas may need to be adjusted accordingly
> 
> What about make some small/mini/tiny feature for mentor project?

yes, smaller projects are needed for this year


> And I saw Nicolas make some RFC maybe can split some subproject for mentor 
> project?

Projects should be small, self contained and accessible for someone who has no
prior knowledge of our codebase.
In that sense (re)design projects are a bad idea unless theres a FFmpeg 
developer
who qualifies as a GSoC Student and thus has prior knowledge.

thx

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/6] avformat/cutils, dvenc: Move ff_brktimegm to its only user

2021-02-02 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> This also allows to completely remove cutils.c.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/Makefile   |  1 -
>  libavformat/cutils.c   | 39 ---
>  libavformat/dvenc.c| 13 +++--
>  libavformat/internal.h |  2 --
>  4 files changed, 11 insertions(+), 44 deletions(-)
>  delete mode 100644 libavformat/cutils.c
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 3a8fbcbe5f..c820dd35f4 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -8,7 +8,6 @@ HEADERS = avformat.h  
>   \
>  OBJS = allformats.o \
> avio.o   \
> aviobuf.o\
> -   cutils.o \
> dump.o   \
> format.o \
> id3v1.o  \
> diff --git a/libavformat/cutils.c b/libavformat/cutils.c
> deleted file mode 100644
> index d86ba05441..00
> --- a/libavformat/cutils.c
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*
> - * various simple utilities for libavformat
> - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
> - *
> - * 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/time_internal.h"
> -#include "avformat.h"
> -#include "internal.h"
> -
> -#define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0))
> -#define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400)
> -
> -/* This is our own gmtime_r. It differs from its POSIX counterpart in a
> -   couple of places, though. */
> -struct tm *ff_brktimegm(time_t secs, struct tm *tm)
> -{
> -tm = gmtime_r(, tm);
> -
> -tm->tm_year += 1900; /* unlike gmtime_r we store complete year here */
> -tm->tm_mon  += 1;/* unlike gmtime_r tm_mon is from 1 to 12 */
> -
> -return tm;
> -}
> diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
> index 6c0d40f819..320f8479f0 100644
> --- a/libavformat/dvenc.c
> +++ b/libavformat/dvenc.c
> @@ -29,6 +29,7 @@
>   */
>  #include 
>  
> +#include "libavutil/time_internal.h"
>  #include "avformat.h"
>  #include "internal.h"
>  #include "libavcodec/dv_profile.h"
> @@ -72,6 +73,14 @@ static const int dv_aaux_packs_dist[12][9] = {
>  { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
>  };
>  
> +static void brktimegm(time_t secs, struct tm *tm)
> +{
> +tm = gmtime_r(, tm);
> +
> +tm->tm_year += 1900; /* unlike gmtime_r we store complete year here */
> +tm->tm_mon  += 1;/* unlike gmtime_r tm_mon is from 1 to 12 */
> +}
> +
>  static int dv_audio_frame_size(const AVDVProfile* sys, int frame, int 
> sample_rate)
>  {
>  if ((sys->time_base.den == 25 || sys->time_base.den == 50) && 
> sys->time_base.num == 1) {
> @@ -143,7 +152,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, 
> DVMuxContext *c, uint8_t* bu
>  case dv_video_recdate:  /* VAUX recording date */
>  ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
>  c->sys->time_base.den, 
> AV_ROUND_DOWN);
> -ff_brktimegm(ct, );
> +brktimegm(ct, );
>  buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */
> /* 0xff is very likely to be "unknown" */
>  buf[2] = (3 << 6) | /* reserved -- always 1 */
> @@ -159,7 +168,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, 
> DVMuxContext *c, uint8_t* bu
>  case dv_video_rectime:  /* VAUX recording time */
>  ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
> 
> c->sys->time_base.den, AV_ROUND_DOWN);
> -ff_brktimegm(ct, );
> +brktimegm(ct, );
>  buf[1] = (3 << 6) | /* reserved -- always 1 */
>   0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? 
> */
>  buf[2] = (1 << 7) | /* reserved -- always 1 */
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index f45b1cd6b4..d0db331b96 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -365,8 +365,6 @@ do {\
>  } while(0)
>  #endif
>  
> -struct tm *ff_brktimegm(time_t secs, struct tm *tm);
> -
>  /**
>   

[FFmpeg-devel] [PATCH 6/7] avcodec/fmvc: avoid copying uninitialized data

2021-02-02 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
30049/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FMVC_fuzzer-5986909455253504

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/fmvc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/fmvc.c b/libavcodec/fmvc.c
index 5bee96a18d..3701b0849b 100644
--- a/libavcodec/fmvc.c
+++ b/libavcodec/fmvc.c
@@ -440,6 +440,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 memcpy(dst, src, avctx->width * s->bpp);
 dst -= frame->linesize[0];
 src += s->stride * 4;
+if (bytestream2_tell_p(pb) < y*s->stride * 4)
+break;
 }
 } else {
 unsigned block, nb_blocks;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 7/7] tools/target_dec_fuzzer: Adjust threshold for VMNC

2021-02-02 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
30055/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMNC_fuzzer-4739482576355328

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 2abc7a0053..91e58c5680 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -186,6 +186,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_TGV: maxpixels  /= 32;break;
 case AV_CODEC_ID_TRUEMOTION2: maxpixels  /= 1024;  break;
 case AV_CODEC_ID_VC1IMAGE:maxpixels  /= 8192;  break;
+case AV_CODEC_ID_VMNC:maxpixels  /= 8192;  break;
 case AV_CODEC_ID_VP7: maxpixels  /= 256;   break;
 case AV_CODEC_ID_VP9: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_WMV3IMAGE:   maxpixels  /= 8192;  break;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 5/7] avformat/mvdec: Sanity check SAMPLE_WIDTH

2021-02-02 Thread Michael Niedermayer
Fixes: signed integer overflow: 9 * 8 cannot be represented in type 
'int'
Fixes: 
30048/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5864289917337600

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/mvdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index d8f121bea5..ac96e4a808 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -159,7 +159,10 @@ static int parse_audio_var(AVFormatContext *avctx, 
AVStream *st,
 st->codecpar->sample_rate = var_read_int(pb, size);
 avpriv_set_pts_info(st, 33, 1, st->codecpar->sample_rate);
 } else if (!strcmp(name, "SAMPLE_WIDTH")) {
-st->codecpar->bits_per_coded_sample = var_read_int(pb, size) * 8;
+uint64_t bpc = var_read_int(pb, size) * (uint64_t)8;
+if (bpc > 100)
+return AVERROR_INVALIDDATA;
+st->codecpar->bits_per_coded_sample = bpc;
 } else
 return AVERROR_INVALIDDATA;
 
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/7] tools/target_dec_fuzzer: count all video decoding failures in the new API

2021-02-02 Thread Michael Niedermayer
The next commit depends on this

Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index affa6e3b51..cef47cbd50 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -349,6 +349,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
   if (ctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {
   int ret = avcodec_send_packet(ctx, );
   decode_more = ret >= 0;
+  if(!decode_more) {
+ec_pixels += (ctx->width + 32LL) * (ctx->height + 32LL);
+if (it > 20 || ec_pixels > 4 * ctx->max_pixels)
+ctx->error_concealment = 0;
+if (ec_pixels > maxpixels)
+goto maximums_reached;
+  }
   } else
   decode_more = 1;
 
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/7] avformat/utils: Extend overflow check in dts wrap in compute_pkt_fields()

2021-02-02 Thread Michael Niedermayer
Fixes: signed integer overflow: -9223372032574480351 - 4294967296 cannot be 
represented in type 'long long'
Fixes: 
30022/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5568610275819520

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index fb3299503e..9f04e94624 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1255,7 +1255,7 @@ static void compute_pkt_fields(AVFormatContext *s, 
AVStream *st,
 presentation_delayed = 1;
 
 if (pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE &&
-st->pts_wrap_bits < 63 && pkt->dts > INT64_MIN + (1LL << 
(st->pts_wrap_bits - 1)) &&
+st->pts_wrap_bits < 63 && pkt->dts > INT64_MIN + (1LL << 
st->pts_wrap_bits) &&
 pkt->dts - (1LL << (st->pts_wrap_bits - 1)) > pkt->pts) {
 if (is_relative(st->cur_dts) || pkt->dts - (1LL<<(st->pts_wrap_bits - 
1)) > st->cur_dts) {
 pkt->dts -= 1LL << st->pts_wrap_bits;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 4/7] avcodec/fits: Check gcount and pcount being non negative

2021-02-02 Thread Michael Niedermayer
Fixes: signed integer overflow: 9223372036854775807 - -30069403896 cannot be 
represented in type 'long'
Fixes: 
30046/clusterfuzz-testcase-minimized-ffmpeg_dem_FITS_fuzzer-5807144773484544

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/fits.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/fits.c b/libavcodec/fits.c
index 25c33e06c8..97fa7abe80 100644
--- a/libavcodec/fits.c
+++ b/libavcodec/fits.c
@@ -205,8 +205,12 @@ int avpriv_fits_header_parse_line(void *avcl, FITSHeader 
*header, const uint8_t
 } else if (!strcmp(keyword, "GROUPS") && sscanf(value, "%c", ) == 1) 
{
 header->groups = (c == 'T');
 } else if (!strcmp(keyword, "GCOUNT") && sscanf(value, "%"SCNd64"", 
) == 1) {
+if (t < 0 || t > INT_MAX)
+return AVERROR_INVALIDDATA;
 header->gcount = t;
 } else if (!strcmp(keyword, "PCOUNT") && sscanf(value, "%"SCNd64"", 
) == 1) {
+if (t < 0 || t > INT_MAX)
+return AVERROR_INVALIDDATA;
 header->pcount = t;
 }
 dict_set_if_not_null(metadata, keyword, value);
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/7] tools/target_dec_fuzzer: Adjust the threshold of vc1image

2021-02-02 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
30025/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5965511357759488

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index cef47cbd50..2abc7a0053 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -185,6 +185,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_SNOW:maxpixels  /= 128;   break;
 case AV_CODEC_ID_TGV: maxpixels  /= 32;break;
 case AV_CODEC_ID_TRUEMOTION2: maxpixels  /= 1024;  break;
+case AV_CODEC_ID_VC1IMAGE:maxpixels  /= 8192;  break;
 case AV_CODEC_ID_VP7: maxpixels  /= 256;   break;
 case AV_CODEC_ID_VP9: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_WMV3IMAGE:   maxpixels  /= 8192;  break;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3 1/2] vc2enc: Add missing static to local variables

2021-02-02 Thread Mark Thompson

On 28/01/2021 19:16, Michael Niedermayer wrote:

On Mon, Jan 25, 2021 at 10:07:01PM +, Mark Thompson wrote:

---
  libavcodec/vc2enc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index bab9d0f3d5..7bd2e4c2ab 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -423,7 +423,7 @@ static void encode_slice_params(VC2EncContext *s)
  }
  
  /* 1st idx = LL, second - vertical, third - horizontal, fourth - total */

-const uint8_t vc2_qm_col_tab[][4] = {
+static const uint8_t vc2_qm_col_tab[][4] = {
  {20,  9, 15,  4},
  { 0,  6,  6,  4},
  { 0,  3,  3,  5},
@@ -431,7 +431,7 @@ const uint8_t vc2_qm_col_tab[][4] = {
  { 0, 11, 10, 11}
  };
  
-const uint8_t vc2_qm_flat_tab[][4] = {

+static const uint8_t vc2_qm_flat_tab[][4] = {
  { 0,  0,  0,  0},
  { 0,  0,  0,  0},
  { 0,  0,  0,  0},


LGTM


Pushed.

Thanks,

- Mark
___
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 2/2] fate: Add test for namespace prefixes in libraries

2021-02-02 Thread Andreas Rheinhardt
Mark Thompson:
> On 30/01/2021 04:47, Andreas Rheinhardt wrote:
>> Mark Thompson:
>>> Ensures that external symbols in the built static libraries either have
>>> correct namespace prefixes or are on a known list of exceptions.
>>> ---
>>>   tests/Makefile  |  1 +
>>>   tests/fate/namespace.mak    | 19 ++
>>>   tests/fate/namespace.sh | 15 
>>>   tests/ref/fate/namespace-avcodec    |  0
>>>   tests/ref/fate/namespace-avdevice   |  0
>>>   tests/ref/fate/namespace-avfilter   |  0
>>>   tests/ref/fate/namespace-avformat   |  0
>>>   tests/ref/fate/namespace-avutil |  0
>>>   tests/ref/fate/namespace-postproc   |  0
>>>   tests/ref/fate/namespace-swresample |  0
>>>   tests/ref/fate/namespace-swscale    | 58 +
>>>   11 files changed, 93 insertions(+)
>>>   create mode 100644 tests/fate/namespace.mak
>>>   create mode 100755 tests/fate/namespace.sh
>>>   create mode 100644 tests/ref/fate/namespace-avcodec
>>>   create mode 100644 tests/ref/fate/namespace-avdevice
>>>   create mode 100644 tests/ref/fate/namespace-avfilter
>>>   create mode 100644 tests/ref/fate/namespace-avformat
>>>   create mode 100644 tests/ref/fate/namespace-avutil
>>>   create mode 100644 tests/ref/fate/namespace-postproc
>>>   create mode 100644 tests/ref/fate/namespace-swresample
>>>   create mode 100644 tests/ref/fate/namespace-swscale
>>>
>>> diff --git a/tests/Makefile b/tests/Makefile
>>> index 7844901e53..94057eb81d 100644
>>> --- a/tests/Makefile
>>> +++ b/tests/Makefile
>>> @@ -173,6 +173,7 @@ include $(SRC_PATH)/tests/fate/mpeg4.mak
>>>   include $(SRC_PATH)/tests/fate/mpegps.mak
>>>   include $(SRC_PATH)/tests/fate/mpegts.mak
>>>   include $(SRC_PATH)/tests/fate/mxf.mak
>>> +include $(SRC_PATH)/tests/fate/namespace.mak
>>>   include $(SRC_PATH)/tests/fate/opus.mak
>>>   include $(SRC_PATH)/tests/fate/pcm.mak
>>>   include $(SRC_PATH)/tests/fate/pixfmt.mak
>>> diff --git a/tests/fate/namespace.mak b/tests/fate/namespace.mak
>>> new file mode 100644
>>> index 00..0021e7152d
>>> --- /dev/null
>>> +++ b/tests/fate/namespace.mak
>>> @@ -0,0 +1,19 @@
>>> +
>>> +define FATE_NAMESPACE
>>> +# (library_name, config_option)
>>> +FATE_NAMESPACE-$(call ALLYES, STATIC $(2)) += fate-namespace-$(1)
>>> +fate-namespace-$(1): lib$(1)/$(LIBPREF)$(1)$(LIBSUF)
>>> +fate-namespace-$(1): CMD = runlocal fate/namespace.sh "$(NM_CMD) -P
>>> lib$(1)/$(LIBPREF)$(1)$(LIBSUF)"
>>> +endef
>>> +
>>> +$(eval $(call FATE_NAMESPACE,avutil, AVUTIL))
>>> +$(eval $(call FATE_NAMESPACE,avcodec,    AVCODEC))
>>> +$(eval $(call FATE_NAMESPACE,avformat,   AVFORMAT))
>>> +$(eval $(call FATE_NAMESPACE,avfilter,   AVFILTER))
>>> +$(eval $(call FATE_NAMESPACE,avdevice,   AVDEVICE))
>>> +$(eval $(call FATE_NAMESPACE,swscale,    SWSCALE))
>>> +$(eval $(call FATE_NAMESPACE,swresample, SWRESAMPLE))
>>> +$(eval $(call FATE_NAMESPACE,postproc,   POSTPROC))
>>> +
>>> +FATE += $(FATE_NAMESPACE-yes)
>>> +fate-namespace: $(FATE_NAMESPACE-yes)
>>> diff --git a/tests/fate/namespace.sh b/tests/fate/namespace.sh
>>> new file mode 100755
>>> index 00..16d306eafc
>>> --- /dev/null
>>> +++ b/tests/fate/namespace.sh
>>> @@ -0,0 +1,15 @@
>>> +#!/bin/sh
>>> +
>>> +$1 |
>>> +   grep ' [TDBR] ' | # Filter to all global text/data/bss symbols.
>>> +   grep -v '^ff_' | # Internal-only globals.
>>> +   grep -v '^av'  | # libav* external API.
>>> +   grep -v '^sws' | # libswscale external API.
>>> +   grep -v '^swr' | # libswresample external API.
>>> +   grep -v '^\(postproc\|pp\)_' | # libpostproc external API.
>>> +   grep -v '^\(ffio\|ffurl\)_'  | # libavformat internal ffio/ffurl
>>> APIs.
>>> +   grep -v '^rgb2rgb_init_' | # libswscale arch-specific init
>>> function.
>>> +   sed 's/ .*//'  | # Remove everything except the symbol name.
>>> +   sort # Sort to allow deterministic comparison.
>>> +
>>> +exit 0
>>> diff --git a/tests/ref/fate/namespace-avcodec
>>> b/tests/ref/fate/namespace-avcodec
>>> new file mode 100644
>>> index 00..e69de29bb2
>>> diff --git a/tests/ref/fate/namespace-avdevice
>>> b/tests/ref/fate/namespace-avdevice
>>> new file mode 100644
>>> index 00..e69de29bb2
>>> diff --git a/tests/ref/fate/namespace-avfilter
>>> b/tests/ref/fate/namespace-avfilter
>>> new file mode 100644
>>> index 00..e69de29bb2
>>> diff --git a/tests/ref/fate/namespace-avformat
>>> b/tests/ref/fate/namespace-avformat
>>> new file mode 100644
>>> index 00..e69de29bb2
>>> diff --git a/tests/ref/fate/namespace-avutil
>>> b/tests/ref/fate/namespace-avutil
>>> new file mode 100644
>>> index 00..e69de29bb2
>>> diff --git a/tests/ref/fate/namespace-postproc
>>> b/tests/ref/fate/namespace-postproc
>>> new file mode 100644
>>> index 00..e69de29bb2
>>> diff --git a/tests/ref/fate/namespace-swresample
>>> b/tests/ref/fate/namespace-swresample
>>> new file mode 100644
>>> index 00..e69de29bb2
>>> diff --git 

[FFmpeg-devel] [PATCH] avfilter/vf_pseudocolor: Add missing braces

2021-02-02 Thread Mark Thompson

The array inside a structure needs two levels of braces.
---
The previous format was unambiguous, but it provoked a lot of warning spam.  
gcc 10:

CC  libavfilter/vf_pseudocolor.o
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around 
initializer [-Wmissing-braces]
  107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, 
-1.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around 
initializer [-Wmissing-braces]
  107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, 
-1.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {   }
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around 
initializer [-Wmissing-braces]
  107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, 
-1.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {   } 
  {}
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around 
initializer [-Wmissing-braces]
  107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, 
-1.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {   } 
  {}
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around 
initializer [-Wmissing-braces]
  108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, 
{-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around 
initializer [-Wmissing-braces]
  108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, 
{-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {}
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around 
initializer [-Wmissing-braces]
  108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, 
{-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {}   
{   }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around 
initializer [-Wmissing-braces]
  108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, 
{-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {}   
{   }   {}
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around 
initializer [-Wmissing-braces]
  108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, 
{-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {}   
{   }   {}   {}
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around 
initializer [-Wmissing-braces]
  108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, 
{-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
  |   ^
  | { }   {}   
{   }   {}   {}

 libavfilter/vf_pseudocolor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c
index 192839342b..3416ab19a9 100644
--- a/libavfilter/vf_pseudocolor.c
+++ b/libavfilter/vf_pseudocolor.c
@@ -104,8 +104,8 @@ static const Range full_range   = {0, 256};
 static const Range spec1_range[] = {{0, 16}, {16, 236}, {236, 256}};
 static const Range spec2_range[] = {{0, 16}, {16, 22}, {22, 226}, {226, 236}, 
{236, 256}};

-static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, -1.f}, {1.f, 
0.f, 0.f}};
-static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, 
-1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
+static const Fill spec1_fills[] = {{{0.5f, 0.f, .5f}}, {{-1.f, -1.f, -1.f}}, 
{{1.f, 0.f, 0.f}}};
+static const Fill spec2_fills[] = {{{0.5f, 0.f, .5f}}, {{0.f, 1.f, 1.f}}, 
{{-1.f, -1.f, -1.f}}, {{1.f, 1.f, 0.f}}, {{1.f, 0.f, 0.f}}};

 static const Curve curves[] =
 {
--
2.29.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link 

Re: [FFmpeg-devel] [PATCH v3 2/2] fate: Add test for namespace prefixes in libraries

2021-02-02 Thread Mark Thompson

On 30/01/2021 04:47, Andreas Rheinhardt wrote:

Mark Thompson:

Ensures that external symbols in the built static libraries either have
correct namespace prefixes or are on a known list of exceptions.
---
  tests/Makefile  |  1 +
  tests/fate/namespace.mak| 19 ++
  tests/fate/namespace.sh | 15 
  tests/ref/fate/namespace-avcodec|  0
  tests/ref/fate/namespace-avdevice   |  0
  tests/ref/fate/namespace-avfilter   |  0
  tests/ref/fate/namespace-avformat   |  0
  tests/ref/fate/namespace-avutil |  0
  tests/ref/fate/namespace-postproc   |  0
  tests/ref/fate/namespace-swresample |  0
  tests/ref/fate/namespace-swscale| 58 +
  11 files changed, 93 insertions(+)
  create mode 100644 tests/fate/namespace.mak
  create mode 100755 tests/fate/namespace.sh
  create mode 100644 tests/ref/fate/namespace-avcodec
  create mode 100644 tests/ref/fate/namespace-avdevice
  create mode 100644 tests/ref/fate/namespace-avfilter
  create mode 100644 tests/ref/fate/namespace-avformat
  create mode 100644 tests/ref/fate/namespace-avutil
  create mode 100644 tests/ref/fate/namespace-postproc
  create mode 100644 tests/ref/fate/namespace-swresample
  create mode 100644 tests/ref/fate/namespace-swscale

diff --git a/tests/Makefile b/tests/Makefile
index 7844901e53..94057eb81d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -173,6 +173,7 @@ include $(SRC_PATH)/tests/fate/mpeg4.mak
  include $(SRC_PATH)/tests/fate/mpegps.mak
  include $(SRC_PATH)/tests/fate/mpegts.mak
  include $(SRC_PATH)/tests/fate/mxf.mak
+include $(SRC_PATH)/tests/fate/namespace.mak
  include $(SRC_PATH)/tests/fate/opus.mak
  include $(SRC_PATH)/tests/fate/pcm.mak
  include $(SRC_PATH)/tests/fate/pixfmt.mak
diff --git a/tests/fate/namespace.mak b/tests/fate/namespace.mak
new file mode 100644
index 00..0021e7152d
--- /dev/null
+++ b/tests/fate/namespace.mak
@@ -0,0 +1,19 @@
+
+define FATE_NAMESPACE
+# (library_name, config_option)
+FATE_NAMESPACE-$(call ALLYES, STATIC $(2)) += fate-namespace-$(1)
+fate-namespace-$(1): lib$(1)/$(LIBPREF)$(1)$(LIBSUF)
+fate-namespace-$(1): CMD = runlocal fate/namespace.sh "$(NM_CMD) -P 
lib$(1)/$(LIBPREF)$(1)$(LIBSUF)"
+endef
+
+$(eval $(call FATE_NAMESPACE,avutil, AVUTIL))
+$(eval $(call FATE_NAMESPACE,avcodec,AVCODEC))
+$(eval $(call FATE_NAMESPACE,avformat,   AVFORMAT))
+$(eval $(call FATE_NAMESPACE,avfilter,   AVFILTER))
+$(eval $(call FATE_NAMESPACE,avdevice,   AVDEVICE))
+$(eval $(call FATE_NAMESPACE,swscale,SWSCALE))
+$(eval $(call FATE_NAMESPACE,swresample, SWRESAMPLE))
+$(eval $(call FATE_NAMESPACE,postproc,   POSTPROC))
+
+FATE += $(FATE_NAMESPACE-yes)
+fate-namespace: $(FATE_NAMESPACE-yes)
diff --git a/tests/fate/namespace.sh b/tests/fate/namespace.sh
new file mode 100755
index 00..16d306eafc
--- /dev/null
+++ b/tests/fate/namespace.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+$1 |
+   grep ' [TDBR] ' | # Filter to all global text/data/bss symbols.
+   grep -v '^ff_' | # Internal-only globals.
+   grep -v '^av'  | # libav* external API.
+   grep -v '^sws' | # libswscale external API.
+   grep -v '^swr' | # libswresample external API.
+   grep -v '^\(postproc\|pp\)_' | # libpostproc external API.
+   grep -v '^\(ffio\|ffurl\)_'  | # libavformat internal ffio/ffurl APIs.
+   grep -v '^rgb2rgb_init_' | # libswscale arch-specific init function.
+   sed 's/ .*//'  | # Remove everything except the symbol name.
+   sort # Sort to allow deterministic comparison.
+
+exit 0
diff --git a/tests/ref/fate/namespace-avcodec b/tests/ref/fate/namespace-avcodec
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avdevice 
b/tests/ref/fate/namespace-avdevice
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avfilter 
b/tests/ref/fate/namespace-avfilter
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avformat 
b/tests/ref/fate/namespace-avformat
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avutil b/tests/ref/fate/namespace-avutil
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-postproc 
b/tests/ref/fate/namespace-postproc
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-swresample 
b/tests/ref/fate/namespace-swresample
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-swscale b/tests/ref/fate/namespace-swscale
new file mode 100644
index 00..a7aa4504ae
--- /dev/null
+++ b/tests/ref/fate/namespace-swscale
@@ -0,0 +1,58 @@
+deinterleaveBytes
+interleaveBytes
+planar2x
+rgb12to15
+rgb12tobgr12
+rgb15to16
+rgb15to24
+rgb15to32
+rgb15tobgr15
+rgb15tobgr16
+rgb15tobgr24
+rgb15tobgr32
+rgb16to15
+rgb16to24
+rgb16to32
+rgb16tobgr15
+rgb16tobgr16
+rgb16tobgr24
+rgb16tobgr32
+rgb24to15
+rgb24to16
+rgb24to32
+rgb24tobgr15
+rgb24tobgr16

Re: [FFmpeg-devel] [PATCH 00/10] deprecate av_init_packet() and sizeof(AVPacket) as part of the ABI

2021-02-02 Thread James Almer

On 2/2/2021 4:33 PM, Andriy Gelman wrote:

On Mon, 01. Feb 19:44, James Almer wrote:

As the subject says, this puts AVPacket in line with AVFrame, allowing
easier extensibility of the struct, and preventing potential undefined behavior
in some cases when packets are used uninitialized on stack.

This set adapts only a few modules, examples, and the tools, as those were the
most complex and the ones that better reflect how AVPackets must be used after
the deprecation period.
I have a branch ready removing every other instance of av_init_packet() in the
tree, and all uses of AVPacket on stack i could find. They are pretty trivial,
so i wont bother spamming the ML with 40+ patches until the core changes are
upstreamed. It's also not exhaustive, as i'm sure i missed a few cases of stack
usage, but they can be removed any time between the deprecation of public
sizeof(AVPacket) and it's effective removal 2+ years from now.
Then there's the few cases where an AVPacket is part of another public struct,
as is the case of AVPacketList, or attached_pic in AVSteam. The latter i could
adapt right now, but it would mean a lot of preprocessor checks littering the
codebase until removed, so i refrained from doing so.

James Almer (10):
   avformat/mux: use av_packet_alloc() to allocate packets
   avformat/movenc: use av_packet_alloc() to allocate packets
   avformat/utils: use av_packet_alloc() to allocate packets
   doc/examples/demuxing_decoding: use av_packet_alloc() to allocate
 packets
   doc/examples/transcode_aac: use av_packet_alloc() to allocate packets
   doc/examples/transcoding: use av_packet_alloc() to allocate packets
   fftools/ffprobe: use av_packet_alloc() to allocate packets
   fftools/ffmpeg: use av_packet_alloc() to allocate packets
   fftools/ffplay: use av_packet_alloc() to allocate packets
   avcodec/packet: deprecate av_init_packet()

  doc/examples/demuxing_decoding.c |  25 +--
  doc/examples/transcode_aac.c |  46 +++--
  doc/examples/transcoding.c   |  48 +++--
  fftools/ffmpeg.c | 318 ---
  fftools/ffmpeg.h |   4 +
  fftools/ffmpeg_opt.c |   5 +-
  fftools/ffplay.c | 222 -
  fftools/ffprobe.c|  34 ++--
  libavcodec/avpacket.c|  23 ++-
  libavcodec/packet.h  |  23 ++-
  libavcodec/version.h |   3 +
  libavformat/avformat.h   |   4 +
  libavformat/internal.h   |   6 +
  libavformat/movenc.c | 101 ++
  libavformat/movenc.h |   2 +
  libavformat/movenchint.c |  19 +-
  libavformat/mux.c|  44 +++--
  libavformat/options.c|   9 +
  libavformat/utils.c  | 106 ++-
  19 files changed, 613 insertions(+), 429 deletions(-)



Hi James,

In case you didn't see, there is some weirdness with fate over the commits:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=3189


Yeah, i messed up and placed a patch using a FF_API_ define before the 
patch that introduced it :p


With all 10 patches applied it works as intended, but patch 10/10 needs 
to go in first to ensure the above doesn't happen.

___
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] cbs_h2645: Implement replace-PS with a table rather than many functions

2021-02-02 Thread Mark Thompson

On 30/01/2021 11:01, Nuo Mi wrote:

On Wed, Jan 27, 2021 at 9:52 PM Nuo Mi  wrote:

On Wed, Jan 27, 2021 at 7:06 AM Mark Thompson  wrote:


+
+err = ff_cbs_make_unit_refcounted(ctx, unit);
+if (err < 0)
+return err;
+
+ref_array =
+ (AVBufferRef**)((uint8_t*)ctx->priv_data +
ps_type->ref_array_offset);
+ptr_array = (void**)((uint8_t*)ctx->priv_data +
ps_type->ptr_array_offset);
+active= (void**)((uint8_t*)ctx->priv_data +
ps_type->active_offset);
+
+if (ptr_array[id] == *active) {
+// The old active parameter set is being overwritten, so it can't
+// be active after this point.
+*active = NULL;
+}
+av_buffer_unref(_array[id]);
+
+ref_array[id] = av_buffer_ref(unit->content_ref);
+if (!ref_array[id])
+return AVERROR(ENOMEM);


This happend after ff_cbs_make_unit_refcounted, do we need urnef 
unit->content_ref
before return?


I don't think so?  The content_ref will be freed by the next call to 
fragment_reset/fragment_free, and we don't want to unset it here because that 
would force us to also clear unit->content as well (which doesn't matter for 
reading, but is a very strange side-effect if you are writing).


+ptr_array[id] = ref_array[id]->data;
+
+return 0;
+}

> Hi Mark,

Will this fix and merged?


Do you prefer it to what is presently there?

My intent was to suggest it and ask the question given the trouble with many 
versions of this in H.266, not to prescribe a particular answer.

- Mark
___
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] cbs_sei: Detect payload overflows when reading SEI messages

2021-02-02 Thread Mark Thompson

The top-level GetBitContext is sized for the whole NAL unit, so it fails
to detect overflows where a payload continues into the following message.
To fix that, we make a new context on the stack for reading each payload.
---
On 01/02/2021 22:31, Michael Niedermayer wrote:

Fixes: Timeout
Fixes: 
29892/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-6310830956216320

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
  libavcodec/cbs_sei_syntax_template.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/libavcodec/cbs_sei_syntax_template.c 
b/libavcodec/cbs_sei_syntax_template.c
index 9114e61ff6..3b9bc942f5 100644
--- a/libavcodec/cbs_sei_syntax_template.c
+++ b/libavcodec/cbs_sei_syntax_template.c
@@ -178,6 +178,8 @@ static int FUNC(message)(CodedBitstreamContext *ctx, 
RWContext *rw,
  GetBitContext tmp = *rw;
  int trailing_bits, trailing_zero_bits;
  
+if (8 * current->payload_size < bits_written)

+return AVERROR_INVALIDDATA;
  bits_left = 8 * current->payload_size - bits_written;
  if (bits_left > 8)
  skip_bits_long(, bits_left - 8);


So it looks like the actual problem is that we don't detect payload overflow, 
so the calculation here underflows if the payload is invalid such that we read 
more bits than there actually are.

How about this answer, which tries to fix the general problem by detecting 
overflow properly - does it fix your fuzzed case?

Thanks,

- Mark


 libavcodec/cbs_sei_syntax_template.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_sei_syntax_template.c 
b/libavcodec/cbs_sei_syntax_template.c
index 9114e61ff6..0ef7b42ed9 100644
--- a/libavcodec/cbs_sei_syntax_template.c
+++ b/libavcodec/cbs_sei_syntax_template.c
@@ -238,6 +238,7 @@ static int FUNC(message_list)(CodedBitstreamContext *ctx, 
RWContext *rw,
 uint32_t payload_type = 0;
 uint32_t payload_size = 0;
 uint32_t tmp;
+GetBitContext payload_gbc;

 while (show_bits(rw, 8) == 0xff) {
 fixed(8, ff_byte, 0xff);
@@ -253,13 +254,27 @@ static int FUNC(message_list)(CodedBitstreamContext *ctx, 
RWContext *rw,
 xu(8, last_payload_size_byte, tmp, 0, 254, 0);
 payload_size += tmp;

+// There must be space remaining for both the payload and
+// the trailing bits on the SEI NAL unit.
+if (payload_size + 1 > get_bits_left(rw) / 8) {
+av_log(ctx->log_ctx, AV_LOG_ERROR,
+   "Invalid SEI message: payload_size too large "
+   "(%"PRIu32" bytes).\n", payload_size);
+return AVERROR_INVALIDDATA;
+}
+CHECK(init_get_bits(_gbc, rw->buffer,
+get_bits_count(rw) + 8 * payload_size));
+skip_bits_long(_gbc, get_bits_count(rw));
+
 CHECK(ff_cbs_sei_list_add(current));
 message = >messages[k];

 message->payload_type = payload_type;
 message->payload_size = payload_size;

-CHECK(FUNC(message)(ctx, rw, message));
+CHECK(FUNC(message)(ctx, _gbc, message));
+
+skip_bits_long(rw, 8 * payload_size);

 if (!cbs_h2645_read_more_rbsp_data(rw))
 break;
--
2.29.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 00/10] deprecate av_init_packet() and sizeof(AVPacket) as part of the ABI

2021-02-02 Thread Andriy Gelman
On Mon, 01. Feb 19:44, James Almer wrote:
> As the subject says, this puts AVPacket in line with AVFrame, allowing
> easier extensibility of the struct, and preventing potential undefined 
> behavior
> in some cases when packets are used uninitialized on stack.
> 
> This set adapts only a few modules, examples, and the tools, as those were the
> most complex and the ones that better reflect how AVPackets must be used after
> the deprecation period.
> I have a branch ready removing every other instance of av_init_packet() in the
> tree, and all uses of AVPacket on stack i could find. They are pretty trivial,
> so i wont bother spamming the ML with 40+ patches until the core changes are
> upstreamed. It's also not exhaustive, as i'm sure i missed a few cases of 
> stack
> usage, but they can be removed any time between the deprecation of public
> sizeof(AVPacket) and it's effective removal 2+ years from now.
> Then there's the few cases where an AVPacket is part of another public struct,
> as is the case of AVPacketList, or attached_pic in AVSteam. The latter i could
> adapt right now, but it would mean a lot of preprocessor checks littering the
> codebase until removed, so i refrained from doing so.
> 
> James Almer (10):
>   avformat/mux: use av_packet_alloc() to allocate packets
>   avformat/movenc: use av_packet_alloc() to allocate packets
>   avformat/utils: use av_packet_alloc() to allocate packets
>   doc/examples/demuxing_decoding: use av_packet_alloc() to allocate
> packets
>   doc/examples/transcode_aac: use av_packet_alloc() to allocate packets
>   doc/examples/transcoding: use av_packet_alloc() to allocate packets
>   fftools/ffprobe: use av_packet_alloc() to allocate packets
>   fftools/ffmpeg: use av_packet_alloc() to allocate packets
>   fftools/ffplay: use av_packet_alloc() to allocate packets
>   avcodec/packet: deprecate av_init_packet()
> 
>  doc/examples/demuxing_decoding.c |  25 +--
>  doc/examples/transcode_aac.c |  46 +++--
>  doc/examples/transcoding.c   |  48 +++--
>  fftools/ffmpeg.c | 318 ---
>  fftools/ffmpeg.h |   4 +
>  fftools/ffmpeg_opt.c |   5 +-
>  fftools/ffplay.c | 222 -
>  fftools/ffprobe.c|  34 ++--
>  libavcodec/avpacket.c|  23 ++-
>  libavcodec/packet.h  |  23 ++-
>  libavcodec/version.h |   3 +
>  libavformat/avformat.h   |   4 +
>  libavformat/internal.h   |   6 +
>  libavformat/movenc.c | 101 ++
>  libavformat/movenc.h |   2 +
>  libavformat/movenchint.c |  19 +-
>  libavformat/mux.c|  44 +++--
>  libavformat/options.c|   9 +
>  libavformat/utils.c  | 106 ++-
>  19 files changed, 613 insertions(+), 429 deletions(-)
> 

Hi James,

In case you didn't see, there is some weirdness with fate over the commits:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=3189

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] avfilter/overlay_cuda: fix framesync with embedded PGS subtitle

2021-02-02 Thread nyanmisaka
Signed-off-by: nyanmisaka 
---
 libavfilter/vf_overlay_cuda.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index 2f0f860e50..f6ee43e929 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -157,9 +157,12 @@ static int overlay_cuda_blend(FFFrameSync *fs)
 if (ret < 0)
 return ret;
 
-if (!input_main || !input_overlay)
+if (!input_main)
 return AVERROR_BUG;
 
+if (!input_overlay)
+return ff_filter_frame(outlink, input_main);
+
 ret = av_frame_make_writable(input_main);
 if (ret < 0) {
 av_frame_free(_main);
-- 
2.30.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avfilter/hwupload_cuda: add YUVA420P format support

2021-02-02 Thread nyanmisaka
Signed-off-by: nyanmisaka 
---
 libavfilter/vf_hwupload_cuda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index 8ee0825859..f01f202832 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -57,7 +57,7 @@ static int cudaupload_query_formats(AVFilterContext *ctx)
 int ret;
 
 static const enum AVPixelFormat input_pix_fmts[] = {
-AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, 
AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_P010, AV_PIX_FMT_P016, AV_PIX_FMT_YUV444P16,
 AV_PIX_FMT_0RGB32, AV_PIX_FMT_0BGR32,
 #if CONFIG_VULKAN
-- 
2.30.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avfilter/overlay_cuda: fix framesync with embedded PGS subtitle

2021-02-02 Thread nyanmisaka
Signed-off-by: nyanmisaka 
---
 libavfilter/vf_overlay_cuda.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index 2f0f860e50..f6ee43e929 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -157,9 +157,12 @@ static int overlay_cuda_blend(FFFrameSync *fs)
 if (ret < 0)
 return ret;
 
-if (!input_main || !input_overlay)
+if (!input_main)
 return AVERROR_BUG;
 
+if (!input_overlay)
+return ff_filter_frame(outlink, input_main);
+
 ret = av_frame_make_writable(input_main);
 if (ret < 0) {
 av_frame_free(_main);
-- 
2.30.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] avfilter/hwupload_cuda: add YUVA420P format support

2021-02-02 Thread nyanmisaka
Signed-off-by: nyanmisaka 
---
 libavfilter/vf_hwupload_cuda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index 8ee0825859..f01f202832 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -57,7 +57,7 @@ static int cudaupload_query_formats(AVFilterContext *ctx)
 int ret;
 
 static const enum AVPixelFormat input_pix_fmts[] = {
-AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, 
AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_P010, AV_PIX_FMT_P016, AV_PIX_FMT_YUV444P16,
 AV_PIX_FMT_0RGB32, AV_PIX_FMT_0BGR32,
 #if CONFIG_VULKAN
-- 
2.30.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v7 2/3] avformat/mxf: add platform local tag

2021-02-02 Thread lance . lmwang
From: Limin Wang 

Please check the string of platform with below command:
./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy out.mxf
./ffmpeg -i out.mxf

application_platform: Lavf (linux)

Reviewed-by: Tomas Härdin 
Signed-off-by: Limin Wang 
---
 configure   | 1 +
 libavformat/mxfenc.c| 4 
 tests/ref/fate/copy-trac4914| 2 +-
 tests/ref/fate/mxf-d10-user-comments| 2 +-
 tests/ref/fate/mxf-opatom-user-comments | 2 +-
 tests/ref/fate/mxf-reel_name| 2 +-
 tests/ref/fate/mxf-user-comments| 2 +-
 tests/ref/fate/time_base| 2 +-
 tests/ref/lavf/mxf  | 6 +++---
 tests/ref/lavf/mxf_d10  | 2 +-
 tests/ref/lavf/mxf_dv25 | 2 +-
 tests/ref/lavf/mxf_dvcpro50 | 2 +-
 tests/ref/lavf/mxf_opatom   | 2 +-
 tests/ref/lavf/mxf_opatom_audio | 2 +-
 14 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index df298b4..a092a6b 100755
--- a/configure
+++ b/configure
@@ -7579,6 +7579,7 @@ cat > $TMPH pb;
 const char *company = "FFmpeg";
 const char *product = s->oformat != _mxf_opatom_muxer ? "OP1a Muxer" : 
"OPAtom Muxer";
+const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : 
PLATFROM_IDENT;
 const char *version;
 int length;
 
@@ -768,6 +770,7 @@ static void mxf_write_identification(AVFormatContext *s)
 "0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
 length = 100 +mxf_utf16_local_tag_length(company) +
   mxf_utf16_local_tag_length(product) +
+  mxf_utf16_local_tag_length(platform) +
   mxf_utf16_local_tag_length(version);
 klv_encode_ber_length(pb, length);
 
@@ -786,6 +789,7 @@ static void mxf_write_identification(AVFormatContext *s)
 store_version(s);
 
 mxf_write_local_tag_utf16(s, 0x3C04, version); // Version String
+mxf_write_local_tag_utf16(s, 0x3C08, platform); // Platform
 
 // write product uid
 mxf_write_local_tag(s, 16, 0x3C05);
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index e8f8afb..743dc8c 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@
-5d58a32f21b78169d925845f783054e6 *tests/data/fate/copy-trac4914.mxf
+f5150fb82c1bb5a90906fce93dcc3f76 *tests/data/fate/copy-trac4914.mxf
 561721 tests/data/fate/copy-trac4914.mxf
 #tb 0: 1001/3
 #media_type 0: video
diff --git a/tests/ref/fate/mxf-d10-user-comments 
b/tests/ref/fate/mxf-d10-user-comments
index 3b9d9d2..c35add0 100644
--- a/tests/ref/fate/mxf-d10-user-comments
+++ b/tests/ref/fate/mxf-d10-user-comments
@@ -1 +1 @@
-fe9b43f5b6e7737fe2670b660fd3d860
+7bb9f39e8e05724525154de17f0235d8
diff --git a/tests/ref/fate/mxf-opatom-user-comments 
b/tests/ref/fate/mxf-opatom-user-comments
index be57eb4..ec4fdff 100644
--- a/tests/ref/fate/mxf-opatom-user-comments
+++ b/tests/ref/fate/mxf-opatom-user-comments
@@ -1 +1 @@
-9b3d7201c37c5783702774e46e0da141
+8475bebf3448a972ae89ba59309fd7d6
diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
index acda8fe..d50f0f6 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@
-422d6ed4821e7bbecbcdecc553abc6e4
+ce49a0361d3f79106e1952d387eace51
diff --git a/tests/ref/fate/mxf-user-comments b/tests/ref/fate/mxf-user-comments
index 3b77db9..5fcdc58 100644
--- a/tests/ref/fate/mxf-user-comments
+++ b/tests/ref/fate/mxf-user-comments
@@ -1 +1 @@
-c77b632dbcdacd6466e1ec794917556e
+956f653cd75e1a319569caec9df81b4f
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index d3c9795..28815d0 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@
-e5c9da6972b6f6e7b15bcbbf20a9dbd1
+78ac0348027b75d73acb8bea14e67a59
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 1b1fe1a..21bf2be 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-1703da2e9f0ca49a5f0bcbcc6944c9c0 *tests/data/lavf/lavf.mxf
+8938d5c4a396ff1b24d10d4f917ae1c9 *tests/data/lavf/lavf.mxf
 526393 tests/data/lavf/lavf.mxf
 tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-b44c4f138f1a87256211c3112dd52c87 *tests/data/lavf/lavf.mxf
+93ea2cfdf5dda7fffdc0d2fdcfb6a9a4 *tests/data/lavf/lavf.mxf
 561721 tests/data/lavf/lavf.mxf
 tests/data/lavf/lavf.mxf CRC=0x96ff1b48
-9ede3c95054c30eb815fbe598a1f097b *tests/data/lavf/lavf.mxf
+87bdf844ae34bcc758e44419e80177a0 *tests/data/lavf/lavf.mxf
 526393 tests/data/lavf/lavf.mxf
 tests/data/lavf/lavf.mxf CRC=0x8dddfaab
diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10
index 19e6f20..47ef244 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-c72f1f3d6ce555f96946c421f705f880 *tests/data/lavf/lavf.mxf_d10
+7f16902e28718c2a92bc082400a1c6ee *tests/data/lavf/lavf.mxf_d10
 5332013 tests/data/lavf/lavf.mxf_d10
 tests/data/lavf/lavf.mxf_d10 

Re: [FFmpeg-devel] ffmpeg-devel@ffmpeg.org

2021-02-02 Thread Steven Liu


> 2021年2月2日 下午8:35,Alan Young  写道:
> 
> <0001-avformat-hls-Use-EXT-X-PROGRAM-DATE-TIME-if-availabl.patch>
LGTM


> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Thanks

Steven Liu



___
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 v7 3/3] avformat/mxfenc: prefer to use the configured metadata

2021-02-02 Thread lance . lmwang
From: Limin Wang 

The metadata company_name, product_name, product_version from input
file will be deleted to avoid overwriting information
Please to test with below commands:
./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy out.mxf
and
./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy \
-metadata company_name="xxx" \
-metadata product_name="xxx" \
-metadata product_version="xxx" \
out.mxf

Reviewed-by: Tomas H??rdin 
Signed-off-by: Limin Wang 
---
 fftools/ffmpeg_opt.c |  3 +++
 libavformat/mxfenc.c | 10 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index bf2eb26..07308cc 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2641,6 +2641,9 @@ loop_end:
 if(o->recording_time != INT64_MAX)
 av_dict_set(>metadata, "duration", NULL, 0);
 av_dict_set(>metadata, "creation_time", NULL, 0);
+av_dict_set(>metadata, "company_name", NULL, 0);
+av_dict_set(>metadata, "product_name", NULL, 0);
+av_dict_set(>metadata, "product_version", NULL, 0);
 }
 if (!o->metadata_streams_manual)
 for (i = of->ost_index; i < nb_output_streams; i++) {
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 39ab443..0b39917 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -757,8 +757,12 @@ static void mxf_write_identification(AVFormatContext *s)
 {
 MXFContext *mxf = s->priv_data;
 AVIOContext *pb = s->pb;
-const char *company = "FFmpeg";
-const char *product = s->oformat != _mxf_opatom_muxer ? "OP1a Muxer" : 
"OPAtom Muxer";
+AVDictionaryEntry *com_entry = av_dict_get(s->metadata, "company_name", 
NULL, 0);
+AVDictionaryEntry *product_entry = av_dict_get(s->metadata, 
"product_name", NULL, 0);
+AVDictionaryEntry *version_entry = av_dict_get(s->metadata, 
"product_version", NULL, 0);
+const char *company = com_entry ? com_entry->value : "FFmpeg";
+const char *product = product_entry ? product_entry->value : s->oformat != 
_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer";
+const char *product_version = version_entry ? version_entry->value : 
AV_STRINGIFY(LIBAVFORMAT_VERSION);
 const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : 
PLATFROM_IDENT;
 const char *version;
 int length;
@@ -767,7 +771,7 @@ static void mxf_write_identification(AVFormatContext *s)
 PRINT_KEY(s, "identification key", pb->buf_ptr - 16);
 
 version = s->flags & AVFMT_FLAG_BITEXACT ?
-"0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
+"0.0.0" : product_version;
 length = 100 +mxf_utf16_local_tag_length(company) +
   mxf_utf16_local_tag_length(product) +
   mxf_utf16_local_tag_length(platform) +
-- 
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 v7 1/3] avformat/mxfdec: set toolkit version metadata

2021-02-02 Thread lance . lmwang
From: Limin Wang 

Please check the string of toolkit version with below command:
./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy out.mxf
./ffmpeg -i out.mxf

toolkit_version : 58.65.101.0.0

Reviewed-by: Tomas Härdin 
Signed-off-by: Limin Wang 
---
 libavformat/mxfdec.c| 24 
 tests/ref/fate/mxf-probe-applehdr10 |  1 +
 tests/ref/fate/mxf-probe-dnxhd  |  1 +
 3 files changed, 26 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 93fa7a9..18db056 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1978,6 +1978,15 @@ static int mxf_umid_to_str(UID ul, UID uid, char **str)
 return 0;
 }
 
+static int mxf_version_to_str(uint16_t major, uint16_t minor, uint16_t 
tertiary,
+  uint16_t patch, uint16_t release, char **str)
+{
+*str = av_asprintf("%d.%d.%d.%d.%d", major, minor, tertiary, patch, 
release);
+if (!*str)
+return AVERROR(ENOMEM);
+return 0;
+}
+
 static int mxf_add_umid_metadata(AVDictionary **pm, const char *key, 
MXFPackage* package)
 {
 char *str;
@@ -2739,6 +2748,17 @@ static int64_t mxf_timestamp_to_int64(uint64_t timestamp)
 av_dict_set(>metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \
 } while (0)
 
+#define SET_VERSION_METADATA(pb, name, major, minor, tertiary, patch, release, 
str) do { \
+major = avio_rb16(pb); \
+minor = avio_rb16(pb); \
+tertiary = avio_rb16(pb); \
+patch = avio_rb16(pb); \
+release = avio_rb16(pb); \
+if ((ret = mxf_version_to_str(major, minor, tertiary, patch, release, 
)) < 0) \
+return ret; \
+av_dict_set(>metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \
+} while (0)
+
 #define SET_UID_METADATA(pb, name, var, str) do { \
 avio_read(pb, var, 16); \
 if ((ret = mxf_uid_to_str(var, )) < 0) \
@@ -2760,6 +2780,7 @@ static int mxf_read_identification_metadata(void *arg, 
AVIOContext *pb, int tag,
 UID uid = { 0 };
 char *str = NULL;
 uint64_t ts;
+uint16_t major, minor, tertiary, patch, release;
 switch (tag) {
 case 0x3C01:
 SET_STR_METADATA(pb, "company_name", str);
@@ -2776,6 +2797,9 @@ static int mxf_read_identification_metadata(void *arg, 
AVIOContext *pb, int tag,
 case 0x3C06:
 SET_TS_METADATA(pb, "modification_date", ts, str);
 break;
+case 0x3C07:
+SET_VERSION_METADATA(pb, "toolkit_version", major, minor, tertiary, 
patch, release, str);
+break;
 case 0x3C08:
 SET_STR_METADATA(pb, "application_platform", str);
 break;
diff --git a/tests/ref/fate/mxf-probe-applehdr10 
b/tests/ref/fate/mxf-probe-applehdr10
index 53a767c..0bf9bf1 100644
--- a/tests/ref/fate/mxf-probe-applehdr10
+++ b/tests/ref/fate/mxf-probe-applehdr10
@@ -164,6 +164,7 @@ TAG:product_name=Compressor
 TAG:product_version=4.4.7 (4.4.7)
 TAG:product_uid=----
 TAG:modification_date=2020-09-08T16:18:57.036000Z
+TAG:toolkit_version=3.8.0.171.1
 
TAG:material_package_umid=0x060A2B340101010501010D20130045843C9FE69D4B8FA90DDAAA1602A2E8
 TAG:timecode=00:01:15;26
 [/FORMAT]
diff --git a/tests/ref/fate/mxf-probe-dnxhd b/tests/ref/fate/mxf-probe-dnxhd
index 5a6221b..74d1831 100644
--- a/tests/ref/fate/mxf-probe-dnxhd
+++ b/tests/ref/fate/mxf-probe-dnxhd
@@ -173,6 +173,7 @@ TAG:project_name=UHD
 TAG:uid=784c8132-ae36-ed4d-b0ff-2edf1f3f2d92
 TAG:generation_uid=b6bcfcab-70ff-7331-c47c-478869de11d2
 TAG:application_platform=AAFSDK (MacOS X)
+TAG:toolkit_version=1.1.0.0.0
 TAG:modification_date=2016-09-18T19:25:25.00Z
 TAG:product_uid=acfbf03a-4f42-a231-d0b7-c06ecd3d4ad7
 TAG:product_version=Unknown version
-- 
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] ffmpeg-devel@ffmpeg.org

2021-02-02 Thread Alan Young
>From 3692430935d7987a41225eec289adb9f2561dd98 Mon Sep 17 00:00:00 2001
From: Alan Young 
Date: Tue, 2 Feb 2021 12:18:34 +
Subject: [PATCH] avformat/hls: Use #EXT-X-PROGRAM-DATE-TIME if available

If all the segments in an HLS playlist have #EXT-X-PROGRAM-DATE-TIME
timestamps then they provide better seeking than (just) using #EXTINF.

Parse timestamp in hls.c:parse_playlist() and use in
find_timestamp_in_playlist() if available.

This results in significantly faster startup when seeking long
distances (say > 30 minutes) into HLS/AAC streams.
---
 libavformat/hls.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3c7e197ce7..b0df06151d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -34,6 +34,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/dict.h"
 #include "libavutil/time.h"
+#include "libavutil/parseutils.h"
 #include "avformat.h"
 #include "internal.h"
 #include "avio_internal.h"
@@ -67,6 +68,7 @@ enum KeyType {
 
 struct segment {
 int64_t duration;
+int64_t timestamp;
 int64_t url_offset;
 int64_t size;
 char *url;
@@ -714,6 +716,7 @@ static int parse_playlist(HLSContext *c, const char *url,
 {
 int ret = 0, is_segment = 0, is_variant = 0;
 int64_t duration = 0;
+int64_t timestamp = 0;
 enum KeyType key_type = KEY_NONE;
 uint8_t iv[16] = "";
 int has_iv = 0;
@@ -868,6 +871,11 @@ static int parse_playlist(HLSContext *c, const char *url,
 } else if (av_strstart(line, "#EXTINF:", )) {
 is_segment = 1;
 duration   = atof(ptr) * AV_TIME_BASE;
+} else if (av_strstart(line, "#EXT-X-PROGRAM-DATE-TIME:", )) {
+if (av_parse_time(, ptr, 0) < 0) {
+av_log(c->ctx, AV_LOG_INFO, "Cannot parse ('%s')\n", line);
+timestamp = 0;
+}
 } else if (av_strstart(line, "#EXT-X-BYTERANGE:", )) {
 seg_size = strtoll(ptr, NULL, 10);
 ptr = strchr(ptr, '@');
@@ -941,6 +949,8 @@ static int parse_playlist(HLSContext *c, const char *url,
 duration = 0.001 * AV_TIME_BASE;
 }
 seg->duration = duration;
+seg->timestamp = timestamp;
+timestamp = 0;
 seg->key_type = key_type;
 dynarray_add(>segments, >n_segments, seg);
 is_segment = 0;
@@ -1644,6 +1654,21 @@ static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls,
 return 0;
 }
 
+/* If all segments have timestamps then more accurate than using segment duration */
+if (pls->n_segments && pls->segments[0]->timestamp) {
+int64_t initial_timestamp = pls->segments[0]->timestamp;
+for (i = 1; i < pls->n_segments; i++) {
+if (!pls->segments[i]->timestamp) break;
+if (timestamp < pls->segments[i]->timestamp - initial_timestamp) {
+*seq_no = pls->start_seq_no + i - 1;
+return 1;
+} else if (i == pls->n_segments - 1) {
+*seq_no = pls->start_seq_no + i;
+return 1;
+}
+}
+}
+
 for (i = 0; i < pls->n_segments; i++) {
 int64_t diff = pos + pls->segments[i]->duration - timestamp;
 if (diff > 0) {
-- 
2.28.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/xbmdec: get_nibble() minor speed increase, and binary reduction

2021-02-02 Thread Paul B Mahol
Gonna apply this set too. Anyone against?
___
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] avfilter/avfilter: mark enable as runtime option too

2021-02-02 Thread Nicolas George
Paul B Mahol (12021-02-02):
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/avfilter.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Should be ok. Maybe a comment in ff_filter_process_command() to explain
that set_enable_expr() is called by more generic code?

Regards,

-- 
  Nicolas George


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] avformat/mxf: Establish register of local tags

2021-02-02 Thread Paul B Mahol
I think you should make tables that never change const.

On Tue, Feb 2, 2021 at 12:11 AM Tomas Härdin  wrote:

> mån 2021-02-01 klockan 11:37 +0100 skrev Tomas Härdin:
> > fre 2021-01-29 klockan 22:06 +0100 skrev Marton Balint:
> > > On Thu, 28 Jan 2021, Tomas Härdin wrote:
> > >
> > > > tor 2021-01-28 klockan 14:48 +0100 skrev Tomas Härdin:
> > > > > tor 2021-01-28 klockan 08:56 +0100 skrev Marton Balint:
> > > > > > On Thu, 28 Jan 2021, Tomas Härdin wrote:
> > > > > > > ons 2021-01-27 klockan 23:50 +0100 skrev Marton Balint:
> > > > > > > > On Wed, 27 Jan 2021, Tomas Härdin wrote:
> > > > > > > There's not really anything to av_assert0() on in
> > > > > > > mxf_lookup_local_tag(). Either way, I'm thinking replacing the
> return
> > > > > > > NULL with either
> > > > > > >
> > > > > > >av_log(NULL, AV_LOG_PANIC, "Tried to use unregistered local
> tag
> > > > > > > 0x%04x\n", tag);
> > > > > > >abort();
> > > > > > >
> > > > > > > or
> > > > > > >
> > > > > > >av_assert0(0 && "Tried to use unregistered local tag");
> > > > > > >
> > > > > > > or maybe
> > > > > > >
> > > > > > >av_log(NULL, AV_LOG_PANIC, "Tried to use unregistered local
> tag
> > > > > > > 0x%04x\n", tag);
> > > > > > >av_assert0(0);
> > > > > > >
> > > > > > > to avoid explicitly calling abort()
> > > > > >
> > > > > > I think we usually do av_assert0(0) in this case. I am not sure
> if the
> > > > > > error message is particularly useful, afterall who sees it
> should be a
> > > > > > programmer and file/line is printed by assert anyway, so a
> comment in the
> > > > > > source code before the assert makes more sense to me.
> > > > >
> > > > > Maybe av_assert0(0 && "you forgot to add a local tag to the
> registry")?
> > > >
> > > > Here's a rebased patch that does this, with a little comment also
> > >
> > > LGTM, thanks.
> >
> > Will push later today
>
> Pushed
>
> /Tomas
>
> ___
> 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] avfilter/avfilter: mark enable as runtime option too

2021-02-02 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/avfilter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 8ff22c71e3..4c52d83842 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -620,11 +620,12 @@ static const AVClass *filter_child_class_iterate(void 
**iter)
 
 #define OFFSET(x) offsetof(AVFilterContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM
+#define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 static const AVOption avfilter_options[] = {
 { "thread_type", "Allowed thread types", OFFSET(thread_type), 
AV_OPT_TYPE_FLAGS,
 { .i64 = AVFILTER_THREAD_SLICE }, 0, INT_MAX, FLAGS, "thread_type" },
 { "slice", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVFILTER_THREAD_SLICE 
}, .flags = FLAGS, .unit = "thread_type" },
-{ "enable", "set enable expression", OFFSET(enable_str), 
AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
+{ "enable", "set enable expression", OFFSET(enable_str), 
AV_OPT_TYPE_STRING, {.str=NULL}, .flags = TFLAGS },
 { "threads", "Allowed number of threads", OFFSET(nb_threads), 
AV_OPT_TYPE_INT,
 { .i64 = 0 }, 0, INT_MAX, FLAGS },
 { "extra_hw_frames", "Number of extra hardware frames to allocate for the 
user",
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add PFM image encoder

2021-02-02 Thread Paul B Mahol
Will apply this set soon.
___
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] GSoC 2021

2021-02-02 Thread Steven Liu


> 2021年2月2日 下午5:48,Michael Niedermayer  写道:
> 
> Hi all
> 
> Most people probably already know but just to be sure everyone knows
> GSoC 2021 is 175h not 350h
> https://groups.google.com/g/google-summer-of-code-discuss/c/GgvbLrFBcUQ?pli=1
> 
> Some project ideas may need to be adjusted accordingly

What about make some small/mini/tiny feature for mentor project?
And I saw Nicolas make some RFC maybe can split some subproject for mentor 
project?

> 
> Thanks
> 
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> I have never wished to cater to the crowd; for what I know they do not
> approve, and what they approve I do not know. -- Epicurus
> ___
> 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

Steven Liu



___
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 6/8] avformat/rmdec: Fix codecdata_length overflow check

2021-02-02 Thread Michael Niedermayer
On Sat, Dec 19, 2020 at 12:22:06AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 2147483647 + 64 cannot be represented in type 
> 'int'
> Fixes: 
> 28509/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-6310969680723968
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/rmdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/8] avcodec/simple_idct: Fix undefined integer overflow in idct4row()

2021-02-02 Thread Michael Niedermayer
On Sat, Dec 19, 2020 at 12:22:03AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -1498310196 - 902891776 cannot be represented 
> in type 'int'
> Fixes: 
> 28445/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5075163389493248
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/simple_idct.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

Observe your enemies, for they first find out your faults. -- Antisthenes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/5] avformat/sccdec: Use larger intermediate for ts/next_ts computation

2021-02-02 Thread Michael Niedermayer
On Sun, Jan 17, 2021 at 11:53:07PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 92237203 * 33 cannot be represented in type 
> 'int'
> Fixes: 
> 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SCC_fuzzer-6603769487949824
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/sccdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply patchset

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] avformat/wtvdec: Check for EOF before potentially reseting the eof state

2021-02-02 Thread Michael Niedermayer
On Sun, Dec 13, 2020 at 07:12:29AM +1100, Peter Ross wrote:
> On Sat, Dec 12, 2020 at 12:38:43PM +0100, Michael Niedermayer wrote:
> > Fixes: infinite loop
> > Fixes: 
> > 28042/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6311288967528448
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/wtvdec.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
> > index 77908e6392..6c41e3c1a3 100644
> > --- a/libavformat/wtvdec.c
> > +++ b/libavformat/wtvdec.c
> > @@ -953,6 +953,9 @@ static int parse_chunks(AVFormatContext *s, int mode, 
> > int64_t seekts, int *len_p
> >  } else
> >  av_log(s, AV_LOG_WARNING, "unsupported chunk:"FF_PRI_GUID"\n", 
> > FF_ARG_GUID(g));
> >  
> > +if (avio_feof(pb))
> > +break;
> > +
> >  avio_skip(pb, WTV_PAD8(len) - consumed);
> >  }
> >  return AVERROR_EOF;
> > -- 
> > 2.17.1
> 
> curious how the infinte loop occurs here, as the while loop already tests 
> avio_feof().
> 
> i suspect it is because the fuzzed case results in 'consumed > len', and 
> therefore avio_skip is seeking backwards.

yes, WTV_PAD8(len) is 88 and consumed is 124 in the testcase, the eof flag
is reset from the backward seek and so the other test doesnt trigger

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


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 6/8] avcodec/cri: Use ff_set_dimensions()

2021-02-02 Thread Michael Niedermayer
On Mon, Feb 01, 2021 at 11:43:20PM +0100, Paul B Mahol wrote:
> LGTM

will applly
thx

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] GSoC 2021

2021-02-02 Thread Michael Niedermayer
Hi all

Most people probably already know but just to be sure everyone knows
GSoC 2021 is 175h not 350h
https://groups.google.com/g/google-summer-of-code-discuss/c/GgvbLrFBcUQ?pli=1

Some project ideas may need to be adjusted accordingly

Thanks

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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] avdevice/xcbgrab: don't assume Xserver endianness

2021-02-02 Thread Carl Eugen Hoyos
Am Di., 2. Feb. 2021 um 04:26 Uhr schrieb Andriy Gelman
:
>
> On Sun, 31. Jan 23:28, Carl Eugen Hoyos wrote:
> > Am So., 31. Jan. 2021 um 20:51 Uhr schrieb Andriy Gelman
> > :
> > >
> > > From: Andriy Gelman 
> > >
> > > Xserver defines the endianness of the grabbed images. Use this information
> > > to set the correct pixel format.
> >
> > lgtm if tested.
>
> Thanks, will apply in a few days.
> Do you think I should keep the docker testing instructions in the commit
> message?

If you believe that testing is not trivial (I agree), then this sounds
like a good idea.

> > Could you look at pal8? This used to work fine with x11grab...
>
> Yes sure, will have a look later this week.

Thank you, Carl Eugen
___
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".