Re: [FFmpeg-devel] [PATCH] avcodec/filter: Remove extra '; ' outside of functions

2019-10-07 Thread Paul B Mahol
ok

On 10/7/19, Andreas Rheinhardt  wrote:
> They are not allowed outside of functions. Fixes the warning
> "ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]"
> when compiling with GCC and -pedantic.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/v4l2_m2m_dec.c|  2 +-
>  libavfilter/vf_blend.c   | 10 +-
>  libavfilter/vf_vmafmotion.c  |  4 ++--
>  libavfilter/x86/scene_sad_init.c |  4 ++--
>  4 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
> index 0c3fa3a7be..4712aca34c 100644
> --- a/libavcodec/v4l2_m2m_dec.c
> +++ b/libavcodec/v4l2_m2m_dec.c
> @@ -256,7 +256,7 @@ static const AVOption options[] = {
>  .capabilities   = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY |
> AV_CODEC_CAP_AVOID_PROBING, \
>  .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS, \
>  .wrapper_name   = "v4l2m2m", \
> -};
> +}
>
>  M2MDEC(h264,  "H.264", AV_CODEC_ID_H264,   "h264_mp4toannexb");
>  M2MDEC(hevc,  "HEVC",  AV_CODEC_ID_HEVC,   "hevc_mp4toannexb");
> diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
> index d6036c10e2..67163be3e7 100644
> --- a/libavfilter/vf_blend.c
> +++ b/libavfilter/vf_blend.c
> @@ -639,11 +639,11 @@ static av_cold void
> init_blend_func_##depth##_##nbits##bit(FilterParams *param)
>  case BLEND_XOR:param->blend = blend_xor_##depth##bit;
>  break;   \
>  }
>   \
>  }
> -DEFINE_INIT_BLEND_FUNC(8, 8);
> -DEFINE_INIT_BLEND_FUNC(9, 16);
> -DEFINE_INIT_BLEND_FUNC(10, 16);
> -DEFINE_INIT_BLEND_FUNC(12, 16);
> -DEFINE_INIT_BLEND_FUNC(16, 16);
> +DEFINE_INIT_BLEND_FUNC(8, 8)
> +DEFINE_INIT_BLEND_FUNC(9, 16)
> +DEFINE_INIT_BLEND_FUNC(10, 16)
> +DEFINE_INIT_BLEND_FUNC(12, 16)
> +DEFINE_INIT_BLEND_FUNC(16, 16)
>
>  void ff_blend_init(FilterParams *param, int depth)
>  {
> diff --git a/libavfilter/vf_vmafmotion.c b/libavfilter/vf_vmafmotion.c
> index 5c2a974538..88d0b35095 100644
> --- a/libavfilter/vf_vmafmotion.c
> +++ b/libavfilter/vf_vmafmotion.c
> @@ -176,8 +176,8 @@ static void convolution_y_##bits##bit(const uint16_t
> *filter, int filt_w, \
>  } \
>  }
>
> -conv_y_fn(uint8_t, 8);
> -conv_y_fn(uint16_t, 10);
> +conv_y_fn(uint8_t, 8)
> +conv_y_fn(uint16_t, 10)
>
>  static void vmafmotiondsp_init(VMAFMotionDSPContext *dsp, int bpp) {
>  dsp->convolution_x = convolution_x;
> diff --git a/libavfilter/x86/scene_sad_init.c
> b/libavfilter/x86/scene_sad_init.c
> index f8104dcb4f..2c3729ceee 100644
> --- a/libavfilter/x86/scene_sad_init.c
> +++ b/libavfilter/x86/scene_sad_init.c
> @@ -37,9 +37,9 @@ static void FUNC_NAME(SCENE_SAD_PARAMS) {
>\
>  }
>
>  #if HAVE_X86ASM
> -SCENE_SAD_FUNC(scene_sad_sse2, ff_scene_sad_sse2, 16);
> +SCENE_SAD_FUNC(scene_sad_sse2, ff_scene_sad_sse2, 16)
>  #if HAVE_AVX2_EXTERNAL
> -SCENE_SAD_FUNC(scene_sad_avx2, ff_scene_sad_avx2, 32);
> +SCENE_SAD_FUNC(scene_sad_avx2, ff_scene_sad_avx2, 32)
>  #endif
>  #endif
>
> --
> 2.20.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v3 1/3] avformat/mpjpegdec: fix finding multipart boundary parameter

2019-10-07 Thread Paul B Mahol
lgtm

On 10/7/19, Moritz Barsnick  wrote:
> The string matching function's return value was evaluated incorrectly.
>
> Fixes trac #7920.
>
> Signed-off-by: Moritz Barsnick 
> ---
>  libavformat/mpjpegdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
> index 84130ab718..c0ffaf616e 100644
> --- a/libavformat/mpjpegdec.c
> +++ b/libavformat/mpjpegdec.c
> @@ -267,7 +267,7 @@ static char* mpjpeg_get_boundary(AVIOContext* pb)
>  while (av_isspace(*start))
>  start++;
>
> -if (!av_stristart(start, "boundary=", &start)) {
> +if (av_stristart(start, "boundary=", &start)) {
>  end = strchr(start, ';');
>  if (end)
>  len = end - start - 1;
> --
> 2.20.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v3 2/3] avformat/mpjpegdec: fix strict boundary search string

2019-10-07 Thread Paul B Mahol
lgtm

On 10/7/19, Moritz Barsnick  wrote:
> According to RFC1341, the multipart boundary indicated by the
> Content-Type header must be prepended by CRLF + "--", and followed
> by CRLF. In the case of strict MIME header boundary handling, the
> "--" was forgotten to add.
>
> Fixes trac #7921.
>
> A side effect is that this coincidentally breaks enforcement of
> strict MIME headers against servers running motion < 3.4.1, where
> the boundary announcement in the HTTP headers incorrectly used the
> prefix "--", which exactly matched this bug's behavior.
>
> Signed-off-by: Moritz Barsnick 
> ---
>  libavformat/mpjpegdec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
> index c0ffaf616e..24bf232db2 100644
> --- a/libavformat/mpjpegdec.c
> +++ b/libavformat/mpjpegdec.c
> @@ -302,8 +302,9 @@ static int mpjpeg_read_packet(AVFormatContext *s,
> AVPacket *pkt)
>  boundary = mpjpeg_get_boundary(s->pb);
>  }
>  if (boundary != NULL) {
> -mpjpeg->boundary = boundary;
> -mpjpeg->searchstr = av_asprintf( "\r\n%s\r\n", boundary );
> +mpjpeg->boundary = av_asprintf("--%s", boundary);
> +mpjpeg->searchstr = av_asprintf("\r\n--%s\r\n", boundary);
> +av_freep(&boundary);
>  } else {
>  mpjpeg->boundary = av_strdup("--");
>  mpjpeg->searchstr = av_strdup("\r\n--");
> --
> 2.20.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v3 3/3] avformat/mpjpegdec: ensure seekback for latest chunk

2019-10-07 Thread Paul B Mahol
lgtm

On 10/7/19, Moritz Barsnick  wrote:
> Not only the first, but each latest chunk must be cached to allow
> seekback after finding the mime boundary.
>
> Fixes trac #5023 and #5921.
>
> Signed-off-by: Moritz Barsnick 
> ---
>  libavformat/mpjpegdec.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
> index 24bf232db2..c79a39c69d 100644
> --- a/libavformat/mpjpegdec.c
> +++ b/libavformat/mpjpegdec.c
> @@ -336,10 +336,8 @@ static int mpjpeg_read_packet(AVFormatContext *s,
> AVPacket *pkt)
>  pkt->size = 0;
>  pkt->pos  = avio_tell(s->pb);
>
> -/* we may need to return as much as all we've read back to the
> buffer */
> -ffio_ensure_seekback(s->pb, read_chunk);
> -
> -while ((ret = av_append_packet(s->pb, pkt, read_chunk - remaining))
>>= 0) {
> +while ((ret = ffio_ensure_seekback(s->pb, read_chunk - remaining))
>>= 0 && /* we may need to return as much as all we've read back to the
> buffer */
> +   (ret = av_append_packet(s->pb, pkt, read_chunk - remaining))
>>= 0) {
>  /* scan the new data */
>  char *start;
>
> --
> 2.20.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec/zmbv: Simplify assigning decode_intra function pointer

2019-10-07 Thread Paul B Mahol
lgtm

On 10/7/19, Andreas Rheinhardt  wrote:
> zmbv has only one function for decoding intra frames, namely
> decode_intra. This can be used to simplify the process of choosing the
> right function pointer.
>
> This also removes spec-incompliant conversions between function pointers
> and pointers of type void * and thereby fixes the warning "ISO C forbids
> assignment between function pointer and ‘void *’" that GCC emits with
> the -pedantic option.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/zmbv.c | 8 +---
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
> index 99e735cfd9..8e9e13c936 100644
> --- a/libavcodec/zmbv.c
> +++ b/libavcodec/zmbv.c
> @@ -425,7 +425,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  c->flags = buf[0];
>  buf++; len--;
>  if (c->flags & ZMBV_KEYFRAME) {
> -void *decode_intra = NULL;
>  c->decode_intra= NULL;
>
>  if (len < 6)
> @@ -436,7 +435,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  c->fmt = buf[3];
>  c->bw = buf[4];
>  c->bh = buf[5];
> -c->decode_intra = NULL;
>  c->decode_xor = NULL;
>
>  buf += 6;
> @@ -460,7 +458,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  switch (c->fmt) {
>  case ZMBV_FMT_8BPP:
>  c->bpp = 8;
> -decode_intra = zmbv_decode_intra;
>  c->decode_xor = zmbv_decode_xor_8;
>  avctx->pix_fmt = AV_PIX_FMT_PAL8;
>  c->stride = c->width;
> @@ -468,7 +465,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  case ZMBV_FMT_15BPP:
>  case ZMBV_FMT_16BPP:
>  c->bpp = 16;
> -decode_intra = zmbv_decode_intra;
>  c->decode_xor = zmbv_decode_xor_16;
>  if (c->fmt == ZMBV_FMT_15BPP)
>  avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
> @@ -479,7 +475,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  #ifdef ZMBV_ENABLE_24BPP
>  case ZMBV_FMT_24BPP:
>  c->bpp = 24;
> -decode_intra = zmbv_decode_intra;
>  c->decode_xor = zmbv_decode_xor_24;
>  avctx->pix_fmt = AV_PIX_FMT_BGR24;
>  c->stride = c->width * 3;
> @@ -487,7 +482,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  #endif //ZMBV_ENABLE_24BPP
>  case ZMBV_FMT_32BPP:
>  c->bpp = 32;
> -decode_intra = zmbv_decode_intra;
>  c->decode_xor = zmbv_decode_xor_32;
>  avctx->pix_fmt = AV_PIX_FMT_BGR0;
>  c->stride = c->width * 4;
> @@ -517,7 +511,7 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  }
>  memset(c->cur, 0, avctx->width * avctx->height * (c->bpp / 8));
>  memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8));
> -c->decode_intra= decode_intra;
> +c->decode_intra = zmbv_decode_intra;
>  }
>  if (c->flags & ZMBV_KEYFRAME) {
>  expected_size = avctx->width * avctx->height * (c->bpp / 8);
> --
> 2.20.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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 0/5] adding ICC profile support to MOV decode/encode

2019-10-07 Thread vectronic
> On 23 Sep 2019, at 21:43, vectronic  wrote:
> 
> As discussed earlier on this mailing list, I needed to implement support for 
> reading and writing ICC profiles which can be stored in MOV/MP4 sample 
> descriptor colour information.
> 
> The overall changes are:
> 
> 1. Add a new enum value AVPacketSideDataType.AV_PKT_DATA_ICC_PROFILE. (Not 
> sure if update to APIchanges is correct.) Added to ff_decode_frame_props() to 
> ensure ICC profiles are attached to decoded frames. Added support for the new 
> side data type to format dump as well.
> 
> 2. Use av_stream_new_side_data() when reading from the MOV/MP4 in 
> libavformat/mov.c => mov_read_colr() to store ICC profile if it exists.
> 
> 3. Use av_stream_get_side_data() when writing to the MOV/MP4 in 
> libavformat/moveenc.c => mov_write_colr_tag() to write ICC profile it it 
> exists. Added a movflag 'prefer_icc' to ensure backwards compatible behaviour 
> of 'write_colr' movflag.
> 
> 
> 
> 
> vectronic (5):
>  API: add AV_PKT_DATA_ICC_PROFILE to AVPacketSideDataType
>  DOC: add AV_PKT_DATA_ICC_PROFILE to API changes
>  avformat/mov: add ICC profile support for colr atom
>  avformat/mov: whitespace indent
>  avformat/movenc: add ICC profile support to colr atom. If 'write_colr' 
> movflag
>is set, then movflag 'prefer_icc' can be used to first look for an
>AV_PKT_DATA_ICC_PROFILE entry to encode. If ICC profile doesn't
>exist, default behaviour enabled by 'write_colr' occurs.
> 
> doc/APIchanges|  3 +++
> libavcodec/avcodec.h  |  6 +
> libavcodec/avpacket.c |  1 +
> libavcodec/decode.c   |  1 +
> libavformat/dump.c|  3 +++
> libavformat/mov.c | 63 +--
> libavformat/movenc.c  | 23 ++--
> libavformat/movenc.h  |  1 +
> 8 files changed, 73 insertions(+), 28 deletions(-)
> 
> -- 
> 2.21.0 (Apple Git-122)
> 

Hello,

Wondering if anyone would be able to review these changes? I’m currently using 
this in production and it is working well.

Thanks


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

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

Re: [FFmpeg-devel] [PATCH] Fix segment muxer

2019-10-07 Thread just . one . man
Updated patch
---

When incoming media has non-zero start PTS,
segment muxer would fail to correctly calculate
the point where to chunk segments, as it always
assumed that media starts with PTS==0.

This change removes this assumption by remembering
the PTS of the very first frame passed through the muxer.

Also fix starting points of first segment
---
 libavformat/segment.c |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index e308206..8b985df 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -87,6 +87,7 @@ typedef struct SegmentContext {
 int64_t last_val;  ///< remember last time for wrap around detection
 int cut_pending;
 int header_written;///< whether we've already called 
avformat_write_header
+int64_t start_pts; ///< pts of the very first packet processed, used 
to compute correct segment length

 char *entry_prefix;///< prefix to add to list entry filenames
 int list_type; ///< set the list type
@@ -702,6 +703,7 @@ static int seg_init(AVFormatContext *s)
 if ((ret = parse_frames(s, &seg->frames, &seg->nb_frames, 
seg->frames_str)) < 0)
 return ret;
 } else {
+seg->start_pts = AV_NOPTS_VALUE;
 /* set default value if not specified */
 if (!seg->time_str)
 seg->time_str = av_strdup("2");
@@ -914,7 +916,15 @@ calc_times:
 seg->cut_pending = 1;
 seg->last_val = wrapped_val;
 } else {
-end_pts = seg->time * (seg->segment_count + 1);
+if (seg->start_pts != AV_NOPTS_VALUE) {
+end_pts = seg->start_pts + seg->time * (seg->segment_count + 
1);
+} else if (pkt->stream_index == seg->reference_stream_index && 
pkt->pts != AV_NOPTS_VALUE) {
+// this is the first packet of the reference stream we see, 
initialize start point
+seg->start_pts = av_rescale_q(pkt->pts, st->time_base, 
AV_TIME_BASE_Q);
+seg->cur_entry.start_time = (double)pkt->pts * 
av_q2d(st->time_base);
+seg->cur_entry.start_pts = seg->start_pts;
+end_pts = seg->start_pts + seg->time * (seg->segment_count + 
1);
+}
 }
 }

--
1.7.9.5


06.10.2019, 14:38, "Vasily" :
> I used that value somewhere during patch development, but I eventually
> settled on -1, because that "start_pts" and "end_pts" are using some other
> units, not the unit used by pkt->pts.
>
> So I wanted to make a distinction. Though a possibility of negative
> timestamps didn't come to me, so I probably have to change it back to
> AV_NOPTS_VALUE.
>
> P.S. Thanks for reviewing my patch!
>
> вс, 6 окт. 2019 г., 13:56 Marton Balint :
>
>>  On Thu, 3 Oct 2019, just.one@yandex.ru wrote:
>>
>>  > It seems that my first attempt to send the patch failed (probably
>>  because my box where I executed "git send-email" failed reverse smtp
>>  check), so I'm going to re-send it to this same thread.
>>  >
>>  > ---
>>  >
>>  > When incoming media has non-zero start PTS,
>>  > segment muxer would fail to correctly calculate
>>  > the point where to chunk segments, as it always
>>  > assumed that media starts with PTS==0.
>>  >
>>  > This change removes this assumption by remembering
>>  > the PTS of the very first frame passed through the muxer.
>>  >
>>  > Also fix starting points of first segment
>>  > ---
>>  > libavformat/segment.c | 12 +++-
>>  > 1 file changed, 11 insertions(+), 1 deletion(-)
>>  >
>>  > diff --git a/libavformat/segment.c b/libavformat/segment.c
>>  > index e308206..2478d8f 100644
>>  > --- a/libavformat/segment.c
>>  > +++ b/libavformat/segment.c
>>  > @@ -87,6 +87,7 @@ typedef struct SegmentContext {
>>  > int64_t last_val; ///< remember last time for wrap around
>>  detection
>>  > int cut_pending;
>>  > int header_written; ///< whether we've already called
>>  avformat_write_header
>>  > + int64_t start_pts; ///< pts of the very first packet processed,
>>  used to compute correct segment length
>>  >
>>  > char *entry_prefix; ///< prefix to add to list entry filenames
>>  > int list_type; ///< set the list type
>>  > @@ -702,6 +703,7 @@ static int seg_init(AVFormatContext *s)
>>  > if ((ret = parse_frames(s, &seg->frames, &seg->nb_frames,
>>  seg->frames_str)) < 0)
>>  > return ret;
>>  > } else {
>>  > + seg->start_pts = -1;
>>
>>  AV_NOPTS_VALUE would be probably better for this purpose, even if the
>>  muxer won't get negative timestamps unless allowed by the
>>  AVFMT_TS_NEGATIVE flag.
>>
>>  Regards,
>>  Marton
>>
>>  > /* set default value if not specified */
>>  > if (!seg->time_str)
>>  > seg->time_str = av_strdup("2");
>>  > @@ -914,7 +916,15 @@ calc_times:
>>  > seg->cut_pending = 1;
>>  > seg->last_val = wrapped_val;
>>  > } else {
>>  > - end_pts = seg->time * (seg->segment_count + 1);
>>  > + if (seg->start_pts != -1) {
>>  > + end_pts = seg->start_pts + seg

Re: [FFmpeg-devel] [PATCH] Fix segment muxer

2019-10-07 Thread Nicolas George
just.one@yandex.ru (12019-10-07):
> Updated patch

This should be after the triple dash, because it does not belong in the
commit message.

> ---
> 
> When incoming media has non-zero start PTS,
> segment muxer would fail to correctly calculate
> the point where to chunk segments, as it always
> assumed that media starts with PTS==0.
> 
> This change removes this assumption by remembering
> the PTS of the very first frame passed through the muxer.
> 
> Also fix starting points of first segment
> ---

This should be before the triple dash, because it does belong in the
commit message.

I did not look at the code.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH] Fix segment muxer

2019-10-07 Thread just . one . man
When incoming media has non-zero start PTS,
segment muxer would fail to correctly calculate
the point where to chunk segments, as it always
assumed that media starts with PTS==0.

This change removes this assumption by remembering
the PTS of the very first frame passed through the muxer.

Also fix starting points of first segment
---
 libavformat/segment.c |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index e308206..8b985df 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -87,6 +87,7 @@ typedef struct SegmentContext {
 int64_t last_val;  ///< remember last time for wrap around detection
 int cut_pending;
 int header_written;///< whether we've already called 
avformat_write_header
+int64_t start_pts; ///< pts of the very first packet processed, used 
to compute correct segment length

 char *entry_prefix;///< prefix to add to list entry filenames
 int list_type; ///< set the list type
@@ -702,6 +703,7 @@ static int seg_init(AVFormatContext *s)
 if ((ret = parse_frames(s, &seg->frames, &seg->nb_frames, 
seg->frames_str)) < 0)
 return ret;
 } else {
+seg->start_pts = AV_NOPTS_VALUE;
 /* set default value if not specified */
 if (!seg->time_str)
 seg->time_str = av_strdup("2");
@@ -914,7 +916,15 @@ calc_times:
 seg->cut_pending = 1;
 seg->last_val = wrapped_val;
 } else {
-end_pts = seg->time * (seg->segment_count + 1);
+if (seg->start_pts != AV_NOPTS_VALUE) {
+end_pts = seg->start_pts + seg->time * (seg->segment_count + 
1);
+} else if (pkt->stream_index == seg->reference_stream_index && 
pkt->pts != AV_NOPTS_VALUE) {
+// this is the first packet of the reference stream we see, 
initialize start point
+seg->start_pts = av_rescale_q(pkt->pts, st->time_base, 
AV_TIME_BASE_Q);
+seg->cur_entry.start_time = (double)pkt->pts * 
av_q2d(st->time_base);
+seg->cur_entry.start_pts = seg->start_pts;
+end_pts = seg->start_pts + seg->time * (seg->segment_count + 
1);
+}
 }
 }

--
1.7.9.5

Now I tried to re-format as Nicolas George said, hopefully this is okay and 
won't make a third entry in patchwork (if it does - how do I stop it from doing 
so?)

07.10.2019, 15:15, "Nicolas George" :
> just.one@yandex.ru (12019-10-07):
>>  Updated patch
>
> This should be after the triple dash, because it does not belong in the
> commit message.
>
>>  ---
>>
>>  When incoming media has non-zero start PTS,
>>  segment muxer would fail to correctly calculate
>>  the point where to chunk segments, as it always
>>  assumed that media starts with PTS==0.
>>
>>  This change removes this assumption by remembering
>>  the PTS of the very first frame passed through the muxer.
>>
>>  Also fix starting points of first segment
>>  ---
>
> This should be before the triple dash, because it does belong in the
> commit message.
>
> I did not look at the code.
>
> Regards,
>
> --
>   Nicolas George
> ,
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v5 1/3] hevc_mp4toannexb: Insert correct parameter sets before IRAP

2019-10-07 Thread Andriy Gelman
On Wed, 02. Oct 08:05, Andriy Gelman wrote:
> On Thu, 26. Sep 14:09, Andriy Gelman wrote:
> > From: Andriy Gelman 
> > 
> > Fixes #7799
> > 
> > Currently, the mp4toannexb filter always inserts the same extradata at
> > the start of the first IRAP unit. As in ticket #7799, this can lead to
> > decoding errors if modified parameter sets are signalled in-band.
> > 
> > This commit keeps track of the VPS/SPS/PPS parameter sets during the
> > conversion. The correct combination is inserted at the start of the
> > first IRAP. SEIs from extradata are inserted before each IRAP.
> > 
> > This commit also makes an update to the hevc-bsf-mp4toannexb fate test
> > since the result before this patch contained duplicate parameter sets
> > in-band.
> > ---
> >  libavcodec/hevc_mp4toannexb_bsf.c | 488 --
> >  tests/fate/hevc.mak   |   2 +-
> >  2 files changed, 456 insertions(+), 34 deletions(-)
> > 
> > diff --git a/libavcodec/hevc_mp4toannexb_bsf.c 
> > b/libavcodec/hevc_mp4toannexb_bsf.c
> > index 09bce5b34c..90a4d17d25 100644
> > --- a/libavcodec/hevc_mp4toannexb_bsf.c
> > +++ b/libavcodec/hevc_mp4toannexb_bsf.c
> > @@ -23,19 +23,209 @@
> >  
> >  #include "libavutil/intreadwrite.h"
> >  #include "libavutil/mem.h"
> > +#include "libavutil/avassert.h"
> >  
> >  #include "avcodec.h"
> >  #include "bsf.h"
> >  #include "bytestream.h"
> >  #include "hevc.h"
> > +#include "h2645_parse.h"
> > +#include "hevc_ps.h"
> > +#include "golomb.h"
> >  
> >  #define MIN_HEVCC_LENGTH 23
> > +#define PROFILE_WITHOUT_IDC_BITS88
> > +#define IS_IRAP(s)  ((s)->type >= 16 && (s)->type <= 23)
> > +#define IS_PARAMSET(s)  ((s)->type >= 32 && (s)->type <= 34)
> > +
> > +/*reserved VCLs not included*/
> > +#define IS_VCL(s)   ((s)->type <= 9 || ((s)->type >= 16 && 
> > (s)->type <= 21))
> > +#define HEVC_NAL_HEADER_BITS16
> > +
> > +/*
> > + *Copies data from input buffer to output buffer. Appends annexb startcode.
> > + *out must be allocated at least out_len + in_len + 4.
> > + */
> > +#define WRITE_NAL(out, out_len, in, in_len) do {\
> > +AV_WB32((out) + (out_len), 1);  \
> > +(out_len) += 4; \
> > +memcpy((out) + (out_len), (in), (in_len));  \
> > +(out_len) += (in_len);  \
> > +} while (0)
> > +
> > +typedef struct Param {
> > +uint8_t *raw_data;  /*raw data to store param set payload*/
> > +int  raw_size;  /*size of raw_data*/
> > +size_t   allocated_size;/*allocated size of raw_data*/
> > +int  ref;   /*stores the ref of the higher level 
> > parameter set*/
> > +int  is_signalled;  /*indicates whether this param has already 
> > been signalled in the cvs*/
> > +} Param;
> > +
> > +/*modified version of HEVCParamSets to store bytestream and reference to 
> > previous level*/
> > +typedef struct ParamSets {
> > +Param vps_list[HEVC_MAX_VPS_COUNT];
> > +Param sps_list[HEVC_MAX_SPS_COUNT];
> > +Param pps_list[HEVC_MAX_PPS_COUNT];
> > +
> > +Param sei; /*cached SEIs from extradata in annexb format*/
> > +} ParamSets;
> >  
> >  typedef struct HEVCBSFContext {
> >  uint8_t  length_size;
> >  int  extradata_parsed;
> > +ParamSets ps; /*cached VPS/SPS/PPS parameter sets + SEI from 
> > extradata*/
> >  } HEVCBSFContext;
> >  
> > +static int update_cached_paramset(AVBSFContext *ctx, Param *cached_param,
> > +  H2645NAL *nal, int ref)
> > +{
> > +int ret;
> > +
> > +if (cached_param->raw_data && cached_param->raw_size == nal->raw_size 
> > &&
> > +!memcmp(cached_param->raw_data, nal->raw_data, nal->raw_size)) {
> > +av_log(ctx, AV_LOG_DEBUG, "NAL unit: %d. Copy already exists in 
> > parameter set.\n", nal->type);
> > +} else {
> > +if (nal->raw_size > cached_param->allocated_size) {
> > +ret = av_reallocp(&cached_param->raw_data, nal->raw_size);
> > +if (ret < 0)
> > +return ret;
> > +cached_param->allocated_size = nal->raw_size;
> > +}
> > +memcpy(cached_param->raw_data, nal->raw_data, nal->raw_size);
> > +cached_param->raw_size = nal->raw_size;
> > +cached_param->ref  = ref;
> > +cached_param->is_signalled = 0;
> > +}
> > +return 0;
> > +}
> > +
> > +static int parse_vps(AVBSFContext *ctx, H2645NAL *nal)
> > +{
> > +int vps_id, ret;
> > +
> > +HEVCBSFContext *s = ctx->priv_data;
> > +ParamSets *ps = &s->ps;
> > +
> > +GetBitContext *gb = &nal->gb;
> > +gb->index = HEVC_NAL_HEADER_BITS;
> > +
> > +vps_id = get_bits(gb, 4);
> > +
> > +av_log(ctx, AV_LOG_TRACE, "Updating VPS id: %d\n", vps_id);
> > +re

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

2019-10-07 Thread Limin Wang
On Tue, Oct 01, 2019 at 09:47:19AM +0200, Moritz Barsnick wrote:
> 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.
Thanks for the catch, I'll fix it for the update patch.


> 
> 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 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-07 Thread Limin Wang
On Tue, Oct 01, 2019 at 09:34:48PM +0200, Marton Balint wrote:
> 
> 
> 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.

When the input file is big, I like to extract the freeze frame
after the running sometimes, it's useful to help check whether 
it's expect for the detecting result.

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

OK, will update the document to note it.

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

OK, I'll consider it how to simplify it by your advise.

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

OK, will update it.

> 
> >
> >{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++;
> >+   

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

2019-10-07 Thread Limin Wang
On Tue, Oct 01, 2019 at 01:23:04PM +0200, Carl Eugen Hoyos wrote:
> 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?
It's minor change, please corrent me if I'm misunderstanding. by description of 
the av_malloc_array parameters: 
  * @param nmemb Number of element
  * @param size  Size of a single element


> 
> 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 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 2/6] avfilter/af_silencedetect: document metadata

2019-10-07 Thread Limin Wang
On Tue, Oct 01, 2019 at 09:40:45AM +0200, Moritz Barsnick wrote:
> 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?
By the code,  if it's mono mode, it'll output lavfi.silence_duration metadata, 
if not mono,
it'll output lavfi.silence_duration.0, lavfi.silence_duration.1(0, 1 is the 
channel number).
Please advise how to describe this clearly.
> 
> 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".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec/zmbv: Simplify assigning decode_intra function pointer

2019-10-07 Thread Tomas Härdin
mån 2019-10-07 klockan 02:57 +0200 skrev Andreas Rheinhardt:
> zmbv has only one function for decoding intra frames, namely
> decode_intra. This can be used to simplify the process of choosing the
> right function pointer.
> 
> This also removes spec-incompliant conversions between function pointers
> and pointers of type void * and thereby fixes the warning "ISO C forbids
> assignment between function pointer and ‘void *’" that GCC emits with
> the -pedantic option.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/zmbv.c | 8 +---
>  1 file changed, 1 insertion(+), 7 deletions(-)

Why not just call zmbv_decode_intra() directly?

/Tomas

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

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

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter/vf_scenechangedetect: add filter to detect scene change

2019-10-07 Thread Limin Wang

ping, please give comments.

On Sun, Sep 29, 2019 at 09:25:12PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
> Please provide a comment to add a new filter for scene change detection to 
> avoid
> multiple calculations of mafd in the filter chain. The filter can avoid 
> duplication
> code also for I am writing a new filter to synchronize frames that require 
> scene
> change information. If the detect metadata can get, the code will be simple.
> 
> In addition, I'm trying  to add a reduced size before scene change detection 
> to improve
> the performance. From the initial test, we can only get 10-20% improvement, 
> but some
> scene change aren't detected after that. Therefore, I think that should not 
> be done.
> 
> This version, I removed the version change for it's easy to cause code 
> conflict, 
> please the committer help to update it if review done.
> 
>  configure  |   1 +
>  doc/filters.texi   |  35 +
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vf_scenechangedetect.c | 220 +
>  5 files changed, 258 insertions(+)
>  create mode 100644 libavfilter/vf_scenechangedetect.c
> 
> diff --git a/configure b/configure
> index 8413826f9e..909a77b9cf 100755
> --- a/configure
> +++ b/configure
> @@ -3520,6 +3520,7 @@ sab_filter_deps="gpl swscale"
>  scale2ref_filter_deps="swscale"
>  scale_filter_deps="swscale"
>  scale_qsv_filter_deps="libmfx"
> +scenechangedetect_filter_select="scene_sad"
>  select_filter_select="scene_sad"
>  sharpness_vaapi_filter_deps="vaapi"
>  showcqt_filter_deps="avcodec avformat swscale"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index e6f8bf0ee9..f9247643cb 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -15642,6 +15642,41 @@ Scale a logo to 1/10th the height of a video, while 
> preserving its display aspec
>  @end example
>  @end itemize
>  
> +@anchor{scenechangedetect}
> +@section scenechangedetect
> +
> +Detect video scene change.
> +
> +This filter sets frame metadata with mafd between frame, the scene score, and
> +forward the frame to the next filter, so they can use these metadata to 
> detect
> +scene change or others.
> +
> +In addition, this filter logs a message and sets frame metadata when it 
> detects
> +a scene change by @option{threshold}.
> +
> +@code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
> +
> +@code{lavfi.scd.score} metadata keys are set with scene change score for 
> every frame
> +to detect scene change.
> +
> +@code{lavfi.scd.time} metadata keys are set with current filtered frame time 
> which
> +detect scene change with @option{threshold}.
> +
> +The filter accepts the following options:
> +
> +@table @option
> +@item threshold, t
> +Set the scene change detection threshold as a percentage of maximum change.  
> Good
> +values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} 
> is
> +@code{[0., 100.]}.
> +
> +Default value is @code{10.}.
> +
> +@item sc_pass, s
> +Set the scene change pass the frame to the next filter or not. Default value 
> is @code{0}
> +You can enable it if you want to get snapshot of scene change frames.
> +@end table
> +
>  @anchor{selectivecolor}
>  @section selectivecolor
>  
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index b99ecc8c26..f6c6ba5d45 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -356,6 +356,7 @@ OBJS-$(CONFIG_SCALE_NPP_FILTER)  += 
> vf_scale_npp.o scale.o
>  OBJS-$(CONFIG_SCALE_QSV_FILTER)  += vf_scale_qsv.o
>  OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o 
> vaapi_vpp.o
>  OBJS-$(CONFIG_SCALE2REF_FILTER)  += vf_scale.o scale.o
> +OBJS-$(CONFIG_SCENECHANGEDETECT_FILTER)  += vf_scenechangedetect.o
>  OBJS-$(CONFIG_SELECT_FILTER) += f_select.o
>  OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
>  OBJS-$(CONFIG_SENDCMD_FILTER)+= f_sendcmd.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 788652ab1e..69a4d5e8e5 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -338,6 +338,7 @@ extern AVFilter ff_vf_scale_npp;
>  extern AVFilter ff_vf_scale_qsv;
>  extern AVFilter ff_vf_scale_vaapi;
>  extern AVFilter ff_vf_scale2ref;
> +extern AVFilter ff_vf_scenechangedetect;
>  extern AVFilter ff_vf_select;
>  extern AVFilter ff_vf_selectivecolor;
>  extern AVFilter ff_vf_sendcmd;
> diff --git a/libavfilter/vf_scenechangedetect.c 
> b/libavfilter/vf_scenechangedetect.c
> new file mode 100644
> index 00..269fa399d0
> --- /dev/null
> +++ b/libavfilter/vf_scenechangedetect.c
> @@ -0,0 +1,220 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
>

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

2019-10-07 Thread Raphaël Zumer
Just sending a reminder for my set of patches (the set of v2 patches up
in the thread and this one). Are there any further comments?

Thanks
Raphaël Zumer

On Wed, 2019-10-02 at 09:04 -0400, Raphaël Zumer wrote:
> There is no change in the encoded bitstream, but this
> ensures that the written field length is consistent
> with the reference implementation.
> 
> Unused bytes are zeroed out for backwards compatibility.
> 
> 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 ae461a872b..eb70421c44 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -84,7 +84,8 @@ static int ivf_write_trailer(AVFormatContext *s)
>  
>  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_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> >frame_cnt - 1));
> +avio_wl32(pb, 0); // zero out unused bytes
>  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".

Re: [FFmpeg-devel] [PATCH v4 1/4] avutil/avstring: support input path as a null pointer or empty string

2019-10-07 Thread Limin Wang

ping the patchset, haven't merge yet.

On Tue, Sep 24, 2019 at 07:23:58PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Linux and OSX systems support basename and dirname via , I plan to
> make the wrapper interface conform to the standard interface first.
> If it is feasible, I will continue to modify it to call the system interface
> if there is already a system call interface.
> 
> You can get more description about the system interface by below command:
>  "man 3 basename"
> 
> Reviewed-by: Marton Balint 
> Reviewed-by: Tomas Härdin 
> Reviewed-by: Liu Steven 
> Signed-off-by: Limin Wang 
> ---
>  libavutil/avstring.c | 12 
>  libavutil/avstring.h | 13 +
>  2 files changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/libavutil/avstring.c b/libavutil/avstring.c
> index 4c068f5bc5..76a13ba3b5 100644
> --- a/libavutil/avstring.c
> +++ b/libavutil/avstring.c
> @@ -257,8 +257,12 @@ char *av_strireplace(const char *str, const char *from, 
> const char *to)
>  
>  const char *av_basename(const char *path)
>  {
> -char *p = strrchr(path, '/');
> +char *p;
>  
> +if (!path || *path == '\0')
> +return ".";
> +
> +p = strrchr(path, '/');
>  #if HAVE_DOS_PATHS
>  char *q = strrchr(path, '\\');
>  char *d = strchr(path, ':');
> @@ -274,11 +278,11 @@ const char *av_basename(const char *path)
>  
>  const char *av_dirname(char *path)
>  {
> -char *p = strrchr(path, '/');
> +char *p = path ? strrchr(path, '/') : NULL;
>  
>  #if HAVE_DOS_PATHS
> -char *q = strrchr(path, '\\');
> -char *d = strchr(path, ':');
> +char *q = path ? strrchr(path, '\\') : NULL;
> +char *d = path ? strchr(path, ':')  : NULL;
>  
>  d = d ? d + 1 : d;
>  
> diff --git a/libavutil/avstring.h b/libavutil/avstring.h
> index 37dd4e2da0..274335cfb9 100644
> --- a/libavutil/avstring.h
> +++ b/libavutil/avstring.h
> @@ -274,16 +274,21 @@ char *av_strireplace(const char *str, const char *from, 
> const char *to);
>  
>  /**
>   * Thread safe basename.
> - * @param path the path, on DOS both \ and / are considered separators.
> + * @param path the string to parse, on DOS both \ and / are considered 
> separators.
>   * @return pointer to the basename substring.
> + * If path does not contain a slash, the function returns a copy of path.
> + * If path is a NULL pointer or points to an empty string, a pointer
> + * to a string "." is returned.
>   */
>  const char *av_basename(const char *path);
>  
>  /**
>   * Thread safe dirname.
> - * @param path the path, on DOS both \ and / are considered separators.
> - * @return the path with the separator replaced by the string terminator or 
> ".".
> - * @note the function may change the input string.
> + * @param path the string to parse, on DOS both \ and / are considered 
> separators.
> + * @return A pointer to a string that's the parent directory of path.
> + * If path is a NULL pointer or points to an empty string, a pointer
> + * to a string "." is returned.
> + * @note the function may modify the contents of the path, so copies should 
> be passed.
>   */
>  const char *av_dirname(char *path);
>  
> -- 
> 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 1/2] avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly

2019-10-07 Thread Matthieu Bouron
On Fri, Sep 27, 2019 at 04:37:31PM +0200, Matthieu Bouron wrote:
> Allows the creation of the sdtp atom while remuxing MP4 to MP4. This
> atom is required by Apple devices (iPhone, Apple TV) in order to accept
> 2160p medias.
> ---
>  libavformat/isom.h |  2 ++
>  libavformat/mov.c  | 41 +
>  2 files changed, 43 insertions(+)
> 
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index 69452cae8e..4943b80ccf 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -163,6 +163,8 @@ typedef struct MOVStreamContext {
>  int64_t *chunk_offsets;
>  unsigned int stts_count;
>  MOVStts *stts_data;
> +unsigned int sdtp_count;
> +uint8_t *sdtp_data;
>  unsigned int ctts_count;
>  unsigned int ctts_allocated_size;
>  MOVStts *ctts_data;
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 8e916a28c6..7dfa07b45e 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2959,6 +2959,40 @@ static int mov_read_stts(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  return 0;
>  }
>  
> +static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> +AVStream *st;
> +MOVStreamContext *sc;
> +int64_t i, entries;
> +
> +if (c->fc->nb_streams < 1)
> +return 0;
> +st = c->fc->streams[c->fc->nb_streams-1];
> +sc = st->priv_data;
> +
> +avio_r8(pb); /* version */
> +avio_rb24(pb); /* flags */
> +entries = atom.size - 4;
> +
> +av_log(c->fc, AV_LOG_TRACE, "track[%u].sdtp.entries = %" PRId64 "\n",
> +   c->fc->nb_streams - 1, entries);
> +
> +if (sc->sdtp_data)
> +av_log(c->fc, AV_LOG_WARNING, "Duplicated SDTP atom\n");
> +av_freep(&sc->sdtp_data);
> +sc->sdtp_count = 0;
> +
> +sc->sdtp_data = av_mallocz(entries);
> +if (!sc->sdtp_data)
> +return AVERROR(ENOMEM);
> +
> +for (i = 0; i < entries && !pb->eof_reached; i++)
> +sc->sdtp_data[i] = avio_r8(pb);
> +sc->sdtp_count = i;
> +
> +return 0;
> +}
> +
>  static void mov_update_dts_shift(MOVStreamContext *sc, int duration)
>  {
>  if (duration < 0) {
> @@ -6767,6 +6801,7 @@ static const MOVParseTableEntry 
> mov_default_parse_table[] = {
>  { MKTAG('s','t','s','z'), mov_read_stsz }, /* sample size */
>  { MKTAG('s','t','t','s'), mov_read_stts },
>  { MKTAG('s','t','z','2'), mov_read_stsz }, /* compact sample size */
> +{ MKTAG('s','d','t','p'), mov_read_sdtp }, /* independant and disposable 
> samples */
>  { MKTAG('t','k','h','d'), mov_read_tkhd }, /* track header */
>  { MKTAG('t','f','d','t'), mov_read_tfdt },
>  { MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */
> @@ -7231,6 +7266,7 @@ static int mov_read_close(AVFormatContext *s)
>  av_freep(&sc->sample_sizes);
>  av_freep(&sc->keyframes);
>  av_freep(&sc->stts_data);
> +av_freep(&sc->sdtp_data);
>  av_freep(&sc->stps_data);
>  av_freep(&sc->elst_data);
>  av_freep(&sc->rap_group);
> @@ -7820,6 +7856,11 @@ static int mov_read_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  }
>  if (st->discard == AVDISCARD_ALL)
>  goto retry;
> +if (sc->sdtp_data && sc->current_sample <= sc->sdtp_count) {
> +uint8_t sample_flags = sc->sdtp_data[sc->current_sample - 1];
> +uint8_t sample_is_depended_on = (sample_flags >> 2) & 0x3;
> +pkt->flags |= sample_is_depended_on == MOV_SAMPLE_DEPENDENCY_NO ? 
> AV_PKT_FLAG_DISPOSABLE : 0;
> +}
>  pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0;
>  pkt->pos = sample->pos;
>  
> -- 
> 2.23.0
> 

Ping.

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

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

Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_delogo: make the interp value compute method simple

2019-10-07 Thread Limin Wang
On Mon, Oct 07, 2019 at 01:12:46PM +0800, Steven Liu wrote:
> because the interp >= 0UL comparison of an unsigned value is always true
> fix CID: 1454642
> 
> Signed-off-by: Steven Liu 
> ---
>  libavfilter/vf_delogo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
> index 376c5e850f..3678548353 100644
> --- a/libavfilter/vf_delogo.c
> +++ b/libavfilter/vf_delogo.c
> @@ -168,7 +168,7 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
>   botleft[x-logo_x1-1]  +
>   botleft[x-logo_x1+1]) * weightb;
>  weight = (weightl + weightr + weightt + weightb) * 3U;
> -interp = ROUNDED_DIV(interp, weight);
> +interp = (interp + weight >> 1) / weight;

By the macros definition:
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))

I feel it should be:
interp = (interp - weight >> 1) / weight;

instead of: 
interp = (interp + weight >> 1) / weight;


>  
>  if (y >= logo_y+band && y < logo_y+logo_h-band &&
>  x >= logo_x+band && x < logo_x+logo_w-band) {
> -- 
> 2.17.2 (Apple Git-113)
> 
> 
> 
> ___
> 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 v1 1/6] avfilter/af_silencedetect: change parameters order for av_malllocz_array

2019-10-07 Thread Moritz Barsnick
On Mon, Oct 07, 2019 at 22:28:01 +0800, Limin Wang wrote:
> It's minor change, please corrent me if I'm misunderstanding. by description 
> of the av_malloc_array parameters:
>   * @param nmemb Number of element
>   * @param size  Size of a single element

I agree that it's more true to the documentation, although there's
technically no (or very little) difference.

Alas, I found 17 such "reversed" uses in the code base, at a quick
glance.

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 1/6] avfilter/af_silencedetect: change parameters order for av_malllocz_array

2019-10-07 Thread Limin Wang
On Mon, Oct 07, 2019 at 05:40:50PM +0200, Moritz Barsnick wrote:
> On Mon, Oct 07, 2019 at 22:28:01 +0800, Limin Wang wrote:
> > It's minor change, please corrent me if I'm misunderstanding. by 
> > description of the av_malloc_array parameters:
> >   * @param nmemb Number of element
> >   * @param size  Size of a single element
> 
> I agree that it's more true to the documentation, although there's
> technically no (or very little) difference.

OK, please ignore the patch if such usage is acceptable.

> 
> Alas, I found 17 such "reversed" uses in the code base, at a quick
> glance.
> 
> 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 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 v1] doc/developer: make clear for the patch processing time

2019-10-07 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 doc/developer.texi | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 5c342c9..698a814 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -497,8 +497,12 @@ incorporates the requests from the review. This process 
may go through
 several iterations. Once your patch is deemed good enough, some developer
 will pick it up and commit it to the official FFmpeg tree.
 
-Give us a few days to react. But if some time passes without reaction,
-send a reminder by email. Your patch should eventually be dealt with.
+Give us a few days to react. But if ten days passes without reaction,
+send a reminder by email. If ten days passes without reaction still,
+send a ping reminder by email again. If one more week passes without
+reaction, your patch is rejected most likely if you're not maintainer,
+because no one will handle it. Although you can continue to send reminder
+emails.
 
 
 @chapter New codecs or formats checklist
-- 
2.6.4

___
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/6] avcodec/qdrw: Check input for header/skiped space before get_buffer()

2019-10-07 Thread Michael Niedermayer
Fixes: Timeout (21sec -> 0.8sec)
Fixes: 
17990/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDRAW_fuzzer-5200374436200448

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

diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index 32ba410968..65279c9805 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -455,6 +455,8 @@ static int decode_frame(AVCodecContext *avctx,
 avpriv_request_sample(avctx, "Pack type %d", pack_type);
 return AVERROR_PATCHWELCOME;
 }
+if (bytestream2_get_bytes_left(&gbc) < 30)
+return AVERROR_INVALIDDATA;
 if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
 return ret;
 
-- 
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 6/6] avcodec/truespeech: Fix integer overflow in truespeech_synth()

2019-10-07 Thread Michael Niedermayer
Fixes: signed integer overflow: -1801695444 + -830224908 cannot be represented 
in type 'int'
Fixes: 
17995/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUESPEECH_fuzzer-5648084880588800

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

diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
index 799cef0945..d7c2d535e2 100644
--- a/libavcodec/truespeech.c
+++ b/libavcodec/truespeech.c
@@ -254,7 +254,7 @@ static void truespeech_synth(TSContext *dec, int16_t *out, 
int quart)
 for(i = 0; i < 60; i++){
 int sum = 0;
 for(k = 0; k < 8; k++)
-sum += ptr0[k] * ptr1[k];
+sum += ptr0[k] * (unsigned)ptr1[k];
 sum = out[i] + ((sum + 0x800) >> 12);
 out[i] = av_clip(sum, -0x7FFE, 0x7FFE);
 for(k = 7; k > 0; k--)
-- 
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 1/6] tools/target_dec_fuzzer: Adjust ffwavesynth threshold

2019-10-07 Thread Michael Niedermayer
ffwavesynth can produce large amounts of data relatively slowly on very small 
input

Fixes: Timeout (60sec -> 9sec)
Fixes: 
17970/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5689121279836160

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

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index a2c59be318..b9e863afa5 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -138,6 +138,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 // Allows a small input to generate gigantic output
 case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32; break;
 case AV_CODEC_ID_DIRAC: maxpixels /= 8192; break;
+case AV_CODEC_ID_FFWAVESYNTH: maxsamples /= 16384; break;
 case AV_CODEC_ID_MSRLE: maxpixels /= 16;  break;
 case AV_CODEC_ID_QTRLE: maxpixels /= 16;  break;
 case AV_CODEC_ID_SANM:  maxpixels /= 16;  break;
-- 
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 5/6] avcodec/interplayacm: Fix integer overflows in juggle()

2019-10-07 Thread Michael Niedermayer
Fixes: signed integer overflow: -760459023 + -1520918047 cannot be represented 
in type 'int'
Fixes: 
17994/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5647123042795520

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

diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c
index 5639d8de82..cff79eb6b2 100644
--- a/libavcodec/interplayacm.c
+++ b/libavcodec/interplayacm.c
@@ -435,7 +435,8 @@ static int fill_block(InterplayACMContext *s)
 static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned 
sub_count)
 {
 unsigned i, j;
-int *p, r0, r1, r2, r3;
+int *p;
+unsigned int r0, r1, r2, r3;
 
 for (i = 0; i < sub_len; i++) {
 p = block_p;
-- 
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] avcodec/zmbv: Simplify assigning decode_intra function pointer

2019-10-07 Thread Andreas Rheinhardt
Tomas Härdin:
> mån 2019-10-07 klockan 02:57 +0200 skrev Andreas Rheinhardt:
>> zmbv has only one function for decoding intra frames, namely
>> decode_intra. This can be used to simplify the process of choosing the
>> right function pointer.
>>
>> This also removes spec-incompliant conversions between function pointers
>> and pointers of type void * and thereby fixes the warning "ISO C forbids
>> assignment between function pointer and ‘void *’" that GCC emits with
>> the -pedantic option.
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>>  libavcodec/zmbv.c | 8 +---
>>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> Why not just call zmbv_decode_intra() directly?
> 
> /Tomas
> 
This is a few lines below:

if (!c->decode_intra) {
av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no
keyframe!\n");
return AVERROR_INVALIDDATA;
}

So whether this function pointer is set or not is used as a test for
initialisation or so. Not being familiar with this code I therefore
opted to not change the observable outcome of it at all.

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

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

[FFmpeg-devel] [PATCH 2/6] tools/target_dec_fuzzer: Adjust threshold for CFHD

2019-10-07 Thread Michael Niedermayer
Fixes: Timeout (18sec -> 5sec)
Fixes: 
17977/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5186112762413056

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

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index b9e863afa5..b55dd9d5ea 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -137,6 +137,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 switch (c->id) {
 // Allows a small input to generate gigantic output
 case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32; break;
+case AV_CODEC_ID_CFHD:  maxpixels /= 128; break;
 case AV_CODEC_ID_DIRAC: maxpixels /= 8192; break;
 case AV_CODEC_ID_FFWAVESYNTH: maxsamples /= 16384; break;
 case AV_CODEC_ID_MSRLE: maxpixels /= 16;  break;
-- 
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 4/6] avcodec/hcom: Check the root entry and the right entries

2019-10-07 Thread Michael Niedermayer
Fixes: Segfault
Fixes: 
17991/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCOM_fuzzer-5647235349479424

Also fixes related memleak

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

diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c
index 0559b050c3..8300676f98 100644
--- a/libavcodec/hcom.c
+++ b/libavcodec/hcom.c
@@ -66,8 +66,15 @@ static av_cold int hcom_init(AVCodecContext *avctx)
 s->dict[i].r = AV_RB16(avctx->extradata + 6 + 4 * i + 2);
 if (s->dict[i].l >= 0 &&
 (s->dict[i].l >= s->dict_entries ||
- s->dict[i].r >= s->dict_entries))
+ s->dict[i].r >= s->dict_entries ||
+ s->dict[i].r < 0 )) {
+av_freep(&s->dict);
 return AVERROR_INVALIDDATA;
+}
+}
+if (s->dict[0].l < 0) {
+av_freep(&s->dict);
+return AVERROR_INVALIDDATA;
 }
 
 avctx->sample_fmt = AV_SAMPLE_FMT_U8;
-- 
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 v1] doc/developer: make clear for the patch processing time

2019-10-07 Thread Andriy Gelman
On Tue, 08. Oct 00:07, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  doc/developer.texi | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/developer.texi b/doc/developer.texi
> index 5c342c9..698a814 100644
> --- a/doc/developer.texi
> +++ b/doc/developer.texi
> @@ -497,8 +497,12 @@ incorporates the requests from the review. This process 
> may go through
>  several iterations. Once your patch is deemed good enough, some developer
>  will pick it up and commit it to the official FFmpeg tree.
>  
> -Give us a few days to react. But if some time passes without reaction,
> -send a reminder by email. Your patch should eventually be dealt with.
> +Give us a few days to react. But if ten days passes without reaction,
> +send a reminder by email. If ten days passes without reaction still,
> +send a ping reminder by email again. If one more week passes without
> +reaction, your patch is rejected most likely if you're not maintainer,
> +because no one will handle it. Although you can continue to send reminder
> +emails.

Maybe you can ping the individual maintainers and ask them to review your
patches?

I've been following the list for a bit of time and it seems that mem leaks,
seg faults and documentation always get merged. Anything else is tough because
there are just not enough reviewers.

You could help by reviewing other people's patches. That's a good way to
build traction with the community. Hopefully people will review your patches in
return.

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

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

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter/vf_scenechangedetect: add filter to detect scene change

2019-10-07 Thread Paul B Mahol
Too long filter name.

On 10/7/19, Limin Wang  wrote:
>
> ping, please give comments.
>
> On Sun, Sep 29, 2019 at 09:25:12PM +0800, lance.lmw...@gmail.com wrote:
>> From: Limin Wang 
>>
>> Signed-off-by: Limin Wang 
>> ---
>> Please provide a comment to add a new filter for scene change detection to
>> avoid
>> multiple calculations of mafd in the filter chain. The filter can avoid
>> duplication
>> code also for I am writing a new filter to synchronize frames that require
>> scene
>> change information. If the detect metadata can get, the code will be
>> simple.
>>
>> In addition, I'm trying  to add a reduced size before scene change
>> detection to improve
>> the performance. From the initial test, we can only get 10-20%
>> improvement, but some
>> scene change aren't detected after that. Therefore, I think that should
>> not be done.
>>
>> This version, I removed the version change for it's easy to cause code
>> conflict,
>> please the committer help to update it if review done.
>>
>>  configure  |   1 +
>>  doc/filters.texi   |  35 +
>>  libavfilter/Makefile   |   1 +
>>  libavfilter/allfilters.c   |   1 +
>>  libavfilter/vf_scenechangedetect.c | 220 +
>>  5 files changed, 258 insertions(+)
>>  create mode 100644 libavfilter/vf_scenechangedetect.c
>>
>> diff --git a/configure b/configure
>> index 8413826f9e..909a77b9cf 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3520,6 +3520,7 @@ sab_filter_deps="gpl swscale"
>>  scale2ref_filter_deps="swscale"
>>  scale_filter_deps="swscale"
>>  scale_qsv_filter_deps="libmfx"
>> +scenechangedetect_filter_select="scene_sad"
>>  select_filter_select="scene_sad"
>>  sharpness_vaapi_filter_deps="vaapi"
>>  showcqt_filter_deps="avcodec avformat swscale"
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index e6f8bf0ee9..f9247643cb 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -15642,6 +15642,41 @@ Scale a logo to 1/10th the height of a video,
>> while preserving its display aspec
>>  @end example
>>  @end itemize
>>
>> +@anchor{scenechangedetect}
>> +@section scenechangedetect
>> +
>> +Detect video scene change.
>> +
>> +This filter sets frame metadata with mafd between frame, the scene score,
>> and
>> +forward the frame to the next filter, so they can use these metadata to
>> detect
>> +scene change or others.
>> +
>> +In addition, this filter logs a message and sets frame metadata when it
>> detects
>> +a scene change by @option{threshold}.
>> +
>> +@code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
>> +
>> +@code{lavfi.scd.score} metadata keys are set with scene change score for
>> every frame
>> +to detect scene change.
>> +
>> +@code{lavfi.scd.time} metadata keys are set with current filtered frame
>> time which
>> +detect scene change with @option{threshold}.
>> +
>> +The filter accepts the following options:
>> +
>> +@table @option
>> +@item threshold, t
>> +Set the scene change detection threshold as a percentage of maximum
>> change.  Good
>> +values are in the @code{[8.0, 14.0]} range. The range for
>> @option{threshold} is
>> +@code{[0., 100.]}.
>> +
>> +Default value is @code{10.}.
>> +
>> +@item sc_pass, s
>> +Set the scene change pass the frame to the next filter or not. Default
>> value is @code{0}
>> +You can enable it if you want to get snapshot of scene change frames.
>> +@end table
>> +
>>  @anchor{selectivecolor}
>>  @section selectivecolor
>>
>> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> index b99ecc8c26..f6c6ba5d45 100644
>> --- a/libavfilter/Makefile
>> +++ b/libavfilter/Makefile
>> @@ -356,6 +356,7 @@ OBJS-$(CONFIG_SCALE_NPP_FILTER)  +=
>> vf_scale_npp.o scale.o
>>  OBJS-$(CONFIG_SCALE_QSV_FILTER)  += vf_scale_qsv.o
>>  OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o
>> vaapi_vpp.o
>>  OBJS-$(CONFIG_SCALE2REF_FILTER)  += vf_scale.o scale.o
>> +OBJS-$(CONFIG_SCENECHANGEDETECT_FILTER)  += vf_scenechangedetect.o
>>  OBJS-$(CONFIG_SELECT_FILTER) += f_select.o
>>  OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
>>  OBJS-$(CONFIG_SENDCMD_FILTER)+= f_sendcmd.o
>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> index 788652ab1e..69a4d5e8e5 100644
>> --- a/libavfilter/allfilters.c
>> +++ b/libavfilter/allfilters.c
>> @@ -338,6 +338,7 @@ extern AVFilter ff_vf_scale_npp;
>>  extern AVFilter ff_vf_scale_qsv;
>>  extern AVFilter ff_vf_scale_vaapi;
>>  extern AVFilter ff_vf_scale2ref;
>> +extern AVFilter ff_vf_scenechangedetect;
>>  extern AVFilter ff_vf_select;
>>  extern AVFilter ff_vf_selectivecolor;
>>  extern AVFilter ff_vf_sendcmd;
>> diff --git a/libavfilter/vf_scenechangedetect.c
>> b/libavfilter/vf_scenechangedetect.c
>> new file mode 100644
>> index 00..269fa399d0
>> --- /dev/null
>> +++ b/libavfilter/vf_scenechangedetect.c
>> @@ -0,0 +1,220 @@
>> +/*

Re: [FFmpeg-devel] [PATCH] avcodec/filter: Remove extra '; ' outside of functions

2019-10-07 Thread Paul B Mahol
applied

On 10/7/19, Paul B Mahol  wrote:
> ok
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_delogo: make the interp value compute method simple

2019-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2019 at 01:12:46PM +0800, Steven Liu wrote:
> because the interp >= 0UL comparison of an unsigned value is always true
> fix CID: 1454642
> 
> Signed-off-by: Steven Liu 
> ---
>  libavfilter/vf_delogo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

this changes fate-filter-delogo, if thats intended it needs to be updated

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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

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

2019-10-07 Thread Vittorio Giovara
this seems good to me, unless objections i'll merge it in 24h

On Mon, Oct 7, 2019 at 11:10 AM Raphaël Zumer  wrote:

> Just sending a reminder for my set of patches (the set of v2 patches up
> in the thread and this one). Are there any further comments?
>
> Thanks
> Raphaël Zumer
>
> On Wed, 2019-10-02 at 09:04 -0400, Raphaël Zumer wrote:
> > There is no change in the encoded bitstream, but this
> > ensures that the written field length is consistent
> > with the reference implementation.
> >
> > Unused bytes are zeroed out for backwards compatibility.
> >
> > 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 ae461a872b..eb70421c44 100644
> > --- a/libavformat/ivfenc.c
> > +++ b/libavformat/ivfenc.c
> > @@ -84,7 +84,8 @@ static int ivf_write_trailer(AVFormatContext *s)
> >
> >  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_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> > >frame_cnt - 1));
> > +avio_wl32(pb, 0); // zero out unused bytes
> >  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".



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

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

Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly

2019-10-07 Thread Derek Buitenhuis
On 07/10/2019 16:06, Matthieu Bouron wrote:
> Ping.
> 

No objections from me.

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

[FFmpeg-devel] [PATCH v1] avcodec/h264_parse: decode sps before pps Fix ticket #6422 The content put pps before sps, which is not a common case. The change just put decoding sps before pps, just for c

2019-10-07 Thread Jun Li
Signed-off-by: Jun Li 
---
 libavcodec/h264_parse.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index 352ffea948..26aaa751ad 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -373,35 +373,36 @@ static int decode_extradata_ps(const uint8_t *data, int 
size, H264ParamSets *ps,
 goto fail;
 }
 
-for (i = 0; i < pkt.nb_nals; i++) {
+/* decode sps before pps, just in case some bitstream put pps before sps. 
*/
+for(i = 0; i < pkt.nb_nals; i++) {
 H2645NAL *nal = &pkt.nals[i];
-switch (nal->type) {
-case H264_NAL_SPS: {
+if (nal->type == H264_NAL_SPS) {
 GetBitContext tmp_gb = nal->gb;
 ret = ff_h264_decode_seq_parameter_set(&tmp_gb, logctx, ps, 0);
 if (ret >= 0)
-break;
+continue;
 av_log(logctx, AV_LOG_DEBUG,
"SPS decoding failure, trying again with the complete 
NAL\n");
 init_get_bits8(&tmp_gb, nal->raw_data + 1, nal->raw_size - 1);
 ret = ff_h264_decode_seq_parameter_set(&tmp_gb, logctx, ps, 0);
 if (ret >= 0)
-break;
+continue;
 ret = ff_h264_decode_seq_parameter_set(&nal->gb, logctx, ps, 1);
 if (ret < 0)
 goto fail;
-break;
 }
-case H264_NAL_PPS:
+}
+
+for (i = 0; i < pkt.nb_nals; i++) {
+H2645NAL *nal = &pkt.nals[i];
+if (nal->type == H264_NAL_PPS) {
 ret = ff_h264_decode_picture_parameter_set(&nal->gb, logctx, ps,
nal->size_bits);
 if (ret < 0)
 goto fail;
-break;
-default:
+} else if (nal->type != H264_NAL_SPS) {
 av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in 
extradata\n",
nal->type);
-break;
 }
 }
 
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH v1] avcodec/h264_parse: decode sps before pps

2019-10-07 Thread Jun Li
Fix ticket #6422
The content put pps before sps, which is not a common case. The change
just put decoding sps before pps, just for compability.

Signed-off-by: Jun Li 
---
 libavcodec/h264_parse.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index 352ffea948..26aaa751ad 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -373,35 +373,36 @@ static int decode_extradata_ps(const uint8_t *data, int 
size, H264ParamSets *ps,
 goto fail;
 }
 
-for (i = 0; i < pkt.nb_nals; i++) {
+/* decode sps before pps, just in case some bitstream put pps before sps. 
*/
+for(i = 0; i < pkt.nb_nals; i++) {
 H2645NAL *nal = &pkt.nals[i];
-switch (nal->type) {
-case H264_NAL_SPS: {
+if (nal->type == H264_NAL_SPS) {
 GetBitContext tmp_gb = nal->gb;
 ret = ff_h264_decode_seq_parameter_set(&tmp_gb, logctx, ps, 0);
 if (ret >= 0)
-break;
+continue;
 av_log(logctx, AV_LOG_DEBUG,
"SPS decoding failure, trying again with the complete 
NAL\n");
 init_get_bits8(&tmp_gb, nal->raw_data + 1, nal->raw_size - 1);
 ret = ff_h264_decode_seq_parameter_set(&tmp_gb, logctx, ps, 0);
 if (ret >= 0)
-break;
+continue;
 ret = ff_h264_decode_seq_parameter_set(&nal->gb, logctx, ps, 1);
 if (ret < 0)
 goto fail;
-break;
 }
-case H264_NAL_PPS:
+}
+
+for (i = 0; i < pkt.nb_nals; i++) {
+H2645NAL *nal = &pkt.nals[i];
+if (nal->type == H264_NAL_PPS) {
 ret = ff_h264_decode_picture_parameter_set(&nal->gb, logctx, ps,
nal->size_bits);
 if (ret < 0)
 goto fail;
-break;
-default:
+} else if (nal->type != H264_NAL_SPS) {
 av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in 
extradata\n",
nal->type);
-break;
 }
 }
 
-- 
2.17.1

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

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

Re: [FFmpeg-devel] [PATCH v1] avformat/tee.c: steal bsf option before passing to fifo muxer

2019-10-07 Thread Dennis Mungai
On Mon, 7 Oct 2019 at 08:26, Liu Steven  wrote:
>
>
>
> > 在 2019年10月6日,上午11:37,Jun Li  写道:
> >
> > Fix #7620
> > In the case tee muxer with both "bsf" and "use_fifo" parameters
> > wil trigger this bug. Tee muxer will first steal parameters (like "f",
> > "select"...) and then "use_fifo" will try reading out remaining options
> > and pass them to fifo as option "format_options".
> > Current code miss the part of stealing "bsf" options.
> > ---
> > libavformat/tee.c | 12 +---
> > 1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavformat/tee.c b/libavformat/tee.c
> > index 89a4ceb280..3530582dbd 100644
> > --- a/libavformat/tee.c
> > +++ b/libavformat/tee.c
> > @@ -159,7 +159,7 @@ static void close_slaves(AVFormatContext *avf)
> > static int open_slave(AVFormatContext *avf, char *slave, TeeSlave 
> > *tee_slave)
> > {
> > int i, ret;
> > -AVDictionary *options = NULL;
> > +AVDictionary *options = NULL, *bsf_options = NULL;
> > AVDictionaryEntry *entry;
> > char *filename;
> > char *format = NULL, *select = NULL, *on_fail = NULL;
> > @@ -186,6 +186,11 @@ static int open_slave(AVFormatContext *avf, char 
> > *slave, TeeSlave *tee_slave)
> > STEAL_OPTION("onfail", on_fail);
> > STEAL_OPTION("use_fifo", use_fifo);
> > STEAL_OPTION("fifo_options", fifo_options_str);
> > +entry = NULL;
> > +while ((entry = av_dict_get(options, "bsfs", entry, 
> > AV_DICT_IGNORE_SUFFIX))) {
> > +av_dict_set(&bsf_options, entry->key, entry->value, 0);
> > +av_dict_set(&options, entry->key, NULL, 0);
> > +}
> >
> > ret = parse_slave_failure_policy_option(on_fail, tee_slave);
> > if (ret < 0) {
> > @@ -311,7 +316,7 @@ static int open_slave(AVFormatContext *avf, char 
> > *slave, TeeSlave *tee_slave)
> > }
> >
> > entry = NULL;
> > -while (entry = av_dict_get(options, "bsfs", NULL, 
> > AV_DICT_IGNORE_SUFFIX)) {
> > +while (entry = av_dict_get(bsf_options, "bsfs", NULL, 
> > AV_DICT_IGNORE_SUFFIX)) {
> > const char *spec = entry->key + strlen("bsfs");
> > if (*spec) {
> > if (strspn(spec, slave_bsfs_spec_sep) != 1) {
> > @@ -352,7 +357,7 @@ static int open_slave(AVFormatContext *avf, char 
> > *slave, TeeSlave *tee_slave)
> > }
> > }
> >
> > -av_dict_set(&options, entry->key, NULL, 0);
> > +av_dict_set(&bsf_options, entry->key, NULL, 0);
> > }
> >
> > for (i = 0; i < avf->nb_streams; i++){
> > @@ -399,6 +404,7 @@ end:
> > av_free(select);
> > av_free(on_fail);
> > av_dict_free(&options);
> > +av_dict_free(&bsf_options);
> > av_freep(&tmp_select);
> > return ret;
> > }
> > --
> > 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”.
>
> should be ok
>
>
> Thanks
> Steven
>
>
>
Generating valid HLS + DASH streams using fragmented mp4 should be
much easier now, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter/vf_scenechangedetect: add filter to detect scene change

2019-10-07 Thread Limin Wang
On Mon, Oct 07, 2019 at 09:00:10PM +0200, Paul B Mahol wrote:

> Too long filter name.
Yes, the name is too long, how about to use scdetect?  If it's OK, I'll
update the patch.

> 
> On 10/7/19, Limin Wang  wrote:
> >
> > ping, please give comments.
> >
> > On Sun, Sep 29, 2019 at 09:25:12PM +0800, lance.lmw...@gmail.com wrote:
> >> From: Limin Wang 
> >>
> >> Signed-off-by: Limin Wang 
> >> ---
> >> Please provide a comment to add a new filter for scene change detection to
> >> avoid
> >> multiple calculations of mafd in the filter chain. The filter can avoid
> >> duplication
> >> code also for I am writing a new filter to synchronize frames that require
> >> scene
> >> change information. If the detect metadata can get, the code will be
> >> simple.
> >>
> >> In addition, I'm trying  to add a reduced size before scene change
> >> detection to improve
> >> the performance. From the initial test, we can only get 10-20%
> >> improvement, but some
> >> scene change aren't detected after that. Therefore, I think that should
> >> not be done.
> >>
> >> This version, I removed the version change for it's easy to cause code
> >> conflict,
> >> please the committer help to update it if review done.
> >>
> >>  configure  |   1 +
> >>  doc/filters.texi   |  35 +
> >>  libavfilter/Makefile   |   1 +
> >>  libavfilter/allfilters.c   |   1 +
> >>  libavfilter/vf_scenechangedetect.c | 220 +
> >>  5 files changed, 258 insertions(+)
> >>  create mode 100644 libavfilter/vf_scenechangedetect.c
> >>
> >> diff --git a/configure b/configure
> >> index 8413826f9e..909a77b9cf 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -3520,6 +3520,7 @@ sab_filter_deps="gpl swscale"
> >>  scale2ref_filter_deps="swscale"
> >>  scale_filter_deps="swscale"
> >>  scale_qsv_filter_deps="libmfx"
> >> +scenechangedetect_filter_select="scene_sad"
> >>  select_filter_select="scene_sad"
> >>  sharpness_vaapi_filter_deps="vaapi"
> >>  showcqt_filter_deps="avcodec avformat swscale"
> >> diff --git a/doc/filters.texi b/doc/filters.texi
> >> index e6f8bf0ee9..f9247643cb 100644
> >> --- a/doc/filters.texi
> >> +++ b/doc/filters.texi
> >> @@ -15642,6 +15642,41 @@ Scale a logo to 1/10th the height of a video,
> >> while preserving its display aspec
> >>  @end example
> >>  @end itemize
> >>
> >> +@anchor{scenechangedetect}
> >> +@section scenechangedetect
> >> +
> >> +Detect video scene change.
> >> +
> >> +This filter sets frame metadata with mafd between frame, the scene score,
> >> and
> >> +forward the frame to the next filter, so they can use these metadata to
> >> detect
> >> +scene change or others.
> >> +
> >> +In addition, this filter logs a message and sets frame metadata when it
> >> detects
> >> +a scene change by @option{threshold}.
> >> +
> >> +@code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
> >> +
> >> +@code{lavfi.scd.score} metadata keys are set with scene change score for
> >> every frame
> >> +to detect scene change.
> >> +
> >> +@code{lavfi.scd.time} metadata keys are set with current filtered frame
> >> time which
> >> +detect scene change with @option{threshold}.
> >> +
> >> +The filter accepts the following options:
> >> +
> >> +@table @option
> >> +@item threshold, t
> >> +Set the scene change detection threshold as a percentage of maximum
> >> change.  Good
> >> +values are in the @code{[8.0, 14.0]} range. The range for
> >> @option{threshold} is
> >> +@code{[0., 100.]}.
> >> +
> >> +Default value is @code{10.}.
> >> +
> >> +@item sc_pass, s
> >> +Set the scene change pass the frame to the next filter or not. Default
> >> value is @code{0}
> >> +You can enable it if you want to get snapshot of scene change frames.
> >> +@end table
> >> +
> >>  @anchor{selectivecolor}
> >>  @section selectivecolor
> >>
> >> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> >> index b99ecc8c26..f6c6ba5d45 100644
> >> --- a/libavfilter/Makefile
> >> +++ b/libavfilter/Makefile
> >> @@ -356,6 +356,7 @@ OBJS-$(CONFIG_SCALE_NPP_FILTER)  +=
> >> vf_scale_npp.o scale.o
> >>  OBJS-$(CONFIG_SCALE_QSV_FILTER)  += vf_scale_qsv.o
> >>  OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o
> >> vaapi_vpp.o
> >>  OBJS-$(CONFIG_SCALE2REF_FILTER)  += vf_scale.o scale.o
> >> +OBJS-$(CONFIG_SCENECHANGEDETECT_FILTER)  += vf_scenechangedetect.o
> >>  OBJS-$(CONFIG_SELECT_FILTER) += f_select.o
> >>  OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
> >>  OBJS-$(CONFIG_SENDCMD_FILTER)+= f_sendcmd.o
> >> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> >> index 788652ab1e..69a4d5e8e5 100644
> >> --- a/libavfilter/allfilters.c
> >> +++ b/libavfilter/allfilters.c
> >> @@ -338,6 +338,7 @@ extern AVFilter ff_vf_scale_npp;
> >>  extern AVFilter ff_vf_scale_qsv;
> >>  extern AVFilter ff_vf_scale_vaapi;
> >>  extern AVFilter

Re: [FFmpeg-devel] [PATCH V1 2/2] lavfi/hqdn3d: add slice thread optionmation

2019-10-07 Thread myp...@gmail.com
On Sun, Oct 6, 2019 at 2:09 AM Moritz Barsnick  wrote:
>
> On Thu, Oct 03, 2019 at 09:53:16 +0800, Jun Zhao wrote:
> > From: Jun Zhao 
> > Subject: [PATCH V1 2/2] lavfi/hqdn3d: add slice thread optionmation
>
> Nit: big typo in the first line of your commit message.
>
> Moritz
Will fix the typo, thx
___
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/3] avcodec/decode: fix identation

2019-10-07 Thread myp...@gmail.com
On Fri, Oct 4, 2019 at 10:23 PM Gyan  wrote:
>
>
>
> On 04-10-2019 07:06 PM, Jun Zhao wrote:
> > From: Jun Zhao 
> >
> > fix identation.
>
> indentation
>
> >
> > Signed-off-by: Jun Zhao 
> > ---
> >   libavcodec/decode.c |2 +-
> >   1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > index 0818475..a7b37c6 100644
> > --- a/libavcodec/decode.c
> > +++ b/libavcodec/decode.c
> > @@ -785,7 +785,7 @@ int attribute_align_arg 
> > avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
> >   if (avctx->frame_number > 1) {
> >   changed = avci->initial_format != frame->format;
> >
> > -   switch(avctx->codec_type) {
> > +switch(avctx->codec_type) {
> >   case AVMEDIA_TYPE_VIDEO:
> >   changed |= avci->initial_width  != frame->width ||
> >  avci->initial_height != frame->height;
>
> LGTM.
>
> Gyan
Fixed the typo and aplied
___
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 2/3] lavc/options_table: Correct the flags for AVCodecContext.flags2

2019-10-07 Thread myp...@gmail.com
On Sat, Oct 5, 2019 at 9:44 PM Michael Niedermayer
 wrote:
>
> On Fri, Oct 04, 2019 at 09:36:54PM +0800, Jun Zhao wrote:
> > From: Jun Zhao 
> >
> > Correct the flags for AVCodecContext.flags2.
> >
> > Signed-off-by: Jun Zhao 
> > ---
> >  libavcodec/options_table.h |4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
>
> LGTM
>
> thx
>
Applied, thx
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

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

2019-10-07 Thread 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)

Signed-off-by: Jun Li 
---
 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 715bec1c2f..5dc2a19c3c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5750,7 +5750,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
@@ -5764,11 +5765,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_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;
+}
+}
 }
 }
 
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 0042902161..4c2b34c431 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -34,6 +34,12 @@ fate-sub-movtext: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/MovText_capabilit
 FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc
 fate-binsub-movtextenc: CMD = md5 -i 
$(TARGET_SAMPLES)/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f 
mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov
 
+FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc-long-dur
+fate-binsub-movtextenc-long-dur: CMD = md5 -i 
$(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text -f 
mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov
+
+FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += 
fate-binsub-movtextenc-long-dur-timebase
+fate-binsub-movtextenc-long-dur-timebase: CMD = md5 -i 
$(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text 
-time_base 1000 -f mp4 -flags +bitexact -fflags +bitexact -movflags 
frag_keyframe+empty_moov
+
 FATE_SUBTITLES_ASS-$(call DEMDEC, MPL2, MPL2) += fate-sub-mpl2
 fate-sub-mpl2: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/MPL2_capability_tester.txt
 
diff --git a/tests/ref/fate/binsub-movtextenc-long-dur 
b/tests/ref/fate/binsub-movtextenc-long-dur
new file mode 100644
index 00..eb8a3f8fc7
--- /dev/null
+++ b/tests/ref/fate/binsub-movtextenc-long-dur
@@ -0,0 +1 @@
+7f78c11bb4a6b16335540ef31ba10219
diff --git a/tests/ref/fate/binsub-movtextenc-long-dur-timebase 
b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
new file mode 100644
index 00..185dcc0aab
--- /dev/null
+++ b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
@@ -0,0 +1 @@
+349d78698cc1226d33d4e6699dbf46d9
-- 
2.17.1

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

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

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

2019-10-07 Thread Jun Li
On Mon, Oct 7, 2019 at 6:34 PM Jun Li  wrote:

> 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)
>
> Signed-off-by: Jun Li 
> ---
>  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 715bec1c2f..5dc2a19c3c 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5750,7 +5750,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
> @@ -5764,11 +5765,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_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;
> +}
> +}
>  }
>  }
>
> diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
> index 0042902161..4c2b34c431 100644
> --- a/tests/fate/subtitles.mak
> +++ b/tests/fate/subtitles.mak
> @@ -34,6 +34,12 @@ fate-sub-movtext: CMD = fmtstdout ass -i
> $(TARGET_SAMPLES)/sub/MovText_capabilit
>  FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc
>  fate-binsub-movtextenc: CMD = md5 -i
> $(TARGET_SAMPLES)/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text
> -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov
>
> +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
> fate-binsub-movtextenc-long-dur
> +fate-binsub-movtextenc-long-dur: CMD = md5 -i
> $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
> -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov
> +
> +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
> fate-binsub-movtextenc-long-dur-timebase
> +fate-binsub-movtextenc-long-dur-timebase: CMD = md5 -i
> $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
> -time_base 1000 -f mp4 -flags +bitexact -fflags +bitexact -movflags
> frag_keyframe+empty_moov
> +
>  FATE_SUBTITLES_ASS-$(call DEMDEC, MPL2, MPL2) += fate-sub-mpl2
>  fate-sub-mpl2: CMD = fmtstdout ass -i
> $(TARGET_SAMPLES)/sub/MPL2_capability_tester.txt
>
> diff --git a/tests/ref/fate/binsub-movtextenc-long-dur
> b/tests/ref/fate/binsub-movtextenc-long-dur
> new file mode 100644
> index 00..eb8a3f8fc7
> --- /dev/null
> +++ b/tests/ref/fate/binsub-movtextenc-long-dur
> @@ -0,0 +1 @@
> +7f78c11bb4a6b16335540ef31ba10219
> diff --git a/tests/ref/fate/binsub-movtextenc-long-dur-timebase
> b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
> new file mode 100644
> index 00..185dcc0aab
> --- /dev/null
> +++ b/tests/ref/fate/binsub-movtextenc-long-dur-timebase
> @@ -0,0 +1 @@
> +349d78698cc1226d33d4e6699dbf46d9
> --
> 2.17.1
>
>
Test file attached.
WEBVTT

00:35:47.484 --> 00:35:50.000
Durations that exceed the signed
int max value break the program

00:40:47.484 --> 00:40:50.00

Re: [FFmpeg-devel] [PATCH V1 1/2] avutil/common: Fix underflow for ROUNDED_DIV with unsigned integer

2019-10-07 Thread myp...@gmail.com
On Sat, Oct 5, 2019 at 10:16 PM Michael Niedermayer
 wrote:
>
> On Thu, Oct 03, 2019 at 09:53:15AM +0800, Jun Zhao wrote:
> > From: Mengye Lv 
> >
> > When used ROUNDED_DIV(a,b), if a is unsigned integer zero, it's
> > will lead to an underflow issue(it called unsigned integer
> > wrapping).
> >
> > Fixes #8062
> >
> > Signed-off-by: Mengye Lv 
> > Signed-off-by: Jun Zhao 
> > ---
> >  libavutil/common.h |2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
>
> LGTM
>
> thx
>
Applied, Thx
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_delogo: make the interp value compute method simple

2019-10-07 Thread myp...@gmail.com
On Mon, Oct 7, 2019 at 11:14 PM Limin Wang  wrote:
>
> On Mon, Oct 07, 2019 at 01:12:46PM +0800, Steven Liu wrote:
> > because the interp >= 0UL comparison of an unsigned value is always true
> > fix CID: 1454642
> >
> > Signed-off-by: Steven Liu 
> > ---
> >  libavfilter/vf_delogo.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
> > index 376c5e850f..3678548353 100644
> > --- a/libavfilter/vf_delogo.c
> > +++ b/libavfilter/vf_delogo.c
> > @@ -168,7 +168,7 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
> >   botleft[x-logo_x1-1]  +
> >   botleft[x-logo_x1+1]) * weightb;
> >  weight = (weightl + weightr + weightt + weightb) * 3U;
> > -interp = ROUNDED_DIV(interp, weight);
> > +interp = (interp + weight >> 1) / weight;
>
> By the macros definition:
> #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
>
I've update the ROUNDED_DIV to:
#define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) -
((b)>>1))/(b)), I guess
you didn't update the code with this change
> I feel it should be:
> interp = (interp - weight >> 1) / weight;
>
> instead of:
> interp = (interp + weight >> 1) / weight;
>

> 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 v1] avcodec/h264_parse: decode sps before pps

2019-10-07 Thread Fu, Linjie
> -Original Message-
> From: ffmpeg-devel  On Behalf Of Jun
> Li
> Sent: Tuesday, October 8, 2019 05:42
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v1] avcodec/h264_parse: decode sps
> before pps
> 
> Fix ticket #6422
> The content put pps before sps, which is not a common case. The change
> just put decoding sps before pps, just for compability.
> 
> Signed-off-by: Jun Li 
> ---
>  libavcodec/h264_parse.c | 21 +++--
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
> index 352ffea948..26aaa751ad 100644
> --- a/libavcodec/h264_parse.c
> +++ b/libavcodec/h264_parse.c
> @@ -373,35 +373,36 @@ static int decode_extradata_ps(const uint8_t *data,
> int size, H264ParamSets *ps,
>  goto fail;
>  }
> 
> -for (i = 0; i < pkt.nb_nals; i++) {
> +/* decode sps before pps, just in case some bitstream put pps before sps.
> */
> +for(i = 0; i < pkt.nb_nals; i++) {

Nit: Missing space here.

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

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

Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_delogo: make the interp value compute method simple

2019-10-07 Thread Limin Wang
On Tue, Oct 08, 2019 at 10:47:56AM +0800, myp...@gmail.com wrote:
> On Mon, Oct 7, 2019 at 11:14 PM Limin Wang  wrote:
> >
> > On Mon, Oct 07, 2019 at 01:12:46PM +0800, Steven Liu wrote:
> > > because the interp >= 0UL comparison of an unsigned value is always true
> > > fix CID: 1454642
> > >
> > > Signed-off-by: Steven Liu 
> > > ---
> > >  libavfilter/vf_delogo.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
> > > index 376c5e850f..3678548353 100644
> > > --- a/libavfilter/vf_delogo.c
> > > +++ b/libavfilter/vf_delogo.c
> > > @@ -168,7 +168,7 @@ static void apply_delogo(uint8_t *dst, int 
> > > dst_linesize,
> > >   botleft[x-logo_x1-1]  +
> > >   botleft[x-logo_x1+1]) * weightb;
> > >  weight = (weightl + weightr + weightt + weightb) * 3U;
> > > -interp = ROUNDED_DIV(interp, weight);
> > > +interp = (interp + weight >> 1) / weight;
> >
> > By the macros definition:
> > #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
> >
> I've update the ROUNDED_DIV to:
> #define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) -
> ((b)>>1))/(b)), I guess
> you didn't update the code with this change

Yeah, I'll fetch and update master.

> > I feel it should be:
> > interp = (interp - weight >> 1) / weight;
> >
> > instead of:
> > interp = (interp + weight >> 1) / weight;
> >
> 
> > 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 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] avcodec/h264_parse: decode sps before pps

2019-10-07 Thread Jun Li
On Mon, Oct 7, 2019 at 7:50 PM Fu, Linjie  wrote:

> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Jun
> > Li
> > Sent: Tuesday, October 8, 2019 05:42
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH v1] avcodec/h264_parse: decode sps
> > before pps
> >
> > Fix ticket #6422
> > The content put pps before sps, which is not a common case. The change
> > just put decoding sps before pps, just for compability.
> >
> > Signed-off-by: Jun Li 
> > ---
> >  libavcodec/h264_parse.c | 21 +++--
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
> > index 352ffea948..26aaa751ad 100644
> > --- a/libavcodec/h264_parse.c
> > +++ b/libavcodec/h264_parse.c
> > @@ -373,35 +373,36 @@ static int decode_extradata_ps(const uint8_t *data,
> > int size, H264ParamSets *ps,
> >  goto fail;
> >  }
> >
> > -for (i = 0; i < pkt.nb_nals; i++) {
> > +/* decode sps before pps, just in case some bitstream put pps
> before sps.
> > */
> > +for(i = 0; i < pkt.nb_nals; i++) {
>
> Nit: Missing space here.


Thanks, will fix in next iteration.


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

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

[FFmpeg-devel] [PATCH v2] avcodec/h264_parse: decode sps before pps

2019-10-07 Thread Jun Li
Fix ticket #6422
The content put pps before sps, which is not a common case. The change
put decoding sps before pps, just for compability.

Signed-off-by: Jun Li 
---
 libavcodec/h264_parse.c | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index 352ffea948..eeda5a76e5 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -373,35 +373,36 @@ static int decode_extradata_ps(const uint8_t *data, int 
size, H264ParamSets *ps,
 goto fail;
 }
 
+/* decode sps before pps, just in case some bitstream put pps before sps. 
*/
 for (i = 0; i < pkt.nb_nals; i++) {
 H2645NAL *nal = &pkt.nals[i];
-switch (nal->type) {
-case H264_NAL_SPS: {
+if (nal->type == H264_NAL_SPS) {
 GetBitContext tmp_gb = nal->gb;
 ret = ff_h264_decode_seq_parameter_set(&tmp_gb, logctx, ps, 0);
 if (ret >= 0)
-break;
+continue;
 av_log(logctx, AV_LOG_DEBUG,
"SPS decoding failure, trying again with the complete 
NAL\n");
 init_get_bits8(&tmp_gb, nal->raw_data + 1, nal->raw_size - 1);
 ret = ff_h264_decode_seq_parameter_set(&tmp_gb, logctx, ps, 0);
 if (ret >= 0)
-break;
+continue;
 ret = ff_h264_decode_seq_parameter_set(&nal->gb, logctx, ps, 1);
 if (ret < 0)
 goto fail;
-break;
 }
-case H264_NAL_PPS:
+}
+
+for (i = 0; i < pkt.nb_nals; i++) {
+H2645NAL *nal = &pkt.nals[i];
+if (nal->type == H264_NAL_PPS) {
 ret = ff_h264_decode_picture_parameter_set(&nal->gb, logctx, ps,
nal->size_bits);
 if (ret < 0)
 goto fail;
-break;
-default:
+} else if (nal->type != H264_NAL_SPS) {
 av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in 
extradata\n",
nal->type);
-break;
 }
 }
 
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH v3] avfilter/vf_delogo: make the interp value compute method simple

2019-10-07 Thread Steven Liu
because the interp >= 0UL comparison of an unsigned value is always true
fix CID: 1454642

Signed-off-by: Steven Liu 
---
 libavfilter/vf_delogo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 376c5e850f..a268b3e9b3 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -168,7 +168,7 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
  botleft[x-logo_x1-1]  +
  botleft[x-logo_x1+1]) * weightb;
 weight = (weightl + weightr + weightt + weightb) * 3U;
-interp = ROUNDED_DIV(interp, weight);
+interp = (interp + (weight >> 1)) / weight;
 
 if (y >= logo_y+band && y < logo_y+logo_h-band &&
 x >= logo_x+band && x < logo_x+logo_w-band) {
-- 
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] avfilter/vf_freezedetect: add discard option to force drop freezen frame

2019-10-07 Thread lance . lmwang
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:discard=0"  -f 
null -
frame=  150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed= 234x

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

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

diff --git a/doc/filters.texi b/doc/filters.texi
index 333f502083..8aa7471f7e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10678,6 +10678,9 @@ 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 freezen frames instead of report
+by metadata. Please note the first few freezen frames (the detection interval)
+won't be dropped for the filter doesn't buffer any frames.
 
 The filter accepts the following options:
 
@@ -10689,6 +10692,13 @@ 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 discard
+Set force to discard freezen frame.
+ 0:  do nothing
+ 1:  discard freezen frame
+
+Default is 0
 @end table
 
 @anchor{frei0r}
diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c
index cc086afee6..cc115eb521 100644
--- a/libavfilter/vf_freezedetect.c
+++ b/libavfilter/vf_freezedetect.c
@@ -45,6 +45,8 @@ typedef struct FreezeDetectContext {
 
 double noise;
 int64_t duration;///< minimum duration of frozen frame until 
notification
+
+int discard; ///< 0: no discard, 1: discard freezen frame
 } FreezeDetectContext;
 
 #define OFFSET(x) offsetof(FreezeDetectContext, x)
@@ -56,6 +58,7 @@ 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 },
+{ "discard", "set frame discard flag", 
OFFSET(discard),   AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, V|F },
 
 {NULL}
 };
@@ -196,7 +199,10 @@ static int activate(AVFilterContext *ctx)
 return AVERROR(ENOMEM);
 }
 }
-return ff_filter_frame(outlink, frame);
+if (s->discard && s->frozen) {
+av_frame_free(&frame);
+} else
+return ff_filter_frame(outlink, frame);
 }
 
 FF_FILTER_FORWARD_STATUS(inlink, outlink);
-- 
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 v2] avfilter/vf_freezedetect: add discard option to force drop freezen frame

2019-10-07 Thread Gyan



On 08-10-2019 09:24 AM, 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:discard=0"  -f 
null -
frame=  150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed= 234x

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

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

diff --git a/doc/filters.texi b/doc/filters.texi
index 333f502083..8aa7471f7e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10678,6 +10678,9 @@ 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 freezen frames instead of report
+by metadata. Please note the first few freezen frames (the detection interval)
+won't be dropped for the filter doesn't buffer any frames.
  

freezen --> frozen
You could suggest that users apply tpad at start of stream so that all 
frozen frames can be removed. Afterwards, users can trim out those added 
frames.

Test this if you add it.


  The filter accepts the following options:
  
@@ -10689,6 +10692,13 @@ 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 discard
+Set force to discard freezen frame.
+ 0:  do nothing
+ 1:  discard freezen frame
+
+Default is 0
  @end table
  
  @anchor{frei0r}

diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c
index cc086afee6..cc115eb521 100644
--- a/libavfilter/vf_freezedetect.c
+++ b/libavfilter/vf_freezedetect.c
@@ -45,6 +45,8 @@ typedef struct FreezeDetectContext {
  
  double noise;

  int64_t duration;///< minimum duration of frozen frame until 
notification
+
+int discard; ///< 0: no discard, 1: discard freezen frame
  } FreezeDetectContext;
  
  #define OFFSET(x) offsetof(FreezeDetectContext, x)

@@ -56,6 +58,7 @@ 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 },
+{ "discard", "set frame discard flag", 
OFFSET(discard),   AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, V|F },
  
  {NULL}

  };
@@ -196,7 +199,10 @@ static int activate(AVFilterContext *ctx)
  return AVERROR(ENOMEM);
  }
  }
-return ff_filter_frame(outlink, frame);
+if (s->discard && s->frozen) {
+av_frame_free(&frame);
+} else
+return ff_filter_frame(outlink, frame);
  }
  
  FF_FILTER_FORWARD_STATUS(inlink, outlink);


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

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

[FFmpeg-devel] [PATCH] lavc/qsv: remove vaapi device free function

2019-10-07 Thread Zhong Li
It is not needed since av_buffer_unref() will call it internally

Signed-off-by: Zhong Li 
---
 libavcodec/qsv.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index a43f0d5..81fa4a8 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -835,10 +835,6 @@ int ff_qsv_close_internal_session(QSVSession *qs)
 qs->session = NULL;
 }
 #ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
-if (qs->va_device_ctx) {
-qs->va_device_ctx->free(qs->va_device_ctx);
-}
-
 av_buffer_unref(&qs->va_device_ref);
 #endif
 return 0;
-- 
2.7.4

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

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

Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_freezedetect: add discard option to force drop freezen frame

2019-10-07 Thread Limin Wang
On Tue, Oct 08, 2019 at 10:02:25AM +0530, Gyan wrote:
> 
> 
> On 08-10-2019 09:24 AM, 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:discard=0"  -f 
> >null -
> >frame=  150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed= 234x
> >
> >./ffmpeg  -f lavfi -i 
> >"smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:discard=1"  -f 
> >null -
> >frame=   30 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=59.7x
> >
> >Signed-off-by: Limin Wang 
> >---
> >  doc/filters.texi  | 10 ++
> >  libavfilter/vf_freezedetect.c |  8 +++-
> >  2 files changed, 17 insertions(+), 1 deletion(-)
> >
> >diff --git a/doc/filters.texi b/doc/filters.texi
> >index 333f502083..8aa7471f7e 100644
> >--- a/doc/filters.texi
> >+++ b/doc/filters.texi
> >@@ -10678,6 +10678,9 @@ 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 freezen frames instead of report
> >+by metadata. Please note the first few freezen frames (the detection 
> >interval)
> >+won't be dropped for the filter doesn't buffer any frames.
> freezen --> frozen

OK, will fix it.

> You could suggest that users apply tpad at start of stream so that
> all frozen frames can be removed. Afterwards, users can trim out
> those added frames.
> Test this if you add it.

I'm not familar with tpad and trim filter yet, anyway, it's not easy to
use it. If you think it's useful to remove all frozen frames, I prefer
to sumit another patch to fix it with frame cached.

> 
> >  The filter accepts the following options:
> >@@ -10689,6 +10692,13 @@ 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 discard
> >+Set force to discard freezen frame.
> >+ 0:  do nothing
> >+ 1:  discard freezen frame
> >+
> >+Default is 0
> >  @end table
> >  @anchor{frei0r}
> >diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c
> >index cc086afee6..cc115eb521 100644
> >--- a/libavfilter/vf_freezedetect.c
> >+++ b/libavfilter/vf_freezedetect.c
> >@@ -45,6 +45,8 @@ typedef struct FreezeDetectContext {
> >  double noise;
> >  int64_t duration;///< minimum duration of frozen frame 
> > until notification
> >+
> >+int discard; ///< 0: no discard, 1: discard freezen 
> >frame
> >  } FreezeDetectContext;
> >  #define OFFSET(x) offsetof(FreezeDetectContext, x)
> >@@ -56,6 +58,7 @@ 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 },
> >+{ "discard", "set frame discard flag", 
> >OFFSET(discard),   AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, V|F 
> >},
> >  {NULL}
> >  };
> >@@ -196,7 +199,10 @@ static int activate(AVFilterContext *ctx)
> >  return AVERROR(ENOMEM);
> >  }
> >  }
> >-return ff_filter_frame(outlink, frame);
> >+if (s->discard && s->frozen) {
> >+av_frame_free(&frame);
> >+} else
> >+return ff_filter_frame(outlink, frame);
> >  }
> >  FF_FILTER_FORWARD_STATUS(inlink, outlink);
> 
> 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 1/4] avformat/mpeg: Remove set-but-unused variable

2019-10-07 Thread Andreas Rheinhardt
Forgotten in 7da57875.

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

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 6f132aae05..bd182e4429 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -489,7 +489,6 @@ static int mpegps_read_packet(AVFormatContext *s,
 MpegDemuxContext *m = s->priv_data;
 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;
@@ -507,8 +506,7 @@ redo:
 
 if (!m->raw_ac3) {
 /* audio: skip header */
-avio_r8(s->pb);
-lpcm_header_len = avio_rb16(s->pb);
+avio_skip(s->pb, 3);
 len -= 3;
 if (startcode >= 0xb0 && startcode <= 0xbf) {
 /* MLP/TrueHD audio has a 4-byte header */
-- 
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/4] avformat/mpeg: Remove secondary packet for reading VobSub

2019-10-07 Thread Andreas Rheinhardt
When vobsub_read_packet() reads a packet, it uses a dedicated AVPacket
to get the subtitle timing and position from an FFDemuxSubtitlesQueue
(which has been filled with this data during reading the idx file in
vobsub_read_header); afterwards the actual subtitle data is read into
the packet destined for output and the timing and position are copied
to this packet. Afterwards, the local packet is unreferenced.

This can be simplified: Simply use the output packet to get the timing
and position from the FFDemuxSubtitlesQueue. The packet's size will be
zero afterwards, so that it can be directly used to read the actual
subtitle data. This makes copying the packet fields as well as
unreferencing the local packet unecessary and also removes an instance
of usage of sizeof(AVPacket) in libavformat.

The only difference is that the returned packet will already be flagged
as a keyframe. This currently only happens in compute_pkt_fields().

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/mpeg.c | 23 +++
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index bd182e4429..7daa72f7ce 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -912,7 +912,6 @@ static int vobsub_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 FFDemuxSubtitlesQueue *q;
 AVIOContext *pb = vobsub->sub_ctx->pb;
 int ret, psize, total_read = 0, i;
-AVPacket idx_pkt = { 0 };
 
 int64_t min_ts = INT64_MAX;
 int sid = 0;
@@ -927,24 +926,22 @@ static int vobsub_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 }
 }
 q = &vobsub->q[sid];
-ret = ff_subtitles_queue_read_packet(q, &idx_pkt);
+/* The returned packet will have size zero,
+ * so that it can be directly used with av_grow_packet. */
+ret = ff_subtitles_queue_read_packet(q, pkt);
 if (ret < 0)
 return ret;
 
 /* compute maximum packet size using the next packet position. This is
  * useful when the len in the header is non-sense */
 if (q->current_sub_idx < q->nb_subs) {
-psize = q->subs[q->current_sub_idx].pos - idx_pkt.pos;
+psize = q->subs[q->current_sub_idx].pos - pkt->pos;
 } else {
 int64_t fsize = avio_size(pb);
-psize = fsize < 0 ? 0x : fsize - idx_pkt.pos;
+psize = fsize < 0 ? 0x : fsize - pkt->pos;
 }
 
-avio_seek(pb, idx_pkt.pos, SEEK_SET);
-
-av_init_packet(pkt);
-pkt->size = 0;
-pkt->data = NULL;
+avio_seek(pb, pkt->pos, SEEK_SET);
 
 do {
 int n, to_read, startcode;
@@ -968,7 +965,7 @@ static int vobsub_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 total_read += pkt_size;
 
 /* the current chunk doesn't match the stream index (unlikely) */
-if ((startcode & 0x1f) != s->streams[idx_pkt.stream_index]->id)
+if ((startcode & 0x1f) != s->streams[pkt->stream_index]->id)
 break;
 
 ret = av_grow_packet(pkt, to_read);
@@ -980,16 +977,10 @@ static int vobsub_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 pkt->size -= to_read - n;
 } while (total_read < psize);
 
-pkt->pts = pkt->dts = idx_pkt.pts;
-pkt->pos = idx_pkt.pos;
-pkt->stream_index = idx_pkt.stream_index;
-
-av_packet_unref(&idx_pkt);
 return 0;
 
 fail:
 av_packet_unref(pkt);
-av_packet_unref(&idx_pkt);
 return ret;
 }
 
-- 
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/4] avformat/utils: Remove redundant save+restore

2019-10-07 Thread Andreas Rheinhardt
If the size of the input packet is zero, av_grow_packet() used to call
av_new_packet() which would initialize the packet and (in particular)
reset the pos field. This behaviour (which was never documented and
arguably always contradicted the documented behaviour) was changed in
2fe04630. This means that it is unnecessary to save and restore the
packet's position in append_packet_chunked().

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 60f0229adc..64ec0b821a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -268,7 +268,6 @@ int ffio_limit(AVIOContext *s, int size)
  * Return the number of bytes read or an error. */
 static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
 {
-int64_t orig_pos   = pkt->pos; // av_grow_packet might reset pos
 int orig_size  = pkt->size;
 int ret;
 
@@ -301,7 +300,6 @@ static int append_packet_chunked(AVIOContext *s, AVPacket 
*pkt, int size)
 if (size > 0)
 pkt->flags |= AV_PKT_FLAG_CORRUPT;
 
-pkt->pos = orig_pos;
 if (!pkt->size)
 av_packet_unref(pkt);
 return pkt->size > orig_size ? pkt->size - orig_size : ret;
-- 
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 4/4] avformat/flacdec: Remove useless packet

2019-10-07 Thread Andreas Rheinhardt
flac_read_timestamp() applied av_init_packet() to a packet (which
initializes all fields of the packet except for data and size) and then
went on to use only the data and size fields. In other words: Said
packet can be removed and replaced by an uint8_t * and an int.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/flacdec.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 8394e47483..cb516fb1f3 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -259,7 +259,7 @@ static int flac_probe(const AVProbeData *p)
 static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int 
stream_index,
  int64_t *ppos, int64_t pos_limit)
 {
-AVPacket pkt, out_pkt;
+AVPacket pkt;
 AVStream *st = s->streams[stream_index];
 AVCodecParserContext *parser;
 int ret;
@@ -276,6 +276,9 @@ static av_unused int64_t 
flac_read_timestamp(AVFormatContext *s, int stream_inde
 parser->flags |= PARSER_FLAG_USE_CODEC_TS;
 
 for (;;){
+uint8_t *data;
+int size;
+
 ret = ff_raw_read_partial_packet(s, &pkt);
 if (ret < 0){
 if (ret == AVERROR(EAGAIN))
@@ -285,14 +288,12 @@ static av_unused int64_t 
flac_read_timestamp(AVFormatContext *s, int stream_inde
 av_assert1(!pkt.size);
 }
 }
-av_init_packet(&out_pkt);
 av_parser_parse2(parser, st->internal->avctx,
- &out_pkt.data, &out_pkt.size, pkt.data, pkt.size,
+ &data, &size, pkt.data, pkt.size,
  pkt.pts, pkt.dts, *ppos);
 
 av_packet_unref(&pkt);
-if (out_pkt.size){
-int size = out_pkt.size;
+if (size) {
 if (parser->pts != AV_NOPTS_VALUE){
 // seeking may not have started from beginning of a frame
 // calculate frame start position from next frame backwards
-- 
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] Change libvpxenc default to crf=32.

2019-10-07 Thread James Zern
On Sat, Oct 5, 2019 at 1:23 PM James Zern  wrote:
>
> On Tue, Sep 24, 2019 at 4:31 PM Elliott Karpilovsky
>  wrote:
> >
> > Current default is 200kbps, which produces inconsistent
> > results (too high for low-res, too low for hi-res). Use
> > CRF instead, which will adapt. Affects VP9. Also have
> > VP8 use a default bitrate of 256kbps.
> > ---
> >  libavcodec/libvpxenc.c | 74 +++---
> >  libavcodec/version.h   |  2 +-
> >  2 files changed, 64 insertions(+), 12 deletions(-)
> >
>
> lgtm. I'll apply this soon.

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

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

Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_freezedetect: add discard option to force drop freezen frame

2019-10-07 Thread Gyan



On 08-10-2019 10:58 AM, Limin Wang wrote:

On Tue, Oct 08, 2019 at 10:02:25AM +0530, Gyan wrote:


On 08-10-2019 09:24 AM, 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:discard=0"  -f 
null -
frame=  150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed= 234x

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

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

diff --git a/doc/filters.texi b/doc/filters.texi
index 333f502083..8aa7471f7e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10678,6 +10678,9 @@ 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 freezen frames instead of report
+by metadata. Please note the first few freezen frames (the detection interval)
+won't be dropped for the filter doesn't buffer any frames.

freezen --> frozen

OK, will fix it.


You could suggest that users apply tpad at start of stream so that
all frozen frames can be removed. Afterwards, users can trim out
those added frames.
Test this if you add it.

I'm not familar with tpad and trim filter yet, anyway, it's not easy to
use it. If you think it's useful to remove all frozen frames, I prefer
to sumit another patch to fix it with frame cached.


Yes, the filter should remove all frozen frames. That it doesn't, is a 
current limitation.
If the limitation can be removed internally, that is preferable to 
external workarounds.


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 v1] avformat/tee.c: steal bsf option before passing to fifo muxer

2019-10-07 Thread Steven Liu


> 在 2019年10月8日,05:54,Dennis Mungai  写道:
> 
> On Mon, 7 Oct 2019 at 08:26, Liu Steven  wrote:
>> 
>> 
>> 
>>> 在 2019年10月6日,上午11:37,Jun Li  写道:
>>> 
>>> Fix #7620
>>> In the case tee muxer with both "bsf" and "use_fifo" parameters
>>> wil trigger this bug. Tee muxer will first steal parameters (like "f",
>>> "select"...) and then "use_fifo" will try reading out remaining options
>>> and pass them to fifo as option "format_options".
>>> Current code miss the part of stealing "bsf" options.
>>> ---
>>> libavformat/tee.c | 12 +---
>>> 1 file changed, 9 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/libavformat/tee.c b/libavformat/tee.c
>>> index 89a4ceb280..3530582dbd 100644
>>> --- a/libavformat/tee.c
>>> +++ b/libavformat/tee.c
>>> @@ -159,7 +159,7 @@ static void close_slaves(AVFormatContext *avf)
>>> static int open_slave(AVFormatContext *avf, char *slave, TeeSlave 
>>> *tee_slave)
>>> {
>>>int i, ret;
>>> -AVDictionary *options = NULL;
>>> +AVDictionary *options = NULL, *bsf_options = NULL;
>>>AVDictionaryEntry *entry;
>>>char *filename;
>>>char *format = NULL, *select = NULL, *on_fail = NULL;
>>> @@ -186,6 +186,11 @@ static int open_slave(AVFormatContext *avf, char 
>>> *slave, TeeSlave *tee_slave)
>>>STEAL_OPTION("onfail", on_fail);
>>>STEAL_OPTION("use_fifo", use_fifo);
>>>STEAL_OPTION("fifo_options", fifo_options_str);
>>> +entry = NULL;
>>> +while ((entry = av_dict_get(options, "bsfs", entry, 
>>> AV_DICT_IGNORE_SUFFIX))) {
>>> +av_dict_set(&bsf_options, entry->key, entry->value, 0);
>>> +av_dict_set(&options, entry->key, NULL, 0);
>>> +}
>>> 
>>>ret = parse_slave_failure_policy_option(on_fail, tee_slave);
>>>if (ret < 0) {
>>> @@ -311,7 +316,7 @@ static int open_slave(AVFormatContext *avf, char 
>>> *slave, TeeSlave *tee_slave)
>>>}
>>> 
>>>entry = NULL;
>>> -while (entry = av_dict_get(options, "bsfs", NULL, 
>>> AV_DICT_IGNORE_SUFFIX)) {
>>> +while (entry = av_dict_get(bsf_options, "bsfs", NULL, 
>>> AV_DICT_IGNORE_SUFFIX)) {
>>>const char *spec = entry->key + strlen("bsfs");
>>>if (*spec) {
>>>if (strspn(spec, slave_bsfs_spec_sep) != 1) {
>>> @@ -352,7 +357,7 @@ static int open_slave(AVFormatContext *avf, char 
>>> *slave, TeeSlave *tee_slave)
>>>}
>>>}
>>> 
>>> -av_dict_set(&options, entry->key, NULL, 0);
>>> +av_dict_set(&bsf_options, entry->key, NULL, 0);
>>>}
>>> 
>>>for (i = 0; i < avf->nb_streams; i++){
>>> @@ -399,6 +404,7 @@ end:
>>>av_free(select);
>>>av_free(on_fail);
>>>av_dict_free(&options);
>>> +av_dict_free(&bsf_options);
>>>av_freep(&tmp_select);
>>>return ret;
>>> }
>>> --
>>> 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”.
>> 
>> should be ok
>> 
>> 
>> Thanks
>> Steven
>> 
>> 
>> 
> Generating valid HLS + DASH streams using fragmented mp4 should be
> much easier now, thanks.
Do you mean much easier after this patch?
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Thanks
Steven





___
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 4/4] avformat/hlsenc: replace with av_freep for all av_free

2019-10-07 Thread Steven Liu


> 在 2019年9月16日,09:03,lance.lmw...@gmail.com 写道:
> 
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
> libavformat/hlsenc.c | 64 ++--
> 1 file changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 21fb9d7a1d..6dc92b786e 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -590,7 +590,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
> HLSContext *hls,
> if ((ret = vs->vtt_avf->io_open(vs->vtt_avf, &out, sub_path, 
> AVIO_FLAG_WRITE, &options)) < 0) {
> if (hls->ignore_io_errors)
> ret = 0;
> -av_free(sub_path);
> +av_freep(&sub_path);
> goto fail;
> }
> ff_format_io_close(vs->vtt_avf, &out);
> @@ -598,18 +598,18 @@ static int hls_delete_old_segments(AVFormatContext *s, 
> HLSContext *hls,
> av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: 
> %s\n",
>sub_path, strerror(errno));
> }
> -av_free(sub_path);
> +av_freep(&sub_path);
> }
> av_freep(&path);
> previous_segment = segment;
> segment = previous_segment->next;
> -av_free(previous_segment);
> +av_freep(&previous_segment);
> }
> 
> fail:
> -av_free(path);
> -av_free(dirname);
> -av_free(vtt_dirname);
> +av_freep(&path);
> +av_freep(&dirname);
> +av_freep(&vtt_dirname);
> 
> return ret;
> }
> @@ -887,7 +887,7 @@ static int sls_flags_filename_process(struct 
> AVFormatContext *s, HLSContext *hls
> strlen(vs->current_segment_final_filename_fmt)) {
> char * new_url = av_strdup(vs->current_segment_final_filename_fmt);
> if (!new_url) {
> -av_free(en);
> +av_freep(&en);
> return AVERROR(ENOMEM);
> }
> ff_format_set_url(vs->avf, new_url);
> @@ -898,8 +898,8 @@ static int sls_flags_filename_process(struct 
> AVFormatContext *s, HLSContext *hls
>"Invalid second level segment filename template '%s', "
>"you can try to remove second_level_segment_size 
> flag\n",
>vs->avf->url);
> -av_free(filename);
> -av_free(en);
> +av_freep(&filename);
> +av_freep(&en);
> return AVERROR(EINVAL);
> }
> ff_format_set_url(vs->avf, filename);
> @@ -912,8 +912,8 @@ static int sls_flags_filename_process(struct 
> AVFormatContext *s, HLSContext *hls
>"Invalid second level segment filename template '%s', "
>"you can try to remove second_level_segment_time 
> flag\n",
>vs->avf->url);
> -av_free(filename);
> -av_free(en);
> +av_freep(&filename);
> +av_freep(&en);
> return AVERROR(EINVAL);
> }
> ff_format_set_url(vs->avf, filename);
> @@ -985,7 +985,7 @@ static int 
> sls_flag_use_localtime_filename(AVFormatContext *oc, HLSContext *c, V
> av_log(c, AV_LOG_ERROR, "Invalid second level segment filename 
> template '%s', "
> "you can try to remove second_level_segment_index flag\n",
>oc->url);
> -av_free(filename);
> +av_freep(&filename);
> return AVERROR(EINVAL);
> }
> ff_format_set_url(oc, filename);
> @@ -999,7 +999,7 @@ static int 
> sls_flag_use_localtime_filename(AVFormatContext *oc, HLSContext *c, V
> av_log(c, AV_LOG_ERROR, "Invalid second level segment 
> filename template '%s', "
> "you can try to remove second_level_segment_size 
> flag\n",
>oc->url);
> -av_free(filename);
> +av_freep(&filename);
> return AVERROR(EINVAL);
> }
> ff_format_set_url(oc, filename);
> @@ -1010,7 +1010,7 @@ static int 
> sls_flag_use_localtime_filename(AVFormatContext *oc, HLSContext *c, V
> av_log(c, AV_LOG_ERROR, "Invalid second level segment 
> filename template '%s', "
> "you can try to remove second_level_segment_time 
> flag\n",
>oc->url);
> -av_free(filename);
> +av_freep(&filename);
> return AVERROR(EINVAL);
> }
> ff_format_set_url(oc, filename);
> @@ -1098,7 +1098,7 @@ static int hls_append_segment(struct AVFormatContext 
> *s, HLSContext *hls,
> if ((ret = hls_delete_old_segments(s, hls, vs)) < 0)
> return ret;
> } else
> -av_free(en);
> +av_freep(&en);
> } else
> vs->nb_entries++;
> 
> @@