Re: [FFmpeg-devel] [PATCH 1/3] avcodec/dxva2_hevc: add support for parsing HEVC Range Extension data

2020-03-17 Thread Steve Lhomme

On 2020-03-15 13:05, Hendrik Leppkes wrote:

On Sun, Mar 15, 2020 at 8:12 AM Steve Lhomme  wrote:

Where is this struct specified? I don't see it in the latest released
Windows SDK.


It is not. It is reversed engineered from the existing structure and wild 
guessing based on the HEVC Range Extension specs. The bits/fields are in the 
same order as the specs. Then I tested some GUIDs that output non 4:2:0 pixel 
formats on an Intel GPU that is known to decoder HEVC Range Extension.

Apparently NVIDIA doesn't provide DXVA GUIDs that output non 4:2:0 pixel 
formats on GPUs that supposedly decode HEVC 444 (likley nvdec only). AMD 
doesn't have such GPUs AFAIK.

So for now it's Intel only.


That seems very hackish for something thats otherwise cleanly based on
official specifications only.  Maybe try to get them to release specs
for this instead?


From what I understand only MS publishes DXVA specs and it seems they 
have no intention on doing one for HEVC Range Extension. That may be why 
NVIDIA has not implemented it. I don't know if Intel is planning to 
release a documentation.

___
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] lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode

2020-03-17 Thread Linjie Fu
With the description in frame size with refs semantics (SPEC 7.2.5),
it is a requirement of bitstream conformance that for at least one
reference frame has the valid dimensions.

Modify the check to make sure the decoder works well in SINGLE_REFERENCE
mode that not all reference frames have valid dimensions.

Check and error out if invalid reference frame is used in inter_recon.

One of the failure case is a 480x272 inter frame (SINGLE_REFERENCE mode)
with following reference pool:

0.  960x544LASTvalid
1. 1920x1088 GOLDEN  invalid, but not used in single reference mode
2. 1920x1088 ALTREF  invalid, but not used in single reference mode
3~7  ... Unused

Identical logic in libvpx:


Signed-off-by: Linjie Fu 
---
[v3]: replace assert with check/return, tested in both multi frame/slice mode

 libavcodec/vp9.c  | 18 --
 libavcodec/vp9dec.h   |  5 +
 libavcodec/vp9recon.c | 10 ++
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 7aaae9b..17a4f7d 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -794,6 +794,7 @@ static int decode_frame_header(AVCodecContext *avctx,
 
 /* check reference frames */
 if (!s->s.h.keyframe && !s->s.h.intraonly) {
+int valid_ref_frame = 0;
 for (i = 0; i < 3; i++) {
 AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
 int refw = ref->width, refh = ref->height;
@@ -807,17 +808,25 @@ static int decode_frame_header(AVCodecContext *avctx,
 } else if (refw == w && refh == h) {
 s->mvscale[i][0] = s->mvscale[i][1] = 0;
 } else {
+/* Check to make sure at least one of frames that */
+/* this frame references has valid dimensions */
 if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 16 * 
refh) {
-av_log(avctx, AV_LOG_ERROR,
+av_log(avctx, AV_LOG_WARNING,
"Invalid ref frame dimensions %dx%d for frame size 
%dx%d\n",
refw, refh, w, h);
-return AVERROR_INVALIDDATA;
+s->mvscale[i][0] = s->mvscale[i][1] = REF_INVALID_SCALE;
+continue;
 }
 s->mvscale[i][0] = (refw << 14) / w;
 s->mvscale[i][1] = (refh << 14) / h;
 s->mvstep[i][0] = 16 * s->mvscale[i][0] >> 14;
 s->mvstep[i][1] = 16 * s->mvscale[i][1] >> 14;
 }
+valid_ref_frame++;
+}
+if (!valid_ref_frame) {
+av_log(avctx, AV_LOG_ERROR, "No valid reference frame is found, 
bitstream not supported\n");
+return AVERROR_INVALIDDATA;
 }
 }
 
@@ -1670,6 +1679,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
 } while (s->pass++ == 1);
 ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
 
+if (s->td->error_info < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to decode tile data\n");
+return s->td->error_info;
+}
+
 finish:
 // ref frame setup
 for (i = 0; i < 8; i++) {
diff --git a/libavcodec/vp9dec.h b/libavcodec/vp9dec.h
index 66573ed..f2585c3 100644
--- a/libavcodec/vp9dec.h
+++ b/libavcodec/vp9dec.h
@@ -36,6 +36,8 @@
 #include "vp9dsp.h"
 #include "vp9shared.h"
 
+#define REF_INVALID_SCALE 0x
+
 enum MVJoint {
 MV_JOINT_ZERO,
 MV_JOINT_H,
@@ -217,6 +219,9 @@ struct VP9TileData {
 struct { int x, y; } min_mv, max_mv;
 int16_t *block_base, *block, *uvblock_base[2], *uvblock[2];
 uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2];
+
+// error message
+int error_info;
 };
 
 void ff_vp9_fill_mv(VP9TileData *td, VP56mv *mv, int mode, int sb);
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index 49bb04e..9a4e7c7 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -572,6 +572,16 @@ static av_always_inline void inter_recon(VP9TileData *td, 
int bytesperpixel)
 VP9Block *b = td->b;
 int row = td->row, col = td->col;
 
+if (s->mvscale[b->ref[0]][0] == REF_INVALID_SCALE ||
+(b->comp && s->mvscale[b->ref[1]][0] == REF_INVALID_SCALE)) {
+if (!s->td->error_info) {
+s->td->error_info = AVERROR_INVALIDDATA;
+av_log(NULL, AV_LOG_ERROR, "Bitstream not supported, "
+   "reference frame has invalid 
dimensions\n");
+}
+return;
+}
+
 if (s->mvscale[b->ref[0]][0] || (b->comp && s->mvscale[b->ref[1]][0])) {
 if (bytesperpixel == 1) {
 inter_pred_scaled_8bpp(td);
-- 
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 "unsubscr

[FFmpeg-devel] 回复: [EXT] Re: [PATCH] avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

2020-03-17 Thread Ming Qian
Yes, I have meet some hang issue on nxp's imx platform.
On nxp's imx platform, there is a stream buffer in the v4l2 decoder driver.
So driver may cache some frames in driver, if without this patch, after the 
draining is set to 1, the v4l2 capture buffer won't be enqueued to driver any 
more, it leds to hang.


发件人: ffmpeg-devel  代表 Andriy Gelman 

发送时间: 2020年3月16日 20:07
收件人: FFmpeg development discussions and patches 
主题: [EXT] Re: [FFmpeg-devel] [PATCH] avcodec/v4l2_buffers: don't prevent 
enqueue capture buffer to driver

Caution: EXT Email

On Mon, 16. Mar 10:02, Ming Qian wrote:
> the draining is set when the output port is finished,
> but it doesn't mean the capture port is finished.
> especially for decoder, there may be a stream buffer to store several
> frames.
> so the decoder still need capture buffer even if the draining is set.
>
> Signed-off-by: Ming Qian 
> ---
>  libavcodec/v4l2_buffers.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
> index dc1b9eaf24..02f23d954b 100644
> --- a/libavcodec/v4l2_buffers.c
> +++ b/libavcodec/v4l2_buffers.c
> @@ -222,7 +222,7 @@ static void v4l2_free_buffer(void *opaque, uint8_t 
> *unused)
>  if (!atomic_load(&s->refcount))
>  sem_post(&s->refsync);
>  } else {
> -if (s->draining) {
> +if (s->draining && V4L2_TYPE_IS_OUTPUT(avbuf->context->type)) {
>  /* no need to queue more buffers to the driver */
>  avbuf->status = V4L2BUF_AVAILABLE;
>  }

It makes sense, but did you have some dropped frames without this?

Thanks,
--
Andriy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fffmpeg.org%2Fmailman%2Flistinfo%2Fffmpeg-devel&data=02%7C01%7Cming.qian%40nxp.com%7C1d1cbfd7cd354eb59c7708d7ca23894e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637200126288687579&sdata=wKgcJcPxVc9rYHtbJlhfA%2Bc4ecbIF0%2FcCHvH4NFLsfk%3D&reserved=0

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 v9 2/4] avcodec/hevc_sei: add support for user data unregistered SEI message

2020-03-17 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/hevc_sei.c   | 31 +++
 libavcodec/hevc_sei.h   |  6 ++
 libavcodec/hevcdec.c| 14 ++
 tests/ref/fate/hevc-monochrome-crop |  3 +++
 4 files changed, 54 insertions(+)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 6057069..e3d6bc9 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -213,6 +213,30 @@ static int 
decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
 return 0;
 }
 
+static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, 
GetBitContext *gb,
+  int size)
+{
+AVBufferRef *buf_ref, **tmp;
+
+if (size < 16)
+   return AVERROR(EINVAL);
+
+tmp = av_realloc_array(s->buf_ref, s->nb_buf_ref + 1, sizeof(*s->buf_ref));
+if (!tmp)
+return AVERROR(ENOMEM);
+s->buf_ref = tmp;
+
+buf_ref = av_buffer_alloc(size);
+if (!buf_ref)
+return AVERROR(ENOMEM);
+
+for (int i = 0; i < size; i++)
+buf_ref->data[i] = get_bits(gb, 8);
+s->buf_ref[s->nb_buf_ref++] = buf_ref;
+
+return 0;
+}
+
 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
GetBitContext *gb,
  int size)
 {
@@ -300,6 +324,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void 
*logctx, HEVCSEI *s,
 return decode_nal_sei_active_parameter_sets(s, gb, logctx);
 case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
 return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
+case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
+return decode_nal_sei_user_data_unregistered(&s->unregistered, gb, 
size);
 case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
 return decode_nal_sei_alternative_transfer(&s->alternative_transfer, 
gb);
 default:
@@ -371,4 +397,9 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, 
HEVCSEI *s,
 void ff_hevc_reset_sei(HEVCSEI *s)
 {
 av_buffer_unref(&s->a53_caption.buf_ref);
+
+for (int i = 0; i < s->unregistered.nb_buf_ref; i++)
+av_buffer_unref(&s->unregistered.buf_ref[i]);
+s->unregistered.nb_buf_ref = 0;
+av_freep(&s->unregistered.buf_ref);
 }
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index a44ccca..3618d16 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -91,6 +91,11 @@ typedef struct HEVCSEIA53Caption {
 AVBufferRef *buf_ref;
 } HEVCSEIA53Caption;
 
+typedef struct HEVCSEIUnregistered {
+AVBufferRef **buf_ref;
+int nb_buf_ref;
+} HEVCSEIUnregistered;
+
 typedef struct HEVCSEIMasteringDisplay {
 int present;
 uint16_t display_primaries[3][2];
@@ -116,6 +121,7 @@ typedef struct HEVCSEI {
 HEVCSEIDisplayOrientation display_orientation;
 HEVCSEIPictureTiming picture_timing;
 HEVCSEIA53Caption a53_caption;
+HEVCSEIUnregistered unregistered;
 HEVCSEIMasteringDisplay mastering_display;
 HEVCSEIContentLight content_light;
 int active_seq_parameter_set_id;
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 7448be4..8909aca 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2795,6 +2795,20 @@ static int set_side_data(HEVCContext *s)
 s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+for (int i = 0; i < s->sei.unregistered.nb_buf_ref; i++) {
+HEVCSEIUnregistered *unreg = &s->sei.unregistered;
+
+if (unreg->buf_ref[i]) {
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(out,
+AV_FRAME_DATA_SEI_UNREGISTERED,
+unreg->buf_ref[i]);
+if (!sd)
+av_buffer_unref(&unreg->buf_ref[i]);
+unreg->buf_ref[i] = NULL;
+}
+}
+s->sei.unregistered.nb_buf_ref = 0;
+
 return 0;
 }
 
diff --git a/tests/ref/fate/hevc-monochrome-crop 
b/tests/ref/fate/hevc-monochrome-crop
index 4e45412..384404d 100644
--- a/tests/ref/fate/hevc-monochrome-crop
+++ b/tests/ref/fate/hevc-monochrome-crop
@@ -1,6 +1,9 @@
 [FRAME]
 width=384
 height=240
+[SIDE_DATA]
+side_data_type=H.26[45] User Data Unregistered SEI message
+[/SIDE_DATA]
 [/FRAME]
 [STREAM]
 width=384
-- 
2.9.5

___
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] avfilter/src_movie: Fix the loop function of dynamic logo

2020-03-17 Thread lance . lmwang
From: Limin Wang 

The following command will attempt to create the input and overlay test 
sequence for you.
./ffmpeg -f lavfi  -i color=white:duration=100:r=25:size=1280x720  input.mkv
./ffmpeg -f lavfi -i "testsrc=duration=5:size=320x240:rate=25" overlay.mkv

Please try with below command and compare the final output.
./ffmpeg -y -filter_complex 
"movie=./input.mkv,setpts=PTS-STARTPTS[main];movie=./overlay.mkv:loop=5,setpts=PTS-STARTPTS[overlay];[main][overlay]overlay=10:10:
 enable='between(t,0,25)" test.mkv

 Without the patch applied, the overlay will repeat the last frame in 
overlay.mkv after the first loop.

Signed-off-by: Limin Wang 
---
 libavfilter/src_movie.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 79423a8..2327046 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -68,6 +68,8 @@ typedef struct MovieContext {
 int loop_count;
 int64_t discontinuity_threshold;
 int64_t ts_offset;
+int64_t last_pts;
+int64_t last_loop_pts;
 
 AVFormatContext *format_ctx;
 int eof;
@@ -455,6 +457,7 @@ static int rewind_file(AVFilterContext *ctx)
 movie->st[i].done = 0;
 }
 movie->eof = 0;
+movie->last_loop_pts = movie->last_pts;
 return 0;
 }
 
@@ -565,6 +568,8 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned 
out_id)
 if (frame->pts != AV_NOPTS_VALUE) {
 if (movie->ts_offset)
 frame->pts += av_rescale_q_rnd(movie->ts_offset, AV_TIME_BASE_Q, 
outlink->time_base, AV_ROUND_UP);
+if (movie->last_loop_pts)
+frame->pts += movie->last_loop_pts;
 if (st->discontinuity_threshold) {
 if (st->last_pts != AV_NOPTS_VALUE) {
 int64_t diff = frame->pts - st->last_pts;
@@ -575,6 +580,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned 
out_id)
 }
 }
 }
+movie->last_pts =
 st->last_pts = frame->pts;
 }
 ff_dlog(ctx, "movie_push_frame(): file:'%s' %s\n", movie->file_name,
-- 
2.9.5

___
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 2/2] avfilter/vf_overlay: remove the duplicated framesync option

2020-03-17 Thread lance . lmwang
From: Limin Wang 

After applied the patch, we can change default eof_action from repeat to pass 
still.

./ffmpeg -y -filter_complex 
"movie=./input.mkv,setpts=PTS-STARTPTS[main];movie=./overlay.mkv:loop=2,setpts=PTS-STARTPTS[overlay];[main][overlay]overlay=10:10:
 enable='between(t,0,25):eof_action=pass"  test.mkv

Signed-off-by: Limin Wang 
---
 libavfilter/vf_overlay.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 0a8f089c0d..a481f74076 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -993,16 +993,9 @@ static int activate(AVFilterContext *ctx)
 static const AVOption overlay_options[] = {
 { "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = 
"0"}, CHAR_MIN, CHAR_MAX, FLAGS },
 { "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = 
"0"}, CHAR_MIN, CHAR_MAX, FLAGS },
-{ "eof_action", "Action to take when encountering EOF from secondary input 
",
-OFFSET(fs.opt_eof_action), AV_OPT_TYPE_INT, { .i64 = EOF_ACTION_REPEAT 
},
-EOF_ACTION_REPEAT, EOF_ACTION_PASS, .flags = FLAGS, "eof_action" },
-{ "repeat", "Repeat the previous frame.",   0, AV_OPT_TYPE_CONST, { 
.i64 = EOF_ACTION_REPEAT }, .flags = FLAGS, "eof_action" },
-{ "endall", "End both streams.",0, AV_OPT_TYPE_CONST, { 
.i64 = EOF_ACTION_ENDALL }, .flags = FLAGS, "eof_action" },
-{ "pass",   "Pass through the main input.", 0, AV_OPT_TYPE_CONST, { 
.i64 = EOF_ACTION_PASS },   .flags = FLAGS, "eof_action" },
 { "eval", "specify when to evaluate expressions", OFFSET(eval_mode), 
AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_FRAME}, 0, EVAL_MODE_NB-1, FLAGS, "eval" },
  { "init",  "eval expressions once during initialization", 0, 
AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT},  .flags = FLAGS, .unit = "eval" },
  { "frame", "eval expressions per-frame",  0, 
AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
-{ "shortest", "force termination when the shortest input terminates", 
OFFSET(fs.opt_shortest), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 { "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT, 
{.i64=OVERLAY_FORMAT_YUV420}, 0, OVERLAY_FORMAT_NB-1, FLAGS, "format" },
 { "yuv420", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420}, 
.flags = FLAGS, .unit = "format" },
 { "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422}, 
.flags = FLAGS, .unit = "format" },
@@ -1010,7 +1003,6 @@ static const AVOption overlay_options[] = {
 { "rgb","", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB},
.flags = FLAGS, .unit = "format" },
 { "gbrp",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_GBRP},   
.flags = FLAGS, .unit = "format" },
 { "auto",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_AUTO},   
.flags = FLAGS, .unit = "format" },
-{ "repeatlast", "repeat overlay of the last overlay frame", 
OFFSET(fs.opt_repeatlast), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
 { "alpha", "alpha format", OFFSET(alpha_format), AV_OPT_TYPE_INT, 
{.i64=0}, 0, 1, FLAGS, "alpha_format" },
 { "straight",  "", 0, AV_OPT_TYPE_CONST, {.i64=0}, .flags = FLAGS, 
.unit = "alpha_format" },
 { "premultiplied", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, .flags = FLAGS, 
.unit = "alpha_format" },
-- 
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 v9 3/4] avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

2020-03-17 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_showinfo.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 79b79db..36b9bf1 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -23,6 +23,7 @@
  */
 
 #include 
+#include 
 
 #include "libavutil/bswap.h"
 #include "libavutil/adler32.h"
@@ -170,6 +171,39 @@ static void dump_content_light_metadata(AVFilterContext 
*ctx, AVFrameSideData *s
metadata->MaxCLL, metadata->MaxFALL);
 }
 
+static int string_is_print(const uint8_t *str)
+{
+while (isprint(*str)) str++;
+return !*str;
+}
+
+static void dump_sei_unregistered_metadata(AVFilterContext *ctx, 
AVFrameSideData *sd)
+{
+const int uuid_size = 16;
+uint8_t *user_data = sd->data;
+
+if (sd->size < uuid_size) {
+av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
sd->size, uuid_size);
+return;
+}
+
+av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
+av_log(ctx, AV_LOG_INFO, "UUID=");
+for (int i = 0; i < uuid_size; i++) {
+av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
+if (i == 3 || i == 5 || i == 7 || i == 9)
+av_log(ctx, AV_LOG_INFO, "-");
+}
+av_log(ctx, AV_LOG_INFO, "\n");
+
+user_data += uuid_size;
+/* Only print the user data details if it's string */
+if (string_is_print(user_data)) {
+av_log(ctx, AV_LOG_INFO, "User Data=");
+av_log(ctx, AV_LOG_INFO, "%s", user_data);
+}
+}
+
 static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
 {
 const char *color_range_str = av_color_range_name(frame->color_range);
@@ -347,6 +381,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 av_log(ctx, AV_LOG_INFO, "GOP timecode - %s", tcbuf);
 break;
 }
+case AV_FRAME_DATA_SEI_UNREGISTERED:
+dump_sei_unregistered_metadata(ctx, sd);
+break;
 default:
 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
sd->type, sd->size);
-- 
2.9.5

___
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 v9 1/4] avutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type

2020-03-17 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
haven't got further feedback after 2 month, so I rebased the patches on ffmpeg 
master,
please the core developer help to push to master.

 doc/APIchanges  | 6 ++
 libavutil/frame.c   | 1 +
 libavutil/frame.h   | 8 
 libavutil/version.h | 2 +-
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 8eeaec2..e14c302 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2020-03-xx - xx - lavu 56.43.100 - frame.h
+  Add AV_FRAME_DATA_SEI_UNREGISTERED.
+
 2020-03-10 - xx - lavc 58.75.100 - avcodec.h
   Add AV_PKT_DATA_ICC_PROFILE.
 
index e403809..ce5ff8e 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -842,6 +842,7 @@ const char *av_frame_side_data_name(enum 
AVFrameSideDataType type)
 #endif
 case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata 
SMPTE2094-40 (HDR10+)";
 case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
+case AV_FRAME_DATA_SEI_UNREGISTERED: return "H.26[45] User Data 
Unregistered SEI message";
 }
 return NULL;
 }
diff --git a/libavutil/frame.h b/libavutil/frame.h
index b5afb58..8c27133 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -179,6 +179,14 @@ enum AVFrameSideDataType {
  * array element is implied by AVFrameSideData.size / 
AVRegionOfInterest.self_size.
  */
 AV_FRAME_DATA_REGIONS_OF_INTEREST,
+
+/**
+ * User data unregistered metadata associated with a video frame.
+ * This is the H.26[45] UDU SEI message, and shouldn't be used for any 
other purpose
+ * The data is stored as uint8_t in AVFrameSideData.data which is 16 bytes 
of
+ * uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of 
user_data_payload_byte.
+ */
+AV_FRAME_DATA_SEI_UNREGISTERED,
 };
 
 enum AVActiveFormatDescription {
diff --git a/libavutil/version.h b/libavutil/version.h
index 8c4f91b..ea9363e 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  42
+#define LIBAVUTIL_VERSION_MINOR  43
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.9.5

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

2020-03-17 Thread Paul B Mahol
Gonna apply this updated set soon.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v2] avcodec/v4l2_m2m: handle the v4l2 eos event

2020-03-17 Thread Ming Qian
when the last frame of capture is dequeueed,
driver may send this V4L2_EVENT_EOS event,
if this event is received, then we can set the capture port done

if the v4l2 m2m driver don't support V4L2_EVENT_EOS,
just output some error message, not make it error.

Without this patch imx8qm often hangs at the end of encoding/decoding when
flushing the capture buffers

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_context.c |  5 +
 libavcodec/v4l2_m2m_dec.c |  9 +
 libavcodec/v4l2_m2m_enc.c | 22 +-
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 8110bbb555..c10862aa12 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -171,6 +171,11 @@ static int v4l2_handle_event(V4L2Context *ctx)
 return 0;
 }
 
+if (evt.type == V4L2_EVENT_EOS) {
+ctx->done = 1;
+return 0;
+}
+
 if (evt.type != V4L2_EVENT_SOURCE_CHANGE)
 return 0;
 
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index d666edffe4..7a4d2a43cb 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -123,6 +123,15 @@ static int v4l2_prepare_decoder(V4L2m2mContext *s)
 }
 }
 
+memset(&sub, 0, sizeof(sub));
+sub.type = V4L2_EVENT_EOS;
+ret = ioctl(s->fd, VIDIOC_SUBSCRIBE_EVENT, &sub);
+if (ret < 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+"the v4l2 driver does not support VIDIOC_SUBSCRIBE_EVENT\n"
+"you must provide an eos event to finish encode\n");
+}
+
 return 0;
 }
 
diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index 5b954f4435..849d28e9a8 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -155,6 +155,24 @@ static int v4l2_check_b_frame_support(V4L2m2mContext *s)
 return AVERROR_PATCHWELCOME;
 }
 
+static int v4l2_subscribe_eos_event(V4L2m2mContext *s)
+{
+struct v4l2_event_subscription sub;
+int ret;
+
+memset(&sub, 0, sizeof(sub));
+sub.type = V4L2_EVENT_EOS;
+ret = ioctl(s->fd, VIDIOC_SUBSCRIBE_EVENT, &sub);
+if (ret < 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+"the v4l2 driver does not support VIDIOC_SUBSCRIBE_EVENT\n"
+"you must provide an eos event to finish encode\n");
+return ret;
+}
+
+return 0;
+}
+
 static int v4l2_prepare_encoder(V4L2m2mContext *s)
 {
 AVCodecContext *avctx = s->avctx;
@@ -164,10 +182,12 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
 /**
  * requirements
  */
-ret = v4l2_check_b_frame_support(s);
+ret = v4l2_subscribe_eos_event(s);
 if (ret)
 return ret;
 
+v4l2_check_b_frame_support(s);
+
 /**
  * settingss
  */
-- 
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 v9 4/4] avcodec/h264: create user data unregistered SEI side data for H.264

2020-03-17 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/h264_sei.c |  30 +--
 libavcodec/h264_sei.h |   2 +
 libavcodec/h264_slice.c   |  14 
 tests/ref/fate/mov-zombie | 195 ++
 4 files changed, 171 insertions(+), 70 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index a565fea..f72c48c 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -24,6 +24,7 @@
  * H.264 / AVC / MPEG-4 part10 SEI decoding.
  * @author Michael Niedermayer 
  */
+#include 
 
 #include "avcodec.h"
 #include "get_bits.h"
@@ -52,6 +53,10 @@ void ff_h264_sei_uninit(H264SEIContext *h)
 h->afd.present =  0;
 
 av_buffer_unref(&h->a53_caption.buf_ref);
+for (int i = 0; i < h->unregistered.nb_buf_ref; i++)
+av_buffer_unref(&h->unregistered.buf_ref[i]);
+h->unregistered.nb_buf_ref = 0;
+av_freep(&h->unregistered.buf_ref);
 }
 
 static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
@@ -241,30 +246,45 @@ static int decode_registered_user_data(H264SEIContext *h, 
GetBitContext *gb,
 return 0;
 }
 
+static int string_is_print(const uint8_t *str)
+{
+while (isprint(*str)) str++;
+return !*str;
+}
+
 static int decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext 
*gb,
  void *logctx, int size)
 {
 uint8_t *user_data;
 int e, build, i;
+AVBufferRef *buf_ref, **tmp;
 
-if (size < 16 || size >= INT_MAX - 1)
+if (size < 16)
 return AVERROR_INVALIDDATA;
 
-user_data = av_malloc(size + 1);
-if (!user_data)
+tmp = av_realloc_array(h->buf_ref, h->nb_buf_ref + 1, sizeof(*h->buf_ref));
+if (!tmp)
 return AVERROR(ENOMEM);
+h->buf_ref = tmp;
+
+buf_ref = av_buffer_alloc(size);
+if (!buf_ref)
+return AVERROR(ENOMEM);
+user_data = buf_ref->data;
 
 for (i = 0; i < size; i++)
 user_data[i] = get_bits(gb, 8);
+h->buf_ref[h->nb_buf_ref++] = buf_ref;
+
+if (!string_is_print(user_data + 16))
+return 0;
 
-user_data[i] = 0;
 e = sscanf(user_data + 16, "x264 - core %d", &build);
 if (e == 1 && build > 0)
 h->x264_build = build;
 if (e == 1 && build == 1 && !strncmp(user_data+16, "x264 - core ", 16))
 h->x264_build = 67;
 
-av_free(user_data);
 return 0;
 }
 
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index a75c3aa..aa4595f 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -121,6 +121,8 @@ typedef struct H264SEIA53Caption {
 
 typedef struct H264SEIUnregistered {
 int x264_build;
+AVBufferRef **buf_ref;
+int nb_buf_ref;
 } H264SEIUnregistered;
 
 typedef struct H264SEIRecoveryPoint {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 34f659b..7638497 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1280,6 +1280,20 @@ static int h264_export_frame_props(H264Context *h)
 h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+for (int i = 0; i < h->sei.unregistered.nb_buf_ref; i++) {
+H264SEIUnregistered *unreg = &h->sei.unregistered;
+
+if (unreg->buf_ref[i]) {
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f,
+AV_FRAME_DATA_SEI_UNREGISTERED,
+unreg->buf_ref[i]);
+if (!sd)
+av_buffer_unref(&unreg->buf_ref[i]);
+unreg->buf_ref[i] = NULL;
+}
+}
+h->sei.unregistered.nb_buf_ref = 0;
+
 if (h->sei.picture_timing.timecode_cnt > 0) {
 uint32_t tc = 0;
 uint32_t *tc_sd;
diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie
index f45fa59..5c58246 100644
--- a/tests/ref/fate/mov-zombie
+++ b/tests/ref/fate/mov-zombie
@@ -1,133 +1,198 @@
 
packet|codec_type=video|stream_index=0|pts=0|pts_time=0.00|dts=-3004|dts_time=-0.033378|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=4133|pos=11309|flags=K_
 
packet|codec_type=video|stream_index=0|pts=5440|pts_time=0.060444|dts=-567|dts_time=-0.006300|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1077|pos=15442|flags=__
-frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=0|pkt_pts_time=0.00|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best_effort_timestamp_time=0.00|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=11309|pkt_size=4133|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleft
+frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=0|pkt_pts_time=0.00|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best

[FFmpeg-devel] [PATCH v2] avcodec/v4l2_m2m: fix setting the frame rate

2020-03-17 Thread Ming Qian
v4l2 set the frame rate through frame intervals,
not set frame rate directly.
the frame rate and frame intervals are reciprocal.
so in libavdevice/v4l2.c we can see the following code:
tpf->numerator   = framerate_q.den;
tpf->denominator = framerate_q.num;

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_m2m_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index c9f1741bfd..84de63ec9d 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -172,7 +172,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
  * settingss
  */
 if (avctx->framerate.num || avctx->framerate.den)
-v4l2_set_timeperframe(s, avctx->framerate.num, avctx->framerate.den);
+v4l2_set_timeperframe(s, avctx->framerate.den, avctx->framerate.num);
 
 /* set ext ctrls */
 v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), 
MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode");
-- 
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] avcodec/v4l2_m2m: handle the v4l2 eos event

2020-03-17 Thread Ming Qian
when the last frame of capture is dequeueed,
driver may send this V4L2_EVENT_EOS event,
if this event is received, then we can set the capture port done

if the v4l2 m2m driver don't support V4L2_EVENT_EOS,
just output some error message, not make it error.

Without this patch imx8qm often hangs at the end of encoding/decoding when
flushing the capture buffers

Signed-off-by: Ming Qian 
---
 libavcodec/v4l2_context.c |  5 +
 libavcodec/v4l2_m2m_dec.c |  9 +
 libavcodec/v4l2_m2m_enc.c | 20 
 3 files changed, 34 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 8110bbb555..c10862aa12 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -171,6 +171,11 @@ static int v4l2_handle_event(V4L2Context *ctx)
 return 0;
 }
 
+if (evt.type == V4L2_EVENT_EOS) {
+ctx->done = 1;
+return 0;
+}
+
 if (evt.type != V4L2_EVENT_SOURCE_CHANGE)
 return 0;
 
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index d666edffe4..7a4d2a43cb 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -123,6 +123,15 @@ static int v4l2_prepare_decoder(V4L2m2mContext *s)
 }
 }
 
+memset(&sub, 0, sizeof(sub));
+sub.type = V4L2_EVENT_EOS;
+ret = ioctl(s->fd, VIDIOC_SUBSCRIBE_EVENT, &sub);
+if (ret < 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+"the v4l2 driver does not support VIDIOC_SUBSCRIBE_EVENT\n"
+"you must provide an eos event to finish encode\n");
+}
+
 return 0;
 }
 
diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index 84de63ec9d..13bd9d29f4 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -155,6 +155,24 @@ static int v4l2_check_b_frame_support(V4L2m2mContext *s)
 return AVERROR_PATCHWELCOME;
 }
 
+static int v4l2_subscribe_eos_event(V4L2m2mContext *s)
+{
+struct v4l2_event_subscription sub;
+int ret;
+
+memset(&sub, 0, sizeof(sub));
+sub.type = V4L2_EVENT_EOS;
+ret = ioctl(s->fd, VIDIOC_SUBSCRIBE_EVENT, &sub);
+if (ret < 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+"the v4l2 driver does not support VIDIOC_SUBSCRIBE_EVENT\n"
+"you must provide an eos event to finish encode\n");
+return ret;
+}
+
+return 0;
+}
+
 static int v4l2_prepare_encoder(V4L2m2mContext *s)
 {
 AVCodecContext *avctx = s->avctx;
@@ -164,6 +182,8 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
 /**
  * requirements
  */
+v4l2_subscribe_eos_event(s);
+
 ret = v4l2_check_b_frame_support(s);
 if (ret)
 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".

Re: [FFmpeg-devel] [PATCH v1 2/2] avfilter/vf_overlay: remove the duplicated framesync option

2020-03-17 Thread Paul B Mahol
NAK

Was added explicitly by Michael, to keep all scripts working.
So you should not sent such patches.

On 3/17/20, lance.lmw...@gmail.com  wrote:
> From: Limin Wang 
>
> After applied the patch, we can change default eof_action from repeat to
> pass still.
>
> ./ffmpeg -y -filter_complex
> "movie=./input.mkv,setpts=PTS-STARTPTS[main];movie=./overlay.mkv:loop=2,setpts=PTS-STARTPTS[overlay];[main][overlay]overlay=10:10:
>  enable='between(t,0,25):eof_action=pass"  test.mkv
>
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_overlay.c | 8 
>  1 file changed, 8 deletions(-)
>
> diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
> index 0a8f089c0d..a481f74076 100644
> --- a/libavfilter/vf_overlay.c
> +++ b/libavfilter/vf_overlay.c
> @@ -993,16 +993,9 @@ static int activate(AVFilterContext *ctx)
>  static const AVOption overlay_options[] = {
>  { "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING,
> {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
>  { "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING,
> {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
> -{ "eof_action", "Action to take when encountering EOF from secondary
> input ",
> -OFFSET(fs.opt_eof_action), AV_OPT_TYPE_INT, { .i64 =
> EOF_ACTION_REPEAT },
> -EOF_ACTION_REPEAT, EOF_ACTION_PASS, .flags = FLAGS, "eof_action" },
> -{ "repeat", "Repeat the previous frame.",   0, AV_OPT_TYPE_CONST, {
> .i64 = EOF_ACTION_REPEAT }, .flags = FLAGS, "eof_action" },
> -{ "endall", "End both streams.",0, AV_OPT_TYPE_CONST, {
> .i64 = EOF_ACTION_ENDALL }, .flags = FLAGS, "eof_action" },
> -{ "pass",   "Pass through the main input.", 0, AV_OPT_TYPE_CONST, {
> .i64 = EOF_ACTION_PASS },   .flags = FLAGS, "eof_action" },
>  { "eval", "specify when to evaluate expressions", OFFSET(eval_mode),
> AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_FRAME}, 0, EVAL_MODE_NB-1, FLAGS, "eval"
> },
>   { "init",  "eval expressions once during initialization", 0,
> AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT},  .flags = FLAGS, .unit = "eval" },
>   { "frame", "eval expressions per-frame",  0,
> AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
> -{ "shortest", "force termination when the shortest input terminates",
> OFFSET(fs.opt_shortest), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
>  { "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT,
> {.i64=OVERLAY_FORMAT_YUV420}, 0, OVERLAY_FORMAT_NB-1, FLAGS, "format" },
>  { "yuv420", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420},
> .flags = FLAGS, .unit = "format" },
>  { "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422},
> .flags = FLAGS, .unit = "format" },
> @@ -1010,7 +1003,6 @@ static const AVOption overlay_options[] = {
>  { "rgb","", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB},
> .flags = FLAGS, .unit = "format" },
>  { "gbrp",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_GBRP},
> .flags = FLAGS, .unit = "format" },
>  { "auto",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_AUTO},
> .flags = FLAGS, .unit = "format" },
> -{ "repeatlast", "repeat overlay of the last overlay frame",
> OFFSET(fs.opt_repeatlast), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
>  { "alpha", "alpha format", OFFSET(alpha_format), AV_OPT_TYPE_INT,
> {.i64=0}, 0, 1, FLAGS, "alpha_format" },
>  { "straight",  "", 0, AV_OPT_TYPE_CONST, {.i64=0}, .flags =
> FLAGS, .unit = "alpha_format" },
>  { "premultiplied", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, .flags =
> FLAGS, .unit = "alpha_format" },
> --
> 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 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] not display motionless vectors in examples/extract_mvs.c

2020-03-17 Thread Moritz Barsnick
On Tue, Mar 17, 2020 at 01:21:15 +0800, numberwolf wrote:
> Subject: not display motionless vectors in examples/extract_mvs.c

Please do have a look at other commits in the repository. This would be
examples/extract_mvs: don't display motionless vectors.


> Here, dont need show motionless vectors,because they're useless.
> (Sorry about I forget to remove the 'printf' on previous version.)

These remarks belong below the three dashes "---" below, otherwise they
become part of the repository.
> Signed-off-by: numberwolf 
> ---

^
These three lines.

> +if (mv->src_x == mv->dst_x && mv->src_y == mv->dst_y) {
> +printf("extract_mvs skip\n");

You didn't actually remove the printf().

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] [PATCH v2][GSOC] avfilter: add atone filter

2020-03-17 Thread Marshall Murmu
Fixing noteon/off logic

---
 Changelog|   1 +
 configure|   4 +
 doc/filters.texi |  29 ++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/asrc_atone.c | 197 +++
 libavfilter/version.h|   2 +-
 7 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/asrc_atone.c

diff --git a/Changelog b/Changelog
index d1572553a5..5ddd2484b0 100644
--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,7 @@ version :
 - AMQP 0-9-1 protocol (RabbitMQ)
 - Vulkan support
 - avgblur_vulkan, overlay_vulkan, scale_vulkan and chromaber_vulkan filters
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 18f2841765..b083ac6453 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable fluidsynth support via libfluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1770,6 +1771,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3465,6 +3467,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6270,6 +6273,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index 328e984e92..918b1703f8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5946,6 +5946,35 @@ anullsrc=r=48000:cl=mono
 
 All the parameters need to be explicitly defined.
 
+@section atone
+
+Synthesize random notes using libfluidsynth library.
+
+To compile this filter you need to configure FFmpeg with
+@code{--enable-libfluidsynth}.
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Set the sample rate of the synthesizer. Default value is 44100.
+
+@item nb_samples, n
+Set the number of samples per frame. Default value is 1024.
+
+@item duration, d
+Set the duration of sound generation. Default value is 10 sec.
+
+@item soundfont
+Enter the location of the soundfont. Without loading the soundfont fluidsynth 
won't be able to synthesize.
+
+@item mchan
+Set the MIDI channel. Default value is 0.
+
+@item seed
+Set the seed value for the PRNG
+@end table
+
 @section flite
 
 Synthesize a voice utterance using the libflite library.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 750412da6b..020c4553cb 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -147,6 +147,7 @@ OBJS-$(CONFIG_AEVALSRC_FILTER)   += aeval.o
 OBJS-$(CONFIG_AFIRSRC_FILTER)+= asrc_afirsrc.o
 OBJS-$(CONFIG_ANOISESRC_FILTER)  += asrc_anoisesrc.o
 OBJS-$(CONFIG_ANULLSRC_FILTER)   += asrc_anullsrc.o
+OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
 OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 501e5d041b..d167499cf1 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -141,6 +141,7 @@ extern AVFilter ff_asrc_aevalsrc;
 extern AVFilter ff_asrc_afirsrc;
 extern AVFilter ff_asrc_anoisesrc;
 extern AVFilter ff_asrc_anullsrc;
+extern AVFilter ff_asrc_atone;
 extern AVFilter ff_asrc_flite;
 extern AVFilter ff_asrc_hilbert;
 extern AVFilter ff_asrc_sinc;
diff --git a/libavfilter/asrc_atone.c b/libavfilter/asrc_atone.c
new file mode 100644
index 00..e3bb7faa34
--- /dev/null
+++ b/libavfilter/asrc_atone.c
@@ -0,0 +1,197 @@
+/*
+ * This file 

Re: [FFmpeg-devel] [PATCH v2][GSOC] avfilter: add atone filter

2020-03-17 Thread Paul B Mahol
Hi,

On 3/17/20, Marshall Murmu  wrote:
> Fixing noteon/off logic
>
> ---
>  Changelog|   1 +
>  configure|   4 +
>  doc/filters.texi |  29 ++
>  libavfilter/Makefile |   1 +
>  libavfilter/allfilters.c |   1 +
>  libavfilter/asrc_atone.c | 197 +++
>  libavfilter/version.h|   2 +-
>  7 files changed, 234 insertions(+), 1 deletion(-)
>  create mode 100644 libavfilter/asrc_atone.c
>
> diff --git a/Changelog b/Changelog
> index d1572553a5..5ddd2484b0 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -48,6 +48,7 @@ version :
>  - AMQP 0-9-1 protocol (RabbitMQ)
>  - Vulkan support
>  - avgblur_vulkan, overlay_vulkan, scale_vulkan and chromaber_vulkan filters
> +- atone filter
>
>
>  version 4.2:
> diff --git a/configure b/configure
> index 18f2841765..b083ac6453 100755
> --- a/configure
> +++ b/configure
> @@ -233,6 +233,7 @@ External library support:
> and libraw1394 [no]
>--enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
>--enable-libfliteenable flite (voice synthesis) support via
> libflite [no]
> +  --enable-libfluidsynth   enable fluidsynth support via libfluidsynth [no]
>--enable-libfontconfig   enable libfontconfig, useful for drawtext filter
> [no]
>--enable-libfreetype enable libfreetype, needed for drawtext filter
> [no]
>--enable-libfribidi  enable libfribidi, improves drawtext filter [no]
> @@ -1770,6 +1771,7 @@ EXTERNAL_LIBRARY_LIST="
>  libdc1394
>  libdrm
>  libflite
> +libfluidsynth
>  libfontconfig
>  libfreetype
>  libfribidi
> @@ -3465,6 +3467,7 @@ asr_filter_deps="pocketsphinx"
>  ass_filter_deps="libass"
>  atempo_filter_deps="avcodec"
>  atempo_filter_select="rdft"
> +atone_filter_deps="libfluidsynth"
>  avgblur_opencl_filter_deps="opencl"
>  avgblur_vulkan_filter_deps="vulkan libglslang"
>  azmq_filter_deps="libzmq"
> @@ -6270,6 +6273,7 @@ enabled libfdk_aac&& { check_pkg_config
> libfdk_aac fdk-aac "fdk-aac/aace
>   warn "using libfdk without pkg-config"; }
> }
>  flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal
> -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish
> -lflite_cmulex -lflite"
>  enabled libflite  && require libflite "flite/flite.h" flite_init
> $flite_extralibs
> +enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth
> "fluidsynth.h" fluid_log
>  enabled fontconfig&& enable libfontconfig
>  enabled libfontconfig && require_pkg_config libfontconfig fontconfig
> "fontconfig/fontconfig.h" FcInit
>  enabled libfreetype   && require_pkg_config libfreetype freetype2
> "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 328e984e92..918b1703f8 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -5946,6 +5946,35 @@ anullsrc=r=48000:cl=mono
>
>  All the parameters need to be explicitly defined.
>
> +@section atone
> +
> +Synthesize random notes using libfluidsynth library.
> +
> +To compile this filter you need to configure FFmpeg with
> +@code{--enable-libfluidsynth}.
> +
> +The filter accepts the following options:
> +
> +@table @option
> +@item sample_rate, r
> +Set the sample rate of the synthesizer. Default value is 44100.
> +
> +@item nb_samples, n
> +Set the number of samples per frame. Default value is 1024.
> +
> +@item duration, d
> +Set the duration of sound generation. Default value is 10 sec.
> +
> +@item soundfont
> +Enter the location of the soundfont. Without loading the soundfont
> fluidsynth won't be able to synthesize.
> +
> +@item mchan
> +Set the MIDI channel. Default value is 0.
> +
> +@item seed
> +Set the seed value for the PRNG
> +@end table
> +
>  @section flite
>
>  Synthesize a voice utterance using the libflite library.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 750412da6b..020c4553cb 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -147,6 +147,7 @@ OBJS-$(CONFIG_AEVALSRC_FILTER)   += aeval.o
>  OBJS-$(CONFIG_AFIRSRC_FILTER)+= asrc_afirsrc.o
>  OBJS-$(CONFIG_ANOISESRC_FILTER)  += asrc_anoisesrc.o
>  OBJS-$(CONFIG_ANULLSRC_FILTER)   += asrc_anullsrc.o
> +OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
>  OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
>  OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
>  OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 501e5d041b..d167499cf1 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -141,6 +141,7 @@ extern AVFilter ff_asrc_aevalsrc;
>  extern AVFilter ff_asrc_afirsrc;
>  extern AVFilter ff_asrc_anoisesrc;
>  extern AVFilter ff_asrc_anullsrc;
> +extern AVFilter ff_asrc_atone;
>  exte

Re: [FFmpeg-devel] [PATCH v1 2/2] avfilter/vf_overlay: remove the duplicated framesync option

2020-03-17 Thread Limin Wang
On Tue, Mar 17, 2020 at 01:09:59PM +0100, Paul B Mahol wrote:
> NAK
> 
> Was added explicitly by Michael, to keep all scripts working.
> So you should not sent such patches.

Sorry, I have realized it'll break the short option without eof_action.
please ignore the patch.

> 
> On 3/17/20, lance.lmw...@gmail.com  wrote:
> > From: Limin Wang 
> >
> > After applied the patch, we can change default eof_action from repeat to
> > pass still.
> >
> > ./ffmpeg -y -filter_complex
> > "movie=./input.mkv,setpts=PTS-STARTPTS[main];movie=./overlay.mkv:loop=2,setpts=PTS-STARTPTS[overlay];[main][overlay]overlay=10:10:
> >  enable='between(t,0,25):eof_action=pass"  test.mkv
> >
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/vf_overlay.c | 8 
> >  1 file changed, 8 deletions(-)
> >
> > diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
> > index 0a8f089c0d..a481f74076 100644
> > --- a/libavfilter/vf_overlay.c
> > +++ b/libavfilter/vf_overlay.c
> > @@ -993,16 +993,9 @@ static int activate(AVFilterContext *ctx)
> >  static const AVOption overlay_options[] = {
> >  { "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING,
> > {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
> >  { "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING,
> > {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
> > -{ "eof_action", "Action to take when encountering EOF from secondary
> > input ",
> > -OFFSET(fs.opt_eof_action), AV_OPT_TYPE_INT, { .i64 =
> > EOF_ACTION_REPEAT },
> > -EOF_ACTION_REPEAT, EOF_ACTION_PASS, .flags = FLAGS, "eof_action" },
> > -{ "repeat", "Repeat the previous frame.",   0, AV_OPT_TYPE_CONST, {
> > .i64 = EOF_ACTION_REPEAT }, .flags = FLAGS, "eof_action" },
> > -{ "endall", "End both streams.",0, AV_OPT_TYPE_CONST, {
> > .i64 = EOF_ACTION_ENDALL }, .flags = FLAGS, "eof_action" },
> > -{ "pass",   "Pass through the main input.", 0, AV_OPT_TYPE_CONST, {
> > .i64 = EOF_ACTION_PASS },   .flags = FLAGS, "eof_action" },
> >  { "eval", "specify when to evaluate expressions", OFFSET(eval_mode),
> > AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_FRAME}, 0, EVAL_MODE_NB-1, FLAGS, "eval"
> > },
> >   { "init",  "eval expressions once during initialization", 0,
> > AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT},  .flags = FLAGS, .unit = "eval" },
> >   { "frame", "eval expressions per-frame",  0,
> > AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
> > -{ "shortest", "force termination when the shortest input terminates",
> > OFFSET(fs.opt_shortest), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
> >  { "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT,
> > {.i64=OVERLAY_FORMAT_YUV420}, 0, OVERLAY_FORMAT_NB-1, FLAGS, "format" },
> >  { "yuv420", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420},
> > .flags = FLAGS, .unit = "format" },
> >  { "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422},
> > .flags = FLAGS, .unit = "format" },
> > @@ -1010,7 +1003,6 @@ static const AVOption overlay_options[] = {
> >  { "rgb","", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB},
> > .flags = FLAGS, .unit = "format" },
> >  { "gbrp",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_GBRP},
> > .flags = FLAGS, .unit = "format" },
> >  { "auto",   "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_AUTO},
> > .flags = FLAGS, .unit = "format" },
> > -{ "repeatlast", "repeat overlay of the last overlay frame",
> > OFFSET(fs.opt_repeatlast), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
> >  { "alpha", "alpha format", OFFSET(alpha_format), AV_OPT_TYPE_INT,
> > {.i64=0}, 0, 1, FLAGS, "alpha_format" },
> >  { "straight",  "", 0, AV_OPT_TYPE_CONST, {.i64=0}, .flags =
> > FLAGS, .unit = "alpha_format" },
> >  { "premultiplied", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, .flags =
> > FLAGS, .unit = "alpha_format" },
> > --
> > 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".

-- 
Thanks,
Limin Wang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH, v4] lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode

2020-03-17 Thread Linjie Fu
With the description in frame size with refs semantics (SPEC 7.2.5),
it is a requirement of bitstream conformance that for at least one
reference frame has the valid dimensions.

Modify the check to make sure the decoder works well in SINGLE_REFERENCE
mode that not all reference frames have valid dimensions.

Check and error out if invalid reference frame is used in inter_recon.

One of the failure case is a 480x272 inter frame (SINGLE_REFERENCE mode)
with following reference pool:

0.  960x544LASTvalid
1. 1920x1088 GOLDEN  invalid, but not used in single reference mode
2. 1920x1088 ALTREF  invalid, but not used in single reference mode
3~7  ... Unused

Identical logic in libvpx:


Signed-off-by: Linjie Fu 
---
[v3]: replace assert with check/return, tested in both multi frame/slice mode
[v4]: clear error_info to make decoding still work for other frames in this 
stream

 libavcodec/vp9.c  | 20 ++--
 libavcodec/vp9dec.h   |  5 +
 libavcodec/vp9recon.c | 10 ++
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 7aaae9b..2b79dfd 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -794,6 +794,7 @@ static int decode_frame_header(AVCodecContext *avctx,
 
 /* check reference frames */
 if (!s->s.h.keyframe && !s->s.h.intraonly) {
+int valid_ref_frame = 0;
 for (i = 0; i < 3; i++) {
 AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
 int refw = ref->width, refh = ref->height;
@@ -807,17 +808,25 @@ static int decode_frame_header(AVCodecContext *avctx,
 } else if (refw == w && refh == h) {
 s->mvscale[i][0] = s->mvscale[i][1] = 0;
 } else {
+/* Check to make sure at least one of frames that */
+/* this frame references has valid dimensions */
 if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 16 * 
refh) {
-av_log(avctx, AV_LOG_ERROR,
+av_log(avctx, AV_LOG_WARNING,
"Invalid ref frame dimensions %dx%d for frame size 
%dx%d\n",
refw, refh, w, h);
-return AVERROR_INVALIDDATA;
+s->mvscale[i][0] = s->mvscale[i][1] = REF_INVALID_SCALE;
+continue;
 }
 s->mvscale[i][0] = (refw << 14) / w;
 s->mvscale[i][1] = (refh << 14) / h;
 s->mvstep[i][0] = 16 * s->mvscale[i][0] >> 14;
 s->mvstep[i][1] = 16 * s->mvscale[i][1] >> 14;
 }
+valid_ref_frame++;
+}
+if (!valid_ref_frame) {
+av_log(avctx, AV_LOG_ERROR, "No valid reference frame is found, 
bitstream not supported\n");
+return AVERROR_INVALIDDATA;
 }
 }
 
@@ -1614,6 +1623,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 s->td[i].eob = s->td[i].eob_base;
 s->td[i].uveob[0] = s->td[i].uveob_base[0];
 s->td[i].uveob[1] = s->td[i].uveob_base[1];
+s->td[i].error_info = 0;
 }
 
 #if HAVE_THREADS
@@ -1670,6 +1680,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
 } while (s->pass++ == 1);
 ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
 
+if (s->td->error_info < 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed to decode tile data\n");
+s->td->error_info = 0;
+return AVERROR_INVALIDDATA;
+}
+
 finish:
 // ref frame setup
 for (i = 0; i < 8; i++) {
diff --git a/libavcodec/vp9dec.h b/libavcodec/vp9dec.h
index 66573ed..f2585c3 100644
--- a/libavcodec/vp9dec.h
+++ b/libavcodec/vp9dec.h
@@ -36,6 +36,8 @@
 #include "vp9dsp.h"
 #include "vp9shared.h"
 
+#define REF_INVALID_SCALE 0x
+
 enum MVJoint {
 MV_JOINT_ZERO,
 MV_JOINT_H,
@@ -217,6 +219,9 @@ struct VP9TileData {
 struct { int x, y; } min_mv, max_mv;
 int16_t *block_base, *block, *uvblock_base[2], *uvblock[2];
 uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2];
+
+// error message
+int error_info;
 };
 
 void ff_vp9_fill_mv(VP9TileData *td, VP56mv *mv, int mode, int sb);
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index 49bb04e..9a4e7c7 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -572,6 +572,16 @@ static av_always_inline void inter_recon(VP9TileData *td, 
int bytesperpixel)
 VP9Block *b = td->b;
 int row = td->row, col = td->col;
 
+if (s->mvscale[b->ref[0]][0] == REF_INVALID_SCALE ||
+(b->comp && s->mvscale[b->ref[1]][0] == REF_INVALID_SCALE)) {
+if (!s->td->error_info) {
+s->td->error_info = AVERROR_INVALIDDATA;
+av_log(NULL, AV_LOG_ERROR, "Bitstream not supported, "
+   "reference frame has invalid 
dimensions\n");
+}
+return;
+}
+
 if

Re: [FFmpeg-devel] [PATCH, v3] lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode

2020-03-17 Thread Carl Eugen Hoyos
Am Di., 17. März 2020 um 10:45 Uhr schrieb Linjie Fu :
>
> With the description in frame size with refs semantics (SPEC 7.2.5),
> it is a requirement of bitstream conformance that for at least one
> reference frame has the valid dimensions.
>
> Modify the check to make sure the decoder works well in SINGLE_REFERENCE
> mode that not all reference frames have valid dimensions.
>
> Check and error out if invalid reference frame is used in inter_recon.

I strongly suspect we only want to error out if explode > default.

Not necessarily related to this patch:
In general, FFmpeg should not unnecessarily copy the behaviour
of other libraries.

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

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

[FFmpeg-devel] [PATCH v3] examples/extract_mvs.c: don't disply motionless vectors

2020-03-17 Thread numberwolf
Signed-off-by: numberwolf 
---



Here, don't need show motionless vectors,because they're useless.
 doc/examples/extract_mvs.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index de31ccd..f6d19b7 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -60,6 +60,13 @@ static int decode_packet(const AVPacket *pkt)
 const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
 for (i = 0; i < sd->size / sizeof(*mvs); i++) {
 const AVMotionVector *mv = &mvs[i];
+
+// dont need show motionless vectors
+// because they're useless
+if (mv->src_x == mv->dst_x && mv->src_y == mv->dst_y) {
+continue;
+}
+
 printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
 video_frame_count, mv->source,
 mv->w, mv->h, mv->src_x, mv->src_y,
-- 
2.17.2 (Apple Git-113)

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

[FFmpeg-devel] [PATCH v3][GSOC] avfilter: add atone filter

2020-03-17 Thread Marshall Murmu
 I hope this one's simple enough
---
 Changelog|   1 +
 configure|   4 +
 doc/filters.texi |  29 ++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/asrc_atone.c | 188 +++
 libavfilter/version.h|   2 +-
 7 files changed, 225 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/asrc_atone.c

diff --git a/Changelog b/Changelog
index 711861bda9..7888ffc7fb 100644
--- a/Changelog
+++ b/Changelog
@@ -54,6 +54,7 @@ version :
 - DERF demuxer
 - CRI HCA decoder
 - CRI HCA demuxer
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 18f2841765..b083ac6453 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable fluidsynth support via libfluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1770,6 +1771,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3465,6 +3467,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6270,6 +6273,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index 328e984e92..918b1703f8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5946,6 +5946,35 @@ anullsrc=r=48000:cl=mono
 
 All the parameters need to be explicitly defined.
 
+@section atone
+
+Synthesize random notes using libfluidsynth library.
+
+To compile this filter you need to configure FFmpeg with
+@code{--enable-libfluidsynth}.
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Set the sample rate of the synthesizer. Default value is 44100.
+
+@item nb_samples, n
+Set the number of samples per frame. Default value is 1024.
+
+@item duration, d
+Set the duration of sound generation. Default value is 10 sec.
+
+@item soundfont
+Enter the location of the soundfont. Without loading the soundfont fluidsynth 
won't be able to synthesize.
+
+@item mchan
+Set the MIDI channel. Default value is 0.
+
+@item seed
+Set the seed value for the PRNG
+@end table
+
 @section flite
 
 Synthesize a voice utterance using the libflite library.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 750412da6b..020c4553cb 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -147,6 +147,7 @@ OBJS-$(CONFIG_AEVALSRC_FILTER)   += aeval.o
 OBJS-$(CONFIG_AFIRSRC_FILTER)+= asrc_afirsrc.o
 OBJS-$(CONFIG_ANOISESRC_FILTER)  += asrc_anoisesrc.o
 OBJS-$(CONFIG_ANULLSRC_FILTER)   += asrc_anullsrc.o
+OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
 OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 501e5d041b..d167499cf1 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -141,6 +141,7 @@ extern AVFilter ff_asrc_aevalsrc;
 extern AVFilter ff_asrc_afirsrc;
 extern AVFilter ff_asrc_anoisesrc;
 extern AVFilter ff_asrc_anullsrc;
+extern AVFilter ff_asrc_atone;
 extern AVFilter ff_asrc_flite;
 extern AVFilter ff_asrc_hilbert;
 extern AVFilter ff_asrc_sinc;
diff --git a/libavfilter/asrc_atone.c b/libavfilter/asrc_atone.c
new file mode 100644
index 00..25490424e0
--- /dev/null
+++ b/libavfilter/asrc_atone.c
@@ -0,0 +1,188 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistr

Re: [FFmpeg-devel] [PATCH v9 4/4] avcodec/h264: create user data unregistered SEI side data for H.264

2020-03-17 Thread Kieran Kunhya
On Tue, 17 Mar 2020 at 11:25,  wrote:

> From: Limin Wang 
>
> Signed-off-by: Limin Wang 
>

I've seen whole planes (e.g Alpha) taking up 10s or 100s of KB put in SEI,
do we really want to export this all as side data?

Kieran
___
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 v9 4/4] avcodec/h264: create user data unregistered SEI side data for H.264

2020-03-17 Thread James Almer
On 3/17/2020 1:05 PM, Kieran Kunhya wrote:
> On Tue, 17 Mar 2020 at 11:25,  wrote:
> 
>> From: Limin Wang 
>>
>> Signed-off-by: Limin Wang 
>>
> 
> I've seen whole planes (e.g Alpha) taking up 10s or 100s of KB put in SEI,
> do we really want to export this all as side data?

Frame side data is reference counted, so it shouldn't be an issue.

> 
> Kieran
> ___
> 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 v9 2/4] avcodec/hevc_sei: add support for user data unregistered SEI message

2020-03-17 Thread Derek Buitenhuis
On 17/03/2020 10:54, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavcodec/hevc_sei.c   | 31 +++
>  libavcodec/hevc_sei.h   |  6 ++
>  libavcodec/hevcdec.c| 14 ++
>  tests/ref/fate/hevc-monochrome-crop |  3 +++
>  4 files changed, 54 insertions(+)

Apologies if I missed this in previous iterations.

What is the proposed usecase?

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

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

Re: [FFmpeg-devel] [PATCH v3][GSOC] avfilter: add atone filter

2020-03-17 Thread Paul B Mahol
On 3/17/20, Marshall Murmu  wrote:
>  I hope this one's simple enough

It is not simple at all. How do you plan to extend it and add other
instruments and so on later?

Use some state variable, which will hold current number of samples
outputted per tone and use loops.

There is filter private context exactly for that.
___
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 08/17] avformat/webmdashenc: Fix memleak upon realloc failure

2020-03-17 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> The classical ptr = av_realloc(ptr, size).
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/webmdashenc.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index d2f0e0ec4d..e8b7a07974 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -489,11 +489,12 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  state = parsing_streams;
>  } else if (state == parsing_streams) {
>  struct AdaptationSet *as = &w->as[w->nb_as - 1];
> +int ret = av_reallocp_array(&as->streams, ++as->nb_streams,
> +sizeof(*as->streams));
> +if (ret < 0)
> +return ret;
>  q = p;
>  while (*q != '\0' && *q != ',' && *q != ' ') q++;
> -as->streams = av_realloc(as->streams, sizeof(*as->streams) * 
> ++as->nb_streams);
> -if (as->streams == NULL)
> -return AVERROR(ENOMEM);
>  as->streams[as->nb_streams - 1] = to_integer(p, q - p + 1);
>  if (as->streams[as->nb_streams - 1] < 0 ||
>  as->streams[as->nb_streams - 1] >= s->nb_streams) {
> 
Ping.

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

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

Re: [FFmpeg-devel] [PATCH 08/17] avformat/webmdashenc: Fix memleak upon realloc failure

2020-03-17 Thread Paul B Mahol
lgtm

On 12/26/19, Andreas Rheinhardt  wrote:
> The classical ptr = av_realloc(ptr, size).
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/webmdashenc.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index d2f0e0ec4d..e8b7a07974 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -489,11 +489,12 @@ static int parse_adaptation_sets(AVFormatContext *s)
>  state = parsing_streams;
>  } else if (state == parsing_streams) {
>  struct AdaptationSet *as = &w->as[w->nb_as - 1];
> +int ret = av_reallocp_array(&as->streams, ++as->nb_streams,
> +sizeof(*as->streams));
> +if (ret < 0)
> +return ret;
>  q = p;
>  while (*q != '\0' && *q != ',' && *q != ' ') q++;
> -as->streams = av_realloc(as->streams, sizeof(*as->streams) *
> ++as->nb_streams);
> -if (as->streams == NULL)
> -return AVERROR(ENOMEM);
>  as->streams[as->nb_streams - 1] = to_integer(p, q - p + 1);
>  if (as->streams[as->nb_streams - 1] < 0 ||
>  as->streams[as->nb_streams - 1] >= s->nb_streams) {
> --
> 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] sws_scale function exception access

2020-03-17 Thread Michael Niedermayer
On Tue, Mar 17, 2020 at 11:13:22AM +0800, BYHYKCHKIO WEIINZWLM wrote:
> Hello,
> 
> I have a vulnerability about FFmpage to report.
> 
> Regarding the sws_scale function in the swscale.c file, when the parameter
> SwsContext is 0, the program access address is abnormal, causing the
> program to crash.

sws_scale() documents the SwsContext parameter as
"the scaling context previously created ..."

0 is not a scaling context.
So if you pass 0 as context your code is buggy.
If other code does that then that code is buggy.

Thanks


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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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

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

[FFmpeg-devel] [PATCH 1/2] avcodec/bsf: Don't set defaults for AVClass without options

2020-03-17 Thread Andreas Rheinhardt
This happened for AVBSFContext.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/bsf.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 9dbf6a636d..d0e0d46068 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -45,8 +45,6 @@ void av_bsf_free(AVBSFContext **pctx)
 if (ctx->filter->priv_class && ctx->priv_data)
 av_opt_free(ctx->priv_data);
 
-av_opt_free(ctx);
-
 if (ctx->internal)
 av_packet_free(&ctx->internal->buffer_pkt);
 av_freep(&ctx->internal);
@@ -112,8 +110,6 @@ int av_bsf_alloc(const AVBitStreamFilter *filter, 
AVBSFContext **pctx)
 goto fail;
 }
 
-av_opt_set_defaults(ctx);
-
 /* allocate priv data and init private options */
 if (filter->priv_data_size) {
 ctx->priv_data = av_mallocz(filter->priv_data_size);
-- 
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] [PATCH 2/2] avcodec/bsf: Beautify log messages from bitstream filters

2020-03-17 Thread Andreas Rheinhardt
Up until now, the name of every AVBSFContext for logging purposes was
"AVBSFContext", so that the default logging callback produced output
like "[AVBSFContext @ 0x55813bae92c0] Extradata". This has been changed
to "[trace_headers @ 0x60a00700] Extradata" by adding an item_name-
function to the AVClass for bitstream filters.

Furthermore, the correct category has been set so that the introductory
part before the actual message (everything before "Extradata" in the
above examples) are displayed in a different colour than the rest.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/bsf.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index d0e0d46068..7b96183e64 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -64,12 +64,18 @@ static void *bsf_child_next(void *obj, void *prev)
 return NULL;
 }
 
+static const char *bsf_to_name(void *bsf)
+{
+return ((AVBSFContext *)bsf)->filter->name;
+}
+
 static const AVClass bsf_class = {
 .class_name   = "AVBSFContext",
-.item_name= av_default_item_name,
+.item_name= bsf_to_name,
 .version  = LIBAVUTIL_VERSION_INT,
 .child_next   = bsf_child_next,
 .child_class_next = ff_bsf_child_class_next,
+.category = AV_CLASS_CATEGORY_BITSTREAM_FILTER,
 };
 
 const AVClass *av_bsf_get_class(void)
-- 
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] [PATCH] avformat/webmdashenc: Don't use custom option for bitexactness

2020-03-17 Thread Andreas Rheinhardt
The WebM DASH Manifest muxer can write manifests for live streams and
these contain an entry that depends on the time the manifest is written;
an AVOption to make the output reproducible has been added for tests.
But this is unnecessary, as there already is a method for reproducible
output: The AVFMT_FLAG_BITEXACT-flag of the AVFormatContext. Therefore
this commit removes the custom option.

Given that the description of said option contained "private option -
users should never set this" and that it was not documented in
muxers.texi, no deprecation period for this option seemed necessary.

The commands of the FATE-tests for this muxer have been changed to no
longer use this option.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/webmdashenc.c | 4 +---
 tests/fate/vpx.mak| 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index d2f0e0ec4d..0e7bfba34c 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -57,7 +57,6 @@ typedef struct WebMDashMuxContext {
 char *utc_timing_url;
 double time_shift_buffer_depth;
 int minimum_update_period;
-int debug_mode;
 } WebMDashMuxContext;
 
 static const char *get_codec_name(int codec_id)
@@ -114,7 +113,7 @@ static int write_header(AVFormatContext *s)
 if (!strftime(gmt_iso, 21, "%Y-%m-%dT%H:%M:%SZ", gmt)) {
 return AVERROR_UNKNOWN;
 }
-if (w->debug_mode) {
+if (s->flags & AVFMT_FLAG_BITEXACT) {
 av_strlcpy(gmt_iso, "", 1);
 }
 avio_printf(s->pb, "  availabilityStartTime=\"%s\"\n", gmt_iso);
@@ -553,7 +552,6 @@ static int webm_dash_manifest_write_packet(AVFormatContext 
*s, AVPacket *pkt)
 #define OFFSET(x) offsetof(WebMDashMuxContext, x)
 static const AVOption options[] = {
 { "adaptation_sets", "Adaptation sets. Syntax: id=0,streams=0,1,2 
id=1,streams=3,4 and so on", OFFSET(adaptation_sets), AV_OPT_TYPE_STRING, { 0 
}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
-{ "debug_mode", "[private option - users should never set this]. Create 
deterministic output", OFFSET(debug_mode), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 
AV_OPT_FLAG_ENCODING_PARAM },
 { "live", "create a live stream manifest", OFFSET(is_live), 
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
 { "chunk_start_index",  "start index of the chunk", 
OFFSET(chunk_start_index), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM },
 { "chunk_duration_ms", "duration of each chunk (in milliseconds)", 
OFFSET(chunk_duration), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM },
diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 3b3da18feb..c65959f133 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -71,10 +71,10 @@ FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += 
fate-webm-dash-manifest-represe
 fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
 
 FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-live
-fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c 
copy -map 0 -map 1 -f webm_dash_manifest -live 1 -adaptation_sets 
"id=0,streams=0 id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 
-time_shift_buffer_depth 7200 -minimum_update_period 60 -debug_mode 1 -
+fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c 
copy -map 0 -map 1 -fflags +bitexact -f webm_dash_manifest -live 1 
-adaptation_sets "id=0,streams=0 id=1,streams=1" -chunk_start_index 1 
-chunk_duration_ms 5000 -time_shift_buffer_depth 7200 -minimum_update_period 60 
-
 
 FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += 
fate-webm-dash-manifest-live-bandwidth
-fate-webm-dash-manifest-live-bandwidth: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -live 1 -bandwidth 100 -i 
$(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 
-bandwidth 200 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 
-map 1 -f webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 
id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 
-time_shift_buffer_depth 7200 -minimum_update_period 60 -debug_mode 1 -
+fate-webm-dash-manifest-live-bandwidth: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -live 1 -bandwidth 100 -i 
$(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 
-bandwidth 200 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.h

[FFmpeg-devel] [PATCH 1/2] MAINTAINERS: Add myself as maintainer for matroska*

2020-03-17 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 MAINTAINERS | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 55e2b385b5..71e9ee8a00 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -434,9 +434,9 @@ Muxers/Demuxers:
   lmlm4.c   Ivo van Poorten
   lvfdec.c  Paul B Mahol
   lxfdec.c  Tomas Härdin
-  matroska.cAurelien Jacobs
-  matroskadec.c Aurelien Jacobs
-  matroskaenc.c David Conrad
+  matroska.cAurelien Jacobs, Andreas Rheinhardt
+  matroskadec.c Aurelien Jacobs, Andreas Rheinhardt
+  matroskaenc.c David Conrad, Andreas Rheinhardt
   matroska subtitles (matroskaenc.c)John Peebles
   metadata* Aurelien Jacobs
   mgsts.c   Paul B Mahol
-- 
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] [PATCH 2/2] MAINTAINERS: Don't mention Google+

2020-03-17 Thread Andreas Rheinhardt
It has been shut down in April 2019.

Signed-off-by: Andreas Rheinhardt 
---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 71e9ee8a00..b960c89ebd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -55,7 +55,6 @@ fate.ffmpeg.org Timothy Gu
 Trac bug trackerAlexander Strasser, Michael 
Niedermayer, Carl Eugen Hoyos
 Patchwork   Andriy Gelman
 mailing lists   Baptiste Coudurier
-Google+ Paul B Mahol, Michael Niedermayer, 
Alexander Strasser
 Twitter Lou Logan, Reynaldo H. Verdejo Pinochet
 Launchpad   Timothy Gu
 ffmpeg-security Andreas Cadhalpun, Carl Eugen Hoyos, 
Clément Bœsch, Michael Niedermayer, Reimar Doeffinger, Rodger Combs, wm4
-- 
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".

Re: [FFmpeg-devel] [PATCH v9 2/4] avcodec/hevc_sei: add support for user data unregistered SEI message

2020-03-17 Thread Limin Wang
On Tue, Mar 17, 2020 at 05:25:29PM +, Derek Buitenhuis wrote:
> On 17/03/2020 10:54, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavcodec/hevc_sei.c   | 31 +++
> >  libavcodec/hevc_sei.h   |  6 ++
> >  libavcodec/hevcdec.c| 14 ++
> >  tests/ref/fate/hevc-monochrome-crop |  3 +++
> >  4 files changed, 54 insertions(+)
> 
> Apologies if I missed this in previous iterations.
> 
> What is the proposed usecase?
The user data unregistered allows arbitrary data to be carried in the bitstream,
for example, ROI info, time info etc. For the real support patch, please refer 
to
the pending patch series 7, 8 in below link:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200107050355.17503-1-lance.lmw...@gmail.com/


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

-- 
Thanks,
Limin Wang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] MAINTAINERS: add myself and my gpg key

2020-03-17 Thread Lynne
Patch attached.

>From 8929300730a68db0353c347d28aa29325fb93bdb Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Tue, 17 Mar 2020 22:56:03 +
Subject: [PATCH] MAINTAINERS: add myself and my gpg key

---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 55e2b385b5..ebb0cf1f08 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -79,6 +79,7 @@ Other:
   float_dsp Loren Merritt
   hash  Reimar Doeffinger
   hwcontext_cuda*   Timo Rothenpieler
+  hwcontext_vulkan* Lynne
   intfloat* Michael Niedermayer
   integer.c, integer.h  Michael Niedermayer
   lzo   Reimar Doeffinger
@@ -89,6 +90,7 @@ Other:
   rational.c, rational.hMichael Niedermayer
   rc4   Reimar Doeffinger
   ripemd.c, ripemd.hJames Almer
+  tx*   Lynne
 
 
 libavcodec
@@ -606,6 +608,7 @@ James Almer   7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 59E0
 Jean Delvare  7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
 Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
 Lou Logan (llogan)7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
+Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
 Michael Niedermayer   9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
 Nicolas George24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
 Nikolay Aleksandrov   8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1
-- 
2.26.0.rc2

___
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] scale_vulkan: add support for RGB->YUV conversions

2020-03-17 Thread Lynne
Mar 15, 2020, 10:33 by d...@lynne.ee:

> Patch attached.
>

Pushed.
___
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 v9 2/4] avcodec/hevc_sei: add support for user data unregistered SEI message

2020-03-17 Thread Derek Buitenhuis
On 17/03/2020 23:11, Limin Wang wrote:
> The user data unregistered allows arbitrary data to be carried in the 
> bitstream,
> for example, ROI info, time info etc. For the real support patch, please 
> refer to
> the pending patch series 7, 8 in below link:
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200107050355.17503-1-lance.lmw...@gmail.com/

I understand what the SEI does. I was inquiring as to what the usecase you had
in mind for it specifically. I don't like the idea of adding APIs that are only
theorically useful - that is, what data is intended to be shoved in there?

- 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]lavf/subviewerdec: Support higher sub-second precision

2020-03-17 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #8575 for me, Google describes such files.

Please comment, Carl Eugen
From 39d0748782bb3e37fb2f92c679ffa58b239374c7 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Wed, 18 Mar 2020 02:11:33 +0100
Subject: [PATCH] lavf/subviewerdec: Support higher sub-second precision.

Fixes ticket #8575.
---
 libavformat/subviewerdec.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavformat/subviewerdec.c b/libavformat/subviewerdec.c
index 06b827b70f..ed48b3388d 100644
--- a/libavformat/subviewerdec.c
+++ b/libavformat/subviewerdec.c
@@ -56,11 +56,15 @@ static int read_ts(const char *s, int64_t *start, int *duration)
 int64_t end;
 int hh1, mm1, ss1, ms1;
 int hh2, mm2, ss2, ms2;
+int multiplier = 1;
 
+if (sscanf(s, "%u:%u:%u.%2u,%u:%u:%u.%2u",
+   &hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8)
+multiplier = 10;
 if (sscanf(s, "%u:%u:%u.%u,%u:%u:%u.%u",
&hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8) {
-end= (hh2*3600LL + mm2*60LL + ss2) * 100LL + ms2;
-*start = (hh1*3600LL + mm1*60LL + ss1) * 100LL + ms1;
+end= (hh2*3600LL + mm2*60LL + ss2) * 1000LL + ms2 * multiplier;
+*start = (hh1*3600LL + mm1*60LL + ss1) * 1000LL + ms1 * multiplier;
 *duration = end - *start;
 return 0;
 }
@@ -84,7 +88,7 @@ static int subviewer_read_header(AVFormatContext *s)
 return res;
 if (avio_rb24(s->pb) != 0xefbbbf)
 avio_seek(s->pb, -3, SEEK_CUR);
-avpriv_set_pts_info(st, 64, 1, 100);
+avpriv_set_pts_info(st, 64, 1, 1000);
 st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
 st->codecpar->codec_id   = AV_CODEC_ID_SUBVIEWER;
 
-- 
2.24.1

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

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

Re: [FFmpeg-devel] [PATCH, v3] lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode

2020-03-17 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of
> Carl Eugen Hoyos
> Sent: Tuesday, March 17, 2020 23:04
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH, v3] lavc/vp9: fix reference frame
> dimensions check for SINGLE_REFERENCE mode
> 
> Am Di., 17. März 2020 um 10:45 Uhr schrieb Linjie Fu :
> >
> > With the description in frame size with refs semantics (SPEC 7.2.5),
> > it is a requirement of bitstream conformance that for at least one
> > reference frame has the valid dimensions.
> >
> > Modify the check to make sure the decoder works well in
> SINGLE_REFERENCE
> > mode that not all reference frames have valid dimensions.
> >
> > Check and error out if invalid reference frame is used in inter_recon.
> 
> I strongly suspect we only want to error out if explode > default.
> 
> Not necessarily related to this patch:
> In general, FFmpeg should not unnecessarily copy the behaviour
> of other libraries.

Yes, and IMHO it depends on whether such behavior it's valuable and
suitable for FFmpeg.

(In this case, libvpx uses longjmp to error out when block-level error happens,
which seems not suitable/allowed in FFmpeg)

Thanks for the review.

- 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 v9 2/4] avcodec/hevc_sei: add support for user data unregistered SEI message

2020-03-17 Thread Limin Wang
On Wed, Mar 18, 2020 at 12:13:33AM +, Derek Buitenhuis wrote:
> On 17/03/2020 23:11, Limin Wang wrote:
> > The user data unregistered allows arbitrary data to be carried in the 
> > bitstream,
> > for example, ROI info, time info etc. For the real support patch, please 
> > refer to
> > the pending patch series 7, 8 in below link:
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200107050355.17503-1-lance.lmw...@gmail.com/
> 
> I understand what the SEI does. I was inquiring as to what the usecase you had
> in mind for it specifically. I don't like the idea of adding APIs that are 
> only
> theorically useful - that is, what data is intended to be shoved in there?

In order to identify the source of time used in the live event, the encoder 
system can
insert a time mode-source code along with each embedded precision time stamp. 
Each time mode-source code will be inserted into the H.264/H.265 bitstream as 
an SEI
message of type User Data (Unregistered). The format is self-defined json 
string 


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

-- 
Thanks,
Limin Wang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v2 2/2] avcodec/libaomenc.c: Add super-resolution options to libaom wrapper

2020-03-17 Thread James Zern
Hi,

On Thu, Mar 5, 2020 at 6:20 PM Wang Cao  wrote:
>
> Signed-off-by: Wang Cao 
> ---
> The changes are made according to the code review
> - Bump the MICRO version
> - Use enum for Super resolution mode consts. The original enum in libaom
>   is not public so a enum is defined and matched the original enum
>  doc/encoders.texi  | 39 +++
>  libavcodec/libaomenc.c | 47 ++
>  libavcodec/version.h   |  2 +-
>  3 files changed, 87 insertions(+), 1 deletion(-)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 0a74ecce9b..04f05e7c9b 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -1608,6 +1608,45 @@ Enable the use of global motion for block prediction. 
> Default is true.
>  Enable block copy mode for intra block prediction. This mode is
>  useful for screen content. Default is true.
>
> +@item enable-superres (@emph{boolean})
> +Enable super-resolution during the encoding process.
> +

Funny aomenc in libaom doesn't have this option. It must assume the
library defaults will take care of it, seems like a bug.

> +@item superres-mode (@emph{mode})
> +Select super-resultion mode.
> +

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

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

[FFmpeg-devel] [PATCH] fftools/ffmpeg_opt: Fix [u]int64_t specifier string

2020-03-17 Thread Andreas Rheinhardt
PRId64 and PRIu64 already expand to the complete specifier; adding
another 'd' at the end is wrong and just leads to warnings that say
that only an option like '-frames:v 2d' will be used, although said
option won't be accepted at all ('Expected int64 for frames:v but found
2d').

Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg_opt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index b1b322c6ef..95001a963f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -46,8 +46,8 @@
 
 #define SPECIFIER_OPT_FMT_str  "%s"
 #define SPECIFIER_OPT_FMT_i"%i"
-#define SPECIFIER_OPT_FMT_i64  "%"PRId64"d"
-#define SPECIFIER_OPT_FMT_ui64 "%"PRIu64"d"
+#define SPECIFIER_OPT_FMT_i64  "%"PRId64
+#define SPECIFIER_OPT_FMT_ui64 "%"PRIu64
 #define SPECIFIER_OPT_FMT_f"%f"
 #define SPECIFIER_OPT_FMT_dbl  "%lf"
 
-- 
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".

Re: [FFmpeg-devel] [PATCH v2 1/2] avcodec/libaomenc.c: Add a libaom command-line option 'tune'

2020-03-17 Thread James Zern
Hi,

On Thu, Mar 5, 2020 at 6:38 PM Wang Cao  wrote:
>
> Signed-off-by: Wang Cao 
> ---
> Made changes according to the review.
> - Bump the MICRO version of libavcodec.
> - Use enum for 'tune' option consts for better consistency
>
>  doc/encoders.texi  | 11 +++
>  libavcodec/libaomenc.c |  7 +++
>  libavcodec/version.h   |  2 +-
>  3 files changed, 19 insertions(+), 1 deletion(-)
>

Just some cosmetics.

> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index e23b6b32fe..0a74ecce9b 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -1508,6 +1508,17 @@ Complexity-based.
>  Cyclic refresh.
>  @end table
>
> +@item tune (@emph{tune})
> +Set the distortion metric the encoder is tune with. Default is @code{psnr}.
> +

...the encoder is tuned with...

> +@table @samp
> +@item psnr (@emph{0})
> +PSNR as distortion metric
> +

Given the description above and the name of the options the extra text
may be redundant.

> [...]
> @@ -1096,6 +1100,9 @@ static const AVOption options[] = {
>  { "usage",   "Quality and compression efficiency vs speed 
> tradeof", OFFSET(usage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, 
> "usage"},
>  { "good","Good quality",  0, AV_OPT_TYPE_CONST, {.i64 = 
> 0 /* AOM_USAGE_GOOD_QUALITY */}, 0, 0, VE, "usage"},
>  { "realtime","Realtime encoding", 0, AV_OPT_TYPE_CONST, {.i64 = 
> 1 /* AOM_USAGE_REALTIME */}, 0, 0, VE, "usage"},
> +{ "tune","The metric that encoder tunes for. Automatically 
> choosen by encoder by default", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, 
> -1, AOM_TUNE_SSIM, VE, "tune"},

...that the encoder tunes...chosen by the encoder...

> +{ "psnr","PSNR as distortion metric", 0, 
> AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_PSNR}, 0, 0, VE, "tune"},
> +{ "ssim","SSIM as distortion metric", 0, 
> AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_SSIM}, 0, 0, VE, "tune"},

Like in the other table the extra descriptions may be redundant, they
could be NULL.
___
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 5/5] avformat/mpeg: Don't use unintialized value

2020-03-17 Thread Andreas Rheinhardt
Michael Niedermayer:
> On Sun, Jan 19, 2020 at 02:43:00PM +, Andreas Rheinhardt wrote:
>> Michael Niedermayer:
>>> On Tue, Oct 22, 2019 at 03:16:45PM +0200, Andreas Rheinhardt wrote:
 vobsub_read_packet() didn't check whether an index in array of AVPackets
 was valid and therefore used uninitialized values.

 Signed-off-by: Andreas Rheinhardt 
 ---
 Actually I only wanted to use Valgrind to check for memleaks...

  libavformat/mpeg.c | 4 
  1 file changed, 4 insertions(+)

 diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
 index 73ade71d95..474afd06b9 100644
 --- a/libavformat/mpeg.c
 +++ b/libavformat/mpeg.c
 @@ -930,6 +930,10 @@ static int vobsub_read_packet(AVFormatContext *s, 
 AVPacket *pkt)
  FFDemuxSubtitlesQueue *tmpq = &vobsub->q[i];
  int64_t ts;
  av_assert0(tmpq->nb_subs);
 +
 +if (tmpq->current_sub_idx >= tmpq->nb_subs)
 +continue;
>>>
>>> How can this issue be reproduced ?
>>>
>>> thx
>>>
>>> [...]
>>
>> Read a VobSub subtitle till the end:
>> ffmpeg -i  -c copy -f null -
> 
> does not reproduce
> 
> ./ffmpeg  -i fate/sub/vobsub.idx  -c copy   -f null -
> Output file #0 does not contain any stream
> code does not execute

Sorry, I forgot that subtitle streams are not enabled by default.
> 
> ./ffmpeg  -i fate/sub/vobsub.idx  -c copy -map s  -f null -
> the if does not execute
> 
> iam obviously doing something wrong, can you provide a unambigous testcase?
> 
You are not doing anything wrong; it's just that the sample is
truncated: The idx file claims to contain 47 packets, yet the sub file
contains only 46. As a result, trying to read the 47. packet (the last
packet that exists in the FFDemuxSubtitlesQueue) fails and no attempt to
read another packet (which would trigger what I told you) is attempted.

You can reproduce this by deleting the last line in vobsub.idx.

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/avcodec: Fix typos

2020-03-17 Thread James Almer
On 3/5/2020 2:02 AM, Andriy Gelman wrote:
> From: Andriy Gelman 
> 
> Signed-off-by: Andriy Gelman 
> ---
>  libavcodec/avcodec.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 5a0fc3405c5..8cda2422efa 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -5037,7 +5037,7 @@ int avcodec_receive_frame(AVCodecContext *avctx, 
> AVFrame *frame);
>   *  AVERROR(EINVAL):   codec not opened, refcounted_frames not set, it 
> is a
>   * decoder, or requires flush
>   *  AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
> - *  other errors: legitimate decoding errors
> + *  other errors: legitimate encoding errors
>   */
>  int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
>  
> @@ -5053,8 +5053,8 @@ int avcodec_send_frame(AVCodecContext *avctx, const 
> AVFrame *frame);
>   * must try to send input
>   *  AVERROR_EOF:   the encoder has been fully flushed, and there 
> will be
>   * no more output packets
> - *  AVERROR(EINVAL):   codec not opened, or it is an encoder
> - *  other errors: legitimate decoding errors
> + *  AVERROR(EINVAL):   codec not opened, or it is a decoder
> + *  other errors: legitimate encoding errors
>   */
>  int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);

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

[FFmpeg-devel] [PATCH] lavfi/vf_dnn_processing: Fix compile warning of mixed declarations and code

2020-03-17 Thread Linjie Fu
Signed-off-by: Linjie Fu 
---
 libavfilter/vf_dnn_processing.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
index 7f40f85..fabe4f1 100644
--- a/libavfilter/vf_dnn_processing.c
+++ b/libavfilter/vf_dnn_processing.c
@@ -418,10 +418,13 @@ static av_always_inline int isPlanarYUV(enum 
AVPixelFormat pix_fmt)
 
 static int copy_uv_planes(DnnProcessingContext *ctx, AVFrame *out, const 
AVFrame *in)
 {
+const AVPixFmtDescriptor *desc;
+int uv_height;
+
 if (!ctx->sws_uv_scale) {
 av_assert0(in->height == out->height && in->width == out->width);
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(in->format);
-int uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h);
+desc = av_pix_fmt_desc_get(in->format);
+uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h);
 for (int i = 1; i < 3; ++i) {
 int bytewidth = av_image_get_linesize(in->format, in->width, i);
 av_image_copy_plane(out->data[i], out->linesize[i],
-- 
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".

[FFmpeg-devel] [PATCH] lavf/protocols: Fix compile warning of discarding 'const' qualifier from pointer target type

2020-03-17 Thread Linjie Fu
Signed-off-by: Linjie Fu 
---
 libavformat/protocols.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index f1b8eab..cb19f77 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -95,9 +95,9 @@ const AVClass *ff_urlcontext_child_class_next(const AVClass 
*prev)
 
 const char *avio_enum_protocols(void **opaque, int output)
 {
-const URLProtocol **p = *opaque;
+URLProtocol **p = *opaque;
 
-p = p ? p + 1 : url_protocols;
+p = p ? p + 1 : (URLProtocol **)url_protocols;
 *opaque = p;
 if (!*p) {
 *opaque = NULL;
-- 
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] lavf/protocols: Fix compile warning of discarding 'const' qualifier from pointer target type

2020-03-17 Thread Andreas Rheinhardt
Linjie Fu:
> Signed-off-by: Linjie Fu 
> ---
>  libavformat/protocols.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/protocols.c b/libavformat/protocols.c
> index f1b8eab..cb19f77 100644
> --- a/libavformat/protocols.c
> +++ b/libavformat/protocols.c
> @@ -95,9 +95,9 @@ const AVClass *ff_urlcontext_child_class_next(const AVClass 
> *prev)
>  
>  const char *avio_enum_protocols(void **opaque, int output)
>  {
> -const URLProtocol **p = *opaque;
> +URLProtocol **p = *opaque;
>  
> -p = p ? p + 1 : url_protocols;
> +p = p ? p + 1 : (URLProtocol **)url_protocols;
>  *opaque = p;
>  if (!*p) {
>  *opaque = NULL;
> 
1. The actual problem with this code is not that the URLProtocols are
const (which they are), but that the pointers in the url_protocols array
are constant pointers (to const URLProtocol); yet the way things are
right now the user gets a non-const pointer to these const pointers (to
const URLProtocol).

2. It follows from this that changing the type of p in the way you did
it is actually unnecessary (if one wanted to solve the problem by
casting const away, you could cast url_protocols to (const URLProtocol
**) (from const URLProtocol * const *)) and a step in the wrong
direction (given that the underlying URLProtocol is const).

3. Casting const away is generally a sign of bad design and this is no
exception. The signature is wrong, the opaque should be const void**, so
that the user never gets a chance to get a pointer to nonconst to
something that is actually const.

4. See [1] for an approach that fixes the underlying issue.

- Andreas

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/248675.html
___
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] FLIF16 GSOC Project Range Transformation YCoCg

2020-03-17 Thread Kartik
From: Kartik K. Khullar

---
 FFmpeg/libavcodec/flif16transform.c | 53 +
 1 file changed, 53 insertions(+)

diff --git a/FFmpeg/libavcodec/flif16transform.c 
b/FFmpeg/libavcodec/flif16transform.c
index e69de29..febf5e9 100644
--- a/FFmpeg/libavcodec/flif16transform.c
+++ b/FFmpeg/libavcodec/flif16transform.c
@@ -0,0 +1,53 @@
+#include 
+#include 
+
+//array of 2 elements is used as parameter because it represents min, max pair.
+void TransformYCoCg(int16_t *range[2], int16_t *crange[2], int16_t yval, 
int16_t coval){   
+   int max_temp;
+   if (range[1][0] > range[1][1]){
+   if (range[1][0] > range[1][2]){
+   max_temp = range[1][0];
+   }
+   else{
+   max_temp = range[1][2];
+   }
+   }
+   else{
+   max_temp  = range[1][1];
+   }
+   int origmax4 = max_temp / 4 + 1;
+   int newmax = 4*origmax4 - 1;
+   
+   //Updating color ranges
+   range[0][0] = 0;//first channel minimum
+   range[1][0] = newmax;   //first channek maximum
+   range[0][1] = -newmax;  //second channel minimum
+   range[1][1] = newmax;   //second channel maximum
+   range[0][2] = -newmax;  //third channel minimum
+   range[1][2] = newmax;   //third channel maximum
+   
+   //Updating conditional range values
+   crange[0][0] = range[0][0];
+   crange[1][0] = range[1][0];
+   
+   if (yval < origmax4 - 1){
+   crange[0][1] = -3 + 4*yval;
+   crange[1][1] = 3 + 4*yval;
+   crange[0][2] = -2 - 2*yval;
+   crange[1][2] = 1 + 2 * yval - 2 * (abs(coval)/2);
+   }
+   else if (yval > 3*origmax4 - 1){
+   crange[0][1] = 4*(yval - newmax);
+   crange[1][1] = 4*(newmax - yval);
+   crange[0][2] = -2*(newmax - yval) + 2 * ((abs(coval)+1)/2);
+   crange[1][2] = 2*(newmax - yval);
+   }
+   else{   
+   crange[0][1] = -newmax;
+   crange[1][1] = newmax;
+   crange[0][2] = (((2*newmax - 2*yval - 2*abs(coval) + 1) < (2 * 
yval + 1)) ? 
+   (2*newmax - 2*yval - 2*abs(coval) + 1) : (2 * yval + 1)) / 2;
+   crange[1][2] = (2*(yval - newmax)) < (-2*yval - 1 + 
2*(abs(coval)/2)) ? 
+   (2*(yval - newmax)) : (-2*yval - 1 + 2*(abs(coval)/2));
+   }
+}
\ No newline at end of file
-- 
2.20.1.windows.1

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

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

[FFmpeg-devel] [PATCH] FLIF16 GSOC Project - Added RGB to YCoCg macros

2020-03-17 Thread Kartik
From: Kartik K. Khullar

---
 FFmpeg/libavutil/colorspace.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/FFmpeg/libavutil/colorspace.h b/FFmpeg/libavutil/colorspace.h
index ef6f610..bf53afe 100644
--- a/FFmpeg/libavutil/colorspace.h
+++ b/FFmpeg/libavutil/colorspace.h
@@ -94,6 +94,17 @@ static inline int C_JPEG_TO_CCIR(int y) {
 return y;
 }
 
+#define RGB_TO_YCoCg(R, G, B, Y, Co, Cg){\
+   Y = (((R+B)>>1) + G)>>1;\
+Co = R - B;\
+Cg = G - ((R+B)>>1);\
+}
+
+#define YCoCg_TO_RGB(R, G, B, Y, Co, Cg){\
+   Y = (((R+B)>>1) + G)>>1;\
+Co = R - B;\
+Cg = G - ((R+B)>>1);\
+}
 
 #define RGB_TO_Y_CCIR(r, g, b) \
 ((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \
-- 
2.20.1.windows.1

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

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

Re: [FFmpeg-devel] [PATCH] web/download: update min. kernel version for linux binaries

2020-03-17 Thread Gyan Doshi



On 14-03-2020 07:15 pm, Carl Eugen Hoyos wrote:

Am Sa., 14. März 2020 um 14:24 Uhr schrieb Gyan Doshi :



On 14-03-2020 06:11 pm, Carl Eugen Hoyos wrote:

Am Sa., 14. März 2020 um 13:19 Uhr schrieb Gyan Doshi :


On 14-03-2020 04:29 pm, Carl Eugen Hoyos wrote:

Am Sa., 14. März 2020 um 07:31 Uhr schrieb Gyan Doshi :

As per https://johnvansickle.com/ffmpeg/
---
src/download | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/download b/src/download
index 6292a7e..d9155ee 100644
--- a/src/download
+++ b/src/download
@@ -70,7 +70,7 @@
Linux Static Builds

  https://johnvansickle.com/ffmpeg/";>32-bit and
-64-bit for kernel 2.6.32 and above
+64-bit for kernel 3.2.0 and above

Shouldn't we instead remove the line?

Why?

Because we cannot know which kernel version the binaries currently require

We know, because the provider mentions it.


Are we mentioning that the Zeranoe binaries do not work on XP?

Or on Vista, as mentioned by the provider.  That should be noted.

As long as the qualifications don't get too verbose, no harm in
adding/maintaining the practice.

I believe it is better if Zeranoe and johnvansickle mention it, we
should remove the existing line.


They already so. So have we, for some years now. Why haven't you removed 
it yet?


In any case, the current line is wrong. So it has to be either updated 
or removed. I propose updating it.


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 1/3] lavformat: Prepare to make avio_enum_protocols const correct

2020-03-17 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: Friday, November 22, 2019 18:02
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 1/3] lavformat: Prepare to make
> avio_enum_protocols const correct
> 
> Andreas Rheinhardt:
> > Andreas Rheinhardt:
> >> Using avio_enum_protocols works as follows: One initializes a pointer to
> >> void and gives avio_enum_protocols the address of said pointer as
> >> argument; the pointer will be updated to point to a member of the
> >> url_protocols array. Now the address of the pointer can be reused for
> >> another call to avio_enum_protocols.
> >> Said array consists of constant pointers (to constant URLProtocols),
> >> but the user now has a pointer to non-const to it; of course it was always
> >> intended that the user is not allowed to modify what the pointer points
> >> to and this has been enforced by hiding the real type of the underlying
> >> object. But it is better to use a const void ** as parameter to enforce
> >> this. This way avio_enum_protocols can be implemented without
> resorting
> >> to casting a const away or ignoring constness as is done currently.
> >>
> >> Given that this amounts to an ABI and API break, this can only be done
> >> at the next major version bump; as usual, the break is currently hidden
> >> behind an appropriate #if.
> >>
> >> It was also necessary to change the type of a pointer used in
> >> avio_enum_protocols. This makes the line that is not const correct move
> >> as long as the old function signature is used. With the new signature,
> >> avio_enum_protocols will be const correct.
> >>
> >> This change will eventually force changes in their callers, e.g. to
> >> show_protocols in fftools/cmdutils. (This function contains all currently
> >> existing calls to avio_enum_protocols in FFmpeg's codebase. It hasn't
> >> been touched in this commit.)
> >>
> >> Signed-off-by: Andreas Rheinhardt 
> >> ---
> >>  libavformat/avio.h  | 4 
> >>  libavformat/protocols.c | 6 +-
> >>  libavformat/version.h   | 3 +++
> >>  3 files changed, 12 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libavformat/avio.h b/libavformat/avio.h
> >> index 9141642e75..e067ea8985 100644
> >> --- a/libavformat/avio.h
> >> +++ b/libavformat/avio.h
> >> @@ -805,7 +805,11 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t
> **pbuffer);
> >>   *
> >>   * @return A static string containing the name of current protocol or NULL
> >>   */
> >> +#if FF_API_NONCONST_ENUM_PROTOCOLS
> >>  const char *avio_enum_protocols(void **opaque, int output);
> >> +#else
> >> +const char *avio_enum_protocols(const void **opaque, int output);
> >> +#endif
> >>
> >>  /**
> >>   * Pause and resume playing - only meaningful if using a network
> streaming
> >> diff --git a/libavformat/protocols.c b/libavformat/protocols.c
> >> index ad95659795..c722f9a897 100644
> >> --- a/libavformat/protocols.c
> >> +++ b/libavformat/protocols.c
> >> @@ -91,9 +91,13 @@ const AVClass
> *ff_urlcontext_child_class_next(const AVClass *prev)
> >>  }
> >>
> >>
> >> +#if FF_API_NONCONST_ENUM_PROTOCOLS
> >>  const char *avio_enum_protocols(void **opaque, int output)
> >> +#else
> >> +const char *avio_enum_protocols(const void **opaque, int output)
> >> +#endif
> >>  {
> >> -const URLProtocol **p = *opaque;
> >> +const URLProtocol * const *p = *opaque;
> >>
> >>  p = p ? p + 1 : url_protocols;
> >>  *opaque = p;
> >> diff --git a/libavformat/version.h b/libavformat/version.h
> >> index 9814db8633..b0b9264382 100644
> >> --- a/libavformat/version.h
> >> +++ b/libavformat/version.h
> >> @@ -106,6 +106,9 @@
> >>  #ifndef FF_API_AVIOFORMAT
> >>  #define FF_API_AVIOFORMAT   (LIBAVFORMAT_VERSION_MAJOR
> < 59)
> >>  #endif
> >> +#ifndef FF_API_NONCONST_ENUM_PROTOCOLS
> >> +#define FF_API_NONCONST_ENUM_PROTOCOLS
> (LIBAVFORMAT_VERSION_MAJOR < 59)
> >> +#endif
> >>
> >>
> >>  #ifndef FF_API_R_FRAME_RATE
> >> I am unsure what to do next given the feedback I received: If ABI
> > compability is no problem, then should I simply add the const and add
> > an entry to doc/APIchanges? Or is a deprecation period necessary?
> >
> > - Andreas
> >
> Ping for all three patches.
> 

Is it necessary to update the relevant code who calls avio_enum_protocols()
when this change takes effect? (either waiting for major version updates to 59,
or applied this modification right now)

Otherwise functions like show_protocols() may report warnings:

Compile with FF_API_NONCONST_ENUM_PROTOCOLS  forced to be 0 (gcc-7.3.0)

Message:
fftools/cmdutils.c: In function ‘show_protocols’:
fftools/cmdutils.c:1681:40: warning: passing argument 1 of 
‘avio_enum_protocols’ from incompatible pointer type 
[-Wincompatible-pointer-types]
 while ((name = avio_enum_protocols(&opaque, 0)))
^
In file included from ./libavformat/avformat.h:321:0,
 from fftools/cmdutils.c:34:
./libavformat/avio.h:811:13

Re: [FFmpeg-devel] [PATCH] lavf/protocols: Fix compile warning of discarding 'const' qualifier from pointer target type

2020-03-17 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: Wednesday, March 18, 2020 12:52
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] lavf/protocols: Fix compile warning of
> discarding 'const' qualifier from pointer target type
> 
> Linjie Fu:
> > Signed-off-by: Linjie Fu 
> > ---
> >  libavformat/protocols.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/protocols.c b/libavformat/protocols.c
> > index f1b8eab..cb19f77 100644
> > --- a/libavformat/protocols.c
> > +++ b/libavformat/protocols.c
> > @@ -95,9 +95,9 @@ const AVClass *ff_urlcontext_child_class_next(const
> AVClass *prev)
> >
> >  const char *avio_enum_protocols(void **opaque, int output)
> >  {
> > -const URLProtocol **p = *opaque;
> > +URLProtocol **p = *opaque;
> >
> > -p = p ? p + 1 : url_protocols;
> > +p = p ? p + 1 : (URLProtocol **)url_protocols;
> >  *opaque = p;
> >  if (!*p) {
> >  *opaque = NULL;
> >
> 1. The actual problem with this code is not that the URLProtocols are
> const (which they are), but that the pointers in the url_protocols array
> are constant pointers (to const URLProtocol); yet the way things are
> right now the user gets a non-const pointer to these const pointers (to
> const URLProtocol).

Yes, a "const" is needed for "void ** opaque" since it's a pointer to a pointer
to a const type.

> 2. It follows from this that changing the type of p in the way you did
> it is actually unnecessary (if one wanted to solve the problem by
> casting const away, you could cast url_protocols to (const URLProtocol
> **) (from const URLProtocol * const *)) and a step in the wrong
> direction (given that the underlying URLProtocol is const).

You are right.

> 3. Casting const away is generally a sign of bad design and this is no
> exception. The signature is wrong, the opaque should be const void**, so
> that the user never gets a chance to get a pointer to nonconst to
> something that is actually const.
> 
> 4. See [1] for an approach that fixes the underlying issue.
> 
> - Andreas
> 
> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/248675.html

Thanks for the elaborations, the fix in [1] is more reasonable.
However got one concern while verifying the patch, replied under your thread.

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