Re: [FFmpeg-devel] [PATCH] lavfi/atempo: fix tempo range limit inconsistency

2018-10-04 Thread Pavel Koshevoy
On Thu, Oct 4, 2018 at 2:11 AM Nicolas George  wrote:
>
> Pavel Koshevoy (2018-10-03):
> > yae_set_tempo was overlooked when max tempo limit was raised to 100.
> >
> > tested with:
> > ./ffmpeg_g -i Delerium/SemanticSpaces/Gateway.mp3 \
> > -af asendcmd=f=asendcmd.cfg,atempo=1.0 -y /tmp/asendcmd-atempo.wav
> >
> > where asendcmd.cfg was:
> > 15.0-45.0 [enter] atempo tempo 2.0,
> >   [leave] atempo tempo 0.5;
> >
> > 60.0-300.0 [enter] atempo tempo 4.0,
> >[leave] atempo tempo 1.0;
> > ---
> >  libavfilter/af_atempo.c | 13 +
> >  1 file changed, 9 insertions(+), 4 deletions(-)
>
> I am ok with this version of the patch, thanks. But I am not the
> maintainer of that file.
>
> Regards,
>
> --
>   Nicolas George

Applied, pushed

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


[FFmpeg-devel] [PATCH] avcodec/h264_cavlc: Check mb_skip_run

2018-10-04 Thread Michael Niedermayer
Fixes: 
10300/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6292205497483264
Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 
'int'

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

diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 5e6a20304a..d82144e3c3 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -714,8 +714,14 @@ int ff_h264_decode_mb_cavlc(const H264Context *h, 
H264SliceContext *sl)
 cbp = 0; /* avoid warning. FIXME: find a solution without slowing
 down the code */
 if (sl->slice_type_nos != AV_PICTURE_TYPE_I) {
-if (sl->mb_skip_run == -1)
-sl->mb_skip_run = get_ue_golomb_long(>gb);
+if (sl->mb_skip_run == -1) {
+unsigned mb_skip_run = get_ue_golomb_long(>gb);
+if (mb_skip_run > h->mb_num) {
+av_log(h->avctx, AV_LOG_ERROR, "mb_skip_run %d is invalid\n", 
mb_skip_run);
+return AVERROR_INVALIDDATA;
+}
+sl->mb_skip_run = mb_skip_run;
+}
 
 if (sl->mb_skip_run--) {
 if (FRAME_MBAFF(h) && (sl->mb_y & 1) == 0) {
-- 
2.19.0

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


Re: [FFmpeg-devel] [PATCH 4/5] av1_metadata: Fix constraint on setting chroma_sample_position

2018-10-04 Thread James Almer
On 10/4/2018 8:09 PM, Mark Thompson wrote:
> It can't be set for 4:2:2 streams.
> ---
>  libavcodec/av1_metadata_bsf.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c
> index 20c3a39da7..52d383661f 100644
> --- a/libavcodec/av1_metadata_bsf.c
> +++ b/libavcodec/av1_metadata_bsf.c
> @@ -86,13 +86,9 @@ static int 
> av1_metadata_update_sequence_header(AVBSFContext *bsf,
>  }
>  
>  if (ctx->chroma_sample_position >= 0) {
> -if (clc->mono_chrome) {
> +if (clc->mono_chrome || !clc->subsampling_x || !clc->subsampling_y) {
>  av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
> -   "is not meaningful for monochrome streams.\n");
> -} else if (clc->subsampling_x == 0 &&
> -   clc->subsampling_y == 0) {
> -av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
> -   "is not meaningful for non-chroma-subsampled streams.\n");
> +   "can only be set for 4:2:0 streams.\n");
>  } else {
>  clc->chroma_sample_position = ctx->chroma_sample_position;
>  }

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


Re: [FFmpeg-devel] [PATCH 1/5] configure: Add missing muxer BSF dependencies

2018-10-04 Thread James Almer
On 10/4/2018 8:09 PM, Mark Thompson wrote:
> ---
>  configure | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 85d5dd5962..cbd52e641b 100755
> --- a/configure
> +++ b/configure
> @@ -3173,26 +3173,30 @@ eac3_demuxer_select="ac3_parser"
>  f4v_muxer_select="mov_muxer"
>  fifo_muxer_deps="threads"
>  flac_demuxer_select="flac_parser"
> +h264_muxer_select="h264_mp4toannexb_bsf"
>  hds_muxer_select="flv_muxer"
> +hevc_muxer_select="hevc_mp4toannexb_bsf"
>  hls_muxer_select="mpegts_muxer"
>  hls_muxer_suggest="gcrypt openssl"
>  image2_alias_pix_demuxer_select="image2_demuxer"
>  image2_brender_pix_demuxer_select="image2_demuxer"
>  ipod_muxer_select="mov_muxer"
>  ismv_muxer_select="mov_muxer"
> +ivf_muxer_select="vp9_superframe_bsf"
> +latm_muxer_select="aac_adtstoasc_bsf"
>  matroska_audio_muxer_select="matroska_muxer"
>  matroska_demuxer_select="iso_media riffdec"
>  matroska_demuxer_suggest="bzlib lzo zlib"
> -matroska_muxer_select="iso_media riffenc"
> +matroska_muxer_select="iso_media riffenc aac_adtstoasc_bsf 
> vp9_superframe_bsf"
>  mmf_muxer_select="riffenc"
>  mov_demuxer_select="iso_media riffdec"
>  mov_demuxer_suggest="zlib"
> -mov_muxer_select="iso_media riffenc rtpenc_chain"
> +mov_muxer_select="iso_media riffenc rtpenc_chain aac_adtstoasc_bsf"
>  mp3_demuxer_select="mpegaudio_parser"
>  mp3_muxer_select="mpegaudioheader"
>  mp4_muxer_select="mov_muxer"
>  mpegts_demuxer_select="iso_media"
> -mpegts_muxer_select="adts_muxer latm_muxer"
> +mpegts_muxer_select="adts_muxer latm_muxer h264_mp4toannexb_bsf 
> hevc_mp4toannexb_bsf"
>  mpegtsraw_demuxer_select="mpegts_demuxer"
>  mxf_d10_muxer_select="mxf_muxer"
>  mxf_opatom_muxer_select="mxf_muxer"

I don't think enabling any of the *_mp4toannexb_bsf or aac_adtstoasc_bsf
is a good idea for mov, matroska, mpegts and similar. Nothing says
whoever is configuring/building ffmpeg wants to mux such codecs into
those containers, so why force enable bsfs they don't care about?
latm, h264 and hevc are the exception, seeing they require the bsfs to
actually work, and at least the latter two don't seem to reject any
packet you pass to them.

vp9_superframe_bsf is a different story since that one prevents muxing
invalid bitstreams, and should indeed be always enabled.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] trace_headers: Fix memory leaks on syntax read failures

2018-10-04 Thread James Almer
On 10/4/2018 8:09 PM, Mark Thompson wrote:
> ---
>  libavcodec/trace_headers_bsf.c | 14 --
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c
> index 94a3ef72a2..839d4c 100644
> --- a/libavcodec/trace_headers_bsf.c
> +++ b/libavcodec/trace_headers_bsf.c
> @@ -49,15 +49,11 @@ static int trace_headers_init(AVBSFContext *bsf)
>  av_log(bsf, AV_LOG_INFO, "Extradata\n");
>  
>  err = ff_cbs_read_extradata(ctx->cbc, , bsf->par_in);
> -if (err < 0) {
> -av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n");

Why remove this error message?

> -return err;
> -}
>  
>  ff_cbs_fragment_uninit(ctx->cbc, );
>  }
>  
> -return 0;
> +return err;
>  }
>  
>  static void trace_headers_close(AVBSFContext *bsf)
> @@ -97,14 +93,12 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
>  av_log(bsf, AV_LOG_INFO, "Packet: %d bytes%s.\n", pkt->size, tmp);
>  
>  err = ff_cbs_read_packet(ctx->cbc, , pkt);
> -if (err < 0) {
> -av_packet_unref(pkt);
> -return err;
> -}
>  
>  ff_cbs_fragment_uninit(ctx->cbc, );

Maybe the ff_cbs_read* functions should clean whatever they were able to
allocate before the failure by calling this function internally, instead
of leaving it to the caller. It would be more consistent with what other
APIs we offer do.

>  
> -return 0;
> +if (err < 0)
> +av_packet_unref(pkt);
> +return err;
>  }
>  
>  const AVBitStreamFilter ff_trace_headers_bsf = {

LGTM in any case.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/5] av1_metadata: Fix constraint on setting chroma_sample_position

2018-10-04 Thread Mark Thompson
It can't be set for 4:2:2 streams.
---
 libavcodec/av1_metadata_bsf.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c
index 20c3a39da7..52d383661f 100644
--- a/libavcodec/av1_metadata_bsf.c
+++ b/libavcodec/av1_metadata_bsf.c
@@ -86,13 +86,9 @@ static int av1_metadata_update_sequence_header(AVBSFContext 
*bsf,
 }
 
 if (ctx->chroma_sample_position >= 0) {
-if (clc->mono_chrome) {
+if (clc->mono_chrome || !clc->subsampling_x || !clc->subsampling_y) {
 av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
-   "is not meaningful for monochrome streams.\n");
-} else if (clc->subsampling_x == 0 &&
-   clc->subsampling_y == 0) {
-av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
-   "is not meaningful for non-chroma-subsampled streams.\n");
+   "can only be set for 4:2:0 streams.\n");
 } else {
 clc->chroma_sample_position = ctx->chroma_sample_position;
 }
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 5/5] doc/bitstream_filters: Add av1_metadata

2018-10-04 Thread Mark Thompson
---
 doc/bitstream_filters.texi | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index d948c6d658..66df24fd3d 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -37,6 +37,56 @@ raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV 
file, or
 to MOV/MP4 files and related formats such as 3GP or M4A. Please note
 that it is auto-inserted for MP4A-LATM and MOV/MP4 and related formats.
 
+@section av1_metadata
+
+Modify metadata embedded in an AV1 stream.
+
+@table @option
+@item td
+Insert or remove temporal delimiter OBUs in all temporal units of the
+stream.
+
+@table @samp
+@item insert
+@item remove
+@end table
+
+@item color_primaries
+@item transfer_characteristics
+@item matrix_coefficients
+Set the color description fields in the stream (see AV1 section 6.4.2).
+
+@item color_range
+Set the color range in the stream (see AV1 section 6.4.2; note that
+this cannot be set for streams using BT.709 primaries, sRGB transfer
+characteristic and identity (RGB) matrix coefficients).
+@table @samp
+@item tv
+Limited range.
+@item pc
+Full range.
+@end table
+
+@item chroma_sample_position
+Set the chroma sample location in the stream (see AV1 section 6.4.2).
+This can only be set for 4:2:0 streams.
+
+@table @samp
+@item vertical
+Left position (matching the default in MPEG-2 and H.264).
+@item colocated
+Top-left position.
+@end table
+
+@item tick_rate
+Set the tick rate (@emph{num_units_in_display_tick / time_scale}) in
+the timing info in the sequence header.
+@item num_ticks_per_picture
+Set the number of ticks in each picture, to indicate that the stream
+has a fixed framerate.  Ignored if @option{tick_rate} is not also set.
+
+@end table
+
 @section chomp
 
 Remove zero padding at the end of a packet.
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 2/5] configure: Add missing V4L2 M2M decoder BSF dependencies

2018-10-04 Thread Mark Thompson
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index cbd52e641b..2e2b016500 100755
--- a/configure
+++ b/configure
@@ -2957,6 +2957,7 @@ h264_rkmpp_decoder_deps="rkmpp"
 h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
 h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
 h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
+h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
 h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
 hevc_amf_encoder_deps="amf"
 hevc_cuvid_decoder_deps="cuvid"
@@ -2971,6 +2972,7 @@ hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
 hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
+hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
 hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
 mjpeg_cuvid_decoder_deps="cuvid"
 mjpeg_qsv_encoder_deps="libmfx"
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 1/5] configure: Add missing muxer BSF dependencies

2018-10-04 Thread Mark Thompson
---
 configure | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 85d5dd5962..cbd52e641b 100755
--- a/configure
+++ b/configure
@@ -3173,26 +3173,30 @@ eac3_demuxer_select="ac3_parser"
 f4v_muxer_select="mov_muxer"
 fifo_muxer_deps="threads"
 flac_demuxer_select="flac_parser"
+h264_muxer_select="h264_mp4toannexb_bsf"
 hds_muxer_select="flv_muxer"
+hevc_muxer_select="hevc_mp4toannexb_bsf"
 hls_muxer_select="mpegts_muxer"
 hls_muxer_suggest="gcrypt openssl"
 image2_alias_pix_demuxer_select="image2_demuxer"
 image2_brender_pix_demuxer_select="image2_demuxer"
 ipod_muxer_select="mov_muxer"
 ismv_muxer_select="mov_muxer"
+ivf_muxer_select="vp9_superframe_bsf"
+latm_muxer_select="aac_adtstoasc_bsf"
 matroska_audio_muxer_select="matroska_muxer"
 matroska_demuxer_select="iso_media riffdec"
 matroska_demuxer_suggest="bzlib lzo zlib"
-matroska_muxer_select="iso_media riffenc"
+matroska_muxer_select="iso_media riffenc aac_adtstoasc_bsf vp9_superframe_bsf"
 mmf_muxer_select="riffenc"
 mov_demuxer_select="iso_media riffdec"
 mov_demuxer_suggest="zlib"
-mov_muxer_select="iso_media riffenc rtpenc_chain"
+mov_muxer_select="iso_media riffenc rtpenc_chain aac_adtstoasc_bsf"
 mp3_demuxer_select="mpegaudio_parser"
 mp3_muxer_select="mpegaudioheader"
 mp4_muxer_select="mov_muxer"
 mpegts_demuxer_select="iso_media"
-mpegts_muxer_select="adts_muxer latm_muxer"
+mpegts_muxer_select="adts_muxer latm_muxer h264_mp4toannexb_bsf 
hevc_mp4toannexb_bsf"
 mpegtsraw_demuxer_select="mpegts_demuxer"
 mxf_d10_muxer_select="mxf_muxer"
 mxf_opatom_muxer_select="mxf_muxer"
-- 
2.18.0

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


[FFmpeg-devel] [PATCH 3/5] trace_headers: Fix memory leaks on syntax read failures

2018-10-04 Thread Mark Thompson
---
 libavcodec/trace_headers_bsf.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c
index 94a3ef72a2..839d4c 100644
--- a/libavcodec/trace_headers_bsf.c
+++ b/libavcodec/trace_headers_bsf.c
@@ -49,15 +49,11 @@ static int trace_headers_init(AVBSFContext *bsf)
 av_log(bsf, AV_LOG_INFO, "Extradata\n");
 
 err = ff_cbs_read_extradata(ctx->cbc, , bsf->par_in);
-if (err < 0) {
-av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n");
-return err;
-}
 
 ff_cbs_fragment_uninit(ctx->cbc, );
 }
 
-return 0;
+return err;
 }
 
 static void trace_headers_close(AVBSFContext *bsf)
@@ -97,14 +93,12 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
 av_log(bsf, AV_LOG_INFO, "Packet: %d bytes%s.\n", pkt->size, tmp);
 
 err = ff_cbs_read_packet(ctx->cbc, , pkt);
-if (err < 0) {
-av_packet_unref(pkt);
-return err;
-}
 
 ff_cbs_fragment_uninit(ctx->cbc, );
 
-return 0;
+if (err < 0)
+av_packet_unref(pkt);
+return err;
 }
 
 const AVBitStreamFilter ff_trace_headers_bsf = {
-- 
2.18.0

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/ivfenc: use the av1_metadata bsf to insert Temporal Delimiter OBUs if needed

2018-10-04 Thread Mark Thompson
On 04/10/18 00:12, James Almer wrote:
> On 10/3/2018 8:01 PM, Mark Thompson wrote:
>> On 03/10/18 01:18, James Almer wrote:
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavformat/ivfenc.c | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
>>> index 66441a2a43..adf72117e9 100644
>>> --- a/libavformat/ivfenc.c
>>> +++ b/libavformat/ivfenc.c
>>> @@ -97,6 +97,8 @@ static int ivf_check_bitstream(struct AVFormatContext *s, 
>>> const AVPacket *pkt)
>>>  
>>>  if (st->codecpar->codec_id == AV_CODEC_ID_VP9)
>>>  ret = ff_stream_add_bitstream_filter(st, "vp9_superframe", NULL);
>>> +else if (st->codecpar->codec_id == AV_CODEC_ID_AV1)
>>> +ret = ff_stream_add_bitstream_filter(st, "av1_metadata", 
>>> "td=insert");
>>>  
>>>  return ret;
>>>  }
>>>
>>
>> I'm not quite seeing why this is wanted - could you explain it a bit further?
>>
>> (Since IVF is packetised into temporal units already, it seems to me that 
>> having TDs or not in the file won't change anything from the point of view 
>> of the consumer.)
> 
> No, but ivf afaik doesn't suggest or mandate the removal of TDs, unlike
> mp4 and matroska, so i figured it would be best to put them back in
> place for such remuxing scenarios.
> 
> I don't mind dropping this patch.

No preference - I don't have any arguments one way or the other.

If you think it's a good idea then it looks fine to me, though probably the IVF 
muxer needs to select av1_metadata in configure to match.  (Several muxers seem 
to be missing these dependencies, including IVF on vp9_superframe - patch 
incoming.)

Thanks,

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


Re: [FFmpeg-devel] [PATCHv3 1/2] ffplay: options to specify window position

2018-10-04 Thread Dave Rice
From caa816d70e69f85d49556ff341addab24ebcd942 Mon Sep 17 00:00:00 2001
From: Dave Rice 
Date: Mon, 1 Oct 2018 17:07:44 -0400
Subject: [PATCH 1/2] ffplay: options to specify window position

---
 doc/ffplay.texi  | 4 
 fftools/ffplay.c | 6 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index dcb86ce13c..99e1d7468a 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -74,6 +74,10 @@ as 100.
 Force format.
 @item -window_title @var{title}
 Set window title (default is the input filename).
+@item -left @var{title}
+Set the x position for the left of the window (default is a centered window).
+@item -top @var{title}
+Set the y position for the top of the window (default is a centered window).
 @item -loop @var{number}
 Loops movie playback  times. 0 means forever.
 @item -showmode @var{mode}
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index e375a32ec2..ab1f9faccf 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -314,6 +314,8 @@ static int default_width  = 640;
 static int default_height = 480;
 static int screen_width  = 0;
 static int screen_height = 0;
+static int screen_left = SDL_WINDOWPOS_CENTERED;
+static int screen_top = SDL_WINDOWPOS_CENTERED;
 static int audio_disable;
 static int video_disable;
 static int subtitle_disable;
@@ -1346,7 +1348,7 @@ static int video_open(VideoState *is)
 SDL_SetWindowTitle(window, window_title);
 
 SDL_SetWindowSize(window, w, h);
-SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, 
SDL_WINDOWPOS_CENTERED);
+SDL_SetWindowPosition(window, screen_left, screen_top);
 if (is_full_screen)
 SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
 SDL_ShowWindow(window);
@@ -3602,6 +3604,8 @@ static const OptionDef options[] = {
 { "framedrop", OPT_BOOL | OPT_EXPERT, {  }, "drop frames when 
cpu is too slow", "" },
 { "infbuf", OPT_BOOL | OPT_EXPERT, { _buffer }, "don't limit the 
input buffer size (useful with realtime streams)", "" },
 { "window_title", OPT_STRING | HAS_ARG, { _title }, "set window 
title", "window title" },
+{ "left", OPT_INT | HAS_ARG | OPT_EXPERT, { _left }, "set the x 
position for the left of the window", "x pos" },
+{ "top", OPT_INT | HAS_ARG | OPT_EXPERT, { _top }, "set the y 
position for the top of the window", "y pos" },
 #if CONFIG_AVFILTER
 { "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video 
filters", "filter_graph" },
 { "af", OPT_STRING | HAS_ARG, {  }, "set audio filters", 
"filter_graph" },
-- 
2.19.0

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


Re: [FFmpeg-devel] [PATCHv2 1/2] ffplay: options to specify window position

2018-10-04 Thread Marton Balint



On Wed, 3 Oct 2018, Dave Rice wrote:


Thanks Marton for comments. Here is a revision to the first patch.

From 3fe6a9e5279a280af9a06843621737ddc44529cc Mon Sep 17 00:00:00 2001
From: Dave Rice 
Date: Mon, 1 Oct 2018 17:07:44 -0400
Subject: [PATCHv2 1/2] ffplay: options to specify window position

---
doc/ffplay.texi  | 4 
fftools/ffplay.c | 6 +-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index dcb86ce13c..a3da2cd570 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -74,6 +74,10 @@ as 100.
Force format.
@item -window_title @var{title}
Set window title (default is the input filename).
+@item -screen_left @var{title}
+Set the x position for the left of the window (default is a centered window).
+@item -screen_top @var{title}
+Set the y position for the top of the window (default is a centered window).


Based on the code below, the options should be -left and -top.


@item -loop @var{number}
Loops movie playback  times. 0 means forever.
@item -showmode @var{mode}
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index e375a32ec2..6cc59b4d33 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -314,6 +314,8 @@ static int default_width  = 640;
static int default_height = 480;
static int screen_width  = 0;
static int screen_height = 0;
+static int left = SDL_WINDOWPOS_CENTERED;
+static int top = SDL_WINDOWPOS_CENTERED;


You should call the variables screen_left and screen_top because 
screen_width and screen_height is used for window width/height.



static int audio_disable;
static int video_disable;
static int subtitle_disable;
@@ -1346,7 +1348,7 @@ static int video_open(VideoState *is)
SDL_SetWindowTitle(window, window_title);

SDL_SetWindowSize(window, w, h);
-SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, 
SDL_WINDOWPOS_CENTERED);
+SDL_SetWindowPosition(window, left, top);
if (is_full_screen)
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_ShowWindow(window);
@@ -3602,6 +3604,8 @@ static const OptionDef options[] = {
{ "framedrop", OPT_BOOL | OPT_EXPERT, {  }, "drop frames when cpu is too 
slow", "" },
{ "infbuf", OPT_BOOL | OPT_EXPERT, { _buffer }, "don't limit the input buffer 
size (useful with realtime streams)", "" },
{ "window_title", OPT_STRING | HAS_ARG, { _title }, "set window title", 
"window title" },
+{ "left", OPT_INT | HAS_ARG | OPT_EXPERT, {  }, "set the x position for the left of 
the window", "x pos" },
+{ "top", OPT_INT | HAS_ARG | OPT_EXPERT, {  }, "set the y position for the top of the 
window", "y pos" },
#if CONFIG_AVFILTER
{ "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", 
"filter_graph" },
{ "af", OPT_STRING | HAS_ARG, {  }, "set audio filters", 
"filter_graph" },
--


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


Re: [FFmpeg-devel] [PATCH] libavdevice: allow cropping avfoundation screen capture

2018-10-04 Thread Thilo Borgmann
Am 03.10.18 um 17:05 schrieb alan.birt...@sony.com:
>> I've developed  a patch to add an option to allow cropping of the
> 
>> avfoundation screen capture.
> 
>> Note that if the captured width is not a multiple of 16 then
> 
>> https://trac.ffmpeg.org/ticket/5654 will be triggered.
> 
> Is there anything more I need to do to get this patch applied?

Sorry for delay I'm quite busy right now. Will have a look during the weekend!

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


Re: [FFmpeg-devel] prores_ks: use CodecContext for color information if specified

2018-10-04 Thread Paul B Mahol
On 10/4/18, Marc-Antoine ARNAUD  wrote:
>
>

Why?

IIRC this patch is not needed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] prores_ks: use CodecContext for color information if specified

2018-10-04 Thread Marc-Antoine ARNAUD



0001-prores_ks-use-CodecContext-for-color-information-if-.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Mentoring project: music test source

2018-10-04 Thread Pedro Arthur
Hi,
Em dom, 30 de set de 2018 às 14:41, Nicolas George 
escreveu:

> Hi.
>
> For the next rounds of sponsored internships, I would like to propose
> the following project, that I would mentor:
>
> A music-like audio lavfi source for testing purposes.
>
> That means a deterministic pseudo-random stream of notes with varied
> frequencies, with a structure that looks like music and would trigger
> the same pathways in filters and codecs.
>
Lately I did some research about fractal music generation using L-Systems.
I'm providing a reference [1] if anyone find it interesting (just searching
it in google give lots of examples).

It basically consists of defining a grammar and applying it to an initial
symbol. Then the result string is interpreted in play a note, pitch
up/down, etc.

[1] -
https://pdfs.semanticscholar.org/8c2f/caaf3153779ec3e838b416cd6e6d7feecdb9.pdf
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avfilter/af_afftdn: use lavfi internal queue

2018-10-04 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---

This is significantly slower than current state for some unknown reason to me.

---
 libavfilter/af_afftdn.c | 56 +
 1 file changed, 17 insertions(+), 39 deletions(-)

diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c
index fbcb0f18d5..4353db05d1 100644
--- a/libavfilter/af_afftdn.c
+++ b/libavfilter/af_afftdn.c
@@ -20,13 +20,13 @@
 
 #include 
 
-#include "libavutil/audio_fifo.h"
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
 #include "libavcodec/avfft.h"
 #include "avfilter.h"
 #include "audio.h"
+#include "filters.h"
 #include "formats.h"
 
 #define C   (M_LN10 * 0.1)
@@ -98,7 +98,6 @@ typedef struct AudioFFTDeNoiseContext {
 float   last_noise_balance;
 int64_t block_count;
 
-int64_t pts;
 int channels;
 int sample_noise;
 int sample_noise_start;
@@ -135,8 +134,6 @@ typedef struct AudioFFTDeNoiseContext {
 double  vector_b[5];
 double  matrix_b[75];
 double  matrix_c[75];
-
-AVAudioFifo *fifo;
 } AudioFFTDeNoiseContext;
 
 #define OFFSET(x) offsetof(AudioFFTDeNoiseContext, x)
@@ -616,7 +613,6 @@ static int config_input(AVFilterLink *inlink)
 if (!s->dnch)
 return AVERROR(ENOMEM);
 
-s->pts = AV_NOPTS_VALUE;
 s->channels = inlink->channels;
 s->sample_rate = inlink->sample_rate;
 s->sample_advance = s->sample_rate / 80;
@@ -846,10 +842,6 @@ static int config_input(AVFilterLink *inlink)
 }
 s->noise_band_count = s->noise_band_edge[16];
 
-s->fifo = av_audio_fifo_alloc(inlink->format, inlink->channels, 
s->fft_length);
-if (!s->fifo)
-return AVERROR(ENOMEM);
-
 return 0;
 }
 
@@ -1153,34 +1145,22 @@ static void 
get_auto_noise_levels(AudioFFTDeNoiseContext *s,
 }
 }
 
-static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
+static int activate(AVFilterContext *ctx)
 {
-AVFilterContext *ctx = inlink->dst;
+AVFilterLink *inlink = ctx->inputs[0];
 AVFilterLink *outlink = ctx->outputs[0];
 AudioFFTDeNoiseContext *s = ctx->priv;
 AVFrame *out = NULL, *in = NULL;
 ThreadData td;
 int ret = 0;
 
-if (s->pts == AV_NOPTS_VALUE)
-s->pts = frame->pts;
+FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
 
-ret = av_audio_fifo_write(s->fifo, (void **)frame->extended_data, 
frame->nb_samples);
-av_frame_free();
+ret = ff_inlink_peek_samples(inlink, s->window_length, );
 if (ret < 0)
 return ret;
 
-while (av_audio_fifo_size(s->fifo) >= s->window_length) {
-if (!in) {
-in = ff_get_audio_buffer(outlink, s->window_length);
-if (!in)
-return AVERROR(ENOMEM);
-}
-
-ret = av_audio_fifo_peek(s->fifo, (void **)in->extended_data, 
s->window_length);
-if (ret < 0)
-break;
-
+if (ret > 0) {
 if (s->track_noise) {
 for (int ch = 0; ch < inlink->channels; ch++) {
 DeNoiseChannel *dnch = >dnch[ch];
@@ -1232,9 +1212,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 
 out = ff_get_audio_buffer(outlink, s->sample_advance);
 if (!out) {
-ret = AVERROR(ENOMEM);
-break;
+av_frame_free();
+return AVERROR(ENOMEM);
 }
+out->pts = in->pts;
 
 for (int ch = 0; ch < inlink->channels; ch++) {
 DeNoiseChannel *dnch = >dnch[ch];
@@ -1262,17 +1243,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 memset(src + (s->window_length - s->sample_advance), 0, 
s->sample_advance * sizeof(*src));
 }
 
-av_audio_fifo_drain(s->fifo, s->sample_advance);
+ff_inlink_skip_samples(inlink, FFMIN(ff_inlink_queued_samples(inlink), 
s->sample_advance));
 
-out->pts = s->pts;
-ret = ff_filter_frame(outlink, out);
-if (ret < 0)
-break;
-s->pts += s->sample_advance;
+av_frame_free();
+return ff_filter_frame(outlink, out);
 }
-av_frame_free();
 
-return ret;
+FF_FILTER_FORWARD_STATUS(inlink, outlink);
+FF_FILTER_FORWARD_WANTED(outlink, inlink);
+
+return FFERROR_NOT_READY;
 }
 
 static av_cold void uninit(AVFilterContext *ctx)
@@ -1308,8 +1288,6 @@ static av_cold void uninit(AVFilterContext *ctx)
 }
 av_freep(>dnch);
 }
-
-av_audio_fifo_free(s->fifo);
 }
 
 static int query_formats(AVFilterContext *ctx)
@@ -1393,7 +1371,6 @@ static const AVFilterPad inputs[] = {
 {
 .name = "default",
 .type = AVMEDIA_TYPE_AUDIO,
-.filter_frame = filter_frame,
 .config_props = config_input,
 },
 { NULL }
@@ -1416,6 +1393,7 @@ AVFilter ff_af_afftdn = {
 .uninit  = uninit,
 .inputs  = inputs,
 .outputs = outputs,
+.activate= activate,
 .process_command 

[FFmpeg-devel] [PATCH 1/2] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2018-10-04 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/avfilter.c | 96 ++
 libavfilter/filters.h  | 17 
 2 files changed, 113 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 93e866b79c..1dad873dfc 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1195,6 +1195,61 @@ static int take_samples(AVFilterLink *link, unsigned 
min, unsigned max,
 return 0;
 }
 
+static int peek_samples(AVFilterLink *link, unsigned peek_samples,
+AVFrame **rframe)
+{
+AVFrame *frame0, *frame, *buf;
+unsigned nb_samples, nb_frames, i, p;
+int ret;
+
+/* Note: this function relies on no format changes and must only be
+   called with enough samples. */
+av_assert1(samples_ready(link, link->min_samples));
+frame0 = frame = ff_framequeue_peek(>fifo, 0);
+if (!link->fifo.samples_skipped && frame->nb_samples == peek_samples) {
+*rframe = frame;
+return 0;
+}
+nb_frames = 0;
+nb_samples = 0;
+while (1) {
+if (nb_samples + frame->nb_samples >= peek_samples)
+break;
+nb_samples += frame->nb_samples;
+nb_frames++;
+if (nb_frames == ff_framequeue_queued_frames(>fifo))
+break;
+frame = ff_framequeue_peek(>fifo, nb_frames);
+}
+
+buf = ff_get_audio_buffer(link, peek_samples);
+if (!buf)
+return AVERROR(ENOMEM);
+ret = av_frame_copy_props(buf, frame0);
+if (ret < 0) {
+av_frame_free();
+return ret;
+}
+buf->pts = frame0->pts;
+
+p = 0;
+for (i = 0; i < nb_frames; i++) {
+frame = ff_framequeue_peek(>fifo, i);
+av_samples_copy(buf->extended_data, frame->extended_data, p, 0,
+frame->nb_samples, link->channels, link->format);
+p += frame->nb_samples;
+}
+if (p < peek_samples) {
+unsigned n = peek_samples - p;
+frame = ff_framequeue_peek(>fifo, i);
+av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n,
+link->channels, link->format);
+}
+
+*rframe = buf;
+return 0;
+}
+
 static int ff_filter_frame_to_filter(AVFilterLink *link)
 {
 AVFrame *frame = NULL;
@@ -1517,6 +1572,47 @@ int ff_inlink_consume_samples(AVFilterLink *link, 
unsigned min, unsigned max,
 return 1;
 }
 
+int ff_inlink_peek_samples(AVFilterLink *link, unsigned nb_samples,
+   AVFrame **rframe)
+{
+AVFrame *frame;
+int ret;
+
+av_assert1(nb_samples);
+*rframe = NULL;
+if (!ff_inlink_check_available_samples(link, nb_samples))
+return 0;
+if (link->status_in)
+nb_samples = FFMIN(nb_samples, 
ff_framequeue_queued_samples(>fifo));
+ret = peek_samples(link, nb_samples, );
+if (ret < 0)
+return ret;
+*rframe = frame;
+return 1;
+}
+
+void ff_inlink_skip_samples(AVFilterLink *link, unsigned skip_samples)
+{
+while (skip_samples > 0) {
+AVFrame *frame = ff_inlink_peek_frame(link, 0);
+if (skip_samples >= frame->nb_samples) {
+frame = ff_framequeue_take(>fifo);
+skip_samples -= frame->nb_samples;
+av_frame_free();
+} else {
+break;
+}
+}
+
+if (skip_samples)
+ff_framequeue_skip_samples(>fifo, skip_samples, link->time_base);
+
+if (ff_inlink_queued_frames(link)) {
+AVFrame *frame = ff_inlink_peek_frame(link, 0);
+consume_update(link, frame);
+}
+}
+
 AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
 {
 return ff_framequeue_peek(>fifo, idx);
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 1157755403..7dc0b35981 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -115,6 +115,23 @@ int ff_inlink_consume_frame(AVFilterLink *link, AVFrame 
**rframe);
 int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max,
 AVFrame **rframe);
 
+/**
+ * Peek samples from the link's FIFO.
+ *
+ * @return  >0 if a samples are available,
+ *  0 and set rframe to NULL if no samples are available,
+ *  or AVERROR code
+ */
+int ff_inlink_peek_samples(AVFilterLink *link, unsigned nb_samples,
+   AVFrame **rframe);
+
+/**
+ * Skip samples from the link's FIFO.
+ *
+ * @note  May trigger process_command() and/or update is_disabled.
+ */
+void ff_inlink_skip_samples(AVFilterLink *link, unsigned skip);
+
 /**
  * Access a frame in the link fifo without consuming it.
  * The first frame is numbered 0; the designated frame must exist.
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH] avformat/xwma: fix WMAv2 with incorrect bit rate

2018-10-04 Thread Paul B Mahol
On 10/3/18, bananaman...@gmail.com  wrote:
> From: bnnm 
>
> Fixes trac issue #7215
>
> Output for files created by xWMAEncode and various videogames is correct
> now.
>
> 1ch 32000hz files are still broken, would need fixes in WMA decoder.
>
> Signed-off-by: bnnm 
> ---
>  libavformat/xwma.c | 38 +++---
>  1 file changed, 31 insertions(+), 7 deletions(-)
>

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


Re: [FFmpeg-devel] Mentoring project: music test source

2018-10-04 Thread Nicolas George
Hi.

No need to Cc people who are on the list.

Mina (2018-09-30):
> Do you mean by "look like music" to just follow music theory rules or
> actually sound like real music.
> Just curious.

In my mind, the purpose is to have a signal that can exercise filters
and codecs, trigger as many code paths as possible, without requiring an
external sample.

Therefore, it must "look like music" from the point of view of analysis
done by filters and codecs. And since some of the have quite subtle
psychoacoustic models tweaked for music, following music theory rules is
probably a requirement.

Sounding like real music seems much more difficult, and possibly not
that useful. But I think that if the code is clean, if somebody comes up
with a better algorithm to sound more catchy, it can be added in the
same filter as an option.

And, to answer Carl Eugen's question: No, I do not have a student lined
for this project.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 2/4] avfilter/af_asetnsamples: use lavfi internal queue

2018-10-04 Thread Nicolas George
Paul B Mahol (2018-10-03):
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/af_asetnsamples.c | 146 --
>  1 file changed, 32 insertions(+), 114 deletions(-)

LGTM, thanks.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] lavfi/atempo: fix tempo range limit inconsistency

2018-10-04 Thread Nicolas George
Pavel Koshevoy (2018-10-03):
> yae_set_tempo was overlooked when max tempo limit was raised to 100.
> 
> tested with:
> ./ffmpeg_g -i Delerium/SemanticSpaces/Gateway.mp3 \
> -af asendcmd=f=asendcmd.cfg,atempo=1.0 -y /tmp/asendcmd-atempo.wav
> 
> where asendcmd.cfg was:
> 15.0-45.0 [enter] atempo tempo 2.0,
>   [leave] atempo tempo 0.5;
> 
> 60.0-300.0 [enter] atempo tempo 4.0,
>[leave] atempo tempo 1.0;
> ---
>  libavfilter/af_atempo.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)

I am ok with this version of the patch, thanks. But I am not the
maintainer of that file.

Regards,

-- 
  Nicolas George


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