Re: [FFmpeg-devel] [PATCH v1 2/6] avfilter/af_silencedetect: document metadata

2019-10-01 Thread Moritz Barsnick
On Mon, Sep 30, 2019 at 21:36:43 +0800, lance.lmw...@gmail.com wrote:
> -The printed times and duration are expressed in seconds.
> +The printed times and duration are expressed in seconds. The 
> @code{lavfi.silence_start}
> +or @code{lavfi.silence_start.X} metadata key is set on the first frame whose 
> timestamp
> +equals or exceeds the detection duration and it contains the timestamp of 
> the first
> +frame of the silence.
> +
> +The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X} and
> +@code{lavfi.silence_end} or @code{lavfi.silence_end.X}metadata keys are set 
> on the
> +first frame after the silence. Where @code{X} is the channel number and .X 
> is used
> +if @option{mono} is enabled.

I don't understand. Literal ".X" (which you should write as
"@code{.X}", by the way)? And if not mono, it's ".0", ".1"? And when is
".N" completely omitted?

This is a bit unclear to me, without experimenting or looking at the
code.

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

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

Re: [FFmpeg-devel] [PATCH v1] avfilter/vf_freezedetect: add force_discard option to force discard freeze/non-freeze frame

2019-10-01 Thread Moritz Barsnick
On Mon, Sep 30, 2019 at 23:22:18 +0800, lance.lmw...@gmail.com wrote:
> +if ( s->force_discard > 0 && frozen)
> +s->drop_count++;
> +else if ( s->force_discard < 0 && frozen && s->drop_count < 
> 0) {
> +s->drop_count = 0;
> +}

"if (s" (drop the space after the opening bracket).

I also don't quite understand why you use no brackets around the if()
block, but around the else block.

> +if (s->force_discard > 0) {
> +s->drop_count = 0;
> +} else if ( s->force_discard < 0)
> +s->drop_count--;

Same here regarding the brackets. Quite confusing, both blocks are
one-liners.

> -return ff_filter_frame(outlink, frame);
> +if (s->drop_count > 0 || s->drop_count < 0) {
> +av_frame_free(&frame);
> +} else
> +return ff_filter_frame(outlink, frame);

Same here.

Moritz
___
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] Location header to be ignored with status code 200 (and others)

2019-10-01 Thread Armin Hasitzka
Hi guys,

sorry for dumping this here with HTML formatting (haven't yet figured out
how to turn it off in Gmail); we ran into a weird HLS playlist today that
sends a malformed location header together with a 200 status code (which is
a misconfiguration on a client's system but cannot be changed). A quick dig
shows that location headers are to be ignored in combination with anything
else but a 201 or 3xx (
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) thus we
patched our FFmpeg version as attached. We further believe that this patch
should be applied to FFmpeg for everyone - please let us know what you
think.

Thanks
Armin

-- 

*Armin Hasitzka*

Software Engineer

t: +44 (0) 20 3745 6566

 


Check out our knowledge base for additional support



ffmpeg.http.location.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] avformat/mpeg: better fix for MLP versus PCM-DVD misdetection

2019-10-01 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/mpeg.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 3205f209e6..6f132aae05 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -490,6 +490,7 @@ static int mpegps_read_packet(AVFormatContext *s,
 AVStream *st;
 int len, startcode, i, es_type, ret;
 int lpcm_header_len = -1; //Init to suppress warning
+int pcm_dvd = 0;
 int request_probe= 0;
 enum AVCodecID codec_id = AV_CODEC_ID_NONE;
 enum AVMediaType type;
@@ -513,6 +514,12 @@ redo:
 /* MLP/TrueHD audio has a 4-byte header */
 avio_r8(s->pb);
 len--;
+} else if (startcode >= 0xa0 && startcode <= 0xaf) {
+ret = ffio_ensure_seekback(s->pb, 3);
+if (ret < 0)
+return ret;
+pcm_dvd = (avio_rb24(s->pb) & 0xFF) == 0x80;
+avio_skip(s->pb, -3);
 }
 }
 }
@@ -591,7 +598,7 @@ redo:
 codec_id = AV_CODEC_ID_DTS;
 } else if (startcode >= 0xa0 && startcode <= 0xaf) {
 type = AVMEDIA_TYPE_AUDIO;
-if (lpcm_header_len >= 6 && startcode == 0xa1) {
+if (!pcm_dvd) {
 codec_id = AV_CODEC_ID_MLP;
 } else {
 codec_id = AV_CODEC_ID_PCM_DVD;
-- 
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] Location header to be ignored with status code 200 (and others)

2019-10-01 Thread Carl Eugen Hoyos
Am Di., 1. Okt. 2019 um 10:32 Uhr schrieb Armin Hasitzka :

> sorry for dumping this here with HTML formatting (haven't yet figured out
> how to turn it off in Gmail); we ran into a weird HLS playlist today that
> sends a malformed location header together with a 200 status code (which is
> a misconfiguration on a client's system but cannot be changed). A quick dig
> shows that location headers are to be ignored in combination with anything
> else but a 201 or 3xx (
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) thus we
> patched our FFmpeg version as attached.

> We further believe that this patch should be applied to FFmpeg for
> everyone - please let us know what you think.

Please use git format-patch to produce a patch that can be committed
with git am.

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

Re: [FFmpeg-devel] [PATCH v3] avformat/movenc: split empty text sample when duration overflow

2019-10-01 Thread Carl Eugen Hoyos
Am Di., 10. Sept. 2019 um 21:12 Uhr schrieb Jun Li :
>
> Fix #7637
> One empty/end sample is created and inserted between two caption lines when 
> there is a gap.
> This patch is to split the sample into multiple ones when its duration is too 
> long (>= INT_MAX).
> ---
>  libavformat/movenc.c  | 24 ++-
>  tests/fate/subtitles.mak  |  6 +
>  tests/ref/fate/binsub-movtextenc-long-dur |  1 +
>  .../fate/binsub-movtextenc-long-dur-timebase  |  1 +
>  4 files changed, 26 insertions(+), 6 deletions(-)
>  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur
>  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index edddfeeb00..aeb7de351f 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>   *
>   * 2) For each subtitle track, check if the current packet's
>   * dts is past the duration of the last subtitle sample. If
> - * so, we now need to write an end sample for that subtitle.
> + * so, we now need to write one or multiple end samples for
> + * that subtitle.
>   *
>   * This must be done conditionally to allow for subtitles that
>   * immediately replace each other, in which case an end sample
> @@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  int ret;
>
>  if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
> -trk->track_duration < pkt->dts &&
> -(trk->entry == 0 || !trk->last_sample_is_subtitle_end)) {
> -ret = mov_write_subtitle_end_packet(s, i, 
> trk->track_duration);
> -if (ret < 0) return ret;
> -trk->last_sample_is_subtitle_end = 1;
> +trk->track_duration < pkt->dts) {
> +int max_duration = INT_MAX - 1;
> +if (trk->entry == 0 || !trk->last_sample_is_subtitle_end) {
> +ret = mov_write_subtitle_end_packet(s, i, 
> trk->track_duration);

> +if (ret < 0) return ret;

> +trk->last_sample_is_subtitle_end = 1;
> +}
> +if (trk->last_sample_is_subtitle_end &&
> +pkt->dts - trk->track_duration > max_duration) {
> +int64_t dts = trk->track_duration;
> +while(pkt->dts - dts > max_duration) {
> +dts += max_duration;
> +ret = mov_write_subtitle_end_packet(s, i, dts);

> +if (ret < 0) return ret;

Please add two CRLFs and I am threatening to push this.

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

Re: [FFmpeg-devel] [PATCH v1 1/6] avfilter/af_silencedetect: change parameters order for av_malllocz_array

2019-10-01 Thread Carl Eugen Hoyos
Am Mo., 30. Sept. 2019 um 15:37 Uhr schrieb :
>
> From: Limin Wang 
>
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/af_silencedetect.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c
> index 3a71f39..c31109f 100644
> --- a/libavfilter/af_silencedetect.c
> +++ b/libavfilter/af_silencedetect.c
> @@ -143,10 +143,10 @@ static int config_input(AVFilterLink *inlink)
>
>  s->channels = inlink->channels;
>  s->independent_channels = s->mono ? s->channels : 1;
> -s->nb_null_samples = av_mallocz_array(sizeof(*s->nb_null_samples), 
> s->independent_channels);
> +s->nb_null_samples = av_mallocz_array(s->independent_channels, 
> sizeof(*s->nb_null_samples));
>  if (!s->nb_null_samples)
>  return AVERROR(ENOMEM);
> -s->start = av_malloc_array(sizeof(*s->start), s->independent_channels);
> +s->start = av_malloc_array(s->independent_channels, sizeof(*s->start));

Sorry if this is obvious:
Why?

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

Re: [FFmpeg-devel] Location header to be ignored with status code 200 (and others)

2019-10-01 Thread Armin Hasitzka
Cool :) Please let me know if the attached patch works for you (tried to
follow ffmpeg's code&commit style).

Armin

On Tue, 1 Oct 2019 at 12:16, Carl Eugen Hoyos  wrote:

> Am Di., 1. Okt. 2019 um 10:32 Uhr schrieb Armin Hasitzka  >:
>
> > sorry for dumping this here with HTML formatting (haven't yet figured out
> > how to turn it off in Gmail); we ran into a weird HLS playlist today that
> > sends a malformed location header together with a 200 status code (which
> is
> > a misconfiguration on a client's system but cannot be changed). A quick
> dig
> > shows that location headers are to be ignored in combination with
> anything
> > else but a 201 or 3xx (
> > https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
> thus we
> > patched our FFmpeg version as attached.
>
> > We further believe that this patch should be applied to FFmpeg for
> > everyone - please let us know what you think.
>
> Please use git format-patch to produce a patch that can be committed
> with git am.
>
> 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".



-- 

*Armin Hasitzka*

Software Engineer

t: +44 (0) 20 3745 6566

 


Check out our knowledge base for additional support



ffmpeg.http.location.2.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 1/5] avformat/electronicarts: If no packet has been read at the end do not treat it as if theres a packet

2019-10-01 Thread Peter Ross
On Tue, Oct 01, 2019 at 01:12:50AM +0200, Michael Niedermayer wrote:
> Fixes: Assertion failure
> Fixes: 
> 17770/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5700606668308480
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/electronicarts.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
> index 6dbc3e350a..c894663c29 100644
> --- a/libavformat/electronicarts.c
> +++ b/libavformat/electronicarts.c
> @@ -574,11 +574,12 @@ static int ea_read_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  EaDemuxContext *ea = s->priv_data;
>  AVIOContext *pb= s->pb;
>  int partial_packet = 0;
> +int hit_end = 0;
>  unsigned int chunk_type, chunk_size;
>  int ret = 0, packet_read = 0, key = 0;
>  int av_uninit(num_samples);
>  
> -while (!packet_read || partial_packet) {
> +while ((!packet_read && !hit_end) || partial_packet) {
>  chunk_type = avio_rl32(pb);
>  chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
>  if (chunk_size < 8)
> @@ -676,7 +677,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  }
>  if (avio_feof(pb))
>  ret = AVERROR_EOF;
> -packet_read = 1;
> +hit_end = 1;
>  break;
>  
>  case MVIh_TAG:
> @@ -737,6 +738,9 @@ get_video_packet:
>  
>  if (ret < 0 && partial_packet)
>  av_packet_unref(pkt);
> +if (ret >= 0 && hit_end && !packet_read)
> +return AVERROR(EAGAIN);
> +
>  return ret;
>  }

looks good.

-- Peter
loo(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 v2] avformat/rtpdec_rfc4175: support non-zero based line numbers

2019-10-01 Thread Kah Goh
On Tue, Sep 24, 2019 at 10:30:38PM +0800, Kah Goh wrote:
> On Wed, Sep 11, 2019 at 08:28:09PM +0200, Michael Niedermayer wrote:
> > On Wed, Aug 28, 2019 at 11:12:51PM +0800, Kah Goh wrote:
> > > There are differing standards that define different starting line
> > > numbers. For example, VSF TR-03 says the line numbers starts at 1,
> > > whereas SMPTE 2110-20 says it should start at 0.
> > > 
> > > This change fixes the following issues when the line numbering start
> > >  at 1:
> > > - The first scan line was being incorrectly interpreted as the second
> > >   scan line. This means the first line in the frame was never being
> > >   populated.
> > > - The last packet for the video frame would be treated as invalid
> > >   because it would have been copied outside of the frame. Consequently,
> > >   the packet would never be "finalized" and the next packet triggers a
> > >   missed RTP marker ("Missed previous RTP marker" would keep being
> > >   logged).
> > > 
> > > VSF TR-03: 
> > > http://www.videoservicesforum.org/download/technical_recommendations/VSF_TR-03_2015-11-12.pdf
> > > 
> > > Co-Authored-By: Jacob Siddall 
> > > Co-Authored-By: Kah Goh 
> > > Signed-off-by: Kah Goh 
> > > ---
> > >  libavformat/rtpdec_rfc4175.c | 41 +---
> > >  1 file changed, 38 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
> > > index e9c62c1389..427d4b31e2 100644
> > > --- a/libavformat/rtpdec_rfc4175.c
> > > +++ b/libavformat/rtpdec_rfc4175.c
> > > @@ -25,6 +25,7 @@
> > >  #include "rtpdec_formats.h"
> > >  #include "libavutil/avstring.h"
> > >  #include "libavutil/pixdesc.h"
> > > +#include 
> > >  
> > >  struct PayloadContext {
> > >  char *sampling;
> > > @@ -37,6 +38,12 @@ struct PayloadContext {
> > >  unsigned int pgroup; /* size of the pixel group in bytes */
> > >  unsigned int xinc;
> > >  
> > > +/* The line number of the first line in the frame (usually either 0 
> > > or 1). */
> > > +int first_line_number;
> > > +
> > > +/* This is set to true once the first line number is confirmed. */
> > > +bool first_line_number_known;
> > 
> > 
> > 
> > > +
> > >  uint32_t timestamp;
> > >  };
> > >  
> > > @@ -136,6 +143,13 @@ static int rfc4175_finalize_packet(PayloadContext 
> > > *data, AVPacket *pkt,
> > > return ret;
> > >  }
> > >  
> > > +static int rfc4175_initialize(AVFormatContext *s, int st_index, 
> > > PayloadContext *data)
> > > +{
> > > +data->first_line_number = 0;
> > > +data->first_line_number_known = false;
> > > +return 0;
> > > +}
> > > +
> > >  static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext 
> > > *data,
> > >   AVStream *st, AVPacket *pkt, uint32_t 
> > > *timestamp,
> > >   const uint8_t * buf, int len,
> > > @@ -199,6 +213,11 @@ static int rfc4175_handle_packet(AVFormatContext 
> > > *ctx, PayloadContext *data,
> > >  cont = headers[4] & 0x80;
> > >  headers += 6;
> > >  
> > > +if (line == 0) {
> > > +data->first_line_number = 0;
> > > +data->first_line_number_known = true;
> > > +}
> > > +
> > >  if (length % data->pgroup)
> > >  return AVERROR_INVALIDDATA;
> > >  
> > > @@ -206,9 +225,15 @@ static int rfc4175_handle_packet(AVFormatContext 
> > > *ctx, PayloadContext *data,
> > >  length = payload_len;
> > >  
> > >  /* prevent ill-formed packets to write after buffer's end */
> > > -copy_offset = (line * data->width + offset) * data->pgroup / 
> > > data->xinc;
> > > -if (copy_offset + length > data->frame_size)
> > > -return AVERROR_INVALIDDATA;
> > > +copy_offset = ((line - data->first_line_number) * data->width + 
> > > offset) * data->pgroup / data->xinc;
> > > +if (copy_offset + length > data->frame_size) {
> > > +if (data->first_line_number_known)
> > > +return AVERROR_INVALIDDATA;
> > > +
> > > +// This would happen if the line numbering is 1 based. We 
> > > still need to check for the RTP flag
> > > +// marker (as per after the while loop).
> > > +break;
> > > +}
> > >  
> > >  dest = data->frame + copy_offset;
> > >  memcpy(dest, payload, length);
> > > @@ -218,6 +243,15 @@ static int rfc4175_handle_packet(AVFormatContext 
> > > *ctx, PayloadContext *data,
> > >  } while (cont);
> > >  
> > >  if ((flags & RTP_FLAG_MARKER)) {
> > > +if (!data->first_line_number_known) {
> > > +data->first_line_number = line - data->height + 1;
> > > +if (data->first_line_number < 0) {
> > > +// This could happen if the frame does not fill up the 
> > > entire height.
> > > +data->first_line_number = 0;
> > > +av_log(ctx, AV_LOG_WARNING, "Video frame does 

Re: [FFmpeg-devel] [PATCH]lavc/opus: Create extradata if it is missing

2019-10-01 Thread Juan Navarro

This patch fixes the remuxing of OPUS audio into MP4 container, as per the
issue described here:
http://ffmpeg.org/pipermail/ffmpeg-user/2019-September/045274.html
but introduces a regression for WEBM recordings.

(Originally posted here, with attachments:
http://ffmpeg.org/pipermail/ffmpeg-user/2019-September/045475.html)

I'm afraid some further testing shows that the patch did actually fix
the case of missing extradata when recording OPUS with MP4, but it in
turn breaks the case of WEBM. Didn't try other formats, yet, but there
is a clear regression for the WEBM format.

Report logs attached for both before and after applying the patch. No
meaningful differences in the log, though. The only visible effect of
the regression is when trying to open up the WEBM file in VLC. ffplay is
able to play it, though.

VLC says this when trying to play the WEBM file:
[7f8978053e20] opus decoder error: cannot read Opus header
[7f8978053e20] opus decoder error: initial Opus header is corrupted

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

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

[FFmpeg-devel] [PATCH] avformat/ivfenc: Encode the number of frames

2019-10-01 Thread Raphaël Zumer
Signed-off-by: Raphaël Zumer 
---
 libavformat/ivfenc.c  | 3 ++-
 libavformat/version.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index adf72117e9..54327f5025 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -53,7 +53,8 @@ static int ivf_write_header(AVFormatContext *s)
 avio_wl16(pb, par->height);
 avio_wl32(pb, s->streams[0]->time_base.den);
 avio_wl32(pb, s->streams[0]->time_base.num);
-avio_wl64(pb, 0xULL);
+avio_wl32(pb, s->streams[0]->nb_frames);
+avio_wl32(pb, 0xUL);
 
 return 0;
 }
diff --git a/libavformat/version.h b/libavformat/version.h
index bcd0408d28..426ffb16e4 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
 #define LIBAVFORMAT_VERSION_MINOR  33
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
-- 
2.23.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] (no subject)

2019-10-01 Thread Raphaël Zumer
The IVF format includes a 4-byte field for the number of frames.
I could not find a specification to cite, but for example,
the Chromium IVF parser handles this field.

Please see:
https://chromium.googlesource.com/chromium/src/media/+/master/filters/ivf_parser.h


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

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

Re: [FFmpeg-devel] [PATCH v2 0/2] AltiVec/VSX fixes in swscale

2019-10-01 Thread Lauri Kasanen
Hi,

I'll apply these in a couple days if no objections. Works ok in my
tests.

- Lauri
___
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/electronicarts: If no packet has been read at the end do not treat it as if theres a packet

2019-10-01 Thread Michael Niedermayer
On Tue, Oct 01, 2019 at 10:23:08PM +1000, Peter Ross wrote:
> On Tue, Oct 01, 2019 at 01:12:50AM +0200, Michael Niedermayer wrote:
> > Fixes: Assertion failure
> > Fixes: 
> > 17770/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5700606668308480
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/electronicarts.c | 8 ++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
> > index 6dbc3e350a..c894663c29 100644
> > --- a/libavformat/electronicarts.c
> > +++ b/libavformat/electronicarts.c
> > @@ -574,11 +574,12 @@ static int ea_read_packet(AVFormatContext *s, 
> > AVPacket *pkt)
> >  EaDemuxContext *ea = s->priv_data;
> >  AVIOContext *pb= s->pb;
> >  int partial_packet = 0;
> > +int hit_end = 0;
> >  unsigned int chunk_type, chunk_size;
> >  int ret = 0, packet_read = 0, key = 0;
> >  int av_uninit(num_samples);
> >  
> > -while (!packet_read || partial_packet) {
> > +while ((!packet_read && !hit_end) || partial_packet) {
> >  chunk_type = avio_rl32(pb);
> >  chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
> >  if (chunk_size < 8)
> > @@ -676,7 +677,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket 
> > *pkt)
> >  }
> >  if (avio_feof(pb))
> >  ret = AVERROR_EOF;
> > -packet_read = 1;
> > +hit_end = 1;
> >  break;
> >  
> >  case MVIh_TAG:
> > @@ -737,6 +738,9 @@ get_video_packet:
> >  
> >  if (ret < 0 && partial_packet)
> >  av_packet_unref(pkt);
> > +if (ret >= 0 && hit_end && !packet_read)
> > +return AVERROR(EAGAIN);
> > +
> >  return ret;
> >  }
> 
> looks good.

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.


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/ivfenc: Encode the number of frames

2019-10-01 Thread Carl Eugen Hoyos
Am Di., 1. Okt. 2019 um 16:59 Uhr schrieb Raphaël Zumer :
>
> Signed-off-by: Raphaël Zumer 
> ---
>  libavformat/ivfenc.c  | 3 ++-
>  libavformat/version.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index adf72117e9..54327f5025 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -53,7 +53,8 @@ static int ivf_write_header(AVFormatContext *s)
>  avio_wl16(pb, par->height);
>  avio_wl32(pb, s->streams[0]->time_base.den);
>  avio_wl32(pb, s->streams[0]->time_base.num);
> -avio_wl64(pb, 0xULL);
> +avio_wl32(pb, s->streams[0]->nb_frames);
> +avio_wl32(pb, 0xUL);

How did you test this patch?

It is wrong to write a time_base and the number of frames
like this, the output make no sense.

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

Re: [FFmpeg-devel] [PATCH] avformat/ivfenc: Encode the number of frames

2019-10-01 Thread James Almer
On 10/1/2019 11:59 AM, Raphaël Zumer wrote:
> Signed-off-by: Raphaël Zumer 
> ---
>  libavformat/ivfenc.c  | 3 ++-
>  libavformat/version.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index adf72117e9..54327f5025 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -53,7 +53,8 @@ static int ivf_write_header(AVFormatContext *s)
>  avio_wl16(pb, par->height);
>  avio_wl32(pb, s->streams[0]->time_base.den);
>  avio_wl32(pb, s->streams[0]->time_base.num);
> -avio_wl64(pb, 0xULL);
> +avio_wl32(pb, s->streams[0]->nb_frames);
> +avio_wl32(pb, 0xUL);

This field is overwritten at the end of the muxing process. The
UINT64_MAX value here is simply a placeholder.

This patch is wrong.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] avformat/matroskaenc: use r_frame_rate as fallback to set a track's DefaultDuration

2019-10-01 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/matroskaenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a64ffdb690..37706e56c7 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1311,6 +1311,9 @@ static int mkv_write_track(AVFormatContext *s, 
MatroskaMuxContext *mkv,
 if(   st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0
&& av_cmp_q(av_inv_q(st->avg_frame_rate), st->time_base) > 0)
 put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 10LL * 
st->avg_frame_rate.den / st->avg_frame_rate.num);
+else if(   st->r_frame_rate.num > 0 && st->r_frame_rate.den > 0
+&& av_cmp_q(av_inv_q(st->r_frame_rate), st->time_base) > 0)
+put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 10LL * 
st->r_frame_rate.den / st->r_frame_rate.num);
 
 if (!native_id &&
 ff_codec_get_tag(ff_codec_movvideo_tags, par->codec_id) &&
-- 
2.22.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/5] avcodec/fitsdec: Use lrint()

2019-10-01 Thread Michael Niedermayer
On Mon, Sep 30, 2019 at 10:30:59PM -0300, James Almer wrote:
> On 9/30/2019 1:30 PM, Michael Niedermayer wrote:
> > Fixes: -nan is outside the range of representable values of type 'unsigned 
> > short'
> 
> From lrint documentation:
> 
> "If x is a NaN or an infinity, or the rounded value is too large to be
> stored in a long (long long in the case of the ll* functions), then a
> domain error occurs, and the return value is unspecified."
> 
> So i don't know if using lrint is a good idea here.
> 
> > Fixes: 
> > 17769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5678314672357376
> 
> Is the output of av_int2double/av_int2float or header.data_min NaN in
> that testcase? Wouldn't it be better to check that instead, and abort?

If you prefer we can do that (check every pixel for being NaN and if not
then within the range.)
I was just hesitating a bit as this is likely going to result in speed loss
And in the most strictest sense it is not preventing the error case as
floats dont gurantee that level of consistency ...

thanks

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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

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

[FFmpeg-devel] [PATCH] avformat/ivf: Change the length field to 32 bits

2019-10-01 Thread Raphaël Zumer
Signed-off-by: Raphaël Zumer 
---
 libavformat/ivfdec.c | 3 ++-
 libavformat/ivfenc.c | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 40ae464b76..2fdb6f5a04 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
 st->codecpar->height = avio_rl16(s->pb);
 time_base.den = avio_rl32(s->pb);
 time_base.num = avio_rl32(s->pb);
-st->duration  = avio_rl64(s->pb);
+st->duration  = avio_rl32(s->pb);
+avio_rl32(s->pb); // unused
 
 st->need_parsing  = AVSTREAM_PARSE_HEADERS;
 
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index adf72117e9..e135a78213 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -53,7 +53,7 @@ static int ivf_write_header(AVFormatContext *s)
 avio_wl16(pb, par->height);
 avio_wl32(pb, s->streams[0]->time_base.den);
 avio_wl32(pb, s->streams[0]->time_base.num);
-avio_wl64(pb, 0xULL);
+avio_wl64(pb, 0xULL); // length is overwritten at the end 
of muxing
 
 return 0;
 }
@@ -83,7 +83,8 @@ static int ivf_write_trailer(AVFormatContext *s)
 size_t end = avio_tell(pb);
 
 avio_seek(pb, 24, SEEK_SET);
-avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 
1));
+// overwrite the "length" field (duration)
+avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 
1));
 avio_seek(pb, end, SEEK_SET);
 }
 
-- 
2.23.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] avformat/ivf: Change the length field to 32 bits

2019-10-01 Thread James Almer
On 10/1/2019 2:05 PM, Raphaël Zumer wrote:
> Signed-off-by: Raphaël Zumer 
> ---
>  libavformat/ivfdec.c | 3 ++-
>  libavformat/ivfenc.c | 5 +++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
> index 40ae464b76..2fdb6f5a04 100644
> --- a/libavformat/ivfdec.c
> +++ b/libavformat/ivfdec.c
> @@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
>  st->codecpar->height = avio_rl16(s->pb);
>  time_base.den = avio_rl32(s->pb);
>  time_base.num = avio_rl32(s->pb);
> -st->duration  = avio_rl64(s->pb);
> +st->duration  = avio_rl32(s->pb);
> +avio_rl32(s->pb); // unused

avio_skip(s->pb, 4);

This part is good either way.

>  
>  st->need_parsing  = AVSTREAM_PARSE_HEADERS;
>  
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index adf72117e9..e135a78213 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -53,7 +53,7 @@ static int ivf_write_header(AVFormatContext *s)
>  avio_wl16(pb, par->height);
>  avio_wl32(pb, s->streams[0]->time_base.den);
>  avio_wl32(pb, s->streams[0]->time_base.num);
> -avio_wl64(pb, 0xULL);
> +avio_wl64(pb, 0xULL); // length is overwritten at the 
> end of muxing
>  
>  return 0;
>  }
> @@ -83,7 +83,8 @@ static int ivf_write_trailer(AVFormatContext *s)
>  size_t end = avio_tell(pb);
>  
>  avio_seek(pb, 24, SEEK_SET);
> -avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt 
> - 1));
> +// overwrite the "length" field (duration)
> +avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt 
> - 1));

The value in the unused field will be 0x after this change
instead of 0, since you're writing 32 bits as duration instead of 64
where the high 32 bits (corresponding to the unused field) are zeroed.
That means the ivf demuxer prior to this patch will read bogus duration
values from ivf files created after this patch.

Just leave the muxer as is.

>  avio_seek(pb, end, SEEK_SET);
>  }
>  
> 

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

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

[FFmpeg-devel] [PATCH v2 1/2] avformat/ivfdec: Change the length field to 32 bits

2019-10-01 Thread Raphaël Zumer
Signed-off-by: Raphaël Zumer 
---
 libavformat/ivfdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 40ae464b76..4a802573e7 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
 st->codecpar->height = avio_rl16(s->pb);
 time_base.den = avio_rl32(s->pb);
 time_base.num = avio_rl32(s->pb);
-st->duration  = avio_rl64(s->pb);
+st->duration  = avio_rl32(s->pb);
+avio_skip(s->pb, 4); // unused
 
 st->need_parsing  = AVSTREAM_PARSE_HEADERS;
 
-- 
2.23.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 v2 2/2] avformat/ivfenc: Comment the length field encoding process

2019-10-01 Thread Raphaël Zumer
Signed-off-by: Raphaël Zumer 
---
 libavformat/ivfenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index adf72117e9..ae461a872b 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -53,7 +53,7 @@ static int ivf_write_header(AVFormatContext *s)
 avio_wl16(pb, par->height);
 avio_wl32(pb, s->streams[0]->time_base.den);
 avio_wl32(pb, s->streams[0]->time_base.num);
-avio_wl64(pb, 0xULL);
+avio_wl64(pb, 0xULL); // length is overwritten at the end 
of muxing
 
 return 0;
 }
@@ -83,6 +83,7 @@ static int ivf_write_trailer(AVFormatContext *s)
 size_t end = avio_tell(pb);
 
 avio_seek(pb, 24, SEEK_SET);
+// overwrite the "length" field (duration)
 avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 
1));
 avio_seek(pb, end, SEEK_SET);
 }
-- 
2.23.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] avformat/ivf: Change the length field to 32 bits

2019-10-01 Thread Raphaël Zumer
Thank you for the review. I have left the encoded value as 64 bits and
split the patch into two in the v2 just sent: one for the decoder
change in field size, and one for the encoder comments.

On Tue, 2019-10-01 at 14:25 -0300, James Almer wrote:
> On 10/1/2019 2:05 PM, Raphaël Zumer wrote:
> > Signed-off-by: Raphaël Zumer 
> > ---
> >  libavformat/ivfdec.c | 3 ++-
> >  libavformat/ivfenc.c | 5 +++--
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
> > index 40ae464b76..2fdb6f5a04 100644
> > --- a/libavformat/ivfdec.c
> > +++ b/libavformat/ivfdec.c
> > @@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
> >  st->codecpar->height = avio_rl16(s->pb);
> >  time_base.den = avio_rl32(s->pb);
> >  time_base.num = avio_rl32(s->pb);
> > -st->duration  = avio_rl64(s->pb);
> > +st->duration  = avio_rl32(s->pb);
> > +avio_rl32(s->pb); // unused
> 
> avio_skip(s->pb, 4);
> 
> This part is good either way.
> 
> >  
> >  st->need_parsing  = AVSTREAM_PARSE_HEADERS;
> >  
> > diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> > index adf72117e9..e135a78213 100644
> > --- a/libavformat/ivfenc.c
> > +++ b/libavformat/ivfenc.c
> > @@ -53,7 +53,7 @@ static int ivf_write_header(AVFormatContext *s)
> >  avio_wl16(pb, par->height);
> >  avio_wl32(pb, s->streams[0]->time_base.den);
> >  avio_wl32(pb, s->streams[0]->time_base.num);
> > -avio_wl64(pb, 0xULL);
> > +avio_wl64(pb, 0xULL); // length is overwritten
> > at the end of muxing
> >  
> >  return 0;
> >  }
> > @@ -83,7 +83,8 @@ static int ivf_write_trailer(AVFormatContext *s)
> >  size_t end = avio_tell(pb);
> >  
> >  avio_seek(pb, 24, SEEK_SET);
> > -avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> > >frame_cnt - 1));
> > +// overwrite the "length" field (duration)
> > +avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> > >frame_cnt - 1));
> 
> The value in the unused field will be 0x after this change
> instead of 0, since you're writing 32 bits as duration instead of 64
> where the high 32 bits (corresponding to the unused field) are
> zeroed.
> That means the ivf demuxer prior to this patch will read bogus
> duration
> values from ivf files created after this patch.
> 
> Just leave the muxer as is.
> 
> >  avio_seek(pb, end, SEEK_SET);
> >  }
> >  
> > 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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

Re: [FFmpeg-devel] [PATCH]lavf/avio: Print https warning also for avio_find_protocol_name()

2019-10-01 Thread Carl Eugen Hoyos
Am Do., 26. Sept. 2019 um 03:48 Uhr schrieb Liu Steven :
>
>
>
> > 在 2019年9月25日,下午8:11,Carl Eugen Hoyos  写道:
> >
> > Am Mi., 25. Sept. 2019 um 11:35 Uhr schrieb Carl Eugen Hoyos
> > :
> >>
> >> Hi!
> >>
> >> Attached patch helps users fixing ticket #8197.
>
> LGTM

Patch applied.

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

[FFmpeg-devel] [PATCH] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread Calvin Walton
The ffmpeg code read and wrote a 64bit duration field (in timebase units) in 
the ivf
header, where the libvpx and chromium code instead use a 32bit frame count 
field, and
then 32bits of unused (reserved?) space.

Switch ffmpeg to match the behaviour of libvpx & chromium.

Note that libvpx writes 0 to the frame count field when initially writing the 
header
then seeks back and overwrites it with the real frame count. ffmpeg used to 
write
0x - I've changed the behaviour to match libvpx.

References:
https://github.com/webmproject/libvpx/blob/v1.8.1/ivfenc.c#L16
Which is called from:
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1191 (initial 
header)
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1209 (rewrite with 
frame count)
And the chromium parser:
https://chromium.googlesource.com/chromium/src/media/+/1681b9abff73fe0e3d0932aefdab4f039a284d1a/filters/ivf_parser.h
---
 libavformat/ivfdec.c |  3 ++-
 libavformat/ivfenc.c | 11 ---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 40ae464b76..2eaa5164ff 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
 st->codecpar->height = avio_rl16(s->pb);
 time_base.den = avio_rl32(s->pb);
 time_base.num = avio_rl32(s->pb);
-st->duration  = avio_rl64(s->pb);
+st->nb_frames = avio_rl32(s->pb);
+avio_skip(s->pb, 4); // 32 bits unused
 
 st->need_parsing  = AVSTREAM_PARSE_HEADERS;
 
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index adf72117e9..85ca6045ba 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -22,8 +22,7 @@
 #include "libavutil/intreadwrite.h"
 
 typedef struct IVFEncContext {
-unsigned frame_cnt;
-uint64_t last_pts, sum_delta_pts;
+uint32_t frame_cnt;
 } IVFEncContext;
 
 static int ivf_write_header(AVFormatContext *s)
@@ -53,7 +52,8 @@ static int ivf_write_header(AVFormatContext *s)
 avio_wl16(pb, par->height);
 avio_wl32(pb, s->streams[0]->time_base.den);
 avio_wl32(pb, s->streams[0]->time_base.num);
-avio_wl64(pb, 0xULL);
+avio_wl32(pb, 0); // frame count
+avio_wl32(pb, 0); // unused
 
 return 0;
 }
@@ -66,10 +66,7 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 avio_wl32(pb, pkt->size);
 avio_wl64(pb, pkt->pts);
 avio_write(pb, pkt->data, pkt->size);
-if (ctx->frame_cnt)
-ctx->sum_delta_pts += pkt->pts - ctx->last_pts;
 ctx->frame_cnt++;
-ctx->last_pts = pkt->pts;
 
 return 0;
 }
@@ -83,7 +80,7 @@ static int ivf_write_trailer(AVFormatContext *s)
 size_t end = avio_tell(pb);
 
 avio_seek(pb, 24, SEEK_SET);
-avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 
1));
+avio_wl32(pb, ctx->frame_cnt);
 avio_seek(pb, end, SEEK_SET);
 }
 
-- 
2.21.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] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread Gyan



On 01-10-2019 11:26 PM, Calvin Walton wrote:

The ffmpeg code read and wrote a 64bit duration field (in timebase units) in 
the ivf
header, where the libvpx and chromium code instead use a 32bit frame count 
field, and
then 32bits of unused (reserved?) space.

Switch ffmpeg to match the behaviour of libvpx & chromium.

Note that libvpx writes 0 to the frame count field when initially writing the 
header
then seeks back and overwrites it with the real frame count. ffmpeg used to 
write
0x - I've changed the behaviour to match libvpx.

References:
https://github.com/webmproject/libvpx/blob/v1.8.1/ivfenc.c#L16
Which is called from:
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1191 (initial 
header)
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1209 (rewrite with 
frame count)
And the chromium parser:
https://chromium.googlesource.com/chromium/src/media/+/1681b9abff73fe0e3d0932aefdab4f039a284d1a/filters/ivf_parser.h
---
  libavformat/ivfdec.c |  3 ++-
  libavformat/ivfenc.c | 11 ---
  2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 40ae464b76..2eaa5164ff 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
  st->codecpar->height = avio_rl16(s->pb);
  time_base.den = avio_rl32(s->pb);
  time_base.num = avio_rl32(s->pb);
-st->duration  = avio_rl64(s->pb);
+st->nb_frames = avio_rl32(s->pb);
+avio_skip(s->pb, 4); // 32 bits unused
  
  st->need_parsing  = AVSTREAM_PARSE_HEADERS;
  
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c

index adf72117e9..85ca6045ba 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -22,8 +22,7 @@
  #include "libavutil/intreadwrite.h"
  
  typedef struct IVFEncContext {

-unsigned frame_cnt;
-uint64_t last_pts, sum_delta_pts;
+uint32_t frame_cnt;
  } IVFEncContext;
  
  static int ivf_write_header(AVFormatContext *s)

@@ -53,7 +52,8 @@ static int ivf_write_header(AVFormatContext *s)
  avio_wl16(pb, par->height);
  avio_wl32(pb, s->streams[0]->time_base.den);
  avio_wl32(pb, s->streams[0]->time_base.num);
-avio_wl64(pb, 0xULL);
+avio_wl32(pb, 0); // frame count
+avio_wl32(pb, 0); // unused
  
  return 0;

  }
@@ -66,10 +66,7 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket 
*pkt)
  avio_wl32(pb, pkt->size);
  avio_wl64(pb, pkt->pts);
  avio_write(pb, pkt->data, pkt->size);
-if (ctx->frame_cnt)
-ctx->sum_delta_pts += pkt->pts - ctx->last_pts;
  ctx->frame_cnt++;
-ctx->last_pts = pkt->pts;
  
  return 0;

  }
@@ -83,7 +80,7 @@ static int ivf_write_trailer(AVFormatContext *s)
  size_t end = avio_tell(pb);
  
  avio_seek(pb, 24, SEEK_SET);

-avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 
1));
+avio_wl32(pb, ctx->frame_cnt);
  avio_seek(pb, end, SEEK_SET);
  }


See http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-October/250871.html

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

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

Re: [FFmpeg-devel] [PATCH] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread James Almer
On 10/1/2019 3:11 PM, Gyan wrote:
> 
> 
> On 01-10-2019 11:26 PM, Calvin Walton wrote:
>> The ffmpeg code read and wrote a 64bit duration field (in timebase
>> units) in the ivf
>> header, where the libvpx and chromium code instead use a 32bit frame
>> count field, and
>> then 32bits of unused (reserved?) space.
>>
>> Switch ffmpeg to match the behaviour of libvpx & chromium.
>>
>> Note that libvpx writes 0 to the frame count field when initially
>> writing the header
>> then seeks back and overwrites it with the real frame count. ffmpeg
>> used to write
>> 0x - I've changed the behaviour to match libvpx.
>>
>> References:
>> https://github.com/webmproject/libvpx/blob/v1.8.1/ivfenc.c#L16
>> Which is called from:
>> https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1191
>> (initial header)
>> https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1209
>> (rewrite with frame count)
>> And the chromium parser:
>> https://chromium.googlesource.com/chromium/src/media/+/1681b9abff73fe0e3d0932aefdab4f039a284d1a/filters/ivf_parser.h
>>
>> ---
>>   libavformat/ivfdec.c |  3 ++-
>>   libavformat/ivfenc.c | 11 ---
>>   2 files changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
>> index 40ae464b76..2eaa5164ff 100644
>> --- a/libavformat/ivfdec.c
>> +++ b/libavformat/ivfdec.c
>> @@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
>>   st->codecpar->height = avio_rl16(s->pb);
>>   time_base.den = avio_rl32(s->pb);
>>   time_base.num = avio_rl32(s->pb);
>> -    st->duration  = avio_rl64(s->pb);
>> +    st->nb_frames = avio_rl32(s->pb);
>> +    avio_skip(s->pb, 4); // 32 bits unused
>>     st->need_parsing  = AVSTREAM_PARSE_HEADERS;
>>   diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
>> index adf72117e9..85ca6045ba 100644
>> --- a/libavformat/ivfenc.c
>> +++ b/libavformat/ivfenc.c
>> @@ -22,8 +22,7 @@
>>   #include "libavutil/intreadwrite.h"
>>     typedef struct IVFEncContext {
>> -    unsigned frame_cnt;
>> -    uint64_t last_pts, sum_delta_pts;
>> +    uint32_t frame_cnt;
>>   } IVFEncContext;
>>     static int ivf_write_header(AVFormatContext *s)
>> @@ -53,7 +52,8 @@ static int ivf_write_header(AVFormatContext *s)
>>   avio_wl16(pb, par->height);
>>   avio_wl32(pb, s->streams[0]->time_base.den);
>>   avio_wl32(pb, s->streams[0]->time_base.num);
>> -    avio_wl64(pb, 0xULL);
>> +    avio_wl32(pb, 0); // frame count
>> +    avio_wl32(pb, 0); // unused
>>     return 0;
>>   }
>> @@ -66,10 +66,7 @@ static int ivf_write_packet(AVFormatContext *s,
>> AVPacket *pkt)
>>   avio_wl32(pb, pkt->size);
>>   avio_wl64(pb, pkt->pts);
>>   avio_write(pb, pkt->data, pkt->size);
>> -    if (ctx->frame_cnt)
>> -    ctx->sum_delta_pts += pkt->pts - ctx->last_pts;
>>   ctx->frame_cnt++;
>> -    ctx->last_pts = pkt->pts;
>>     return 0;
>>   }
>> @@ -83,7 +80,7 @@ static int ivf_write_trailer(AVFormatContext *s)
>>   size_t end = avio_tell(pb);
>>     avio_seek(pb, 24, SEEK_SET);
>> -    avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts /
>> (ctx->frame_cnt - 1));
>> +    avio_wl32(pb, ctx->frame_cnt);
>>   avio_seek(pb, end, SEEK_SET);
>>   }
> 
> See http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-October/250871.html
> 
> Gyan

That patch was already NAKed, and a fixed version sent in replacement.
___
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] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread James Almer
On 10/1/2019 2:56 PM, Calvin Walton wrote:
> The ffmpeg code read and wrote a 64bit duration field (in timebase units) in 
> the ivf
> header, where the libvpx and chromium code instead use a 32bit frame count 
> field, and
> then 32bits of unused (reserved?) space.
> 
> Switch ffmpeg to match the behaviour of libvpx & chromium.
> 
> Note that libvpx writes 0 to the frame count field when initially writing the 
> header
> then seeks back and overwrites it with the real frame count. ffmpeg used to 
> write
> 0x - I've changed the behaviour to match libvpx.
> 
> References:
> https://github.com/webmproject/libvpx/blob/v1.8.1/ivfenc.c#L16
> Which is called from:
> https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1191 (initial 
> header)
> https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1209 (rewrite 
> with frame count)
> And the chromium parser:
> https://chromium.googlesource.com/chromium/src/media/+/1681b9abff73fe0e3d0932aefdab4f039a284d1a/filters/ivf_parser.h
> ---
>  libavformat/ivfdec.c |  3 ++-
>  libavformat/ivfenc.c | 11 ---
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
> index 40ae464b76..2eaa5164ff 100644
> --- a/libavformat/ivfdec.c
> +++ b/libavformat/ivfdec.c
> @@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
>  st->codecpar->height = avio_rl16(s->pb);
>  time_base.den = avio_rl32(s->pb);
>  time_base.num = avio_rl32(s->pb);
> -st->duration  = avio_rl64(s->pb);
> +st->nb_frames = avio_rl32(s->pb);

The demuxer will report N/A as duration after this.

> +avio_skip(s->pb, 4); // 32 bits unused
>  
>  st->need_parsing  = AVSTREAM_PARSE_HEADERS;
>  
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index adf72117e9..85ca6045ba 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -22,8 +22,7 @@
>  #include "libavutil/intreadwrite.h"
>  
>  typedef struct IVFEncContext {
> -unsigned frame_cnt;
> -uint64_t last_pts, sum_delta_pts;
> +uint32_t frame_cnt;
>  } IVFEncContext;
>  
>  static int ivf_write_header(AVFormatContext *s)
> @@ -53,7 +52,8 @@ static int ivf_write_header(AVFormatContext *s)
>  avio_wl16(pb, par->height);
>  avio_wl32(pb, s->streams[0]->time_base.den);
>  avio_wl32(pb, s->streams[0]->time_base.num);
> -avio_wl64(pb, 0xULL);
> +avio_wl32(pb, 0); // frame count
> +avio_wl32(pb, 0); // unused
>  
>  return 0;
>  }
> @@ -66,10 +66,7 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  avio_wl32(pb, pkt->size);
>  avio_wl64(pb, pkt->pts);
>  avio_write(pb, pkt->data, pkt->size);
> -if (ctx->frame_cnt)
> -ctx->sum_delta_pts += pkt->pts - ctx->last_pts;
>  ctx->frame_cnt++;
> -ctx->last_pts = pkt->pts;
>  
>  return 0;
>  }
> @@ -83,7 +80,7 @@ static int ivf_write_trailer(AVFormatContext *s)
>  size_t end = avio_tell(pb);
>  
>  avio_seek(pb, 24, SEEK_SET);
> -avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt 
> - 1));
> +avio_wl32(pb, ctx->frame_cnt);
>  avio_seek(pb, end, SEEK_SET);
>  }

Similarly, old versions of the ivf demuxer will read bogus duration
values after this change.
___
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] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread Gyan



On 01-10-2019 11:53 PM, James Almer wrote:

On 10/1/2019 3:11 PM, Gyan wrote:


On 01-10-2019 11:26 PM, Calvin Walton wrote:

The ffmpeg code read and wrote a 64bit duration field (in timebase
units) in the ivf
header, where the libvpx and chromium code instead use a 32bit frame
count field, and
then 32bits of unused (reserved?) space.

Switch ffmpeg to match the behaviour of libvpx & chromium.

Note that libvpx writes 0 to the frame count field when initially
writing the header
then seeks back and overwrites it with the real frame count. ffmpeg
used to write
0x - I've changed the behaviour to match libvpx.

References:
https://github.com/webmproject/libvpx/blob/v1.8.1/ivfenc.c#L16
Which is called from:
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1191
(initial header)
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1209
(rewrite with frame count)
And the chromium parser:
https://chromium.googlesource.com/chromium/src/media/+/1681b9abff73fe0e3d0932aefdab4f039a284d1a/filters/ivf_parser.h

---
   libavformat/ivfdec.c |  3 ++-
   libavformat/ivfenc.c | 11 ---
   2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 40ae464b76..2eaa5164ff 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
   st->codecpar->height = avio_rl16(s->pb);
   time_base.den = avio_rl32(s->pb);
   time_base.num = avio_rl32(s->pb);
-    st->duration  = avio_rl64(s->pb);
+    st->nb_frames = avio_rl32(s->pb);
+    avio_skip(s->pb, 4); // 32 bits unused
     st->need_parsing  = AVSTREAM_PARSE_HEADERS;
   diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index adf72117e9..85ca6045ba 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -22,8 +22,7 @@
   #include "libavutil/intreadwrite.h"
     typedef struct IVFEncContext {
-    unsigned frame_cnt;
-    uint64_t last_pts, sum_delta_pts;
+    uint32_t frame_cnt;
   } IVFEncContext;
     static int ivf_write_header(AVFormatContext *s)
@@ -53,7 +52,8 @@ static int ivf_write_header(AVFormatContext *s)
   avio_wl16(pb, par->height);
   avio_wl32(pb, s->streams[0]->time_base.den);
   avio_wl32(pb, s->streams[0]->time_base.num);
-    avio_wl64(pb, 0xULL);
+    avio_wl32(pb, 0); // frame count
+    avio_wl32(pb, 0); // unused
     return 0;
   }
@@ -66,10 +66,7 @@ static int ivf_write_packet(AVFormatContext *s,
AVPacket *pkt)
   avio_wl32(pb, pkt->size);
   avio_wl64(pb, pkt->pts);
   avio_write(pb, pkt->data, pkt->size);
-    if (ctx->frame_cnt)
-    ctx->sum_delta_pts += pkt->pts - ctx->last_pts;
   ctx->frame_cnt++;
-    ctx->last_pts = pkt->pts;
     return 0;
   }
@@ -83,7 +80,7 @@ static int ivf_write_trailer(AVFormatContext *s)
   size_t end = avio_tell(pb);
     avio_seek(pb, 24, SEEK_SET);
-    avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts /
(ctx->frame_cnt - 1));
+    avio_wl32(pb, ctx->frame_cnt);
   avio_seek(pb, end, SEEK_SET);
   }

See http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-October/250871.html

Gyan

That patch was already NAKed, and a fixed version sent in replacement.


I intended to link to the start of the thread, not the patch.

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

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

Re: [FFmpeg-devel] [PATCH] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread Raphaël Zumer
This is a superset of my patch(es). It should match the behavior of
libvpx more closely, but the validity of the change from duration to
number of frames depends on your interpretation of the reference
implementation, which comments the field as "length".

On Tue, 2019-10-01 at 23:41 +0530, Gyan wrote:
> 
> On 01-10-2019 11:26 PM, Calvin Walton wrote:
> > The ffmpeg code read and wrote a 64bit duration field (in timebase
> > units) in the ivf
> > header, where the libvpx and chromium code instead use a 32bit
> > frame count field, and
> > then 32bits of unused (reserved?) space.
> > 
> > Switch ffmpeg to match the behaviour of libvpx & chromium.
> > 
> > Note that libvpx writes 0 to the frame count field when initially
> > writing the header
> > then seeks back and overwrites it with the real frame count. ffmpeg
> > used to write
> > 0x - I've changed the behaviour to match libvpx.
> > 
> > References:
> > https://github.com/webmproject/libvpx/blob/v1.8.1/ivfenc.c#L16
> > Which is called from:
> > https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1191
> > (initial header)
> > https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1209
> > (rewrite with frame count)
> > And the chromium parser:
> > https://chromium.googlesource.com/chromium/src/media/+/1681b9abff73fe0e3d0932aefdab4f039a284d1a/filters/ivf_parser.h
> > ---
> >   libavformat/ivfdec.c |  3 ++-
> >   libavformat/ivfenc.c | 11 ---
> >   2 files changed, 6 insertions(+), 8 deletions(-)
> > 
> > diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
> > index 40ae464b76..2eaa5164ff 100644
> > --- a/libavformat/ivfdec.c
> > +++ b/libavformat/ivfdec.c
> > @@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
> >   st->codecpar->height = avio_rl16(s->pb);
> >   time_base.den = avio_rl32(s->pb);
> >   time_base.num = avio_rl32(s->pb);
> > -st->duration  = avio_rl64(s->pb);
> > +st->nb_frames = avio_rl32(s->pb);
> > +avio_skip(s->pb, 4); // 32 bits unused
> >   
> >   st->need_parsing  = AVSTREAM_PARSE_HEADERS;
> >   
> > diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> > index adf72117e9..85ca6045ba 100644
> > --- a/libavformat/ivfenc.c
> > +++ b/libavformat/ivfenc.c
> > @@ -22,8 +22,7 @@
> >   #include "libavutil/intreadwrite.h"
> >   
> >   typedef struct IVFEncContext {
> > -unsigned frame_cnt;
> > -uint64_t last_pts, sum_delta_pts;
> > +uint32_t frame_cnt;
> >   } IVFEncContext;
> >   
> >   static int ivf_write_header(AVFormatContext *s)
> > @@ -53,7 +52,8 @@ static int ivf_write_header(AVFormatContext *s)
> >   avio_wl16(pb, par->height);
> >   avio_wl32(pb, s->streams[0]->time_base.den);
> >   avio_wl32(pb, s->streams[0]->time_base.num);
> > -avio_wl64(pb, 0xULL);
> > +avio_wl32(pb, 0); // frame count
> > +avio_wl32(pb, 0); // unused
> >   
> >   return 0;
> >   }
> > @@ -66,10 +66,7 @@ static int ivf_write_packet(AVFormatContext *s,
> > AVPacket *pkt)
> >   avio_wl32(pb, pkt->size);
> >   avio_wl64(pb, pkt->pts);
> >   avio_write(pb, pkt->data, pkt->size);
> > -if (ctx->frame_cnt)
> > -ctx->sum_delta_pts += pkt->pts - ctx->last_pts;
> >   ctx->frame_cnt++;
> > -ctx->last_pts = pkt->pts;
> >   
> >   return 0;
> >   }
> > @@ -83,7 +80,7 @@ static int ivf_write_trailer(AVFormatContext *s)
> >   size_t end = avio_tell(pb);
> >   
> >   avio_seek(pb, 24, SEEK_SET);
> > -avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> > >frame_cnt - 1));
> > +avio_wl32(pb, ctx->frame_cnt);
> >   avio_seek(pb, end, SEEK_SET);
> >   }
> 
> See 
> http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-October/250871.html
> 
> Gyan
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

___
ffmpeg-devel 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] Fix gas-preprocessor to translate .rdata sections for armasm and armasm64

2019-10-01 Thread Lukas Fellechner
Compiling FFmpeg with gas-preprocessor.pl and armasm or armasm64 fails since 
FFmpeg 4.2.

New .rdata sections have been added in ARM NEON assembly code (e.g. 
libavutil/aarch64/asm.S).
This fix allows gas-preprocessor to translate those sections to armasm 
compatible code.

Gas-preprocessor is maintained in https://github.com/FFmpeg/gas-preprocessor

---
 gas-preprocessor.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 743ce45..5d1d50d 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -1132,6 +1132,7 @@ sub handle_serialized_line {
 # The alignment in AREA is the power of two, just as .align in gas
 $line =~ s/\.text/AREA |.text|, CODE, READONLY, ALIGN=4, CODEALIGN/;
 $line =~ s/(\s*)(.*)\.rodata/$1AREA |.rodata|, DATA, READONLY, 
ALIGN=5/;
+$line =~ s/(\s*)(.*)\.rdata/$1AREA |.rdata|, DATA, READONLY, ALIGN=5/;
 $line =~ s/\.data/AREA |.data|, DATA, ALIGN=5/;
 }
 if ($as_type eq "armasm" and $arch eq "arm") {
-- 


___
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] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread Calvin Walton
On Tue, 2019-10-01 at 15:26 -0300, James Almer wrote:
> On 10/1/2019 2:56 PM, Calvin Walton wrote:
> >  libavformat/ivfdec.c |  3 ++-
> >  libavformat/ivfenc.c | 11 ---
> >  2 files changed, 6 insertions(+), 8 deletions(-)
> > 
> > diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
> > index 40ae464b76..2eaa5164ff 100644
> > --- a/libavformat/ivfdec.c
> > +++ b/libavformat/ivfdec.c
> > @@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s)
> >  st->codecpar->height = avio_rl16(s->pb);
> >  time_base.den = avio_rl32(s->pb);
> >  time_base.num = avio_rl32(s->pb);
> > -st->duration  = avio_rl64(s->pb);
> > +st->nb_frames = avio_rl32(s->pb);
> 
> The demuxer will report N/A as duration after this.

This is intentional, as the container format doesn't have a duration
field, only a frame count. I suppose it might be possible to estimate a
duration by probing the file to guess the average framerate, and then
dividing the frame count by the framerate - but I'm not familiar with
how that could be done in the demuxer

> >  size_t end = avio_tell(pb);
> >  
> >  avio_seek(pb, 24, SEEK_SET);
> > -avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> > >frame_cnt - 1));
> > +avio_wl32(pb, ctx->frame_cnt);
> >  avio_seek(pb, end, SEEK_SET);
> >  }
> 
> Similarly, old versions of the ivf demuxer will read bogus duration
> values after this change.

Old versions of the ivf demuxer read bogus duration values for files
generated by vpxenc in the case where the timebase is something other
than 1/framerate (i think this can happen if a timebase is manually set
or if a fractional framerate is used) or if the file is vfr (I'm not
sure if vpxenc can generate vfr files).


-- 
Calvin Walton 

___
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] cmdutils: trailing options may be ignored

2019-10-01 Thread Lou Logan
On Sat, Sep 28, 2019, at 5:04 PM, myp...@gmail.com wrote:
>
> LGTM

Pushed
61b7676bd5a6ae79e4a607a600d3741c84ec6d8a
___
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] cmdutils: trailing options may be ignored

2019-10-01 Thread Carl Eugen Hoyos
Am Sa., 28. Sept. 2019 um 00:52 Uhr schrieb Lou Logan :
>
> Signed-off-by: Lou Logan 
> ---
>  fftools/cmdutils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
> index 6f4031fbb9..84f98b7c04 100644
> --- a/fftools/cmdutils.c
> +++ b/fftools/cmdutils.c
> @@ -848,8 +848,8 @@ do {  
>  \
>  }
>
>  if (octx->cur_group.nb_opts || codec_opts || format_opts || 
> resample_opts)
> -av_log(NULL, AV_LOG_WARNING, "Trailing options were found on the "
> -   "commandline.\n");
> +av_log(NULL, AV_LOG_WARNING, "Trailing option(s) found in the "

> +   "command: may be ignored.\n");

In which case are they not ignored?

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

Re: [FFmpeg-devel] [PATCH] avformat/ivf: Change the length field to 32 bits

2019-10-01 Thread Derek Buitenhuis
On 01/10/2019 18:25, James Almer wrote:
> The value in the unused field will be 0x after this change
> instead of 0, since you're writing 32 bits as duration instead of 64
> where the high 32 bits (corresponding to the unused field) are zeroed.
> That means the ivf demuxer prior to this patch will read bogus duration
> values from ivf files created after this patch.
> 
> Just leave the muxer as is.

Why not just write zero?

It's, to me, worse to leave a bogus 64-bit write to appease bugs in our
own demuxer. It's confusing and misleading for any readers of the code.

- Derek
___
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] ivfdec/ivfenc: Match behaviour of libvpx and chromium

2019-10-01 Thread Calvin Walton
On Tue, 2019-10-01 at 13:56 -0400, Calvin Walton wrote:
> The ffmpeg code read and wrote a 64bit duration field (in timebase
> units) in the ivf
> header, where the libvpx and chromium code instead use a 32bit frame
> count field, and
> then 32bits of unused (reserved?) space.
> 
> Switch ffmpeg to match the behaviour of libvpx & chromium.

Just to note (now that I've got fate working on my dev machine again),
if this patch is applied, a bunch of the test references will need
updates due to the ivf file output changing. I'll include those updates
if I do a second patch revision.

-- 
Calvin Walton 

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

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

Re: [FFmpeg-devel] [PATCH v1] avfilter/vf_freezedetect: add force_discard option to force discard freeze/non-freeze frame

2019-10-01 Thread Marton Balint



On Mon, 30 Sep 2019, lance.lmw...@gmail.com wrote:


From: Limin Wang 

How to tested it, please try with the following command:
./ffmpeg  -f lavfi -i 
"smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:f=0"  -f null -
frame=  150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed= 232x

./ffmpeg  -f lavfi -i 
"smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:f=-1"  -f null -
frame=  120 fps=0.0 q=-0.0 Lsize=N/A time=00:00:04.00 bitrate=N/A speed= 211x

./ffmpeg  -f lavfi -i 
"smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:f=1"  -f null -
frame=   30 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=93.9x

Signed-off-by: Limin Wang 
---
doc/filters.texi  | 10 ++
libavfilter/vf_freezedetect.c | 23 ++-
2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6ed1c8fa75..2be8b93c53 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10678,6 +10678,8 @@ timestamp of the first frame of the freeze. The
@code{lavfi.freezedetect.freeze_duration} and
@code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
after the freeze.
+In addition, you can choose to discard the freeze/non-freezee frames instead of
+report by metadata.

The filter accepts the following options:

@@ -10689,6 +10691,14 @@ specified value) or as a difference ratio between 0 
and 1. Default is -60dB, or

@item duration, d
Set freeze duration until notification (default is 2 seconds).
+
+@item force_discard, f
+Set force to discard or keep freeze frame.
+ 0:  do nothing
+-1:  discard non-freeze frame
+ 1:  discard freeze frame


I don't see how discarding non-frozen frames is useful in any way, so that 
option should be removed unless you have something sensible in mind.


I would also like to point out that freezedetect does not buffer any 
frames, so the first few frames (the detection interval) of a freeze won't 
be dropped, which is not what the user might expect when it wants to drop 
frozen frames. At least you should document this.



+
+Default is 0
@end table

@anchor{frei0r}
diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c
index cc086afee6..fc08c235f7 100644
--- a/libavfilter/vf_freezedetect.c
+++ b/libavfilter/vf_freezedetect.c
@@ -45,6 +45,9 @@ typedef struct FreezeDetectContext {

double noise;
int64_t duration;///< minimum duration of frozen frame until 
notification
+
+int force_discard;   ///< 0: no discard, -1: discard non-freeze 
frame, 1: discard freeze frame
+int drop_count;


Why don't you simply use s->frozen to see if the current frame needs to be 
dropped or not? That would be much easier to follow.



} FreezeDetectContext;

#define OFFSET(x) offsetof(FreezeDetectContext, x)
@@ -56,6 +59,8 @@ static const AVOption freezedetect_options[] = {
{ "noise",   "set noise tolerance",   
OFFSET(noise),  AV_OPT_TYPE_DOUBLE,   {.dbl=0.001}, 0,   1.0, V|F },
{ "d",   "set minimum duration in seconds",
OFFSET(duration),  AV_OPT_TYPE_DURATION, {.i64=200},   0, INT64_MAX, V|F },
{ "duration","set minimum duration in seconds",
OFFSET(duration),  AV_OPT_TYPE_DURATION, {.i64=200},   0, INT64_MAX, V|F },
+{ "f",   "set frame discard",  
OFFSET(force_discard), AV_OPT_TYPE_INT,  {.i64=0}, -1,1, V|F },
+{ "force_discard",   "set frame discard",  
OFFSET(force_discard), AV_OPT_TYPE_INT,  {.i64=0}, -1,1, V|F },


A name like "discard" should be enough, no need for short version, it is 
only used for consistency with silencedetect.




{NULL}
};
@@ -115,6 +120,7 @@ static int config_input(AVFilterLink *inlink)
if (!s->sad)
return AVERROR(EINVAL);

+s->drop_count = 0;
return 0;
}

@@ -184,10 +190,22 @@ static int activate(AVFilterContext *ctx)
set_meta(s, frame, "lavfi.freezedetect.freeze_end", 
av_ts2timestr(frame->pts, &inlink->time_base));
}
s->frozen = frozen;
+if ( s->force_discard > 0 && frozen)
+s->drop_count++;
+else if ( s->force_discard < 0 && frozen && s->drop_count < 0) 
{
+s->drop_count = 0;
+}
+} else {
+if ( s->force_discard < 0)
+s->drop_count--;
}
}

if (!frozen) {
+if (s->force_discard > 0) {
+s->drop_count = 0;
+} else if ( s->force_discard < 0)
+s->drop_count--;
av_frame_free(&s->reference_frame);
s->reference_frame = av_frame_clone(frame);
s->reference_n = s->n;
@@ -196,7 +214,10 @@ static int activate(AVFilterContext *ctx)
return AVERROR(ENOMEM);

Re: [FFmpeg-devel] [PATCH] avformat/ivf: Change the length field to 32 bits

2019-10-01 Thread Raphaël Zumer
On Tue, 2019-10-01 at 20:09 +0100, Derek Buitenhuis wrote:
> On 01/10/2019 18:25, James Almer wrote:
> > The value in the unused field will be 0x after this change
> > instead of 0, since you're writing 32 bits as duration instead of
> > 64
> > where the high 32 bits (corresponding to the unused field) are
> > zeroed.
> > That means the ivf demuxer prior to this patch will read bogus
> > duration
> > values from ivf files created after this patch.
> > 
> > Just leave the muxer as is.
> 
> Why not just write zero?
> 
> It's, to me, worse to leave a bogus 64-bit write to appease bugs in
> our
> own demuxer. It's confusing and misleading for any readers of the
> code.

In that case I would prefer changing the initial written value to 0
rather than 0xULL. Writing over the unused bytes twice
to get around an old error is a bit odd as well.

___
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/ivf: Change the length field to 32 bits

2019-10-01 Thread Carl Eugen Hoyos
Am Di., 1. Okt. 2019 um 21:35 Uhr schrieb Raphaël Zumer :
>
> On Tue, 2019-10-01 at 20:09 +0100, Derek Buitenhuis wrote:
> > On 01/10/2019 18:25, James Almer wrote:
> > > The value in the unused field will be 0x after this change
> > > instead of 0, since you're writing 32 bits as duration instead of
> > > 64
> > > where the high 32 bits (corresponding to the unused field) are
> > > zeroed.
> > > That means the ivf demuxer prior to this patch will read bogus
> > > duration
> > > values from ivf files created after this patch.
> > >
> > > Just leave the muxer as is.
> >
> > Why not just write zero?
> >
> > It's, to me, worse to leave a bogus 64-bit write to appease bugs in
> > our
> > own demuxer. It's confusing and misleading for any readers of the
> > code.
>
> In that case I would prefer changing the initial written value to 0
> rather than 0xULL. Writing over the unused bytes twice
> to get around an old error is a bit odd as well.

That may needlessly break non-seekable output.

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

Re: [FFmpeg-devel] [PATCH]lavfi/movie: Use filter threads as decoding threads

2019-10-01 Thread Carl Eugen Hoyos
Am So., 25. Aug. 2019 um 18:43 Uhr schrieb Carl Eugen Hoyos
:
>
> Am So., 25. Aug. 2019 um 18:38 Uhr schrieb James Almer :
> >
> > On 8/25/2019 1:27 PM, Carl Eugen Hoyos wrote:
> > > Hi!
> > >
> > > Attached patch should fix ticket #7542.
> > >
> > > Please comment, Carl Eugen
> > >
> > >
> > > 0001-lavfi-movie-Use-filter-thread-count-for-decoding-thr.patch
> > >
> > > From 21f3c281dbd9d97ac47ed611958a85881c4b7fba Mon Sep 17 00:00:00 2001
> > > From: Carl Eugen Hoyos 
> > > Date: Sun, 25 Aug 2019 18:12:30 +0200
> > > Subject: [PATCH] lavfi/movie: Use filter thread count for decoding 
> > > threads.
> > >
> > > Fixes ticket #7542.
> > > ---
> > >  libavfilter/src_movie.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > > index bcabfcc4c2..78c73e78a4 100644
> > > --- a/libavfilter/src_movie.c
> > > +++ b/libavfilter/src_movie.c
> > > @@ -153,7 +153,7 @@ static AVStream *find_stream(void *log, 
> > > AVFormatContext *avf, const char *spec)
> > >  return found;
> > >  }
> > >
> > > -static int open_stream(void *log, MovieStream *st)
> > > +static int open_stream(AVFilterContext *ctx, MovieStream *st)
> >
> > log is now undeclared. Or rather, it still is for some reason (i guess
> > the function parameter overloaded some global declaration), just not
> > pointing to what you wanted it to.
>
> New patch attached.

Patch applied.

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

Re: [FFmpeg-devel] [PATCH] avformat/ivf: Change the length field to 32 bits

2019-10-01 Thread Calvin Walton
On Tue, 2019-10-01 at 21:41 +0200, Carl Eugen Hoyos wrote:
> Am Di., 1. Okt. 2019 um 21:35 Uhr schrieb Raphaël Zumer <
> rzu...@tebako.net>:
> > On Tue, 2019-10-01 at 20:09 +0100, Derek Buitenhuis wrote:
> > > On 01/10/2019 18:25, James Almer wrote:
> > > > The value in the unused field will be 0x after this
> > > > change
> > > > instead of 0, since you're writing 32 bits as duration instead
> > > > of
> > > > 64
> > > > where the high 32 bits (corresponding to the unused field) are
> > > > zeroed.
> > > > That means the ivf demuxer prior to this patch will read bogus
> > > > duration
> > > > values from ivf files created after this patch.
> > > > 
> > > > Just leave the muxer as is.
> > > 
> > > Why not just write zero?
> > > 
> > > It's, to me, worse to leave a bogus 64-bit write to appease bugs
> > > in
> > > our
> > > own demuxer. It's confusing and misleading for any readers of the
> > > code.
> > 
> > In that case I would prefer changing the initial written value to 0
> > rather than 0xULL. Writing over the unused bytes
> > twice
> > to get around an old error is a bit odd as well.
> 
> That may needlessly break non-seekable output.

Writing a 0 as the initial value is consistent with the behaviour of
libvpx.

libvpx writes 0 initially:
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1191
then updates afterwards with the length (if output is seekable):
https://github.com/webmproject/libvpx/blob/v1.8.1/vpxenc.c#L1209

(for reference, the ivf_write_file_header function is here: 
https://github.com/webmproject/libvpx/blob/v1.8.1/ivfenc.c#L16 )

So we need to make sure that ffmpeg can handle 0 values in this field
regardless.

-- 
Calvin Walton 

___
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] Various build errors with armasm64 and armasm after update to FFmpeg 4.2

2019-10-01 Thread Lukas Fellechner
Hi there,

TL;DR: 

Lots of compile errors when building FFmpeg 4.2 ARM/NEON Code through 
gas-preprocessor and armasm(64). Build target is Windows (UWP) ARM and ARM64. 
X86 and X64 targets are building fine.

Long Version:

I am building FFmpeg with an MSYS2 environment where ARM/NEON assembly code is 
compiled through gas-preprocessor and armasm/armasm64, similar to how it is 
described in this compilation guide: 
https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT.

This has worked very well for quite a long time. But after upgrading to FFmpeg 
4.2, the build fails. A lot of changes and additions have been done for 
ARM/NEON 64-bit, and it looks like many of them are not compatible with 
armasm64. First I had to fix gas-preprocessor, a patch has been submitted 
today. But now, many other errors occur, which have to do with the ARM64 
assembly code itself. I don’t have any knowledge of ARM/NEON assembly code, so 
I cannot help much with the investigation or fixes.

It would be great if ARM/NEON experts here (possibly those who submitted the 
changes) could check the new assembly codes and fix them, so that also armasm64 
will eat it.

On ARM platform, I also see build errors. Interestingly, those files have not 
even changed. Only the referenced file libavutil/arm/asm.S has changed. Even 
when I undo the last changes there, the build still fails, so I am out of ideas 
here right now. When I switch back to FFmpeg 4.1.4, everything builds fine. 
Maybe there is a config change which causes those errors?

Below I will post build errors that I see on ARM and ARM64 builds. Other files 
could be affected as well (build cancels out after a few errors).

Thank you for your help.

Best Regards
Lukas


Errors with ARM64 target:

C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(29)
 : error A2523: operand 5: Wrong size operand
ld1 {v0.4h - v3.4h}, [x1]
CC  libavcodec/aasc.o
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(97)
 : error A2523: operand 5: Wrong size operand
ld1 {v0.8b - v3.8b}, [x1]
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(1972)
 : error A2509: operand 3: Illegal reg field
ld1 {v1.1d - v2.1d}, [x2], x3
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(1973)
 : error A2509: operand 3: Illegal reg field
ld1 {v3.1d - v4.1d}, [x2], x3
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(1974)
 : error A2509: operand 3: Illegal reg field
ld1 {v16.1d - v17.1d}, [x2], x3
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(1975)
 : error A2509: operand 3: Illegal reg field
ld1 {v18.1d - v19.1d}, [x2], x3
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(1976)
 : error A2509: operand 3: Illegal reg field
ld1 {v20.1d - v21.1d}, [x2], x3
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(1977)
 : error A2509: operand 3: Illegal reg field
ld1 {v22.1d - v23.1d}, [x2], x3
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(1978)
 : error A2509: operand 3: Illegal reg field
ld1 {v24.1d - v25.1d}, [x2]
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2032)
 : error A2509: operand 3: Illegal reg field
st1 {v1.1d - v2.1d}, [x0], x1
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2033)
 : error A2509: aasc.c
operand 3: Illegal reg field
st1 {v3.1d - v4.1d}, [x0], x1
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2183)
 : error A2506: operand 6: Not enough operands
ld1 {v1.8b - v4.8b}, [x7], #32
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2184)
 : error A2506: operand 6: Not enough operands
ld1 {v16.8b - v19.8b}, [x7], #32
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2185)
 : error A2506: operand 6: Not enough operands
ld1 {v20.8b - v23.8b}, [x7], #32
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2186)
 : error A2509: operand 3: Illegal reg field
ld1 {v24.8b - v25.8b}, [x7]
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2432)
 : error A2506: operand 6: Not enough operands
ld1 {v1.8b - v4.8b}, [x7], #32
C:\Source\FFmpegInterop-lukasf\ffmpeg\Output\Windows10\ARM64\libavcodec\aarch64\vp8dsp_neon.o.asm(2433)
 : error A2509: operand 4: Illegal reg field
ld1 {v5.8b - v7.8b}, [x7]
C:\Source\FFmpegInterop-lukasf\

Re: [FFmpeg-devel] [PATCH]lavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new

2019-10-01 Thread Carl Eugen Hoyos
Am So., 25. Aug. 2019 um 17:48 Uhr schrieb James Almer :
>
> On 8/25/2019 11:55 AM, Carl Eugen Hoyos wrote:
> > Am So., 25. Aug. 2019 um 16:15 Uhr schrieb Carl Eugen Hoyos
> > :
> >> Hi!
> >>
> >> x264 removed the usage of strtok(), using FF_CODEC_CAP_INIT_THREADSAFE
> >> is ok with new libx264.
> > New patch attached.
> >
> > Carl Eugen
> >
> >
> > 0001-lavc-x264-Use-FF_CODEC_CAP_INIT_THREADSAFE-if-x264-i.patch
> >
> > From e65319ab33f9cb2cb3d1db45bbc0fc8e69a80535 Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos 
> > Date: Sun, 25 Aug 2019 16:12:28 +0200
> > Subject: [PATCH] lavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new.
> >
> > Usage of strtok() was removed from x264, see also b02490a4
> > ---
> >  libavcodec/libx264.c | 13 +
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> > index 86e3530e79..1b9043d2cc 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -1168,7 +1168,11 @@ AVCodec ff_libx264_encoder = {
> >  .priv_class   = &x264_class,
> >  .defaults = x264_defaults,
> >  .init_static_data = X264_init_static,
> > +#if X264_BUILD >= 158
> > +.caps_internal= FF_CODEC_CAP_INIT_CLEANUP | 
> > FF_CODEC_CAP_INIT_THREADSAFE,
> > +#else
> >  .caps_internal= FF_CODEC_CAP_INIT_CLEANUP,
> > +#endif
> >  .wrapper_name = "libx264",
> >  };
> >  #endif
> > @@ -1195,7 +1199,11 @@ AVCodec ff_libx264rgb_encoder = {
> >  .priv_class = &rgbclass,
> >  .defaults   = x264_defaults,
> >  .pix_fmts   = pix_fmts_8bit_rgb,
> > +#if X264_BUILD >= 158
> > +.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP | 
> > FF_CODEC_CAP_INIT_THREADSAFE,
> > +#else
> >  .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
> > +#endif
> >  .wrapper_name   = "libx264",
> >  };
> >  #endif
> > @@ -1222,7 +1230,11 @@ AVCodec ff_libx262_encoder = {
>
> Does this also apply for libx262? Are both codebases in sync?
>
> >  .priv_class   = &X262_class,
> >  .defaults = x264_defaults,
> >  .pix_fmts = pix_fmts_8bit,
> > +#if X264_BUILD >= 158
> > +.caps_internal= FF_CODEC_CAP_INIT_CLEANUP | 
> > FF_CODEC_CAP_INIT_THREADSAFE,
> > +#else
> >  .caps_internal= FF_CODEC_CAP_INIT_CLEANUP,
> > +#endif

Pushed without the change to libx262.

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

Re: [FFmpeg-devel] [PATCH v3] avformat/movenc: split empty text sample when duration overflow

2019-10-01 Thread Jun Li
On Tue, Oct 1, 2019 at 4:19 AM Carl Eugen Hoyos  wrote:

> Am Di., 10. Sept. 2019 um 21:12 Uhr schrieb Jun Li :
> >
> > Fix #7637
> > One empty/end sample is created and inserted between two caption lines
> when there is a gap.
> > This patch is to split the sample into multiple ones when its duration
> is too long (>= INT_MAX).
> > ---
> >  libavformat/movenc.c  | 24 ++-
> >  tests/fate/subtitles.mak  |  6 +
> >  tests/ref/fate/binsub-movtextenc-long-dur |  1 +
> >  .../fate/binsub-movtextenc-long-dur-timebase  |  1 +
> >  4 files changed, 26 insertions(+), 6 deletions(-)
> >  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur
> >  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase
> >
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index edddfeeb00..aeb7de351f 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s,
> AVPacket *pkt)
> >   *
> >   * 2) For each subtitle track, check if the current packet's
> >   * dts is past the duration of the last subtitle sample. If
> > - * so, we now need to write an end sample for that subtitle.
> > + * so, we now need to write one or multiple end samples for
> > + * that subtitle.
> >   *
> >   * This must be done conditionally to allow for subtitles that
> >   * immediately replace each other, in which case an end sample
> > @@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext *s,
> AVPacket *pkt)
> >  int ret;
> >
> >  if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
> > -trk->track_duration < pkt->dts &&
> > -(trk->entry == 0 || !trk->last_sample_is_subtitle_end))
> {
> > -ret = mov_write_subtitle_end_packet(s, i,
> trk->track_duration);
> > -if (ret < 0) return ret;
> > -trk->last_sample_is_subtitle_end = 1;
> > +trk->track_duration < pkt->dts) {
> > +int max_duration = INT_MAX - 1;
> > +if (trk->entry == 0 ||
> !trk->last_sample_is_subtitle_end) {
> > +ret = mov_write_subtitle_end_packet(s, i,
> trk->track_duration);
>
> > +if (ret < 0) return ret;
>
> > +trk->last_sample_is_subtitle_end = 1;
> > +}
> > +if (trk->last_sample_is_subtitle_end &&
> > +pkt->dts - trk->track_duration > max_duration) {
> > +int64_t dts = trk->track_duration;
> > +while(pkt->dts - dts > max_duration) {
> > +dts += max_duration;
> > +ret = mov_write_subtitle_end_packet(s, i, dts);
>
> > +if (ret < 0) return ret;
>
> Please add two CRLFs and I am threatening to push this.
>
> 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".


Thanks Carl for review. Code is updated as follows.



Fix #7637
One empty/end sample is created and inserted between two caption lines when
there is a gap.
This patch is to split the sample into multiple ones when its duration is
too long (>= INT_MAX)
---
 libavformat/movenc.c  | 26 ++-
 tests/fate/subtitles.mak  |  6 +
 tests/ref/fate/binsub-movtextenc-long-dur |  1 +
 .../fate/binsub-movtextenc-long-dur-timebase  |  1 +
 4 files changed, 28 insertions(+), 6 deletions(-)
 create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur
 create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index edddfeeb00..db6f5afefc 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s,
AVPacket *pkt)
  *
  * 2) For each subtitle track, check if the current packet's
  * dts is past the duration of the last subtitle sample. If
- * so, we now need to write an end sample for that subtitle.
+ * so, we now need to write one or multiple end samples for
+ * that subtitle.
  *
  * This must be done conditionally to allow for subtitles that
  * immediately replace each other, in which case an end sample
@@ -5760,11 +5761,24 @@ static int mov_write_packet(AVFormatContext *s,
AVPacket *pkt)
 int ret;

 if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
-trk->track_duration < pkt->dts &&
-(trk->entry == 0 || !trk->last_sample_is_subtitle_end)) {
-ret = mov_write_sub

Re: [FFmpeg-devel] [PATCH] avcodec/tiff: correct the default value of YCbCrSubsampling

2019-10-01 Thread Skakov Pavel

TIFF decoder uses wrong default YCbCrSubsampling value so it breaks
on files that rely on standard default and omit the value.

This patch broke fate-exif-image-tiff and fate-lavf-tiff.


Patch updated, fixed one more error in code: rps check used subsampling even 
for non-subsampled formats.
FATE should be happy with this.
From ecda81bd912581b5fb411dc83f51d1c7a5117b3b Mon Sep 17 00:00:00 2001
From: Pavel Skakov 
Date: Wed, 2 Oct 2019 04:14:32 +0300
Subject: [PATCH] avcodec/tiff: correct the default value of YCbCrSubsampling
 to 2x2

Signed-off-by: Pavel Skakov 
---
 libavcodec/tiff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 9f24796a88..8b39ca1ebc 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1869,7 +1869,7 @@ again:
 avpkt->size - s->strippos);
 }
 
-if (s->rps <= 0 || s->rps % s->subsampling[1]) {
+if (s->rps <= 0 || s->photometric == TIFF_PHOTOMETRIC_YCBCR && s->rps % s->subsampling[1]) {
 av_log(avctx, AV_LOG_ERROR, "rps %d invalid\n", s->rps);
 return AVERROR_INVALIDDATA;
 }
@@ -2065,7 +2065,7 @@ static av_cold int tiff_init(AVCodecContext *avctx)
 s->width  = 0;
 s->height = 0;
 s->subsampling[0] =
-s->subsampling[1] = 1;
+s->subsampling[1] = 2;
 s->avctx  = avctx;
 ff_lzw_decode_open(&s->lzw);
 if (!s->lzw)
-- 
2.13.2.windows.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/3] avformat/aiffenc: Use standard packet list functions

2019-10-01 Thread Andreas Rheinhardt
Up until now, aiffenc didn't rely on the standard functions for adding
an element to a linked list and freeing the list, but instead
reimplemented them. This has been changed.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/aiffenc.c | 33 -
 1 file changed, 4 insertions(+), 29 deletions(-)

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index aab37418f0..dd8b8c3d01 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -36,7 +36,7 @@ typedef struct AIFFOutputContext {
 int64_t frames;
 int64_t ssnd;
 int audio_stream_idx;
-AVPacketList *pict_list;
+AVPacketList *pict_list, *pict_list_end;
 int write_id3v2;
 int id3v2_version;
 } AIFFOutputContext;
@@ -215,9 +215,6 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (pkt->stream_index == aiff->audio_stream_idx)
 avio_write(pb, pkt->data, pkt->size);
 else {
-int ret;
-AVPacketList *pict_list, *last;
-
 if (s->streams[pkt->stream_index]->codecpar->codec_type != 
AVMEDIA_TYPE_VIDEO)
 return 0;
 
@@ -229,24 +226,8 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (s->streams[pkt->stream_index]->nb_frames >= 1)
 return 0;
 
-pict_list = av_mallocz(sizeof(AVPacketList));
-if (!pict_list)
-return AVERROR(ENOMEM);
-
-ret = av_packet_ref(&pict_list->pkt, pkt);
-if (ret < 0) {
-av_freep(&pict_list);
-return ret;
-}
-
-if (!aiff->pict_list)
-aiff->pict_list = pict_list;
-else {
-last = aiff->pict_list;
-while (last->next)
-last = last->next;
-last->next = pict_list;
-}
+return ff_packet_list_put(&aiff->pict_list, &aiff->pict_list_end,
+  pkt, FF_PACKETLIST_FLAG_REF_PACKET);
 }
 
 return 0;
@@ -257,7 +238,6 @@ static int aiff_write_trailer(AVFormatContext *s)
 int ret;
 AVIOContext *pb = s->pb;
 AIFFOutputContext *aiff = s->priv_data;
-AVPacketList *pict_list = aiff->pict_list;
 AVCodecParameters *par = s->streams[aiff->audio_stream_idx]->codecpar;
 
 /* Chunks sizes must be even */
@@ -293,12 +273,7 @@ static int aiff_write_trailer(AVFormatContext *s)
 avio_flush(pb);
 }
 
-while (pict_list) {
-AVPacketList *next = pict_list->next;
-av_packet_unref(&pict_list->pkt);
-av_freep(&pict_list);
-pict_list = next;
-}
+ff_packet_list_free(&aiff->pict_list, &aiff->pict_list_end);
 
 return 0;
 }
-- 
2.21.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/3] avformat/aiffenc: Fix potential memleak upon failure

2019-10-01 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavformat/aiffenc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index dd8b8c3d01..0b837cd264 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -235,7 +235,7 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 
 static int aiff_write_trailer(AVFormatContext *s)
 {
-int ret;
+int ret = 0;
 AVIOContext *pb = s->pb;
 AIFFOutputContext *aiff = s->priv_data;
 AVCodecParameters *par = s->streams[aiff->audio_stream_idx]->codecpar;
@@ -263,7 +263,7 @@ static int aiff_write_trailer(AVFormatContext *s)
 /* Write ID3 tags */
 if (aiff->write_id3v2)
 if ((ret = put_id3v2_tags(s, aiff)) < 0)
-return ret;
+goto free;
 
 /* File length */
 file_size = avio_tell(pb);
@@ -273,9 +273,10 @@ static int aiff_write_trailer(AVFormatContext *s)
 avio_flush(pb);
 }
 
+free:
 ff_packet_list_free(&aiff->pict_list, &aiff->pict_list_end);
 
-return 0;
+return ret;
 }
 
 #define OFFSET(x) offsetof(AIFFOutputContext, x)
-- 
2.21.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 3/3] avformat/aiffenc: Remove wrong and redundant check

2019-10-01 Thread Andreas Rheinhardt
The check "if (!pb->seekable & AVIO_SEEKABLE_NORMAL)" is wrong, because
! has higher precendence than &. But it is also redundant, because this
part of the code is only ever reached when the AVIO_SEEKABLE_NORMAL flag
is set for pb. So simply remove the check.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/aiffenc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 0b837cd264..d09c9afb95 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -49,9 +49,6 @@ static int put_id3v2_tags(AVFormatContext *s, 
AIFFOutputContext *aiff)
 AVIOContext *pb = s->pb;
 AVPacketList *pict_list = aiff->pict_list;
 
-if (!pb->seekable & AVIO_SEEKABLE_NORMAL)
-return 0;
-
 if (!s->metadata && !aiff->pict_list)
 return 0;
 
-- 
2.21.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 v2 05/14] avformat/network: add logging context to log

2019-10-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/network.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index 5664455d18..0f5a575f77 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -238,7 +238,7 @@ int ff_accept(int fd, int timeout, URLContext *h)
 if (ret < 0)
 return ff_neterrno();
 if (ff_socket_nonblock(ret, 1) < 0)
-av_log(NULL, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
+av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
 
 return ret;
 }
@@ -264,7 +264,7 @@ int ff_listen_connect(int fd, const struct sockaddr *addr,
 socklen_t optlen;
 
 if (ff_socket_nonblock(fd, 1) < 0)
-av_log(NULL, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
+av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
 
 while ((ret = connect(fd, addr, addrlen))) {
 ret = ff_neterrno();
-- 
2.15.1



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

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

[FFmpeg-devel] [PATCH v2 03/14] avformat/rtmpptoto: add logging context to log

2019-10-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/rtmpproto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index b741e421af..eb08d4d424 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2386,7 +2386,7 @@ static int handle_metadata(RTMPContext *rt, RTMPPacket 
*pkt)
 next += size + 3 + 4;
 }
 if (p != rt->flv_data + rt->flv_size) {
-av_log(NULL, AV_LOG_WARNING, "Incomplete flv packets in "
+av_log(rt, AV_LOG_WARNING, "Incomplete flv packets in "
  "RTMP_PT_METADATA packet\n");
 rt->flv_size = p - rt->flv_data;
 }
-- 
2.15.1



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

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

[FFmpeg-devel] [PATCH v2 04/14] avformat/avidec: add logging context to log

2019-10-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/avidec.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index e3cd844169..1ca26968fa 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -117,8 +117,8 @@ static const AVMetadataConv avi_metadata_conv[] = {
 static int avi_load_index(AVFormatContext *s);
 static int guess_ni_flag(AVFormatContext *s);
 
-#define print_tag(str, tag, size)  \
-av_log(NULL, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \
+#define print_tag(s, str, tag, size)  \
+av_log(s, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \
avio_tell(pb), str, av_fourcc2str(tag), size)  \
 
 static inline int get_duration(AVIStream *ast, int len)
@@ -504,7 +504,7 @@ static int avi_read_header(AVFormatContext *s)
 tag  = avio_rl32(pb);
 size = avio_rl32(pb);
 
-print_tag("tag", tag, size);
+print_tag(s, "tag", tag, size);
 
 switch (tag) {
 case MKTAG('L', 'I', 'S', 'T'):
@@ -512,7 +512,7 @@ static int avi_read_header(AVFormatContext *s)
 /* Ignored, except at start of video packets. */
 tag1 = avio_rl32(pb);
 
-print_tag("list", tag1, 0);
+print_tag(s, "list", tag1, 0);
 
 if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
 avi->movi_list = avio_tell(pb) - 4;
@@ -520,7 +520,7 @@ static int avi_read_header(AVFormatContext *s)
 avi->movi_end = avi->movi_list + size + (size & 1);
 else
 avi->movi_end = avi->fsize;
-av_log(NULL, AV_LOG_TRACE, "movi end=%"PRIx64"\n", 
avi->movi_end);
+av_log(s, AV_LOG_TRACE, "movi end=%"PRIx64"\n", avi->movi_end);
 goto end_of_header;
 } else if (tag1 == MKTAG('I', 'N', 'F', 'O'))
 ff_read_riff_info(s, size - 4);
@@ -584,7 +584,7 @@ static int avi_read_header(AVFormatContext *s)
 tag1 = stream_index ? MKTAG('a', 'u', 'd', 's')
 : MKTAG('v', 'i', 'd', 's');
 
-print_tag("strh", tag1, -1);
+print_tag(s, "strh", tag1, -1);
 
 if (tag1 == MKTAG('i', 'a', 'v', 's') ||
 tag1 == MKTAG('i', 'v', 'a', 's')) {
@@ -802,7 +802,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 ast->has_pal = 1;
 }
 
-print_tag("video", tag1, 0);
+print_tag(s, "video", tag1, 0);
 
 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codecpar->codec_tag  = tag1;
-- 
2.15.1



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

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

[FFmpeg-devel] [PATCH v2 07/14] avformat/mms: add logging context to log

2019-10-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/mms.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/mms.c b/libavformat/mms.c
index 768fda6525..16babc0954 100644
--- a/libavformat/mms.c
+++ b/libavformat/mms.c
@@ -60,7 +60,7 @@ int ff_mms_asf_header_parser(MMSContext *mms)
 
 if (mms->asf_header_size < sizeof(ff_asf_guid) * 2 + 22 ||
 memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Corrupt stream (invalid ASF header, size=%d)\n",
mms->asf_header_size);
 return AVERROR_INVALIDDATA;
@@ -77,7 +77,7 @@ int ff_mms_asf_header_parser(MMSContext *mms)
 chunksize = AV_RL64(p + sizeof(ff_asf_guid));
 }
 if (!chunksize || chunksize > end - p) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Corrupt stream (header chunksize %"PRId64" is invalid)\n",
chunksize);
 return AVERROR_INVALIDDATA;
@@ -87,7 +87,7 @@ int ff_mms_asf_header_parser(MMSContext *mms)
 if (end - p > sizeof(ff_asf_guid) * 2 + 68) {
 mms->asf_packet_len = AV_RL32(p + sizeof(ff_asf_guid) * 2 + 
64);
 if (mms->asf_packet_len <= 0 || mms->asf_packet_len > 
sizeof(mms->in_buffer)) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Corrupt stream (too large pkt_len %d)\n",
mms->asf_packet_len);
 return AVERROR_INVALIDDATA;
@@ -110,7 +110,7 @@ int ff_mms_asf_header_parser(MMSContext *mms)
 mms->streams[mms->stream_num].id = stream_id;
 mms->stream_num++;
 } else {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Corrupt stream (too many A/V streams)\n");
 return AVERROR_INVALIDDATA;
 }
@@ -121,7 +121,7 @@ int ff_mms_asf_header_parser(MMSContext *mms)
 uint64_t skip_bytes = 88;
 while (stream_count--) {
 if (end - p < skip_bytes + 4) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Corrupt stream (next stream name length is not 
in the buffer)\n");
 return AVERROR_INVALIDDATA;
 }
@@ -129,14 +129,14 @@ int ff_mms_asf_header_parser(MMSContext *mms)
 }
 while (ext_len_count--) {
 if (end - p < skip_bytes + 22) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Corrupt stream (next extension system info 
length is not in the buffer)\n");
 return AVERROR_INVALIDDATA;
 }
 skip_bytes += 22 + AV_RL32(p + skip_bytes + 18);
 }
 if (end - p < skip_bytes) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Corrupt stream (the last extension system info 
length is invalid)\n");
 return AVERROR_INVALIDDATA;
 }
@@ -146,7 +146,7 @@ int ff_mms_asf_header_parser(MMSContext *mms)
 } else if (!memcmp(p, ff_asf_head1_guid, sizeof(ff_asf_guid))) {
 chunksize = 46; // see references [2] section 3.4. This should be 
set 46.
 if (chunksize > end - p) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
 "Corrupt stream (header chunksize %"PRId64" is invalid)\n",
 chunksize);
 return AVERROR_INVALIDDATA;
-- 
2.15.1



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

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

[FFmpeg-devel] [PATCH v2 09/14] avcodec/videotoolbox: add logging context to log

2019-10-01 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavcodec/videotoolbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index e9b3370169..8773de3393 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -617,7 +617,7 @@ static void videotoolbox_decoder_callback(void *opaque,
 }
 
 if (!image_buffer) {
-av_log(NULL, AV_LOG_DEBUG, "vt decoder cb: output image buffer is 
null\n");
+av_log(avctx, AV_LOG_DEBUG, "vt decoder cb: output image buffer is 
null\n");
 return;
 }
 
-- 
2.15.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".