[FFmpeg-devel] [PATCH v3 2/2] lavf/movenc: cosmetics

2019-10-31 Thread Yuki Tsuchiya
Signed-off-by: Yuki Tsuchiya 
---
 libavformat/movenc.c | 72 +++-
 1 file changed, 38 insertions(+), 34 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ff234d9..85f978a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2411,7 +2411,9 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, 
MOVTrack *track)
 if (!sgpd_entries)
 return AVERROR(ENOMEM);
 
-av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || 
track->par->codec_id == AV_CODEC_ID_AAC || track->par->codec_id == 
AV_CODEC_ID_MPEGH_3D_AUDIO);
+av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS ||
+   track->par->codec_id == AV_CODEC_ID_AAC ||
+   track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO);
 
 if (track->par->codec_id == AV_CODEC_ID_OPUS) {
 for (i = 0; i < track->entry; i++) {
@@ -2513,7 +2515,9 @@ static int mov_write_stbl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
 if (track->cenc.aes_ctr) {
 ff_mov_cenc_write_stbl_atoms(>cenc, pb);
 }
-if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == 
AV_CODEC_ID_AAC || track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO) {
+if (track->par->codec_id == AV_CODEC_ID_OPUS ||
+track->par->codec_id == AV_CODEC_ID_AAC ||
+track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO) {
 mov_preroll_write_stbl_atoms(pb, track);
 }
 return update_size(pb, pos);
@@ -6847,39 +6851,39 @@ static const AVCodecTag codec_3gp_tags[] = {
 };
 
 const AVCodecTag codec_mp4_tags[] = {
-{ AV_CODEC_ID_MPEG4   , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
-{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },
-{ AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') },
-{ AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') },
-{ AV_CODEC_ID_MPEG2VIDEO  , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_MPEG1VIDEO  , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_MJPEG   , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_PNG , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_JPEG2000, MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_VC1 , MKTAG('v', 'c', '-', '1') },
-{ AV_CODEC_ID_DIRAC   , MKTAG('d', 'r', 'a', 'c') },
-{ AV_CODEC_ID_TSCC2   , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_VP9 , MKTAG('v', 'p', '0', '9') },
-{ AV_CODEC_ID_AV1 , MKTAG('a', 'v', '0', '1') },
-{ AV_CODEC_ID_AAC , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_MP4ALS  , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_MP3 , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_MP2 , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_AC3 , MKTAG('a', 'c', '-', '3') },
-{ AV_CODEC_ID_EAC3, MKTAG('e', 'c', '-', '3') },
-{ AV_CODEC_ID_DTS , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_TRUEHD  , MKTAG('m', 'l', 'p', 'a') },
-{ AV_CODEC_ID_FLAC, MKTAG('f', 'L', 'a', 'C') },
-{ AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') },
-{ AV_CODEC_ID_VORBIS  , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_QCELP   , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_EVRC, MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_DVD_SUBTITLE, MKTAG('m', 'p', '4', 's') },
-{ AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
-{ AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') },
+{ AV_CODEC_ID_MPEG4 , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_H264  , MKTAG('a', 'v', 'c', '1') },
+{ AV_CODEC_ID_H264  , MKTAG('a', 'v', 'c', '3') },
+{ AV_CODEC_ID_HEVC  , MKTAG('h', 'e', 'v', '1') },
+{ AV_CODEC_ID_HEVC  , MKTAG('h', 'v', 'c', '1') },
+{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_MJPEG , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_PNG   , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_JPEG2000  , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_VC1   , MKTAG('v', 'c', '-', '1') },
+{ AV_CODEC_ID_DIRAC , MKTAG('d', 'r', 'a', 'c') },
+{ AV_CODEC_ID_TSCC2 , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_VP9   , MKTAG('v', 'p', '0', '9') },
+{ AV_CODEC_ID_AV1   , MKTAG('a', 'v', '0', '1') },
+{ AV_CODEC_ID_AAC   , MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_MP4ALS, MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_MP3   , MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_MP2   , MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_AC3   , MKTAG('a', 'c', '-', '3') },
+{ AV_CODEC_ID_EAC3  , MKTAG('e', 'c', '-', '3') },
+{ AV_CODEC_ID_DTS   , MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_TRUEHD, 

[FFmpeg-devel] [PATCH v3 1/2] lavf/isom: support for demuxing MPEG-H 3D Audio in MP4

2019-10-31 Thread Yuki Tsuchiya
Implemented according to the specification at 
https://www.iso.org/standard/69561.html
The "mhm1" sample entry is registered with MP4RA, which is defined as MHAS 
encapsulated single stream MPEG-H 3D Audio.
"MHAS" stands for MPEG-H audio stream, which contains encoded audio data and 
corresponds metadata for decoding.
This patch enables extracting the MHAS bitstream from MP4.

Signed-off-by: Yuki Tsuchiya 
---
 libavcodec/avcodec.h| 1 +
 libavcodec/codec_desc.c | 7 +++
 libavcodec/version.h| 2 +-
 libavformat/isom.c  | 1 +
 libavformat/movenc.c| 6 --
 libavformat/utils.c | 3 ++-
 6 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index bcb931f..8c1a85d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -654,6 +654,7 @@ enum AVCodecID {
 AV_CODEC_ID_ATRAC9,
 AV_CODEC_ID_HCOM,
 AV_CODEC_ID_ACELP_KELVIN,
+AV_CODEC_ID_MPEGH_3D_AUDIO,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0602ecb..a970fae 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2998,6 +2998,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Sipro ACELP.KELVIN"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_MPEGH_3D_AUDIO,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "mpegh_3d_audio",
+.long_name = NULL_IF_CONFIG_SMALL("MPEG-H 3D Audio"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 27c126e..b36f331 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  60
+#define LIBAVCODEC_VERSION_MINOR  61
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavformat/isom.c b/libavformat/isom.c
index edd0d81..824e811 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -371,6 +371,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = {
 { AV_CODEC_ID_FLAC,MKTAG('f', 'L', 'a', 'C') }, /* nonstandard 
*/
 { AV_CODEC_ID_TRUEHD,  MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */
 { AV_CODEC_ID_OPUS,MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */
+{ AV_CODEC_ID_MPEGH_3D_AUDIO,  MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D 
Audio bitstream */
 { AV_CODEC_ID_NONE, 0 },
 };
 
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 715bec1..ff234d9 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2411,7 +2411,7 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, 
MOVTrack *track)
 if (!sgpd_entries)
 return AVERROR(ENOMEM);
 
-av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || 
track->par->codec_id == AV_CODEC_ID_AAC);
+av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || 
track->par->codec_id == AV_CODEC_ID_AAC || track->par->codec_id == 
AV_CODEC_ID_MPEGH_3D_AUDIO);
 
 if (track->par->codec_id == AV_CODEC_ID_OPUS) {
 for (i = 0; i < track->entry; i++) {
@@ -2493,6 +2493,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
 mov_write_stts_tag(pb, track);
 if ((track->par->codec_type == AVMEDIA_TYPE_VIDEO ||
  track->par->codec_id == AV_CODEC_ID_TRUEHD ||
+ track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO ||
  track->par->codec_tag == MKTAG('r','t','p',' ')) &&
 track->has_keyframes && track->has_keyframes < track->entry)
 mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
@@ -2512,7 +2513,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
 if (track->cenc.aes_ctr) {
 ff_mov_cenc_write_stbl_atoms(>cenc, pb);
 }
-if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == 
AV_CODEC_ID_AAC) {
+if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == 
AV_CODEC_ID_AAC || track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO) {
 mov_preroll_write_stbl_atoms(pb, track);
 }
 return update_size(pb, pos);
@@ -6877,6 +6878,7 @@ const AVCodecTag codec_mp4_tags[] = {
 { AV_CODEC_ID_DVD_SUBTITLE, MKTAG('m', 'p', '4', 's') },
 { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
 { AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') },
+{ AV_CODEC_ID_MPEGH_3D_AUDIO, MKTAG('m', 'h', 'm', '1') },
 { AV_CODEC_ID_NONE,0 },
 };
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cfb6d03..d271251 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1021,7 +1021,8 @@ static int is_intra_only(enum AVCodecID id)
 

Re: [FFmpeg-devel] [PATCH] FATE: add a test for the bilateral filter

2019-10-31 Thread myp...@gmail.com
On Thu, Oct 31, 2019 at 4:30 PM leozhang  wrote:
>
> Signed-off-by: leozhang 
> ---
>  tests/fate/filter-video.mak |  3 +++
>  tests/ref/fate/filter-bilateral | 55
+
>  2 files changed, 58 insertions(+)
>  create mode 100644 tests/ref/fate/filter-bilateral
>
> diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
> index 7f55c73..0c33de5 100644
> --- a/tests/fate/filter-video.mak
> +++ b/tests/fate/filter-video.mak
> @@ -122,6 +122,9 @@ FATE_FILTER-$(call ALLYES, FRAMERATE_FILTER
TESTSRC2_FILTER FORMAT_FILTER) += fa
>  fate-filter-framerate-12bit-up: CMD = framecrc -lavfi
testsrc2=r=50:d=1,format=pix_fmts=yuv422p12le,framerate=fps=60 -t 1
-pix_fmt yuv422p12le
>  fate-filter-framerate-12bit-down: CMD = framecrc -lavfi
testsrc2=r=60:d=1,format=pix_fmts=yuv422p12le,framerate=fps=50 -t 1
-pix_fmt yuv422p12le
>
> +FATE_FILTER_VSYNTH-$(CONFIG_BILATERAL_FILTER) += fate-filter-bilateral
> +fate-filter-bilateral: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf bilateral
> +
>  FATE_FILTER_VSYNTH-$(CONFIG_BOXBLUR_FILTER) += fate-filter-boxblur
>  fate-filter-boxblur: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf boxblur=2:1
>
> diff --git a/tests/ref/fate/filter-bilateral
b/tests/ref/fate/filter-bilateral
> new file mode 100644
> index 000..6b2d2e5
> --- /dev/null
> +++ b/tests/ref/fate/filter-bilateral
> @@ -0,0 +1,55 @@
> +#tb 0: 1/25
> +#media_type 0: video
> +#codec_id 0: rawvideo
> +#dimensions 0: 352x288
> +#sar 0: 0/1
> +0,  0,  0,1,   152064, 0x5bbd7b0c
> +0,  1,  1,1,   152064, 0x1ff551db
> +0,  2,  2,1,   152064, 0xff04fb27
> +0,  3,  3,1,   152064, 0x374c7095
> +0,  4,  4,1,   152064, 0x6b6bb6fc
> +0,  5,  5,1,   152064, 0x72506d74
> +0,  6,  6,1,   152064, 0x87f4ff6b
> +0,  7,  7,1,   152064, 0xe4cf78b9
> +0,  8,  8,1,   152064, 0xd9b304eb
> +0,  9,  9,1,   152064, 0x84bb3553
> +0, 10, 10,1,   152064, 0x9bea0265
> +0, 11, 11,1,   152064, 0xa9046321
> +0, 12, 12,1,   152064, 0x126299af
> +0, 13, 13,1,   152064, 0xea83fe82
> +0, 14, 14,1,   152064, 0x06de9af5
> +0, 15, 15,1,   152064, 0xe8feeefd
> +0, 16, 16,1,   152064, 0x2687e830
> +0, 17, 17,1,   152064, 0x0538ac63
> +0, 18, 18,1,   152064, 0xcba8d8f6
> +0, 19, 19,1,   152064, 0xde833d19
> +0, 20, 20,1,   152064, 0xe9a970b4
> +0, 21, 21,1,   152064, 0xc8dd87db
> +0, 22, 22,1,   152064, 0xd8ad95e5
> +0, 23, 23,1,   152064, 0x36f7c7fd
> +0, 24, 24,1,   152064, 0x35f863dc
> +0, 25, 25,1,   152064, 0x92eb1e39
> +0, 26, 26,1,   152064, 0x669441e7
> +0, 27, 27,1,   152064, 0x0b429de2
> +0, 28, 28,1,   152064, 0x2137824f
> +0, 29, 29,1,   152064, 0xba9e54d9
> +0, 30, 30,1,   152064, 0x8868701d
> +0, 31, 31,1,   152064, 0xf3beedd7
> +0, 32, 32,1,   152064, 0xae2a7230
> +0, 33, 33,1,   152064, 0xcd696392
> +0, 34, 34,1,   152064, 0xa73cb092
> +0, 35, 35,1,   152064, 0xb23c4fe8
> +0, 36, 36,1,   152064, 0x40b631be
> +0, 37, 37,1,   152064, 0x2b814f1d
> +0, 38, 38,1,   152064, 0x454b58f2
> +0, 39, 39,1,   152064, 0xb91c4145
> +0, 40, 40,1,   152064, 0x44f50dda
> +0, 41, 41,1,   152064, 0x7ec76f9d
> +0, 42, 42,1,   152064, 0x9ca3c1ee
> +0, 43, 43,1,   152064, 0x98b63e1c
> +0, 44, 44,1,   152064, 0x60ed25fa
> +0, 45, 45,1,   152064, 0xc3c99fec
> +0, 46, 46,1,   152064, 0xf29a7d91
> +0, 47, 47,1,   152064, 0x8bafd7b2
> +0, 48, 48,1,   152064, 0x0b87b824
> +0, 49, 49,1,   152064, 0x50fe02ce
> --
> 1.8.3.1
>
I don't think adding FATE like this for bilateral filter is a good idea, if
we change the implement with a fast algorithm, I think keep bit match is
hard
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] lavc/qsv: improve the default GPU memory usage

2019-10-31 Thread Linjie Fu
A large initial_pool_size leads to redundant GPU memory allocations
compared with MSDK.

For some special cases which needs larger GPU memory like look_ahead,
add -extra_hw_frames to allocate more.

CMD:
ffmpeg -hwaccel qsv -extra_hw_frames 50 -c:v hevc_qsv -i hevc.h265 -c:v h264_qsv
-look_ahead 1 -look_ahead_depth 50 -y output.h264

Fix #7943.

Reported-by: Eero T
Signed-off-by: Linjie Fu 
---
 fftools/ffmpeg_qsv.c | 2 +-
 libavcodec/qsvdec.c  | 5 -
 libavcodec/qsvenc_h264.c | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg_qsv.c b/fftools/ffmpeg_qsv.c
index 9c4285b..5039a5a 100644
--- a/fftools/ffmpeg_qsv.c
+++ b/fftools/ffmpeg_qsv.c
@@ -93,7 +93,7 @@ int qsv_init(AVCodecContext *s)
 frames_ctx->height= FFALIGN(s->coded_height, 32);
 frames_ctx->format= AV_PIX_FMT_QSV;
 frames_ctx->sw_format = s->sw_pix_fmt;
-frames_ctx->initial_pool_size = 64 + s->extra_hw_frames;
+frames_ctx->initial_pool_size = 24 + s->extra_hw_frames;
 frames_hwctx->frame_type  = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
 
 ret = av_hwframe_ctx_init(ist->hw_frames_ctx);
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 0d34021..407e6de 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -300,8 +300,11 @@ static int alloc_frame(AVCodecContext *avctx, QSVContext 
*q, QSVFrame *frame)
 else
 ret = ff_get_buffer(avctx, frame->frame, AV_GET_BUFFER_FLAG_REF);
 
-if (ret < 0)
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "More memory in need, "
+"try -extra_hw_frames to allocate more.\n");
 return ret;
+}
 
 if (frame->frame->format == AV_PIX_FMT_QSV) {
 frame->surface = *(mfxFrameSurface1*)frame->frame->data[3];
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 27f36b9..4e8035b 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -112,8 +112,8 @@ static const AVOption options[] = {
 { "max_dec_frame_buffering", "Maximum number of frames buffered in the 
DPB", OFFSET(qsv.max_dec_frame_buffering), AV_OPT_TYPE_INT, { .i64 = 0 },   0, 
UINT16_MAX, VE },
 
 #if QSV_HAVE_LA
-{ "look_ahead",   "Use VBR algorithm with look ahead",
OFFSET(qsv.look_ahead),   AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
-{ "look_ahead_depth", "Depth of look ahead in number frames", 
OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE },
+{ "look_ahead",   "Use VBR algorithm with look ahead, extra_hw_frames 
is needed",OFFSET(qsv.look_ahead),   AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 
1, VE },
+{ "look_ahead_depth", "Depth of look ahead in number frames, 
extra_hw_frames is needed", OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { 
.i64 = 0 }, 0, 100, VE },
 #endif
 #if QSV_HAVE_LA_DS
 { "look_ahead_downsampling", "Downscaling factor for the frames saved for 
the lookahead analysis", OFFSET(qsv.look_ahead_downsampling),
-- 
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 7/8] avcodec/vc1_block: Fix undefined behavior in ac prediction rescaling

2019-10-31 Thread Michael Niedermayer
The intermediates are required to fit in 12bit (8.1.3.9 Coefficient Scaling)
See SMPTE 421M-2006 and Amendment 1-2007

Fixes: signed integer overflow: -20691 * 262144 cannot be represented in type 
'int'
Fixes: 
18479/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5128912371187712

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

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index 4c6dfaf6bf..da0eee8cc7 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -1036,10 +1036,10 @@ static int vc1_decode_intra_block(VC1Context *v, 
int16_t block[64], int n,
 if (q2 && q1 != q2) {
 if (dc_pred_dir) { // left
 for (k = 1; k < 8; k++)
-block[k << v->left_blk_sh] += (ac_val[k] * q2 * 
ff_vc1_dqscale[q1 - 1] + 0x2) >> 18;
+block[k << v->left_blk_sh] += (int)(ac_val[k] * q2 * 
(unsigned)ff_vc1_dqscale[q1 - 1] + 0x2) >> 18;
 } else { //top
 for (k = 1; k < 8; k++)
-block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * 
ff_vc1_dqscale[q1 - 1] + 0x2) >> 18;
+block[k << v->top_blk_sh] += (int)(ac_val[k + 8] * q2 
* (unsigned)ff_vc1_dqscale[q1 - 1] + 0x2) >> 18;
 }
 } else {
 if (dc_pred_dir) { // left
-- 
2.23.0

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

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

[FFmpeg-devel] [PATCH 2/8] avcodec/wmadec: Check block_align

2019-10-31 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
18432/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5675574936207360

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

diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index 78b51e5871..25c1d9a452 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -828,6 +828,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, 
void *data,
buf_size, avctx->block_align);
 return AVERROR_INVALIDDATA;
 }
+if (avctx->block_align < 0)
+return AVERROR_INVALIDDATA;
 if (avctx->block_align)
 buf_size = avctx->block_align;
 
-- 
2.23.0

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

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

[FFmpeg-devel] [PATCH 1/8] avcodec/wmalosslessdec: Set FF_CODEC_CAP_INIT_CLEANUP

2019-10-31 Thread Michael Niedermayer
Fixes: memleaks
Fixes: 
18429/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-6210814364614656

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

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index d4f18b9841..7ed6ce3135 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1327,6 +1327,7 @@ AVCodec ff_wmalossless_decoder = {
 .decode = decode_packet,
 .flush  = flush,
 .capabilities   = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1 | 
AV_CODEC_CAP_DELAY,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 .sample_fmts= (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
   AV_SAMPLE_FMT_S32P,
   AV_SAMPLE_FMT_NONE },
-- 
2.23.0

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

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

[FFmpeg-devel] [PATCH 8/8] avcodec/qdm2: The smallest header seems to have 2 bytes so treat 1 as invalid

2019-10-31 Thread Michael Niedermayer
Fixes: Timeout (217sec -> 2ms)
Fixes: 
18488/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5708293662310400

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

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index ac8ae8cbbb..7b9d50b234 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1704,7 +1704,7 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
 s->group_size = bytestream2_get_be32();
 s->fft_size = bytestream2_get_be32();
 s->checksum_size = bytestream2_get_be32();
-if (s->checksum_size >= 1U << 28 || !s->checksum_size) {
+if (s->checksum_size >= 1U << 28 || s->checksum_size <= 1) {
 av_log(avctx, AV_LOG_ERROR, "data block size invalid (%u)\n", 
s->checksum_size);
 return AVERROR_INVALIDDATA;
 }
-- 
2.23.0

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

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

[FFmpeg-devel] [PATCH 6/8] avcodec/wmadec: Require previous exponents for reuse

2019-10-31 Thread Michael Niedermayer
Fixes: division by zero
Fixes: 
18474/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5764986962182144

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

diff --git a/libavcodec/wma.h b/libavcodec/wma.h
index 325f03c44b..8344cb5b93 100644
--- a/libavcodec/wma.h
+++ b/libavcodec/wma.h
@@ -123,6 +123,7 @@ typedef struct WMACodecContext {
 uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 
AV_INPUT_BUFFER_PADDING_SIZE]; /* padding added */
 int last_bitoffset;
 int last_superframe_len;
+int exponents_initialized;
 float noise_table[NOISE_TAB_SIZE];
 int noise_index;
 float noise_mult; /* XXX: suppress that and integrate it in the noise 
array */
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index 25c1d9a452..f9260c966a 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -587,6 +587,9 @@ static int wma_decode_block(WMACodecContext *s)
 s->exponents_bsize[ch] = bsize;
 }
 }
+s->exponents_initialized = 1;
+}else if (!s->exponents_initialized) {
+return AVERROR_INVALIDDATA;
 }
 
 /* parse spectral coefficients : just RLE encoding */
-- 
2.23.0

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

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

[FFmpeg-devel] [PATCH 3/8] avcodec/utils: Check block_align

2019-10-31 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
18432/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5675574936207360

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

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6cc770b1ea..75e7035b8a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -694,6 +694,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 ret = AVERROR(EINVAL);
 goto free_and_end;
 }
+if (avctx->block_align < 0) {
+av_log(avctx, AV_LOG_ERROR, "Invalid block align: %d\n", 
avctx->block_align);
+ret = AVERROR(EINVAL);
+goto free_and_end;
+}
 
 avctx->codec = codec;
 if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == 
codec->type) &&
-- 
2.23.0

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

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

[FFmpeg-devel] [PATCH 4/8] avformat/mxfdec: cleanup on "essence prior to first PartitionPack"

2019-10-31 Thread Michael Niedermayer
Fixes: memleak
Fixes: 
18473/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5738557074833408

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

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 397f820b3f..f3b1b704f9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3199,7 +3199,8 @@ static int mxf_read_header(AVFormatContext *s)
 
 if (!mxf->current_partition) {
 av_log(mxf->fc, AV_LOG_ERROR, "found essence prior to first 
PartitionPack\n");
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto fail;
 }
 
 if (!mxf->current_partition->first_essence_klv.offset)
-- 
2.23.0

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

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

[FFmpeg-devel] [PATCH 5/8] avformat/mxfdec: Clear metadata_sets_count in mxf_read_close()

2019-10-31 Thread Michael Niedermayer
This avoids problems if the function is called twice

Signed-off-by: Michael Niedermayer 
---
 libavformat/mxfdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index f3b1b704f9..68a670154b 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3582,6 +3582,7 @@ static int mxf_read_close(AVFormatContext *s)
 for (i = 0; i < mxf->metadata_sets_count; i++) {
 mxf_free_metadataset(mxf->metadata_sets + i, 1);
 }
+mxf->metadata_sets_count = 0;
 av_freep(>partitions);
 av_freep(>metadata_sets);
 av_freep(>aesc);
-- 
2.23.0

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

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

Re: [FFmpeg-devel] [PATCH] lavf/mov: initial support for reading HEIF images

2019-10-31 Thread Dale Curtis
On Thu, Oct 31, 2019 at 1:32 AM Swaraj Hota  wrote:

> Yes I will send the patch soon for review. Still a few things left to do.
>
> Swaraj
>

Great! Let me know if there's anything I can help with. If you need some
AVIF samples they can be found here:
https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/

- dale
___
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 0/1] avformat/mpegenc.c: vbvsize option

2019-10-31 Thread Nicolas Gaullier
This patch is to allow the user to set or override the vbv size for mpg output.
On one side, this is a follow up of https://trac.ffmpeg.org/ticket/3494 (closed)
On another side, this is also a turnaround when using video codec copy, as the 
buffer size is not parsed/known.

Thank you for the review!
Nicolas

Nicolas Gaullier (1):
  avformat/mpegenc.c: vbvsize option

 libavformat/mpegenc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.22.0

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

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

[FFmpeg-devel] [PATCH 1/1] avformat/mpegenc.c: vbvsize option

2019-10-31 Thread Nicolas Gaullier
Allow the user to set or override the vbv size
---
 libavformat/mpegenc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index f6980231a2..1613c8afa1 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -67,6 +67,7 @@ typedef struct MpegMuxContext {
 int system_header_freq;
 int system_header_size;
 int user_mux_rate; /* bitrate in units of bits/s */
+int user_vbv_size; /* vbv buffer size in units of bits/s */
 int mux_rate; /* bitrate in units of 50 bytes/s */
 /* stream info */
 int audio_bound;
@@ -433,7 +434,9 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
 stream->id = mpv_id++;
 
 props = (AVCPBProperties*)av_stream_get_side_data(st, 
AV_PKT_DATA_CPB_PROPERTIES, NULL);
-if (props && props->buffer_size)
+if (s->user_vbv_size)
+stream->max_buffer_size = 6 * 1024 + s->user_vbv_size / 8;
+else if (props && props->buffer_size)
 stream->max_buffer_size = 6 * 1024 + props->buffer_size / 8;
 else {
 av_log(ctx, AV_LOG_WARNING,
@@ -1268,6 +1271,7 @@ static void mpeg_mux_deinit(AVFormatContext *ctx)
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
 { "muxrate", NULL,  
OFFSET(user_mux_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, ((1<<22) - 1) * (8 * 
50), E },
+{ "vbvsize", "set vbv buffer size (in bits)",   
OFFSET(user_vbv_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, (1LL<<32) - 1, E},
 { "preload", "Initial demux-decode delay in microseconds.", 
OFFSET(preload),  AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, E },
 { NULL },
 };
-- 
2.22.0

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

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

Re: [FFmpeg-devel] [PATCH] avformat/segment: fix cuttting for non-zero start pts

2019-10-31 Thread Vasily
Hi Marton,

> Please use a proper commit title: e.g:
>
> avformat/segment: fix non-zero start pts
>
> Also make sure you provide the author name you want when you send the
> patch email. (you only provided an email address in the From field, not a
> full name, I guess this is not intentional).

I've fixed "From" and subject (so it's just my first name, I don't want to 
share my family name etc), hope it's okay now (or do I need to send a 
completely new patch with fixed From and subject instead?).


> What happens if the first packet is not from a reference stream? As far as
> I see in that case the output packet timestamp will be 0 based until we
> get a packet from the refence stream... Maybe you should accept a packet
> from any stream here?

I am not changing output packet timestamps here, I only change the way the 
cutting point for segment muxer is calculated.
Cutting is performed when a packet in a reference stream has greater pts than 
one determined as cutting point (and some other conditions are met), and before 
my patch that cutting point always assumed reference stream started at zero.

So, as cutting point is used to determine whether current packet has to begin a 
new segment only by looking at reference stream, it doesn't seem correct to me 
to use any other streams as sources of "pts of first packet", as other streams 
could potentially use different start times. Cutting point should make segments 
as close to desired length as possible IMHO.

--- 
Thanks,
Vasily

___
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/5] swscale/swscale_unscaled: fix gbrap10be md5 different on big endian system

2019-10-31 Thread Paul B Mahol
lgtm

On 10/30/19, lance.lmw...@gmail.com  wrote:
> From: Limin Wang 
>
> You can reproduce it by below command:
> ./ffmpeg -f lavfi -i "testsrc=duration=1:rate=30" -vf format=gbrap10 -vcodec
> rawvideo \
> -pix_fmt gbrap10le -flags +bitexact -sws_flags +accurate_rnd+bitexact
> -fflags +bitexact  \
> -frames:v 1 -f nut md5:
>
> little-endian:
> f91e2edd8098276579c1929e5e160416
> big-endian:
> ba4d011dbbdc78ccbf6cc7d698630929
>
> Signed-off-by: Limin Wang 
> ---
>  libswscale/swscale_unscaled.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
> index e0b9e99373..d9260c151a 100644
> --- a/libswscale/swscale_unscaled.c
> +++ b/libswscale/swscale_unscaled.c
> @@ -2048,6 +2048,7 @@ void ff_get_unscaled_swscale(SwsContext *c)
>  IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) ||
>  IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP14) ||
>  IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP16) ||
> +IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP10) ||
>  IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP12) ||
>  IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP16) ||
>  IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB444) ||
> --
> 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] acrossfade filter crossfading before first input is exhausted

2019-10-31 Thread Paul B Mahol
Done,

On 10/30/19, Mark Niebur  wrote:
> Hello,
> I have been trying to use acrossfade but have been experiencing that the
> audio in the resulting output is totally jumbled.  From stepping through the
> code, it appears that acrossfade is starting the crossfade before the first
> input is exhausted.  I'm not sure why this happens from ffmpeg's point of
> view; I'm guessing it's from poor disk performance in docker.  I have found
> that the following patch fixes this issue:
>
> diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
> index 23608fb..91a454b 100644
> --- a/libavfilter/af_afade.c
> +++ b/libavfilter/af_afade.c
> @@ -485,7 +485,8 @@ static int activate(AVFilterContext *ctx)
>  (AVRational){ 1, outlink->sample_rate }, outlink->time_base);
>  return ff_filter_frame(outlink, in);
>  } else if (ff_inlink_queued_samples(ctx->inputs[0]) >= s->nb_samples &&
> -   ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples) {
> +   ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples &&
> +   s->cf0_eof) {
>  if (s->overlap) {
>  out = ff_get_audio_buffer(outlink, s->nb_samples);
>  if (!out)
>
> Could you please merge this patch or merge a similar fix?
>
> Thanks,
> Mark Niebur
> ___
> 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 1/2] lavf/isom: support for demuxing MPEG-H 3D Audio in MP4

2019-10-31 Thread Paul B Mahol
On 10/31/19, Tsuchiya, Yuki (SHES)  wrote:
> Hi,
>
>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of Paul
>> B Mahol
>> Sent: Wednesday, October 30, 2019 6:52 PM
>> To: FFmpeg development discussions and patches
>> 
>> Cc: Tsuchiya, Yuki (SHES) 
>> Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] lavf/isom: support for
>> demuxing
>> MPEG-H 3D Audio in MP4
>> > +- Support for demuxing MPEG-H 3D Audio in mp4
>
>> Unacceptable change.
> Could you point out the reason why is this patch not acceptable?
>
>> > +AV_CODEC_ID_MPEGH_3D_AUDIO,
>>
>> Does this really need _AUDIO suffix?
> There is no short name or other name regarding MPEG-H 3D Audio codec as of
> this moment.
> If AV_CODEC_ID_MPEGH_3D_AUDIO is too redundant, just "AV_CODEC_ID_MPEGH_3D"
> will also work.

Well, if it is official name its fine.

>
>> >  #define LIBAVCODEC_VERSION_MINOR  60
>> > -#define LIBAVCODEC_VERSION_MICRO 100
>> > +#define LIBAVCODEC_VERSION_MICRO 101
>>
>> Not good.
> Should change minor version? Or not necessary?

Minor version please.

>
>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of Paul
>> B Mahol
>> Sent: Wednesday, October 30, 2019 6:52 PM
>> To: FFmpeg development discussions and patches
>> 
>> Cc: Tsuchiya, Yuki (SHES) 
>> Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] lavf/isom: support for
>> demuxing
>> MPEG-H 3D Audio in MP4
>>
>> On 10/30/19, Yuki.Tsuchiya  wrote:
>> > Implemented according to the specification at
>> > https://www.iso.org/standard/69561.html
>> > The 'mhm1' sample entry is registered with MP4RA, which is defined as
>> > MHAS encapsulated single stream MPEG-H 3D Audio.
>> > 'MHAS' stands for MPEG-H audio stream, which contains encoded audio
>> > data and corresponds metadata for decoding.
>> > This patch enables extracting the MHAS bitstream from MP4.
>> >
>> > Signed-off-by: Yuki.Tsuchiya 
>> > ---
>> >  Changelog   | 1 +
>> >  libavcodec/avcodec.h| 1 +
>> >  libavcodec/codec_desc.c | 7 +++
>> >  libavcodec/version.h| 2 +-
>> >  libavformat/isom.c  | 1 +
>> >  libavformat/movenc.c| 6 --
>> >  libavformat/utils.c | 3 ++-
>> >  7 files changed, 17 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/Changelog b/Changelog
>> > index 7c971fc..afb3bff 100644
>> > --- a/Changelog
>> > +++ b/Changelog
>> > @@ -20,6 +20,7 @@ version :
>> >  - maskedmin and maskedmax filters
>> >  - VDPAU VP9 hwaccel
>> >  - median filter
>> > +- Support for demuxing MPEG-H 3D Audio in mp4
>>
>> Unacceptable change.
>>
>> >
>> >
>> >  version 4.2:
>> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index
>> > bcb931f..8c1a85d 100644
>> > --- a/libavcodec/avcodec.h
>> > +++ b/libavcodec/avcodec.h
>> > @@ -654,6 +654,7 @@ enum AVCodecID {
>> >  AV_CODEC_ID_ATRAC9,
>> >  AV_CODEC_ID_HCOM,
>> >  AV_CODEC_ID_ACELP_KELVIN,
>> > +AV_CODEC_ID_MPEGH_3D_AUDIO,
>>
>> Does this really need _AUDIO suffix?
>>
>> >
>> >  /* subtitle codecs */
>> >  AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy
>> ID pointing
>> > at the start of subtitle codecs.
>> > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index
>> > 0602ecb..a970fae 100644
>> > --- a/libavcodec/codec_desc.c
>> > +++ b/libavcodec/codec_desc.c
>> > @@ -2998,6 +2998,13 @@ static const AVCodecDescriptor
>> > codec_descriptors[] = {
>> >  .long_name = NULL_IF_CONFIG_SMALL("Sipro ACELP.KELVIN"),
>> >  .props = AV_CODEC_PROP_LOSSY,
>> >  },
>> > +{
>> > +.id= AV_CODEC_ID_MPEGH_3D_AUDIO,
>> > +.type  = AVMEDIA_TYPE_AUDIO,
>> > +.name  = "mpegh_3d_audio",
>>
>> Same here.
>>
>> > +.long_name = NULL_IF_CONFIG_SMALL("MPEG-H 3D Audio"),
>> > +.props = AV_CODEC_PROP_LOSSY,
>> > +},
>> >
>> >  /* subtitle codecs */
>> >  {
>> > diff --git a/libavcodec/version.h b/libavcodec/version.h index
>> > 27c126e..64e2365 100644
>> > --- a/libavcodec/version.h
>> > +++ b/libavcodec/version.h
>> > @@ -29,7 +29,7 @@
>> >
>> >  #define LIBAVCODEC_VERSION_MAJOR  58
>> >  #define LIBAVCODEC_VERSION_MINOR  60
>> > -#define LIBAVCODEC_VERSION_MICRO 100
>> > +#define LIBAVCODEC_VERSION_MICRO 101
>>
>> Not good.
>>
>> >
>> >  #define LIBAVCODEC_VERSION_INT
>> AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>> >
>> > LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/isom.c
>> > b/libavformat/isom.c index edd0d81..824e811 100644
>> > --- a/libavformat/isom.c
>> > +++ b/libavformat/isom.c
>> > @@ -371,6 +371,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = {
>> >  { AV_CODEC_ID_FLAC,MKTAG('f', 'L', 'a', 'C') }, /*
>> > nonstandard */
>> >  { AV_CODEC_ID_TRUEHD,  MKTAG('m', 'l', 'p', 'a') }, /*
>> > mp4ra.org */
>> >  { AV_CODEC_ID_OPUS,MKTAG('O', 'p', 'u', 's') }, /*
>> > mp4ra.org */
>> > +{ AV_CODEC_ID_MPEGH_3D_AUDIO,  MKTAG('m', 'h', 'm', '1') }, /*
>> > + MPEG-H
>> > 3D Audio bitstream */
>> >  { AV_CODEC_ID_NONE, 0 },
>> >  };
>> >

Re: [FFmpeg-devel] [PATCH] avfilter/vf_bilateral: remove useless memcpy

2019-10-31 Thread Tao Zhang
Paul B Mahol  于2019年10月30日周三 下午4:35写道:
>
> Why you think it is useless?
>
> Have you checked checksums matches before and after?
Hi Paul,
I add FATE test for the bilateral filter which is
https://patchwork.ffmpeg.org/patch/16042/. Checked checksums matched
before and after. Thanks
>
> On 10/30/19, leozhang  wrote:
> > Signed-off-by: leozhang 
> > ---
> >  libavfilter/vf_bilateral.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c
> > index 3c9d800..ba3c6e1 100644
> > --- a/libavfilter/vf_bilateral.c
> > +++ b/libavfilter/vf_bilateral.c
> > @@ -277,8 +277,8 @@ static void bilateral_##name(BilateralContext *s, const
> > uint8_t *ssrc, uint8_t *
> >  factor_++;
> >   \
> >  }
> >   \
> >
> >   \
> > -memcpy(ypy, ycy, sizeof(float) * width);
> >   \
> > -memcpy(ypf, ycf, sizeof(float) * width);
> >   \
> > +ypy = ycy;  \
> > +ypf = ycf;  \
> >  }
> >   \
> >
> >   \
> >  for (int i = 0; i < height; i++)
> >   \
> > --
> > 1.8.3.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".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH V3] avfilter/vf_dnn_processing: add a generic filter for image proccessing with dnn networks

2019-10-31 Thread Guo, Yejun
This filter accepts all the dnn networks which do image processing.
Currently, frame with formats rgb24 and bgr24 are supported. Other
formats such as gray and YUV will be supported next. The dnn network
can accept data in float32 or uint8 format. And the dnn network can
change frame size.

The following is a python script to halve the value of the first
channel of the pixel. It demos how to setup and execute dnn model
with python+tensorflow. It also generates .pb file which will be
used by ffmpeg.

import tensorflow as tf
import numpy as np
import scipy.misc
in_img = scipy.misc.imread('in.bmp')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]
filter_data = np.array([0.5, 0, 0, 0, 1., 0, 0, 0, 
1.]).reshape(1,1,3,3).astype(np.float32)
filter = tf.Variable(filter_data)
x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
y = tf.nn.conv2d(x, filter, strides=[1, 1, 1, 1], padding='VALID', 
name='dnn_out')
sess=tf.Session()
sess.run(tf.global_variables_initializer())
output = sess.run(y, feed_dict={x: in_data})
graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, 
['dnn_out'])
tf.train.write_graph(graph_def, '.', 'halve_first_channel.pb', as_text=False)
output = output * 255.0
output = output.astype(np.uint8)
scipy.misc.imsave("out.bmp", np.squeeze(output))

To do the same thing with ffmpeg:
- generate halve_first_channel.pb with the above script
- generate halve_first_channel.model with tools/python/convert.py
- try with following commands
  ./ffmpeg -i input.jpg -vf 
dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:fmt=rgb24:dnn_backend=native
 -y out.native.png
  ./ffmpeg -i input.jpg -vf 
dnn_processing=model=halve_first_channel.pb:input=dnn_in:output=dnn_out:fmt=rgb24:dnn_backend=tensorflow
 -y out.tf.png

Signed-off-by: Guo, Yejun 
---
 configure   |   1 +
 doc/filters.texi|  44 ++
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_dnn_processing.c | 331 
 5 files changed, 378 insertions(+)
 create mode 100644 libavfilter/vf_dnn_processing.c

diff --git a/configure b/configure
index 875b77f..4b3964d 100755
--- a/configure
+++ b/configure
@@ -3463,6 +3463,7 @@ derain_filter_select="dnn"
 deshake_filter_select="pixelutils"
 deshake_opencl_filter_deps="opencl"
 dilation_opencl_filter_deps="opencl"
+dnn_processing_filter_select="dnn"
 drawtext_filter_deps="libfreetype"
 drawtext_filter_suggest="libfontconfig libfribidi"
 elbg_filter_deps="avcodec"
diff --git a/doc/filters.texi b/doc/filters.texi
index 9d387be..15771ab 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8928,6 +8928,50 @@ ffmpeg -i INPUT -f lavfi -i 
nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2
 @end example
 @end itemize
 
+@section dnn_processing
+
+Do image processing with deep neural networks. Currently only AVFrame with 
RGB24
+and BGR24 are supported, more formats will be added later.
+
+The filter accepts the following options:
+
+@table @option
+@item dnn_backend
+Specify which DNN backend to use for model loading and execution. This option 
accepts
+the following values:
+
+@table @samp
+@item native
+Native implementation of DNN loading and execution.
+
+@item tensorflow
+TensorFlow backend. To enable this backend you
+need to install the TensorFlow for C library (see
+@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
+@code{--enable-libtensorflow}
+@end table
+
+Default value is @samp{native}.
+
+@item model
+Set path to model file specifying network architecture and its parameters.
+Note that different backends use different file formats. TensorFlow and native
+backend can load files for only its format.
+
+Native model file (.model) can be generated from TensorFlow model file (.pb) 
by using tools/python/convert.py
+
+@item input
+Set the input name of the dnn network.
+
+@item output
+Set the output name of the dnn network.
+
+@item fmt
+Set the pixel format for the Frame. Allowed values are 
@code{AV_PIX_FMT_RGB24}, and @code{AV_PIX_FMT_BGR24}.
+Default value is @code{AV_PIX_FMT_RGB24}.
+
+@end table
+
 @section drawbox
 
 Draw a colored box on the input image.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 2080eed..3eff398 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -223,6 +223,7 @@ OBJS-$(CONFIG_DILATION_FILTER)   += 
vf_neighbor.o
 OBJS-$(CONFIG_DILATION_OPENCL_FILTER)+= vf_neighbor_opencl.o opencl.o \
 opencl/neighbor.o
 OBJS-$(CONFIG_DISPLACE_FILTER)   += vf_displace.o framesync.o
+OBJS-$(CONFIG_DNN_PROCESSING_FILTER) += vf_dnn_processing.o
 OBJS-$(CONFIG_DOUBLEWEAVE_FILTER)+= vf_weave.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
 OBJS-$(CONFIG_DRAWGRAPH_FILTER)  += f_drawgraph.o
diff --git 

Re: [FFmpeg-devel] [PATCH] lavf/mov: initial support for reading HEIF images

2019-10-31 Thread Swaraj Hota
On Thu, Oct 31, 2019, 4:39 AM Dale Curtis  wrote:

> On Wed, Oct 30, 2019 at 1:17 PM Carl Eugen Hoyos 
> wrote:
>
> > https://github.com/Swaraj1998/FFmpeg
> >
> > (Roger's patch sadly did not work with real-world files)
>
>
> Thanks Carl! That patch looks good. I'll test it out. Is Swaraj still
> planning to send that for review later?
>

Yes I will send the patch soon for review. Still a few things left to do.

Swaraj

>
___
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 05/11] avformat/nutenc: Don't pass NULL to memcmp

2019-10-31 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Carl Eugen Hoyos:
>> Am Fr., 20. Sept. 2019 um 00:30 Uhr schrieb Andreas Rheinhardt
>> :
>>>
>>> Fixes lots of FATE tests, e.g. lavf-nut, as well as the nut part of
>>> ticket #7980.
>>>
>>> Signed-off-by: Andreas Rheinhardt 
>>> ---
>>> This patch is made to match the previous behaviour; whether the previous
>>> behaviour is correct at all if the header length is zero is unknown to
>>> me.
>>>
>>>  libavformat/nutenc.c | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
>>> index e9a3bb49db..dc714eb809 100644
>>> --- a/libavformat/nutenc.c
>>> +++ b/libavformat/nutenc.c
>>> @@ -791,8 +791,9 @@ static int get_needed_flags(NUTContext *nut, 
>>> StreamContext *nus, FrameCode *fc,
>>>  flags |= FLAG_CHECKSUM;
>>>  if (pkt->size < nut->header_len[fc->header_idx] ||
>>>  (pkt->size > 4096 && fc->header_idx)||
>>> -memcmp(pkt->data, nut->header[fc->header_idx],
>>> -   nut->header_len[fc->header_idx]))
>>> +(nut->header_len[fc->header_idx] > 0 &&
>>> + memcmp(pkt->data, nut->header[fc->header_idx],
>>> +nut->header_len[fc->header_idx])))
>>>  flags |= FLAG_HEADER_IDX;
>>
>> Is this different from the patch I sent?
>> (Why does it look different)
>> https://patchwork.ffmpeg.org/patch/13782/
>>
>> Carl Eugen
> 
> Yes.
> a) Your patch checks whether nut->header[fc->header_idx] is NULL.
> b) Michael's proposal is to check for fc->header_idx instead. This
> would work, because it is the index of the only used pointer in
> nut->header that is NULL, and this proposal has the advantage of one
> dereferencing less than a).
> c) My* patch checks whether nut->header_len[fc->header_idx] is zero.
> Given that nut->header_len[fc->header_idx] is already used in the very
> first check, my solution should not entail a dereference at all.
> 
> Furthermore, b) is very specific to the nutenc situation here and a)
> might hide a situation where nut->header_len[fc->header_idx] is > 0,
> but nut->header[fc->header_idx] == NULL, which should of course not
> happen. And it singles out one of the two pointer arguments.
> 
> - Andreas
> 
> *: It is also what Reimar proposed (I was completely unaware of the
> earlier patch when I submitted mine).
> 
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 v3 1/3] avformat/hlsenc: fix the av_dirname path isn't include separator in the end of string

2019-10-31 Thread Steven Liu


> 在 2019年10月31日,14:01,Limin Wang  写道:
> 
> 
> 
> ping, please help to push the patch, it'll fix ticket #8348 although I have 
> sumit the fix long
> time ago after Miachel report it.
Waiting that reporter test it, i will push it if test passed.
> 
> 
> On Wed, Oct 23, 2019 at 11:55:15PM +0800, lance.lmw...@gmail.com wrote:
>> From: Limin Wang 
>> 
>> Reviewed-by: Liu Steven 
>> Signed-off-by: Limin Wang 
>> ---
>> libavformat/hlsenc.c | 16 ++--
>> 1 file changed, 10 insertions(+), 6 deletions(-)
>> 
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index 7b1d54e..af4b532 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -478,6 +478,12 @@ static void reflush_dynbuf(VariantStream *vs, int 
>> *range_length)
>> avio_write(vs->out, vs->temp_buffer, *range_length);;
>> }
>> 
>> +#if HAVE_DOS_PATHS
>> +#define SEPARATOR '\\'
>> +#else
>> +#define SEPARATOR '/'
>> +#endif
>> +
>> static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
>>VariantStream *vs)
>> {
>> @@ -544,7 +550,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
>> HLSContext *hls,
>> while (segment) {
>> av_log(hls, AV_LOG_DEBUG, "deleting old segment %s\n",
>>segment->filename);
>> -path_size =  (hls->use_localtime_mkdir ? 0 : strlen(dirname)) + 
>> strlen(segment->filename) + 1;
>> +path_size =  (hls->use_localtime_mkdir ? 0 : strlen(dirname)+1) + 
>> strlen(segment->filename) + 1;
>> path = av_malloc(path_size);
>> if (!path) {
>> ret = AVERROR(ENOMEM);
>> @@ -554,8 +560,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
>> HLSContext *hls,
>> if (hls->use_localtime_mkdir)
>> av_strlcpy(path, segment->filename, path_size);
>> else { // segment->filename contains basename only
>> -av_strlcpy(path, dirname, path_size);
>> -av_strlcat(path, segment->filename, path_size);
>> +snprintf(path, path_size, "%s%c%s", dirname, SEPARATOR, 
>> segment->filename);
>> }
>> 
>> proto = avio_find_protocol_name(s->url);
>> @@ -575,15 +580,14 @@ static int hls_delete_old_segments(AVFormatContext *s, 
>> HLSContext *hls,
>> if ((segment->sub_filename[0] != '\0')) {
>> char *vtt_dirname_r = av_strdup(vs->vtt_avf->url);
>> vtt_dirname = (char*)av_dirname(vtt_dirname_r);
>> -sub_path_size = strlen(segment->sub_filename) + 1 + 
>> strlen(vtt_dirname);
>> +sub_path_size = strlen(segment->sub_filename) + 1 + 
>> strlen(vtt_dirname) + 1;
>> sub_path = av_malloc(sub_path_size);
>> if (!sub_path) {
>> ret = AVERROR(ENOMEM);
>> goto fail;
>> }
>> 
>> -av_strlcpy(sub_path, vtt_dirname, sub_path_size);
>> -av_strlcat(sub_path, segment->sub_filename, sub_path_size);
>> +snprintf(sub_path, sub_path_size, "%s%c%s", vtt_dirname, 
>> SEPARATOR, segment->sub_filename);
>> 
>> av_freep(_dirname);
>> 
>> -- 
>> 2.6.4
>> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Thanks
Steven





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

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

Re: [FFmpeg-devel] [PATCH v3 1/3] avformat/hlsenc: fix the av_dirname path isn't include separator in the end of string

2019-10-31 Thread Limin Wang


ping, please help to push the patch, it'll fix ticket #8348 although I have 
sumit the fix long
time ago after Miachel report it.


On Wed, Oct 23, 2019 at 11:55:15PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Reviewed-by: Liu Steven 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/hlsenc.c | 16 ++--
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 7b1d54e..af4b532 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -478,6 +478,12 @@ static void reflush_dynbuf(VariantStream *vs, int 
> *range_length)
>  avio_write(vs->out, vs->temp_buffer, *range_length);;
>  }
>  
> +#if HAVE_DOS_PATHS
> +#define SEPARATOR '\\'
> +#else
> +#define SEPARATOR '/'
> +#endif
> +
>  static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
> VariantStream *vs)
>  {
> @@ -544,7 +550,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
> HLSContext *hls,
>  while (segment) {
>  av_log(hls, AV_LOG_DEBUG, "deleting old segment %s\n",
> segment->filename);
> -path_size =  (hls->use_localtime_mkdir ? 0 : strlen(dirname)) + 
> strlen(segment->filename) + 1;
> +path_size =  (hls->use_localtime_mkdir ? 0 : strlen(dirname)+1) + 
> strlen(segment->filename) + 1;
>  path = av_malloc(path_size);
>  if (!path) {
>  ret = AVERROR(ENOMEM);
> @@ -554,8 +560,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
> HLSContext *hls,
>  if (hls->use_localtime_mkdir)
>  av_strlcpy(path, segment->filename, path_size);
>  else { // segment->filename contains basename only
> -av_strlcpy(path, dirname, path_size);
> -av_strlcat(path, segment->filename, path_size);
> +snprintf(path, path_size, "%s%c%s", dirname, SEPARATOR, 
> segment->filename);
>  }
>  
>  proto = avio_find_protocol_name(s->url);
> @@ -575,15 +580,14 @@ static int hls_delete_old_segments(AVFormatContext *s, 
> HLSContext *hls,
>  if ((segment->sub_filename[0] != '\0')) {
>  char *vtt_dirname_r = av_strdup(vs->vtt_avf->url);
>  vtt_dirname = (char*)av_dirname(vtt_dirname_r);
> -sub_path_size = strlen(segment->sub_filename) + 1 + 
> strlen(vtt_dirname);
> +sub_path_size = strlen(segment->sub_filename) + 1 + 
> strlen(vtt_dirname) + 1;
>  sub_path = av_malloc(sub_path_size);
>  if (!sub_path) {
>  ret = AVERROR(ENOMEM);
>  goto fail;
>  }
>  
> -av_strlcpy(sub_path, vtt_dirname, sub_path_size);
> -av_strlcat(sub_path, segment->sub_filename, sub_path_size);
> +snprintf(sub_path, sub_path_size, "%s%c%s", vtt_dirname, 
> SEPARATOR, segment->sub_filename);
>  
>  av_freep(_dirname);
>  
> -- 
> 2.6.4
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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