Re: [FFmpeg-devel] [PATCH v2] swscale/output: Altivec-optimize yuv2plane1_8

2018-11-23 Thread Lauri Kasanen
On Fri, 23 Nov 2018 03:26:50 +0100
Michael Niedermayer  wrote:

> On Wed, Nov 21, 2018 at 07:19:45PM +0200, Lauri Kasanen wrote:
> > On Wed, 21 Nov 2018 17:22:36 +0100
> > Michael Niedermayer  wrote:
> > > the full fate tests must be run, many of these tests use swscale without
> > > having "scale" in their name
> > > and yes on lower end hardware 20min and longer is possible
> > 
> > I get failures on the baseline, without my patch. What is the procedure
> > here? Is there a var to skip those tests, or?
> 
> procedure ?
> First i try to convince you to attempt to fix some of these failures ;)
> because well, everyone would benefit if they are fixed ...

I mean, if my patch adds no failures, is that enough to apply it?

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


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: Fix segment duration overflow on fine time bases.

2018-11-23 Thread Jeyapal, Karthick

On 11/22/18 7:33 PM, Jeyapal, Karthick wrote:
>
> On 11/22/18 6:35 PM, Carl Eugen Hoyos wrote:
>> 2018-11-22 7:43 GMT+01:00, Jeyapal, Karthick :
>>>
>>> On 11/20/18 11:03 PM, Andrey Semashev wrote:
 When stream time bases are very fine grained (e.g. nanoseconds), 32-bit
 segment duration may overflow for even for rather small segment duration
 (about 4 seconds long). Therefore we use 64-bit values for segment
 duration.
 ---
  libavformat/dashenc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
 index d151921175..8d0bc4baa2 100644
 --- a/libavformat/dashenc.c
 +++ b/libavformat/dashenc.c
 @@ -59,7 +59,7 @@ typedef struct Segment {
  int64_t start_pos;
  int range_length, index_length;
  int64_t time;
 -int duration;
 +int64_t duration;
  int n;
  } Segment;

 @@ -428,7 +428,7 @@ static void output_segment_list(OutputStream *os,
 AVIOContext *out, AVFormatCont
  cur_time = seg->time;
  avio_printf(out, "t=\"%"PRId64"\" ", seg->time);
  }
 -avio_printf(out, "d=\"%d\" ", seg->duration);
 +avio_printf(out, "d=\"%"PRId64"\" ", seg->duration);
  while (i + repeat + 1 < os->nb_segments &&
 os->segments[i + repeat + 1]->duration ==
 seg->duration &&
 os->segments[i + repeat + 1]->time ==
 os->segments[i + repeat]->time + os->segments[i + repeat]->duration)
 @@ -1149,7 +1149,7 @@ static int dash_write_header(AVFormatContext *s)
  }

  static int add_segment(OutputStream *os, const char *file,
 -   int64_t time, int duration,
 +   int64_t time, int64_t duration,
 int64_t start_pos, int64_t range_length,
 int64_t index_length, int next_exp_index)
  {
>>>
>>> LGTM.
>>
>> Please commit the patch if it is ok.
> Sure. I am just waiting for 3 days to complete as per the ffmpeg developer 
> guidelines.
> Will push it tomorrow. Let me know if it is urgent for some reason, in which 
> case I will push it earlier.
Pushed.
>>
>> Carl Eugen
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/1] avcodec/vaapi_encode: add frame-skip func

2018-11-23 Thread Sun, Jing A
Hi Mark,

In some cases, that is useful. For example, an online content distributer, who 
keeps encoding the captured video frames by ffmpeg and sending them out. At 
times, there is no update of source, which makes one or several captured source 
frames are exactly the same as the last one, and the distributer wants to just 
skip such frames, without stopping the encoding process.

Regards,
SUN, Jing


-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Mark 
Thompson
Sent: Tuesday, November 20, 2018 4:07 AM
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 1/1] avcodec/vaapi_encode: add frame-skip 
func

On 19/11/18 09:04, Jing SUN wrote:
> frame-skip is required to implement network bandwidth self-adaptive 
> vaapi encoding.
> To make a frame skipped, allocate its frame side data of 
> AV_FRAME_DATA_SKIP_FRAME type and set its value to 1.

So if I'm reading this correctly the idea is to implement partial VFR by having 
a special new side-data type which indicates where frames would have been had 
the input actually matched the configured CFR behaviour?

Why is the user meant to create these special frames?  It seems to me that the 
existing method of looking at the timestamps would be a better way to find any 
gaps.

(Or, even better, add timestamps to VAAPI so that it can support VFR in a 
sensible way rather than adding hacks like this to allow partial VFR with weird 
constraints.)

> Signed-off-by: Jing SUN 
> ---
>  libavcodec/vaapi_encode.c | 142 
> --
>  libavcodec/vaapi_encode.h |   5 ++
>  libavutil/frame.c |   1 +
>  libavutil/frame.h |   5 ++
>  4 files changed, 149 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c 
> index 2fe8501..a401d61 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -23,6 +23,7 @@
>  #include "libavutil/common.h"
>  #include "libavutil/log.h"
>  #include "libavutil/pixdesc.h"
> +#include "libavutil/intreadwrite.h"
>  
>  #include "vaapi_encode.h"
>  #include "avcodec.h"
> @@ -103,6 +104,47 @@ static int vaapi_encode_make_param_buffer(AVCodecContext 
> *avctx,
>  return 0;
>  }
>  
> +static int vaapi_encode_check_if_skip(AVCodecContext *avctx,
> +  VAAPIEncodePicture *pic) {
> +AVFrameSideData *fside = NULL;
> +VAAPIEncodeContext *ctx = avctx->priv_data;
> +VAAPIEncodePicture *cur = NULL;
> +int i = 0;
> +
> +if (!pic || !pic->input_image)
> +return AVERROR(EINVAL);
> +
> +fside = av_frame_get_side_data(pic->input_image, 
> AV_FRAME_DATA_SKIP_FRAME);
> +if (fside)
> +pic->skipped_flag = AV_RL8(fside->data);
> +else
> +pic->skipped_flag = 0;
> +
> +if (0 == pic->skipped_flag)
> +return 0;
> +
> +if ((pic->type == PICTURE_TYPE_IDR) || (pic->type == PICTURE_TYPE_I)) {
> +av_log(avctx, AV_LOG_INFO, "Can't skip IDR/I pic 
> %"PRId64"/%"PRId64".\n",
> +   pic->display_order, pic->encode_order);
> +pic->skipped_flag = 0;
> +return 0;
> +}
> +
> +for (cur = ctx->pic_start; cur; cur = cur->next) {
> +for (i=0; i < cur->nb_refs; ++i) {
> +if (cur->refs[i] == pic) {
> +av_log(avctx, AV_LOG_INFO, "Can't skip ref pic 
> %"PRId64"/%"PRId64".\n",
> +   pic->display_order, pic->encode_order);
> +pic->skipped_flag = 0;
> +return 0;
> +}
> +}
> +}
> +
> +return 0;
> +}
> +
>  static int vaapi_encode_wait(AVCodecContext *avctx,
>   VAAPIEncodePicture *pic)  { @@ -418,6 
> +460,69 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
>  }
>  }
>  
> +err = vaapi_encode_check_if_skip(avctx, pic);
> +if (err != 0)
> +av_log(avctx, AV_LOG_ERROR, "Fail to check if skip.\n");
> +
> +#ifdef VAEncMiscParameterSkipFrame
> +if (pic->skipped_flag) {
> +av_log(avctx, AV_LOG_INFO, "Skip pic %"PRId64"/%"PRId64" as 
> requested.\n",
> +   pic->display_order, pic->encode_order);
> +
> +++ctx->skipped_pic_count;
> +pic->encode_issued = 1;
> +
> +return 0;
> +} else if (ctx->skipped_pic_count > 0) {
> +VABufferID skip_param_id;
> +VAEncMiscParameterBuffer *misc_param;
> +VAEncMiscParameterSkipFrame *skip_param;
> +
> +err = vaapi_encode_make_param_buffer(avctx, pic,
> +  VAEncMiscParameterBufferType, NULL,
> +  (sizeof(VAEncMiscParameterBuffer) +
> +  sizeof(VAEncMiscParameterSkipFrame)));
> +if (err < 0)
> +goto fail;
> +
> +skip_param_id = pic->param_buffers[pic->nb_param_buffers-1];
> +
> +vas = vaMapBuffer(ctx->hwctx->display,
> +  skip_param_id,
> +  (void **)&misc_p

[FFmpeg-devel] [PATCH] avformat: add DHAV demuxer

2018-11-23 Thread Paul B Mahol
Timestamps and seeking still broken.

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

diff --git a/libavformat/Makefile b/libavformat/Makefile
index e4d997c4a0..a6c5ea9aa3 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -149,6 +149,7 @@ OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
 OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
 OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
 OBJS-$(CONFIG_DFA_DEMUXER)   += dfa.o
+OBJS-$(CONFIG_DHAV_DEMUXER)  += dhav.o
 OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o
 OBJS-$(CONFIG_DIRAC_MUXER)   += rawenc.o
 OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 498077e1de..5fb5bf17c6 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -110,6 +110,7 @@ extern AVInputFormat  ff_daud_demuxer;
 extern AVOutputFormat ff_daud_muxer;
 extern AVInputFormat  ff_dcstr_demuxer;
 extern AVInputFormat  ff_dfa_demuxer;
+extern AVInputFormat  ff_dhav_demuxer;
 extern AVInputFormat  ff_dirac_demuxer;
 extern AVOutputFormat ff_dirac_muxer;
 extern AVInputFormat  ff_dnxhd_demuxer;
diff --git a/libavformat/dhav.c b/libavformat/dhav.c
new file mode 100644
index 00..0bfd42bdec
--- /dev/null
+++ b/libavformat/dhav.c
@@ -0,0 +1,237 @@
+/*
+ * DHAV demuxer
+ *
+ * Copyright (c) 2018 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/avassert.h"
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct DHAVContext {
+unsigned type;
+int width, height;
+int video_codec;
+int frame_rate;
+int sample_rate;
+int64_t pts;
+
+int video_stream_index;
+int audio_stream_index;
+} DHAVContext;
+
+static int dhav_probe(AVProbeData *p)
+{
+if (memcmp(p->buf, "DHAV", 4))
+return 0;
+
+return AVPROBE_SCORE_MAX;
+}
+
+static int dhav_read_header(AVFormatContext *s)
+{
+DHAVContext *dhav = s->priv_data;
+
+s->ctx_flags |= AVFMTCTX_NOHEADER;
+dhav->video_stream_index = -1;
+dhav->audio_stream_index = -1;
+
+return 0;
+}
+
+static const uint16_t sample_rates[] = {
+8000, 4000, 8000, 11025, 16000,
+2, 22050, 32000, 44100, 48000,
+};
+
+static int parse_ext(AVFormatContext *s, int length)
+{
+DHAVContext *dhav = s->priv_data;
+int index;
+
+while (length > 0) {
+int type = avio_r8(s->pb);
+
+switch (type) {
+case 0x80:
+avio_skip(s->pb, 1);
+dhav->width  = 8 * avio_r8(s->pb);
+dhav->height = 8 * avio_r8(s->pb);
+length -= 4;
+break;
+case 0x81:
+avio_skip(s->pb, 1);
+dhav->video_codec = avio_r8(s->pb);
+dhav->frame_rate = avio_r8(s->pb);
+length -= 4;
+break;
+case 0x82:
+avio_skip(s->pb, 3);
+dhav->width  = avio_rl16(s->pb);
+dhav->height = avio_rl16(s->pb);
+length -= 8;
+break;
+case 0x83:
+avio_skip(s->pb, 2);
+index = avio_r8(s->pb);
+if (index < 10) {
+dhav->sample_rate = sample_rates[index];
+} else {
+dhav->sample_rate = 8000;
+}
+length -= 4;
+break;
+case 0x88:
+avio_skip(s->pb, 7);
+length -= 8;
+break;
+case 0x91:
+case 0x92:
+case 0x93:
+case 0x95:
+case 0x9a:
+avio_skip(s->pb, 7);
+length -= 8;
+break;
+case 0x8b:
+case 0x94:
+case 0x96:
+avio_skip(s->pb, 3);
+length -= 4;
+break;
+default:
+av_log(s, AV_LOG_INFO, "Unknown type: %X, skipping rest of 
header.\n", type);
+avio_skip(s->pb, length - 1);
+length = 0;
+}
+}
+
+return 0;
+}
+
+static int read_chunk(AVFormatContext *s)
+{
+DHAVCo

[FFmpeg-devel] [PATCH] avformat: add DHAV demuxer

2018-11-23 Thread Paul B Mahol
Timestamps and seeking still broken.

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

diff --git a/libavformat/Makefile b/libavformat/Makefile
index e4d997c4a0..a6c5ea9aa3 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -149,6 +149,7 @@ OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
 OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
 OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
 OBJS-$(CONFIG_DFA_DEMUXER)   += dfa.o
+OBJS-$(CONFIG_DHAV_DEMUXER)  += dhav.o
 OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o
 OBJS-$(CONFIG_DIRAC_MUXER)   += rawenc.o
 OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 498077e1de..5fb5bf17c6 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -110,6 +110,7 @@ extern AVInputFormat  ff_daud_demuxer;
 extern AVOutputFormat ff_daud_muxer;
 extern AVInputFormat  ff_dcstr_demuxer;
 extern AVInputFormat  ff_dfa_demuxer;
+extern AVInputFormat  ff_dhav_demuxer;
 extern AVInputFormat  ff_dirac_demuxer;
 extern AVOutputFormat ff_dirac_muxer;
 extern AVInputFormat  ff_dnxhd_demuxer;
diff --git a/libavformat/dhav.c b/libavformat/dhav.c
new file mode 100644
index 00..0bfd42bdec
--- /dev/null
+++ b/libavformat/dhav.c
@@ -0,0 +1,237 @@
+/*
+ * DHAV demuxer
+ *
+ * Copyright (c) 2018 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/avassert.h"
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct DHAVContext {
+unsigned type;
+int width, height;
+int video_codec;
+int frame_rate;
+int sample_rate;
+int64_t pts;
+
+int video_stream_index;
+int audio_stream_index;
+} DHAVContext;
+
+static int dhav_probe(AVProbeData *p)
+{
+if (memcmp(p->buf, "DHAV", 4))
+return 0;
+
+return AVPROBE_SCORE_MAX;
+}
+
+static int dhav_read_header(AVFormatContext *s)
+{
+DHAVContext *dhav = s->priv_data;
+
+s->ctx_flags |= AVFMTCTX_NOHEADER;
+dhav->video_stream_index = -1;
+dhav->audio_stream_index = -1;
+
+return 0;
+}
+
+static const uint16_t sample_rates[] = {
+8000, 4000, 8000, 11025, 16000,
+2, 22050, 32000, 44100, 48000,
+};
+
+static int parse_ext(AVFormatContext *s, int length)
+{
+DHAVContext *dhav = s->priv_data;
+int index;
+
+while (length > 0) {
+int type = avio_r8(s->pb);
+
+switch (type) {
+case 0x80:
+avio_skip(s->pb, 1);
+dhav->width  = 8 * avio_r8(s->pb);
+dhav->height = 8 * avio_r8(s->pb);
+length -= 4;
+break;
+case 0x81:
+avio_skip(s->pb, 1);
+dhav->video_codec = avio_r8(s->pb);
+dhav->frame_rate = avio_r8(s->pb);
+length -= 4;
+break;
+case 0x82:
+avio_skip(s->pb, 3);
+dhav->width  = avio_rl16(s->pb);
+dhav->height = avio_rl16(s->pb);
+length -= 8;
+break;
+case 0x83:
+avio_skip(s->pb, 2);
+index = avio_r8(s->pb);
+if (index < 10) {
+dhav->sample_rate = sample_rates[index];
+} else {
+dhav->sample_rate = 8000;
+}
+length -= 4;
+break;
+case 0x88:
+avio_skip(s->pb, 7);
+length -= 8;
+break;
+case 0x91:
+case 0x92:
+case 0x93:
+case 0x95:
+case 0x9a:
+avio_skip(s->pb, 7);
+length -= 8;
+break;
+case 0x8b:
+case 0x94:
+case 0x96:
+avio_skip(s->pb, 3);
+length -= 4;
+break;
+default:
+av_log(s, AV_LOG_INFO, "Unknown type: %X, skipping rest of 
header.\n", type);
+avio_skip(s->pb, length - 1);
+length = 0;
+}
+}
+
+return 0;
+}
+
+static int read_chunk(AVFormatContext *s)
+{
+DHAVCo

Re: [FFmpeg-devel] [RFC] VDD FFmpeg session and community survey

2018-11-23 Thread Kieran Kunhya
>
> > What if a majority of the committee is biased and bans everyone they
> disagree with to take over the project? They certainly could.
> What if the committee's decision is something the majority of the
> developers disagree with?
>
> This is why I'm against formalizing such prodecures. They're too inflexible
> and absolute, and end up being abused or overused (like videolan's weekly
> temporary bannings I've heard of).
> Furthermore why do you bring this up now at all? We haven't had accidents
> of this nature in quite some time. In fact the last time it was the ML
> admin's random incorrect decision to block a discussion which ended up
> being a problem that everyone disagreed with. And that was 11 months ago


Thank you for confirming to the rest of the community why we need a
committee and proper Code of Conduct like other comparable Open Source
projects.

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


Re: [FFmpeg-devel] [RFC] VDD FFmpeg session and community survey

2018-11-23 Thread Thilo Borgmann
Am 22.11.18 um 22:58 schrieb Rostislav Pehlivanov:
> On Thu, 22 Nov 2018 at 19:02, Thilo Borgmann  wrote:
> 
>>
>> Please note that this survey is _not_ meant to be a vote about the
>> proposal. It is to
>> determine if we should actually have a refinement/vote on instantiating
>> such a
>> community committee - depending on the community's point of view.
>>
> 
> Spamming (which this would certainly be a textbook definition of) every
> subscriber ever (including those who forgot) is unacceptable.

All subscribers are per definition interested in FFmpeg development. 
I don't see how this should be spam in general to this audience.


> +Further on it is to impose any sanctions related to violations of the code of
>> +conduct only if these incidents are brought up to its attention from 
>> directly
>> +involved parties of such an incident.
>>
>> Violations should be limited to publicly logged IRC channels or the ML.
> Otherwise without proof this will end up as a "but they said" situation.

Agree.


> ++ at subheading 
> Committee members
>> +
>> +The community committee consists of three elected individuals. Committee 
>> members are
>> +elected for a period of one year and are automatically removed from the 
>> committee after
>> +that period. Reelection of committee members for the following period is 
>> possible.
>>
>> Three members is far too low and would be prone to bias. 5 or 7 would be
> better.

A question I discussed with many others. I don't have a strong opinion, 3/5/7 
have always been the options. Feel free to put that to discussion again.


>> +
>> +If for any reason a current member of the committee wishes to leave the 
>> committee, the
>> +whole committee is to be reelected. No former committee members having left 
>> the committee
>> +on their own wish can be a candidate for the successor committee.
>>
>> That last sentence is random.

Not quite. It prevents "blocking" attempts by stepping back and getting elected 
again. The whole committee is to be voted upon again to prevent biasing 
attempts within the committee. Or I might see why you think this could not 
happen.


> +The vote has to implement a direct, free, equal and secret election.
>> +The results are to be publicly available.
>> +The election should be completed not later than the end of the ongoing 
>> period.
>> +Any community member can call on itself or any other person to be a 
>> candidate for an election.
>>
>> What if a majority of the committee is biased and bans everyone they
> disagree with to take over the project? They certainly could.
> What if the committee's decision is something the majority of the
> developers disagree with?

Nothing prevents the community to release the committee it instantiated. A 
community vote on (this or whatever) is not object to the powers of the 
committee.


> This is why I'm against formalizing such prodecures. They're too inflexible
> and absolute, and end up being abused or overused (like videolan's weekly
> temporary bannings I've heard of).

Didn't heard of these by now. However, in discussing with people, it revealed 
there are two ways to go with that. Either, you give a set of rules and define 
everything in these and can't handle anything else. Or, you set one rule to be 
 and have each thing in relation to that.

Experience says, the first possibility comes with people navigating on the 
bleeding edge of the rules exploiting every grey zone there might be. The 
second comes with people having an other interpretation of the "one rule" in 
contrast to the committee.
Well, I prefer the second way. But this question you can also put to discussion 
again.



> Furthermore why do you bring this up now at all? We haven't had accidents
> of this nature in quite some time. In fact the last time it was the ML
> admin's random incorrect decision to block a discussion which ended up
> being a problem that everyone disagreed with. And that was 11 months ago.

You have been at VDD, Rostislav. We had this session, people made this a topic, 
I agreed on summing up and sending it to the list. I've not stumbled across 
such incidents lately, too. However, I by far do not read every mail here or do 
watch IRC at all - people still having this impression are a good enough reason 
for me.

Personally, even if these accidents would have ceased to happen - history tells 
us we might use a better way of dealing with it, since CoC violations are an 
ever repeating thing to happen.

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


[FFmpeg-devel] [PATCH]Avoid duplicating Closed Captions when increasing frame rate

2018-11-23 Thread Carl Eugen Hoyos
Hi!

Attached patches fix Closed Captions when increasing frame rate, both
with "-r" and the fps filter, fixes ticket #7506.

Please comment, Carl Eugen
From fcb6a6ec0bb3246913fab50a0aa7d3c9dc0a465a Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 23 Nov 2018 18:48:50 +0100
Subject: [PATCH 1/2] lavfi/fps: Avoid duplicating Closed Captions when
 increasing frame rate.

---
 libavfilter/vf_fps.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index 9167a00..6b99f20 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -249,6 +249,8 @@ static int write_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *outlin
 frame = av_frame_clone(s->frames[0]);
 if (!frame)
 return AVERROR(ENOMEM);
+// Make sure Closed Captions will not be duplicated
+av_frame_remove_side_data(s->frames[0], AV_FRAME_DATA_A53_CC);
 frame->pts = s->next_pts++;
 
 av_log(ctx, AV_LOG_DEBUG, "Writing frame with pts %"PRId64" to pts %"PRId64"\n",
-- 
1.7.10.4

From 86ddd7f86991bdfe865f4180f8bf5779383f5295 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 23 Nov 2018 18:49:27 +0100
Subject: [PATCH 2/2] ffmpeg: Avoid duplicating Closed Captions when
 increasing frame rate.

Fixes ticket #7506.
---
 fftools/ffmpeg.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a12208c..6ce1156 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1286,6 +1286,8 @@ static void do_video_out(OutputFile *of,
 ret = avcodec_send_frame(enc, in_picture);
 if (ret < 0)
 goto error;
+// Make sure Closed Captions will not be duplicated
+av_frame_remove_side_data(in_picture, AV_FRAME_DATA_A53_CC);
 
 while (1) {
 ret = avcodec_receive_packet(enc, &pkt);
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [RFC] VDD FFmpeg session and community survey

2018-11-23 Thread Jean-Baptiste Kempf
On Thu, 22 Nov 2018, at 22:58, Rostislav Pehlivanov wrote:
> This is why I'm against formalizing such prodecures. They're too inflexible
> and absolute, 

Enforcement depends on who is enforcing it. Hence elections.

> and end up being abused or overused (like videolan's weekly
> temporary bannings I've heard of).



We banned 2 times 1 person from IRC 24hours, and banned someone once from the 
mailing-list, in the many years (7?) that our CoC existed. Please don't spread 
misinformation.

I don't see how that is abusing or overusing...

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat: add DHAV demuxer

2018-11-23 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/dhav.c   | 250 +++
 3 files changed, 252 insertions(+)
 create mode 100644 libavformat/dhav.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index e4d997c4a0..a6c5ea9aa3 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -149,6 +149,7 @@ OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
 OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
 OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
 OBJS-$(CONFIG_DFA_DEMUXER)   += dfa.o
+OBJS-$(CONFIG_DHAV_DEMUXER)  += dhav.o
 OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o
 OBJS-$(CONFIG_DIRAC_MUXER)   += rawenc.o
 OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 498077e1de..5fb5bf17c6 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -110,6 +110,7 @@ extern AVInputFormat  ff_daud_demuxer;
 extern AVOutputFormat ff_daud_muxer;
 extern AVInputFormat  ff_dcstr_demuxer;
 extern AVInputFormat  ff_dfa_demuxer;
+extern AVInputFormat  ff_dhav_demuxer;
 extern AVInputFormat  ff_dirac_demuxer;
 extern AVOutputFormat ff_dirac_muxer;
 extern AVInputFormat  ff_dnxhd_demuxer;
diff --git a/libavformat/dhav.c b/libavformat/dhav.c
new file mode 100644
index 00..2b523dc402
--- /dev/null
+++ b/libavformat/dhav.c
@@ -0,0 +1,250 @@
+/*
+ * DHAV demuxer
+ *
+ * Copyright (c) 2018 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/avassert.h"
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct DHAVContext {
+unsigned type;
+int width, height;
+int video_codec;
+int frame_rate;
+int channels;
+int audio_codec;
+int sample_rate;
+int64_t pts;
+
+int video_stream_index;
+int audio_stream_index;
+} DHAVContext;
+
+static int dhav_probe(AVProbeData *p)
+{
+if (memcmp(p->buf, "DHAV", 4))
+return 0;
+
+return AVPROBE_SCORE_MAX;
+}
+
+static int dhav_read_header(AVFormatContext *s)
+{
+DHAVContext *dhav = s->priv_data;
+
+s->ctx_flags |= AVFMTCTX_NOHEADER;
+dhav->video_stream_index = -1;
+dhav->audio_stream_index = -1;
+
+return 0;
+}
+
+static const uint16_t sample_rates[] = {
+8000, 4000, 8000, 11025, 16000,
+2, 22050, 32000, 44100, 48000,
+};
+
+static int parse_ext(AVFormatContext *s, int length)
+{
+DHAVContext *dhav = s->priv_data;
+int index;
+
+while (length > 0) {
+int type = avio_r8(s->pb);
+
+switch (type) {
+case 0x80:
+avio_skip(s->pb, 1);
+dhav->width  = 8 * avio_r8(s->pb);
+dhav->height = 8 * avio_r8(s->pb);
+length -= 4;
+break;
+case 0x81:
+avio_skip(s->pb, 1);
+dhav->video_codec = avio_r8(s->pb);
+dhav->frame_rate = avio_r8(s->pb);
+length -= 4;
+break;
+case 0x82:
+avio_skip(s->pb, 3);
+dhav->width  = avio_rl16(s->pb);
+dhav->height = avio_rl16(s->pb);
+length -= 8;
+break;
+case 0x83:
+dhav->channels = avio_r8(s->pb);
+dhav->audio_codec = avio_r8(s->pb);
+index = avio_r8(s->pb);
+if (index < 10) {
+dhav->sample_rate = sample_rates[index];
+} else {
+dhav->sample_rate = 8000;
+}
+length -= 4;
+break;
+case 0x88:
+avio_skip(s->pb, 7);
+length -= 8;
+break;
+case 0x91:
+case 0x92:
+case 0x93:
+case 0x95:
+case 0x9a:
+avio_skip(s->pb, 7);
+length -= 8;
+break;
+case 0x8b:
+case 0x94:
+case 0x96:
+avio_skip(s->pb, 3);
+length -= 4;
+break;
+default:
+av_log(s, AV_LOG_INFO, "Unknown type: %X, skipping rest of 
header.\n", type);
+avio_skip(s->pb, length - 1);
+length = 0;
+}
+}
+
+return 0

Re: [FFmpeg-devel] [PATCH v2] swscale/output: Altivec-optimize yuv2plane1_8

2018-11-23 Thread Michael Niedermayer
On Fri, Nov 23, 2018 at 10:38:13AM +0200, Lauri Kasanen wrote:
> On Fri, 23 Nov 2018 03:26:50 +0100
> Michael Niedermayer  wrote:
> 
> > On Wed, Nov 21, 2018 at 07:19:45PM +0200, Lauri Kasanen wrote:
> > > On Wed, 21 Nov 2018 17:22:36 +0100
> > > Michael Niedermayer  wrote:
> > > > the full fate tests must be run, many of these tests use swscale without
> > > > having "scale" in their name
> > > > and yes on lower end hardware 20min and longer is possible
> > > 
> > > I get failures on the baseline, without my patch. What is the procedure
> > > here? Is there a var to skip those tests, or?
> > 
> > procedure ?
> > First i try to convince you to attempt to fix some of these failures ;)
> > because well, everyone would benefit if they are fixed ...
> 
> I mean, if my patch adds no failures, is that enough to apply it?

yes that and the tests failing should still fail the same way with the
same checksums
This of course assumes noone finds an issue in the patch

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH V3 3/7] fftools/ffmpeg: delete the unused code.

2018-11-23 Thread Michael Niedermayer
On Thu, Nov 22, 2018 at 10:56:15PM +0800, Jun Zhao wrote:
> There are come from 2012 ago and have never been used from this
> time.
> 
> Signed-off-by: Jun Zhao 
> ---
>  fftools/ffmpeg.c |9 +
>  1 files changed, 1 insertions(+), 8 deletions(-)

probably ok

thx

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/hevcdec: Check for overlapping slices

2018-11-23 Thread Michael Niedermayer
On Sat, Nov 17, 2018 at 03:01:43AM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 10108/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6222384351674368
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hevcdec.c | 8 
>  libavcodec/hevcdec.h | 1 +
>  2 files changed, 9 insertions(+)

will post a simpler solution


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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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


[FFmpeg-devel] [PATCH] lavc/decode: allow users to shrink the hw frames pool size, if they so desire.

2018-11-23 Thread Timo Rothenpieler
---
 libavcodec/decode.c| 9 +
 libavcodec/options_table.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index c89c77c43a..08ae8788a2 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1256,10 +1256,11 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
*avctx,
 AVHWFramesContext *frames_ctx = (AVHWFramesContext*)frames_ref->data;
 
 if (frames_ctx->initial_pool_size) {
-// If the user has requested that extra output surfaces be
-// available then add them here.
-if (avctx->extra_hw_frames > 0)
-frames_ctx->initial_pool_size += avctx->extra_hw_frames;
+// If the user has requested extra/fewer output surfaces be
+// available then add/substract them here.
+frames_ctx->initial_pool_size += avctx->extra_hw_frames;
+if (avctx->extra_hw_frames < 0)
+av_log(avctx, AV_LOG_WARNING, "Decreasing hwaccel frame pool 
size!\n");
 
 // If frame threading is enabled then an extra surface per thread
 // is also required.
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 099261e168..af0ab1cfe0 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -478,7 +478,7 @@ static const AVOption avcodec_options[] = {
 {"ignore_level", "ignore level even if the codec level used is unknown or 
higher than the maximum supported level reported by the hardware driver", 0, 
AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, INT_MAX, V 
| D, "hwaccel_flags" },
 {"allow_high_depth", "allow to output YUV pixel formats with a different 
chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, 
INT_MAX, V | D, "hwaccel_flags"},
 {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated 
decoder's supported profiles do not exactly match the stream", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, 
INT_MAX, V | D, "hwaccel_flags"},
-{"extra_hw_frames", "Number of extra hardware frames to allocate for the 
user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
V|D },
+{"extra_hw_frames", "Number of extra hardware frames to allocate for the user, 
negative values are supported at own risk", OFFSET(extra_hw_frames), 
AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, V|D },
 {NULL},
 };
 
-- 
2.17.0

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


[FFmpeg-devel] [PATCH] avcodec/hevcdec: Check for overlapping slices

2018-11-23 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
10108/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6222384351674368

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

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index a3b5c8cb71..10bf2563c0 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2942,6 +2942,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL 
*nal)
 s->max_ra = INT_MIN;
 }
 
+s->overlap ++;
 ret = hevc_frame_start(s);
 if (ret < 0)
 return ret;
@@ -3020,6 +3021,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t 
*buf, int length)
 s->ref = NULL;
 s->last_eos = s->eos;
 s->eos = 0;
+s->overlap = 0;
 
 /* split the input packet into NAL units, so we know the upper bound on the
  * number of slices in the frame */
@@ -3054,6 +3056,8 @@ static int decode_nal_units(HEVCContext *s, const uint8_t 
*buf, int length)
 continue;
 
 ret = decode_nal_unit(s, nal);
+if (ret >= 0 && s->overlap > 2)
+ret = AVERROR_INVALIDDATA;
 if (ret < 0) {
 av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index dd951aae06..b45969b7e2 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -430,6 +430,7 @@ typedef struct HEVCContext {
 int max_ra;
 int bs_width;
 int bs_height;
+int overlap;
 
 int is_decoded;
 int no_rasl_output_flag;
-- 
2.19.1

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


[FFmpeg-devel] [PATCH 2/5] cbs: Add a macro to create functions for deep copying

2018-11-23 Thread Andreas Rheinhardt
Some structs in cbs (most importantly some of the parameter sets of
H.264/HEVC) can contain external buffers so that shallow copies are not
enough for them; furthermore, they need a special free-callback
function. The macro provided in this commit can be used to easily create
functions both for copying as well as freeing such structures.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_internal.h | 53 +++
 1 file changed, 53 insertions(+)

diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h
index 62a836af90..dd45748c61 100644
--- a/libavcodec/cbs_internal.h
+++ b/libavcodec/cbs_internal.h
@@ -98,4 +98,57 @@ extern const CodedBitstreamType ff_cbs_type_mpeg2;
 extern const CodedBitstreamType ff_cbs_type_vp9;
 
 
+enum {
+BITS,
+BYTES
+};
+
+// The following macro automatically creates both (deep) copy and
+// free functions for structs with exactly one internal buffer.
+
+#define cbs_copy_free(codec, type, var, buffer, size_element, size_offset, 
size_unit) \
+static void cbs_ ## codec ## _free_ ## var(void *unit, uint8_t *content) \
+{ \
+type *var = (type *)content; \
+ \
+av_buffer_unref(&var->buffer ## _ref); \
+av_freep(&var); \
+} \
+ \
+static AVBufferRef *cbs_ ## codec ## _copy_ ## var(const type *source) \
+{ \
+AVBufferRef *copy_ref; \
+type *copy; \
+ \
+copy = av_malloc(sizeof(type)); \
+if (!copy) \
+return NULL; \
+memcpy(copy, source, sizeof(type)); \
+ \
+copy_ref = av_buffer_create((uint8_t*)copy, sizeof(type), \
+&cbs_ ## codec ## _free_ ## var, \
+NULL, 0); \
+if (!copy_ref) { \
+av_free(copy); \
+return NULL; \
+} \
+ \
+if (source->buffer) { \
+size_t size = (size_t)source->size_element + size_offset; \
+if (size_unit == BITS) \
+size = (size + 7) / 8; \
+ \
+copy->buffer ## _ref = av_buffer_alloc(size + 
AV_INPUT_BUFFER_PADDING_SIZE); \
+if (!copy->buffer ## _ref) {\
+av_buffer_unref(©_ref); \
+return NULL; \
+} \
+copy->buffer = copy->buffer ## _ref->data; \
+memcpy(copy->buffer, source->buffer, size); \
+memset(copy->buffer + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); \
+} \
+ \
+return copy_ref; \
+}
+
 #endif /* AVCODEC_CBS_INTERNAL_H */
-- 
2.19.1

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


[FFmpeg-devel] [PATCH 4/5] cbs_h2645: Implement functions to make a unit's content writable

2018-11-23 Thread Andreas Rheinhardt
These functions (which are only implemented for parameter sets) make it
possible to change the contents of the parameter sets as one pleases
without changing/breaking the parsing process of future access units.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_h2645.c | 67 --
 1 file changed, 65 insertions(+), 2 deletions(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index b40cf92a7b..931c7fb2af 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1062,6 +1062,69 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext 
*ctx,
 return 0;
 }
 
+static int cbs_h264_make_unit_writable(CodedBitstreamContext *ctx,
+   CodedBitstreamUnit *unit)
+{
+AVBufferRef *ref;
+
+switch (unit->type) {
+case H264_NAL_SPS:
+{
+ref = cbs_h264_copy_sps(unit->content);
+break;
+}
+case H264_NAL_PPS:
+{
+ref = cbs_h264_copy_pps(unit->content);
+break;
+}
+default:
+return AVERROR_PATCHWELCOME;
+}
+if (!ref)
+return AVERROR(ENOMEM);
+
+av_buffer_unref(&unit->content_ref);
+unit->content = ref->data;
+unit->content_ref = ref;
+
+return 0;
+}
+
+static int cbs_h265_make_unit_writable(CodedBitstreamContext *ctx,
+   CodedBitstreamUnit *unit)
+{
+AVBufferRef *ref;
+
+switch (unit->type) {
+case HEVC_NAL_VPS:
+{
+ref = cbs_h265_copy_vps(unit->content);
+break;
+}
+case HEVC_NAL_SPS:
+{
+ref = cbs_h265_copy_sps(unit->content);
+break;
+}
+case HEVC_NAL_PPS:
+{
+ref = cbs_h265_copy_pps(unit->content);
+break;
+}
+default:
+return AVERROR_PATCHWELCOME;
+}
+if (!ref)
+return AVERROR(ENOMEM);
+
+av_buffer_unref(&unit->content_ref);
+unit->content = ref->data;
+unit->content_ref = ref;
+
+return 0;
+}
+
 static int cbs_h2645_write_slice_data(CodedBitstreamContext *ctx,
   PutBitContext *pbc, const uint8_t *data,
   size_t data_size, int data_bit_start)
@@ -1534,7 +1597,7 @@ const CodedBitstreamType ff_cbs_type_h264 = {
 
 .split_fragment= &cbs_h2645_split_fragment,
 .read_unit = &cbs_h264_read_nal_unit,
-.make_writable = NULL,
+.make_writable = &cbs_h264_make_unit_writable,
 .write_unit= &cbs_h2645_write_nal_unit,
 .assemble_fragment = &cbs_h2645_assemble_fragment,
 
@@ -1548,7 +1611,7 @@ const CodedBitstreamType ff_cbs_type_h265 = {
 
 .split_fragment= &cbs_h2645_split_fragment,
 .read_unit = &cbs_h265_read_nal_unit,
-.make_writable = NULL,
+.make_writable = &cbs_h265_make_unit_writable,
 .write_unit= &cbs_h2645_write_nal_unit,
 .assemble_fragment = &cbs_h2645_assemble_fragment,
 
-- 
2.19.1

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


[FFmpeg-devel] [PATCH 3/5] cbs_h2645: Implement copy-functions for parameter sets

2018-11-23 Thread Andreas Rheinhardt
and use them to replace the context's parameter sets.

This fixes a dangling pointers problem with the parameter sets
held in the CodedBitstreamH26xContext that occurs when the parameter
sets were not reference-counted initially.

The functions to free the parameter sets that have a special free
callback are now also created via the same macro as the copy functions.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_h2645.c | 47 --
 1 file changed, 18 insertions(+), 29 deletions(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 7296c4cf29..b40cf92a7b 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -413,14 +413,25 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext 
*gbc)
 #undef byte_alignment
 #undef allocate
 
-
-static void cbs_h264_free_pps(void *unit, uint8_t *content)
+static AVBufferRef *cbs_h264_copy_sps(const H264RawSPS *source)
 {
-H264RawPPS *pps = (H264RawPPS*)content;
-av_buffer_unref(&pps->slice_group_id_ref);
-av_freep(&content);
+AVBufferRef *ref = av_buffer_alloc(sizeof(H264RawSPS));
+if (!ref)
+return NULL;
+memcpy(ref->data, source, sizeof(H264RawSPS));
+return ref;
 }
 
+cbs_copy_free(h264, H264RawPPS, pps, slice_group_id,
+  pic_size_in_map_units_minus1, BYTES, 1)
+
+cbs_copy_free(h265, H265RawVPS, vps, extension_data.data,
+  extension_data.bit_length, BITS, 0)
+cbs_copy_free(h265, H265RawSPS, sps, extension_data.data,
+  extension_data.bit_length, BITS, 0)
+cbs_copy_free(h265, H265RawPPS, pps, extension_data.data,
+  extension_data.bit_length, BITS, 0)
+
 static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
 {
 switch (payload->payload_type) {
@@ -459,27 +470,6 @@ static void cbs_h264_free_slice(void *unit, uint8_t 
*content)
 av_freep(&content);
 }
 
-static void cbs_h265_free_vps(void *unit, uint8_t *content)
-{
-H265RawVPS *vps = (H265RawVPS*)content;
-av_buffer_unref(&vps->extension_data.data_ref);
-av_freep(&content);
-}
-
-static void cbs_h265_free_sps(void *unit, uint8_t *content)
-{
-H265RawSPS *sps = (H265RawSPS*)content;
-av_buffer_unref(&sps->extension_data.data_ref);
-av_freep(&content);
-}
-
-static void cbs_h265_free_pps(void *unit, uint8_t *content)
-{
-H265RawPPS *pps = (H265RawPPS*)content;
-av_buffer_unref(&pps->extension_data.data_ref);
-av_freep(&content);
-}
-
 static void cbs_h265_free_slice(void *unit, uint8_t *content)
 {
 H265RawSlice *slice = (H265RawSlice*)content;
@@ -721,6 +711,7 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext 
*ctx,
 return 0;
 }
 
+
 #define cbs_h2645_replace_ps(h26n, ps_name, ps_var, id_element) \
 static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \
   CodedBitstreamUnit *unit)  \
@@ -739,12 +730,10 @@ static int cbs_h26 ## h26n ## _replace_ ## 
ps_var(CodedBitstreamContext *ctx, \
 if (unit->content_ref) \
 priv->ps_var ## _ref[id] = av_buffer_ref(unit->content_ref); \
 else \
-priv->ps_var ## _ref[id] = av_buffer_alloc(sizeof(*ps_var)); \
+priv->ps_var ## _ref[id] = cbs_h26 ## h26n ## _copy_ ## 
ps_var(ps_var); \
 if (!priv->ps_var ## _ref[id]) \
 return AVERROR(ENOMEM); \
 priv->ps_var[id] = (H26 ## h26n ## Raw ## ps_name *)priv->ps_var ## 
_ref[id]->data; \
-if (!unit->content_ref) \
-memcpy(priv->ps_var[id], ps_var, sizeof(*ps_var)); \
 return 0; \
 }
 
-- 
2.19.1

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


[FFmpeg-devel] [PATCH 5/5] h264_redundant_pps: Make it reference-compatible

2018-11-23 Thread Andreas Rheinhardt
Since c6a63e11092c975b89d824f08682fe31948d3686, the parameter sets
modified as content of PPS units were references shared with the
CodedBitstreamH264Context, so modifying them alters the parsing process
of future access units which meant that frames often got discarded
because invalid values were parsed. This patch makes h264_redundant_pps
compatible with the reality of reference-counted parameter sets.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h264_redundant_pps_bsf.c | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_redundant_pps_bsf.c 
b/libavcodec/h264_redundant_pps_bsf.c
index 0b7888c97e..2270f9df7d 100644
--- a/libavcodec/h264_redundant_pps_bsf.c
+++ b/libavcodec/h264_redundant_pps_bsf.c
@@ -40,8 +40,17 @@ typedef struct H264RedundantPPSContext {
 
 
 static int h264_redundant_pps_fixup_pps(H264RedundantPPSContext *ctx,
-H264RawPPS *pps)
+CodedBitstreamUnit *unit)
 {
+H264RawPPS *pps;
+int err;
+// The changes we are about to perform affect the parsing process,
+// so we must make sure that the PPS is writable, otherwise the
+// parsing of future slices will be incorrect and even raise errors.
+if ((err = ff_cbs_make_unit_writable(ctx->input, unit)) < 0)
+return err;
+pps = unit->content;
+
 // Record the current value of pic_init_qp in order to fix up
 // following slices, then overwrite with the global value.
 ctx->current_pic_init_qp = pps->pic_init_qp_minus26 + 26;
@@ -89,7 +98,7 @@ static int h264_redundant_pps_filter(AVBSFContext *bsf, 
AVPacket *out)
 if (nal->type == H264_NAL_SPS)
 au_has_sps = 1;
 if (nal->type == H264_NAL_PPS) {
-err = h264_redundant_pps_fixup_pps(ctx, nal->content);
+err = h264_redundant_pps_fixup_pps(ctx, nal);
 if (err < 0)
 goto fail;
 if (!au_has_sps) {
@@ -151,7 +160,7 @@ static int h264_redundant_pps_init(AVBSFContext *bsf)
 
 for (i = 0; i < au->nb_units; i++) {
 if (au->units[i].type == H264_NAL_PPS) {
-err = h264_redundant_pps_fixup_pps(ctx, au->units[i].content);
+err = h264_redundant_pps_fixup_pps(ctx, &au->units[i]);
 if (err < 0)
 goto fail;
 }
-- 
2.19.1

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


[FFmpeg-devel] [PATCH 0/5] New version

2018-11-23 Thread Andreas Rheinhardt
I actually never liked these magic defines myself. So I followed
your proposal and in doing so I realized that it doesn't really
solve the need for these defines: One still has to differentiate the
case where a external buffer exists and the case where no such buffer
exists (because one needs a special free function for the first case,
unless one wants to create unnecessary free functions for the second
case). The only advantage such a solution has is that it is easily
extendable to the case where a struct contains more than one external
buffer. And this is a case that simply doesn't exist at the moment, so I
didn't really care about it and instead kept it simple.*

The SIZE define could be replaced by adding explicit macro arguments
whether the size element value is in bits or in bytes.

Given that one needs to have a special free callback for structures with
external buffers, it makes sense to automatically generate them together
with the copy functions. And this is what I did. These functions really
belong together. (I do not consider replacing the free functions with
macros to be obscure per se, but the old variable names was definitely
obscuring.)

The macro is in cbs_internal so that it can be used e.g. for
MPEG2RawUserData. Of course, it could be transferred to cbs_h2645.c.

ff_cbs_make_unit_writable is still called so, although it only makes the
unit's content writable, because it takes a unit argument. I wanted to
write generic code to (optionally) make the data writable, too, but I
refrained from it after I realized that the very definition of writable
isn't clear for slice units at all: Both the unit and the unit's content
contain a data_ref that usually point to the same buffer, so that a
unit's data could be said to be writable if it owns all references to
its data. Therefore determining the writability of the data would be
codec-dependent, so I left this can of worms closed for now (and probably
forever).



*: For the record, this is the structure I ended up using in this
approach:
struct {
size_tdata_offset;
size_tref_offset;
size_tsize_offset;
SizeType  size_type;
SizeScale size_scale;
size_tplus_size;
};
SizeType is the type of the element containing the size.


Andreas Rheinhardt (5):
  cbs: Add function to make content of a unit writable
  cbs: Add a macro to create functions for deep copying
  cbs_h2645: Implement copy-functions for parameter sets
  cbs_h2645: Implement functions to make a unit's content writable
  h264_redundant_pps: Make it reference-compatible

 libavcodec/cbs.c|  14 
 libavcodec/cbs.h|   6 ++
 libavcodec/cbs_av1.c|   1 +
 libavcodec/cbs_h2645.c  | 112 +---
 libavcodec/cbs_internal.h   |  57 ++
 libavcodec/cbs_jpeg.c   |   1 +
 libavcodec/cbs_mpeg2.c  |   1 +
 libavcodec/cbs_vp9.c|   1 +
 libavcodec/h264_redundant_pps_bsf.c |  15 +++-
 9 files changed, 176 insertions(+), 32 deletions(-)

-- 
2.19.1

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


[FFmpeg-devel] [PATCH 1/5] cbs: Add function to make content of a unit writable

2018-11-23 Thread Andreas Rheinhardt
This will enable us to change e.g. the parameter sets of H.2645 in ways
that would change the parsing process of future units. An example of
this is the h264_redundant_pps bsf.
The actual implementation of the underlying codec-dependent
make_writable functions is not contained in this commit.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs.c  | 14 ++
 libavcodec/cbs.h  |  6 ++
 libavcodec/cbs_av1.c  |  1 +
 libavcodec/cbs_h2645.c|  2 ++
 libavcodec/cbs_internal.h |  4 
 libavcodec/cbs_jpeg.c |  1 +
 libavcodec/cbs_mpeg2.c|  1 +
 libavcodec/cbs_vp9.c  |  1 +
 8 files changed, 30 insertions(+)

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index ecbf57c293..3125656027 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -665,3 +665,17 @@ int ff_cbs_delete_unit(CodedBitstreamContext *ctx,
 
 return 0;
 }
+
+int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx,
+  CodedBitstreamUnit *unit)
+{
+if (unit->content && (!unit->content_ref ||
+  !av_buffer_is_writable(unit->content_ref))) {
+if (!ctx->codec->make_writable)
+return AVERROR_PATCHWELCOME;
+
+return ctx->codec->make_writable(ctx, unit);
+}
+
+return 0;
+}
diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h
index 53ac360bb1..faef6124f1 100644
--- a/libavcodec/cbs.h
+++ b/libavcodec/cbs.h
@@ -352,5 +352,11 @@ int ff_cbs_delete_unit(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag,
int position);
 
+/**
+ * Make the content of a unit writable.
+ */
+int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx,
+  CodedBitstreamUnit *unit);
+
 
 #endif /* AVCODEC_CBS_H */
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index e02bc7027a..ce8ee3faaa 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -1305,6 +1305,7 @@ const CodedBitstreamType ff_cbs_type_av1 = {
 
 .split_fragment= &cbs_av1_split_fragment,
 .read_unit = &cbs_av1_read_unit,
+.make_writable = NULL,
 .write_unit= &cbs_av1_write_unit,
 .assemble_fragment = &cbs_av1_assemble_fragment,
 
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 666970ed03..7296c4cf29 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1545,6 +1545,7 @@ const CodedBitstreamType ff_cbs_type_h264 = {
 
 .split_fragment= &cbs_h2645_split_fragment,
 .read_unit = &cbs_h264_read_nal_unit,
+.make_writable = NULL,
 .write_unit= &cbs_h2645_write_nal_unit,
 .assemble_fragment = &cbs_h2645_assemble_fragment,
 
@@ -1558,6 +1559,7 @@ const CodedBitstreamType ff_cbs_type_h265 = {
 
 .split_fragment= &cbs_h2645_split_fragment,
 .read_unit = &cbs_h265_read_nal_unit,
+.make_writable = NULL,
 .write_unit= &cbs_h2645_write_nal_unit,
 .assemble_fragment = &cbs_h2645_assemble_fragment,
 
diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h
index 53f2e5d187..62a836af90 100644
--- a/libavcodec/cbs_internal.h
+++ b/libavcodec/cbs_internal.h
@@ -44,6 +44,10 @@ typedef struct CodedBitstreamType {
 int (*read_unit)(CodedBitstreamContext *ctx,
  CodedBitstreamUnit *unit);
 
+// Make a unit's content writable.
+int (*make_writable)(CodedBitstreamContext *ctx,
+ CodedBitstreamUnit *unit);
+
 // Write the unit->data bitstream from unit->content.
 int (*write_unit)(CodedBitstreamContext *ctx,
   CodedBitstreamUnit *unit);
diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c
index 5a72f0e2e7..f3706e7575 100644
--- a/libavcodec/cbs_jpeg.c
+++ b/libavcodec/cbs_jpeg.c
@@ -513,6 +513,7 @@ const CodedBitstreamType ff_cbs_type_jpeg = {
 
 .split_fragment= &cbs_jpeg_split_fragment,
 .read_unit = &cbs_jpeg_read_unit,
+.make_writable = NULL,
 .write_unit= &cbs_jpeg_write_unit,
 .assemble_fragment = &cbs_jpeg_assemble_fragment,
 
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
index 8b8b266563..3e6a109550 100644
--- a/libavcodec/cbs_mpeg2.c
+++ b/libavcodec/cbs_mpeg2.c
@@ -414,6 +414,7 @@ const CodedBitstreamType ff_cbs_type_mpeg2 = {
 
 .split_fragment= &cbs_mpeg2_split_fragment,
 .read_unit = &cbs_mpeg2_read_unit,
+.make_writable = NULL,
 .write_unit= &cbs_mpeg2_write_unit,
 .assemble_fragment = &cbs_mpeg2_assemble_fragment,
 
diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
index c03ce986c0..e939ec10ba 100644
--- a/libavcodec/cbs_vp9.c
+++ b/libavcodec/cbs_vp9.c
@@ -685,6 +685,7 @@ const CodedBitstreamType ff_cbs_type_vp9 = {
 
 .split_fragment= &cbs_vp9_split_fragment,
 .read_unit = &cbs_vp9_read_unit,
+.make_writable = NULL,
 .write_unit= &cbs_vp9_write_unit,
 .assemble_fragment = &

Re: [FFmpeg-devel] [PATCH 2/3] avcodec/truemotion2: fix integer overflows in tm2_low_chroma()

2018-11-23 Thread Michael Niedermayer
On Tue, Nov 20, 2018 at 12:03:31PM +0100, Tomas Härdin wrote:
> tis 2018-11-20 klockan 00:04 +0100 skrev Michael Niedermayer:
> > On Mon, Nov 19, 2018 at 09:37:28AM +0100, Tomas Härdin wrote:
> > > mån 2018-11-19 klockan 02:02 +0100 skrev Michael Niedermayer:
> > > > On Sun, Nov 18, 2018 at 11:32:21PM +0100, Tomas Härdin wrote:
> > > > > lör 2018-11-17 klockan 03:01 +0100 skrev Michael Niedermayer:
> > > > > > Fixes: 
> > > > > > 11295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-4888953459572736
> > > > > > 
> > > > > > Found-by: continuous fuzzing process 
> > > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > > > > Signed-off-by: Michael Niedermayer 
> > > > > > 
> > > > > > ---
> > > > > >  libavcodec/truemotion2.c | 6 +++---
> > > > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > > > 
> > > > > > diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
> > > > > > index 58a577f53c..c583ff4032 100644
> > > > > > --- a/libavcodec/truemotion2.c
> > > > > > +++ b/libavcodec/truemotion2.c
> > > > > > @@ -484,7 +484,7 @@ static inline void tm2_high_chroma(int *data, 
> > > > > > int stride, int *last, unsigned *C
> > > > > >  }
> > > > > >  }
> > > > > >  
> > > > > > -static inline void tm2_low_chroma(int *data, int stride, int 
> > > > > > *clast, int *CD, int *deltas, int bx)
> > > > > > +static inline void tm2_low_chroma(int *data, int stride, int 
> > > > > > *clast, unsigned *CD, int *deltas, int bx)
> > > > > >  {
> > > > > >  int t;
> > > > > >  int l;
> > > > > > @@ -494,8 +494,8 @@ static inline void tm2_low_chroma(int *data, 
> > > > > > int stride, int *clast, int *CD, in
> > > > > >  prev = clast[-3];
> > > > > >  else
> > > > > >  prev = 0;
> > > > > > -t= (CD[0] + CD[1]) >> 1;
> > > > > > -l= (prev - CD[0] - CD[1] + clast[1]) >> 1;
> > > > > > +t= (int)(CD[0] + CD[1]) >> 1;
> > > > > 
> > > > > I presume the old code would overflow for sums exceeding INT_MAX. 
> > > > 
> > > > There were overflows in the sense of undefined behavior, yes
> > > > 
> > > > 
> > > > > Why
> > > > > then is there a cast to int before the shift and not after?
> > > > 
> > > > because shifts of signed and unsigned values produce different results
> > > > 
> > > > maybe the unsigned type confused you. CD is signed in a semantic sense 
> > > > its
> > > > stored in a unsigned type because otherwise this code has undefined 
> > > > behavior.
> > > > It would be better to use a type with different name but that had lead 
> > > > to
> > > > long arguments that went nowhere in the past. So i tend to use plain
> > > > unsigned now for these kind of cases as it seems that is what most 
> > > > people
> > > > prefer.
> > > 
> > > So signed overflow is intended? Huh, weird format.
> > 
> > it occurs in the fuzzed sample used here. i do not know if it occurs in
> > normal samples, i would suspect it does not.
> 
> I see. Some kind of spec might be nice, but I suspect the spec as it is
> is named Kostya

yes, probably ...

will apply

thanks

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH 1/5] cbs: Add function to make content of a unit writable

2018-11-23 Thread Carl Eugen Hoyos
2018-11-24 2:55 GMT+01:00, Andreas Rheinhardt
:

> +.make_writable = NULL,

These are unneeded afaict.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH V4 5/6] lavf/isom: use side data to save max bit rate for esds box

2018-11-23 Thread Jun Zhao
Use AV_PKT_DATA_CPB_PROPERTIES to save max bit rate for esds box,
and update fate at the same time.

Signed-off-by: Jun Zhao 
---
 libavformat/isom.c   |   19 ---
 tests/ref/fate/adtstoasc_ticket3715  |2 +-
 tests/ref/fate/copy-psp  |4 ++--
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac |   10 ++
 tests/ref/fate/gaplessenc-pcm-to-mov-aac |   10 ++
 tests/ref/fate/gaplessinfo-itunes1   |   10 ++
 tests/ref/fate/gaplessinfo-itunes2   |   10 ++
 tests/ref/fate/mov-mp3-demux |2 +-
 8 files changed, 40 insertions(+), 27 deletions(-)

diff --git a/libavformat/isom.c b/libavformat/isom.c
index ca9d22e..1780490 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -508,18 +508,23 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, 
AVStream *st, AVIOContext
 int len, tag;
 int ret;
 int object_type_id = avio_r8(pb);
+AVCPBProperties *props = NULL;
+
 avio_r8(pb); /* stream type */
 avio_rb24(pb); /* buffer size db */
 
 v = avio_rb32(pb);
 
-// TODO: fix this with codecpar
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
-if (v < INT32_MAX)
-st->codec->rc_max_rate = v;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
+if (v < INT32_MAX) {
+props = (AVCPBProperties *)av_stream_new_side_data(
+st,
+AV_PKT_DATA_CPB_PROPERTIES,
+sizeof(*props));
+if (!props)
+return AVERROR(ENOMEM);
+memset(props, 0, sizeof(*props));
+props->max_bitrate = v; /* max bitrate */
+}
 
 st->codecpar->bit_rate = avio_rb32(pb); /* avg bitrate */
 
diff --git a/tests/ref/fate/adtstoasc_ticket3715 
b/tests/ref/fate/adtstoasc_ticket3715
index c5f03e4..6f6e8b9 100644
--- a/tests/ref/fate/adtstoasc_ticket3715
+++ b/tests/ref/fate/adtstoasc_ticket3715
@@ -7,7 +7,7 @@
 #sample_rate 0: 44100
 #channel_layout 0: 3
 #channel_layout_name 0: stereo
-0,  0,  0, 1024,  371, 0x14b11a4f
+0,  0,  0, 1024,  371, 0x14b11a4f, S=1,   24, 
0x1f170156
 0,   1024,   1024, 1024,  402, 0x2f00c487
 0,   2048,   2048, 1024,  403, 0x1959c0d4
 0,   3072,   3072, 1024,  396, 0x98a9c134
diff --git a/tests/ref/fate/copy-psp b/tests/ref/fate/copy-psp
index 44ec461..a4683ab 100644
--- a/tests/ref/fate/copy-psp
+++ b/tests/ref/fate/copy-psp
@@ -1,4 +1,4 @@
-65a177552e03123c9a62ddb942970d05 *tests/data/fate/copy-psp.psp
+3bc37a07647197c6fbd55a3585f532ab *tests/data/fate/copy-psp.psp
 2041445 tests/data/fate/copy-psp.psp
 #extradata 0:   51, 0xaf6d1012
 #extradata 1:2, 0x00b200a1
@@ -14,7 +14,7 @@
 #channel_layout 1: 3
 #channel_layout_name 1: stereo
 0,  0,  0, 3003,37084, 0x021a0d3f
-1,  0,  0, 1024,   10, 0x0e270398
+1,  0,  0, 1024,   10, 0x0e270398, S=1,   24, 
0x163600f1
 1,   1024,   1024, 1025,   10, 0x0f4703b8
 0,   3003,   3003, 3003, 6925, 0x011b3822, F=0x0
 1,   2049,   2049, 1023,  334, 0x2675a55f
diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac 
b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
index 76cbf22..1ef4e9b 100644
--- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
+++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
@@ -2,6 +2,8 @@
 index=0
 start_pts=0
 duration_ts=103326
+[SIDE_DATA]
+[/SIDE_DATA]
 [/STREAM]
 [FORMAT]
 start_time=0.00
@@ -15,7 +17,6 @@ packet|pts=2048|dts=2048|duration=1024|flags=K_
 packet|pts=3072|dts=3072|duration=1024|flags=K_
 packet|pts=4096|dts=4096|duration=1024|flags=K_
 packet|pts=5120|dts=5120|duration=1024|flags=K_
-packet|pts=95232|dts=95232|duration=1024|flags=K_
 packet|pts=96256|dts=96256|duration=1024|flags=K_
 packet|pts=97280|dts=97280|duration=1024|flags=K_
 packet|pts=98304|dts=98304|duration=1024|flags=K_
@@ -23,7 +24,8 @@ packet|pts=99328|dts=99328|duration=1024|flags=K_
 packet|pts=100352|dts=100352|duration=1024|flags=K_
 packet|pts=101376|dts=101376|duration=1024|flags=K_
 packet|pts=102400|dts=102400|duration=926|flags=K_
-stream|nb_read_packets=102
+stream|nb_read_packets=102side_data|
+
 
frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
 
frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
 
frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
@@ -32,7 +34,6 @@ 
frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_
 
frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
 
frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
 
frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
-frame|pkt_pts=95232|pkt_dts=95232|best_effort_t

[FFmpeg-devel] [PATCH V4 3/6] fftools/ffmpeg: delete the unused code.

2018-11-23 Thread Jun Zhao
There are come from 2012 ago and have never been used from this
time.

Signed-off-by: Jun Zhao 
---
 fftools/ffmpeg.c |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a12208c..085d6d2 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1485,8 +1485,6 @@ static int reap_filters(int flush)
 av_rescale_q(filtered_frame->pts, filter_tb, 
enc->time_base) -
 av_rescale_q(start_time, AV_TIME_BASE_Q, enc->time_base);
 }
-//if (ost->source_index >= 0)
-//*filtered_frame= 
*input_streams[ost->source_index]->decoded_frame; //for me_threshold
 
 switch (av_buffersink_get_type(filter)) {
 case AVMEDIA_TYPE_VIDEO:
@@ -3340,7 +3338,7 @@ static int init_output_stream_encode(OutputStream *ost)
"if you want a different framerate.\n",
ost->file_index, ost->index);
 }
-//  ost->frame_rate = ist->st->avg_frame_rate.num ? 
ist->st->avg_frame_rate : (AVRational){25, 1};
+
 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];
@@ -4879,11 +4877,6 @@ int main(int argc, char **argv)
 exit_program(1);
 }
 
-// if (nb_input_files == 0) {
-// av_log(NULL, AV_LOG_FATAL, "At least one input file must be 
specified\n");
-// exit_program(1);
-// }
-
 for (i = 0; i < nb_output_files; i++) {
 if (strcmp(output_files[i]->ctx->oformat->name, "rtp"))
 want_sdp = 0;
-- 
1.7.1

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


[FFmpeg-devel] [PATCH V4 4/6] lavc/kvazaar: fix auto thread flag in kvazaar wrapper.

2018-11-23 Thread Jun Zhao
Now the kvazaar warpper didn't setting the threads for kvazaar API,
and kavzaar will auto selecte the thread number.

Signed-off-by: Jun Zhao 
---
 libavcodec/libkvazaar.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 5bc5b4e..8f50bef 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -293,7 +293,7 @@ AVCodec ff_libkvazaar_encoder = {
 .long_name= NULL_IF_CONFIG_SMALL("libkvazaar H.265 / HEVC"),
 .type = AVMEDIA_TYPE_VIDEO,
 .id   = AV_CODEC_ID_HEVC,
-.capabilities = AV_CODEC_CAP_DELAY,
+.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
 .pix_fmts = pix_fmts,
 
 .priv_class   = &class,
-- 
1.7.1

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


[FFmpeg-devel] [PATCH V4 0/6] Misc change V4

2018-11-23 Thread Jun Zhao
V4: - use AV_PKT_DATA_CPB_PROPERTIES/AVCPBProperties side-data to save max
  bit rate for MOV/MP4 esds box. (Tks Hendrik's suggestion) and update
  the fate test case.

V3: - add rc_max_rate to AVStream and bump the version
- use AVStream.rc_max_rate for MOV/MP4 esds box.
- use AVStream.rc_max_rate for ffprobe to fix can't get max bit rate issue.

V2: - fix max_bit_rate dump change break the fate test. 
  (based on Micheal/Moritz's review) 

V1: - indet ffmpeg/buffersrc
- add auto threads flag for kvazaar
- delete the unused code from ffmpeg
- fix max_bit_rate dump warning for ffprobe

Jun Zhao (6):
  lavfi/buffersrc: Indent the code.
  fftools/ffprobe: Indent the code.
  fftools/ffmpeg: delete the unused code.
  lavc/kvazaar: fix auto thread flag in kvazaar wrapper.
  lavf/isom: use side data to save max bit rate for esds box
  fftools/ffprobe: fix max_bit_rate dump.

 fftools/ffmpeg.c |9 +-
 fftools/ffprobe.c|   39 ++
 libavcodec/libkvazaar.c  |2 +-
 libavfilter/buffersrc.c  |   30 ++--
 libavformat/isom.c   |   19 
 tests/ref/fate/adtstoasc_ticket3715  |2 +-
 tests/ref/fate/copy-psp  |4 +-
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac |   10 --
 tests/ref/fate/gaplessenc-pcm-to-mov-aac |   10 --
 tests/ref/fate/gaplessinfo-itunes1   |   10 --
 tests/ref/fate/gaplessinfo-itunes2   |   10 --
 tests/ref/fate/mov-mp3-demux |2 +-
 12 files changed, 78 insertions(+), 69 deletions(-)

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


[FFmpeg-devel] [PATCH V4 1/6] lavfi/buffersrc: Indent the code.

2018-11-23 Thread Jun Zhao
commit b0012de420f missed reindent.

Signed-off-by: Jun Zhao 
---
 libavfilter/buffersrc.c |   30 +++---
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index cd56f8c..0c12650 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -205,21 +205,21 @@ static int 
av_buffersrc_add_frame_internal(AVFilterContext *ctx,
 
 if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {
 
-switch (ctx->outputs[0]->type) {
-case AVMEDIA_TYPE_VIDEO:
-CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,
- frame->format);
-break;
-case AVMEDIA_TYPE_AUDIO:
-/* For layouts unknown on input but known on link after negotiation. */
-if (!frame->channel_layout)
-frame->channel_layout = s->channel_layout;
-CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, 
frame->channel_layout,
- frame->channels, frame->format);
-break;
-default:
-return AVERROR(EINVAL);
-}
+switch (ctx->outputs[0]->type) {
+case AVMEDIA_TYPE_VIDEO:
+CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,
+ frame->format);
+break;
+case AVMEDIA_TYPE_AUDIO:
+/* For layouts unknown on input but known on link after 
negotiation. */
+if (!frame->channel_layout)
+frame->channel_layout = s->channel_layout;
+CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, 
frame->channel_layout,
+ frame->channels, frame->format);
+break;
+default:
+return AVERROR(EINVAL);
+}
 
 }
 
-- 
1.7.1

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


[FFmpeg-devel] [PATCH V4 2/6] fftools/ffprobe: Indent the code.

2018-11-23 Thread Jun Zhao
commit 196765a7cc4 missed the reindet.

Signed-off-by: Jun Zhao 
---
 fftools/ffprobe.c |   28 ++--
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 544786e..dea489d 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2646,20 +2646,20 @@ static int show_stream(WriterContext *w, 
AVFormatContext *fmt_ctx, int stream_id
 } while (0)
 
 if (do_show_stream_disposition) {
-writer_print_section_header(w, in_program ? 
SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION);
-PRINT_DISPOSITION(DEFAULT,  "default");
-PRINT_DISPOSITION(DUB,  "dub");
-PRINT_DISPOSITION(ORIGINAL, "original");
-PRINT_DISPOSITION(COMMENT,  "comment");
-PRINT_DISPOSITION(LYRICS,   "lyrics");
-PRINT_DISPOSITION(KARAOKE,  "karaoke");
-PRINT_DISPOSITION(FORCED,   "forced");
-PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired");
-PRINT_DISPOSITION(VISUAL_IMPAIRED,  "visual_impaired");
-PRINT_DISPOSITION(CLEAN_EFFECTS,"clean_effects");
-PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic");
-PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
-writer_print_section_footer(w);
+writer_print_section_header(w, in_program ? 
SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION);
+PRINT_DISPOSITION(DEFAULT,  "default");
+PRINT_DISPOSITION(DUB,  "dub");
+PRINT_DISPOSITION(ORIGINAL, "original");
+PRINT_DISPOSITION(COMMENT,  "comment");
+PRINT_DISPOSITION(LYRICS,   "lyrics");
+PRINT_DISPOSITION(KARAOKE,  "karaoke");
+PRINT_DISPOSITION(FORCED,   "forced");
+PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired");
+PRINT_DISPOSITION(VISUAL_IMPAIRED,  "visual_impaired");
+PRINT_DISPOSITION(CLEAN_EFFECTS,"clean_effects");
+PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic");
+PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
+writer_print_section_footer(w);
 }
 
 if (do_show_stream_tags)
-- 
1.7.1

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


[FFmpeg-devel] [PATCH V4 6/6] fftools/ffprobe: fix max_bit_rate dump.

2018-11-23 Thread Jun Zhao
‘codec’ is deprecated in AVStream, so used the side data to dump
max_bit_rate in ffprobe. Clean the warning like:
"warning: ‘codec’ is deprecated [-Wdeprecated-declarations]"

Signed-off-by: Jun Zhao 
---
 fftools/ffprobe.c |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index dea489d..29144a1 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2464,6 +2464,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 const AVCodecDescriptor *cd;
 int ret = 0;
 const char *profile = NULL;
+AVCPBProperties *props = NULL;
 
 av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
 
@@ -2611,6 +2612,10 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 }
 }
 
+props = (AVCPBProperties *) av_stream_get_side_data(stream,
+
AV_PKT_DATA_CPB_PROPERTIES,
+NULL);
+
 if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt("id", "0x%x", 
stream->id);
 else  print_str_opt("id", "N/A");
 print_q("r_frame_rate",   stream->r_frame_rate,   '/');
@@ -2622,10 +2627,8 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 print_time("duration",stream->duration, &stream->time_base);
 if (par->bit_rate > 0) print_val("bit_rate", par->bit_rate, 
unit_bit_per_second_str);
 else   print_str_opt("bit_rate", "N/A");
-#if FF_API_LAVF_AVCTX
-if (stream->codec->rc_max_rate > 0) print_val ("max_bit_rate", 
stream->codec->rc_max_rate, unit_bit_per_second_str);
-elseprint_str_opt("max_bit_rate", "N/A");
-#endif
+if (props && props->max_bitrate > 0) print_val("max_bit_rate", 
props->max_bitrate, unit_bit_per_second_str);
+else print_str_opt("max_bit_rate", "N/A");
 if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) 
print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
 else 
print_str_opt("bits_per_raw_sample", "N/A");
 if (stream->nb_frames) print_fmt("nb_frames", "%"PRId64, 
stream->nb_frames);
-- 
1.7.1

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