[FFmpeg-cvslog] avfilter/vf_nnedi: fix possible double free

2019-10-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Oct  7 11:10:45 
2019 +0200| [5b4010e88686ea40a56f016f3c27753af6b3c766] | committer: Paul B Mahol

avfilter/vf_nnedi: fix possible double free

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b4010e88686ea40a56f016f3c27753af6b3c766
---

 libavfilter/vf_nnedi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c
index b14aa64c04..9bad99e98a 100644
--- a/libavfilter/vf_nnedi.c
+++ b/libavfilter/vf_nnedi.c
@@ -809,8 +809,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *src)
 ret = get_frame(ctx, 1);
 if (ret < 0) {
 av_frame_free(&s->dst);
-av_frame_free(&s->src);
 av_frame_free(&s->second);
+s->src = NULL;
 return ret;
 }
 dst = s->dst;

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

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

[FFmpeg-cvslog] avfilter/af_afftfilt: fix possible invalid memory access

2019-10-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Oct  7 11:37:05 
2019 +0200| [0c4137bcb742bccc29f87145615a120bc5988c24] | committer: Paul B Mahol

avfilter/af_afftfilt: fix possible invalid memory access

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c4137bcb742bccc29f87145615a120bc5988c24
---

 libavfilter/af_afftfilt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c
index 86278ef35b..28b4bda8da 100644
--- a/libavfilter/af_afftfilt.c
+++ b/libavfilter/af_afftfilt.c
@@ -188,6 +188,8 @@ static int config_input(AVFilterLink *inlink)
 if (!args)
 return AVERROR(ENOMEM);
 
+saveptr = NULL;
+last_expr = "1";
 for (ch = 0; ch < inlink->channels; ch++) {
 char *arg = av_strtok(ch == 0 ? args : NULL, "|", &saveptr);
 

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

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

[FFmpeg-cvslog] avfilter/vf_showpalette: remove timeline flag

2019-10-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Oct  7 12:07:00 
2019 +0200| [651a0f63080f4073c324594188841a15da13e9ce] | committer: Paul B Mahol

avfilter/vf_showpalette: remove timeline flag

This filter changes output size and thus can not have support
for timeline.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=651a0f63080f4073c324594188841a15da13e9ce
---

 libavfilter/vf_showpalette.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/vf_showpalette.c b/libavfilter/vf_showpalette.c
index 25904a88f4..5b0772bc0b 100644
--- a/libavfilter/vf_showpalette.c
+++ b/libavfilter/vf_showpalette.c
@@ -136,5 +136,4 @@ AVFilter ff_vf_showpalette = {
 .inputs= showpalette_inputs,
 .outputs   = showpalette_outputs,
 .priv_class= &showpalette_class,
-.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };

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

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

[FFmpeg-cvslog] avfilter/vf_normalize: typedef all structs

2019-10-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Oct  7 12:17:14 
2019 +0200| [c303d0979fb050008974182784b633e8184f0be7] | committer: Paul B Mahol

avfilter/vf_normalize: typedef all structs

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c303d0979fb050008974182784b633e8184f0be7
---

 libavfilter/vf_normalize.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_normalize.c b/libavfilter/vf_normalize.c
index 48eea59e64..c955aeb7d2 100644
--- a/libavfilter/vf_normalize.c
+++ b/libavfilter/vf_normalize.c
@@ -81,6 +81,17 @@
 #include "internal.h"
 #include "video.h"
 
+typedef struct NormalizeHistory {
+uint8_t *history;   // History entries.
+uint32_t history_sum;   // Sum of history entries.
+} NormalizeHistory;
+
+typedef struct NormalizeLocal {
+uint8_t in; // Original input byte value for this frame.
+float smoothed; // Smoothed input value [0,255].
+float out;  // Output value [0,255]
+} NormalizeLocal;
+
 typedef struct NormalizeContext {
 const AVClass *class;
 
@@ -98,10 +109,7 @@ typedef struct NormalizeContext {
 int frame_num;  // Increments on each frame, starting from 0.
 
 // Per-extremum, per-channel history, for temporal smoothing.
-struct {
-uint8_t *history;   // History entries.
-uint32_t history_sum;   // Sum of history entries.
-} min[3], max[3];   // Min and max for each channel in {R,G,B}.
+NormalizeHistory min[3], max[3];   // Min and max for each channel 
in {R,G,B}.
 uint8_t *history_mem;   // Single allocation for above history entries
 
 } NormalizeContext;
@@ -126,11 +134,7 @@ AVFILTER_DEFINE_CLASS(normalize);
 static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
 {
 // Per-extremum, per-channel local variables.
-struct {
-uint8_t in; // Original input byte value for this frame.
-float smoothed; // Smoothed input value [0,255].
-float out;  // Output value [0,255].
-} min[3], max[3];   // Min and max for each channel in {R,G,B}.
+NormalizeLocal min[3], max[3];   // Min and max for each channel in 
{R,G,B}.
 
 float rgb_min_smoothed; // Min input range for linked normalization
 float rgb_max_smoothed; // Max input range for linked normalization

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

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

[FFmpeg-cvslog] avfilter/formats: guard against double free

2019-10-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Oct  7 17:26:59 
2019 +0200| [9a53e0125290238db66034f67a9c41c420264c09] | committer: Paul B Mahol

avfilter/formats: guard against double free

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a53e0125290238db66034f67a9c41c420264c09
---

 libavfilter/formats.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 31ee445c49..e6d27f45f3 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -456,7 +456,7 @@ do {\
 do {   \
 int idx = -1;  \
\
-if (!*ref || !(*ref)->refs)\
+if (!ref || !*ref || !(*ref)->refs)\
 return;\
\
 FIND_REF_INDEX(ref, idx);  \
@@ -518,7 +518,8 @@ void ff_formats_changeref(AVFilterFormats **oldref, 
AVFilterFormats **newref)
 int ret = ref_fn(fmts, &ctx->inputs[i]->out_fmts);  \
 if (ret < 0) {  \
 unref_fn(&fmts);\
-av_freep(&fmts->list);  \
+if (fmts)   \
+av_freep(&fmts->list);  \
 av_freep(&fmts);\
 return ret; \
 }   \
@@ -530,7 +531,8 @@ void ff_formats_changeref(AVFilterFormats **oldref, 
AVFilterFormats **newref)
 int ret = ref_fn(fmts, &ctx->outputs[i]->in_fmts);  \
 if (ret < 0) {  \
 unref_fn(&fmts);\
-av_freep(&fmts->list);  \
+if (fmts)   \
+av_freep(&fmts->list);  \
 av_freep(&fmts);\
 return ret; \
 }   \

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

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

[FFmpeg-cvslog] avfilter/af_adelay: add option which changes how unset channels are delayed

2019-10-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Oct  7 18:02:50 
2019 +0200| [0633d87ae6e6a63669d0877aac5a12c22778b0e8] | committer: Paul B Mahol

avfilter/af_adelay: add option which changes how unset channels are delayed

Fixes #8032.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0633d87ae6e6a63669d0877aac5a12c22778b0e8
---

 doc/filters.texi| 10 ++
 libavfilter/af_adelay.c |  7 +++
 2 files changed, 17 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index accea99182..0e72cce829 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -688,6 +688,10 @@ Unused delays will be silently ignored. If number of given 
delays is
 smaller than number of channels all remaining channels will not be delayed.
 If you want to delay exact number of samples, append 'S' to number.
 If you want instead to delay in seconds, append 's' to number.
+
+@item all
+Use last set delay for all remaining channels. By default is disabled.
+This option if enabled changes how option @code{delays} is interpreted.
 @end table
 
 @subsection Examples
@@ -706,6 +710,12 @@ the first channel (and any other channels that may be 
present) unchanged.
 @example
 adelay=0|500S|700S
 @end example
+
+@item
+Delay all channels by same number of samples:
+@example
+adelay=delays=64S:all=1
+@end example
 @end itemize
 
 @section aderivative, aintegral
diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
index eb97039566..06e39fa6a4 100644
--- a/libavfilter/af_adelay.c
+++ b/libavfilter/af_adelay.c
@@ -36,6 +36,7 @@ typedef struct ChanDelay {
 
 typedef struct AudioDelayContext {
 const AVClass *class;
+int all;
 char *delays;
 ChanDelay *chandelay;
 int nb_delays;
@@ -54,6 +55,7 @@ typedef struct AudioDelayContext {
 
 static const AVOption adelay_options[] = {
 { "delays", "set list of delays for each channel", OFFSET(delays), 
AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, A },
+{ "all","use last available delay for remained channels", OFFSET(all), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
 { NULL }
 };
 
@@ -163,6 +165,11 @@ static int config_input(AVFilterLink *inlink)
 }
 }
 
+if (s->all) {
+for (int j = i + 1; j < s->nb_delays; j++)
+s->chandelay[j].delay = s->chandelay[i].delay;
+}
+
 s->padding = s->chandelay[0].delay;
 for (i = 1; i < s->nb_delays; i++) {
 ChanDelay *d = &s->chandelay[i];

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

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

[FFmpeg-cvslog] avcodec/filter: Remove extra '; ' outside of functions

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Oct  7 02:10:30 2019 +0200| [361fb42e1e53a78a96a8b30ed7c4baff18fa206e] | 
committer: Paul B Mahol

avcodec/filter: Remove extra '; ' outside of functions

They are not allowed outside of functions. Fixes the warning
"ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]"
when compiling with GCC and -pedantic.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=361fb42e1e53a78a96a8b30ed7c4baff18fa206e
---

 libavcodec/v4l2_m2m_dec.c|  2 +-
 libavfilter/vf_blend.c   | 10 +-
 libavfilter/vf_vmafmotion.c  |  4 ++--
 libavfilter/x86/scene_sad_init.c |  4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 0c3fa3a7be..4712aca34c 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -256,7 +256,7 @@ static const AVOption options[] = {
 .capabilities   = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | 
AV_CODEC_CAP_AVOID_PROBING, \
 .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS, \
 .wrapper_name   = "v4l2m2m", \
-};
+}
 
 M2MDEC(h264,  "H.264", AV_CODEC_ID_H264,   "h264_mp4toannexb");
 M2MDEC(hevc,  "HEVC",  AV_CODEC_ID_HEVC,   "hevc_mp4toannexb");
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index d6036c10e2..67163be3e7 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -639,11 +639,11 @@ static av_cold void 
init_blend_func_##depth##_##nbits##bit(FilterParams *param)
 case BLEND_XOR:param->blend = blend_xor_##depth##bit;
break;   \
 }  
   \
 }
-DEFINE_INIT_BLEND_FUNC(8, 8);
-DEFINE_INIT_BLEND_FUNC(9, 16);
-DEFINE_INIT_BLEND_FUNC(10, 16);
-DEFINE_INIT_BLEND_FUNC(12, 16);
-DEFINE_INIT_BLEND_FUNC(16, 16);
+DEFINE_INIT_BLEND_FUNC(8, 8)
+DEFINE_INIT_BLEND_FUNC(9, 16)
+DEFINE_INIT_BLEND_FUNC(10, 16)
+DEFINE_INIT_BLEND_FUNC(12, 16)
+DEFINE_INIT_BLEND_FUNC(16, 16)
 
 void ff_blend_init(FilterParams *param, int depth)
 {
diff --git a/libavfilter/vf_vmafmotion.c b/libavfilter/vf_vmafmotion.c
index 5c2a974538..88d0b35095 100644
--- a/libavfilter/vf_vmafmotion.c
+++ b/libavfilter/vf_vmafmotion.c
@@ -176,8 +176,8 @@ static void convolution_y_##bits##bit(const uint16_t 
*filter, int filt_w, \
 } \
 }
 
-conv_y_fn(uint8_t, 8);
-conv_y_fn(uint16_t, 10);
+conv_y_fn(uint8_t, 8)
+conv_y_fn(uint16_t, 10)
 
 static void vmafmotiondsp_init(VMAFMotionDSPContext *dsp, int bpp) {
 dsp->convolution_x = convolution_x;
diff --git a/libavfilter/x86/scene_sad_init.c b/libavfilter/x86/scene_sad_init.c
index f8104dcb4f..2c3729ceee 100644
--- a/libavfilter/x86/scene_sad_init.c
+++ b/libavfilter/x86/scene_sad_init.c
@@ -37,9 +37,9 @@ static void FUNC_NAME(SCENE_SAD_PARAMS) { 
\
 }
 
 #if HAVE_X86ASM
-SCENE_SAD_FUNC(scene_sad_sse2, ff_scene_sad_sse2, 16);
+SCENE_SAD_FUNC(scene_sad_sse2, ff_scene_sad_sse2, 16)
 #if HAVE_AVX2_EXTERNAL
-SCENE_SAD_FUNC(scene_sad_avx2, ff_scene_sad_avx2, 32);
+SCENE_SAD_FUNC(scene_sad_avx2, ff_scene_sad_avx2, 32)
 #endif
 #endif
 

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

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

[FFmpeg-cvslog] doc/formats: Update documentation for chromaprint

2019-10-07 Thread Andriy Gelman
ffmpeg | branch: master | Andriy Gelman  | Sun Oct  6 
01:49:47 2019 -0400| [4cb124a800d0150f7a632b4a61bc7449f8562e2d] | committer: 
Gyan Doshi

doc/formats: Update documentation for chromaprint

Silence detection can only be set with algorithm version 3.

Reviewed-by: Gyan Doshi 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cb124a800d0150f7a632b4a61bc7449f8562e2d
---

 doc/muxers.texi | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index b3da8bf12e..4c88b5daec 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -105,12 +105,14 @@ It takes a single signed native-endian 16-bit raw audio 
stream of at most 2 chan
 
 @table @option
 @item silence_threshold
-Threshold for detecting silence, ranges from -1 to 32767. -1 disables silence 
detection and
-is required for use with the AcoustID service. Default is -1.
+Threshold for detecting silence. Range is from -1 to 32767, where -1 disables
+silence detection. Silence detection can only be used with version 3 of the
+algorithm.
+Silence detection must be disabled for use with the AcoustID service. Default 
is -1.
 
 @item algorithm
-Version of algorithm to fingerprint with. Range is 0 to 4. Version 2 requires 
that silence
-detection be enabled. Default is 1.
+Version of algorithm to fingerprint with. Range is 0 to 4.
+Version 3 enables silence detection. Default is 1.
 
 @item fp_format
 Format to output the fingerprint as. Accepts the following options:

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

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

[FFmpeg-cvslog] avcodec/flac_parser: Fix off-by-one error

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:15 2019 +0200| [e5e5be4c7f607d3c04396d71f511c6b81a1cd997] | 
committer: Paul B Mahol

avcodec/flac_parser: Fix off-by-one error

The flac parser uses a fifo to buffer its data. Consequently, when
searching for sync codes of flac packets, one needs to take care of
the possibility of wraparound. This is done by using an optimized start
code search that works on each of the continuous buffers separately and
by explicitly checking whether the last pre-wrap byte and the first
post-wrap byte constitute a valid sync code.

Moreover, the last MAX_FRAME_HEADER_SIZE - 1 bytes ought not to be searched
for (the start of) a sync code because a header that might be found in this
region might not be completely available. These bytes ought to be searched
lateron when more data is available or when flushing.

Unfortunately there was an off-by-one error in the calculation of the
length to search of the post-wrap buffer: It was too large, because the
calculation was based on the amount of bytes available in the fifo from
the last pre-wrap byte onwards. This meant that a header might be
parsed twice (once prematurely and once regularly when more data is
available); it could also mean that an invalid header will be treated as
valid (namely if the length of said invalid header is
MAX_FRAME_HEADER_SIZE and the invalid byte that will be treated as the
last byte of this potential header happens to be the right CRC-8).

Should a header be parsed twice, the second instance will be the best child
of the first instance; the first instance's score will be
FLAC_HEADER_BASE_SCORE - FLAC_HEADER_CHANGED_PENALTY ( = 3) higher than
the second instance's score. So the frame belonging to the first
instance will be output and it will be done as a zero length frame (the
difference of the header's offset and the child's offset). This has
serious consequences when flushing, as returning a zero length buffer
signals to the caller that no more data will be output; consequently the
last frames not yet output will be dropped.

Furthermore, a "sample/frame number mismatch in adjacent frames" warning
got output when returning the zero-length frame belonging to the first
header, because the child's sample/frame number of course didn't match
the expected sample frame/number given its parent.

filter/hdcd-mix.flac from the FATE-suite was affected by this (the last
frame was omitted) which is the reason why several FATE-tests needed to
be updated.

Fixes ticket #5937.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5e5be4c7f607d3c04396d71f511c6b81a1cd997
---

 libavcodec/flac_parser.c|  4 ++--
 tests/fate/filter-audio.mak | 16 
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 2658d3c4dc..197f234e61 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -244,9 +244,9 @@ static int find_new_headers(FLACParseContext *fpc, int 
search_start)
 uint8_t wrap[2];
 
 wrap[0]  = buf[read_len - 1];
-read_len = search_end - search_start + 1;
-
 /* search_start + 1 is the post-wrap offset in the fifo. */
+read_len = search_end - (search_start + 1) + 1;
+
 buf  = flac_fifo_read(fpc, search_start + 1, &read_len);
 wrap[1]  = buf[0];
 
diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index f1db7b9f02..fed2644ccf 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -312,47 +312,47 @@ FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, HDCD, 
FLAC, FLAC, PCM_S24LE, PCM
 fate-filter-hdcd-mix: SRC = $(TARGET_SAMPLES)/filter/hdcd-mix.flac
 fate-filter-hdcd-mix: CMD = md5 -i $(SRC) -af hdcd -f s24le
 fate-filter-hdcd-mix: CMP = oneline
-fate-filter-hdcd-mix: REF = e7079913e90c124460cdbc712df5b84c
+fate-filter-hdcd-mix: REF = 77443573e0bd3532de52a8bc0e825da7
 
 # output will be different because of the gain mismatch in the second and 
third parts
 FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, HDCD, FLAC, FLAC, PCM_S24LE, 
PCM_S24LE) += fate-filter-hdcd-mix-psoff
 fate-filter-hdcd-mix-psoff: SRC = $(TARGET_SAMPLES)/filter/hdcd-mix.flac
 fate-filter-hdcd-mix-psoff: CMD = md5 -i $(SRC) -af hdcd=process_stereo=false 
-f s24le
 fate-filter-hdcd-mix-psoff: CMP = oneline
-fate-filter-hdcd-mix-psoff: REF = bd0e81fe17696b825ee3515ab928e6bb
+fate-filter-hdcd-mix-psoff: REF = 89e57885917a436b30855db4d478cefb
 
 # test the different analyze modes
 FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, HDCD, FLAC, FLAC, PCM_S24LE, 
PCM_S24LE) += fate-filter-hdcd-analyze-pe
 fate-filter-hdcd-analyze-pe: SRC = $(TARGET_SAMPLES)/filter/hdcd-mix.flac
 fate-filter-hdcd-analyze-pe: CMD = md5 -i $(SRC) -af hdcd=analyze_mode=pe -f 
s24le
 fate-filter-hdcd-analyze-pe: CMP = oneline
-fate-filter-hdcd-analyze-pe: REF = bb83e97bbd0064b9b1c0ef2f2c8f0c77
+fate-filter-hdcd-analyze-pe: RE

[FFmpeg-cvslog] avformat/flac_picture: Avoid allocation of AVIOContext

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:12 2019 +0200| [69dd8d3a2a3d82ada344c889cbf8a8837a9157a0] | 
committer: Paul B Mahol

avformat/flac_picture: Avoid allocation of AVIOContext

Put an AVIOContext whose lifetime doesn't extend beyond the function
where it is allocated on the stack instead of allocating and freeing it.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69dd8d3a2a3d82ada344c889cbf8a8837a9157a0
---

 libavformat/flac_picture.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index 8317ab2fa6..f0871d9c79 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -26,6 +26,7 @@
 #include "flac_picture.h"
 #include "id3v2.h"
 #include "internal.h"
+#include "avio_internal.h"
 
 int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
 {
@@ -33,15 +34,13 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, 
int buf_size)
 enum AVCodecID id = AV_CODEC_ID_NONE;
 AVBufferRef *data = NULL;
 uint8_t mimetype[64], *desc = NULL;
-AVIOContext *pb = NULL;
+AVIOContext pb0, *pb = &pb0;
 AVStream *st;
 int width, height, ret = 0;
 int len;
 unsigned int type;
 
-pb = avio_alloc_context(buf, buf_size, 0, NULL, NULL, NULL, NULL);
-if (!pb)
-return AVERROR(ENOMEM);
+ffio_init_context(pb, buf, buf_size, 0, NULL, NULL, NULL, NULL);
 
 /* read the picture type */
 type = avio_rb32(pb);
@@ -145,14 +144,11 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t 
*buf, int buf_size)
 if (desc)
 av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL);
 
-avio_context_free(&pb);
-
 return 0;
 
 fail:
 av_buffer_unref(&data);
 av_freep(&desc);
-avio_context_free(&pb);
 
 return ret;
 }

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

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

[FFmpeg-cvslog] avcodec/flac_parser: Don't allocate array separately

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:14 2019 +0200| [d03c3e85176436d06b0367b6dd926645d46a2083] | 
committer: Paul B Mahol

avcodec/flac_parser: Don't allocate array separately

The FLACHeaderMarker structure contained a pointer to an array of int;
said array was always allocated and freed at the same time as its
referencing FLACHeaderMarker; the pointer was never modified to point to
a different array and each FLACHeaderMarker had its own unique array.
Furthermore, all these arrays had a constant size. Therefore include
this array in the FLACHeaderMarker struct.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d03c3e85176436d06b0367b6dd926645d46a2083
---

 libavcodec/flac_parser.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 5d0705ce63..2658d3c4dc 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -58,8 +58,9 @@
 
 typedef struct FLACHeaderMarker {
 int offset;   /**< byte offset from start of FLACParseContext->buffer 
*/
-int *link_penalty;  /**< pointer to array of local scores between this 
header
-   and the one at a distance equal array position 
*/
+int link_penalty[FLAC_MAX_SEQUENTIAL_HEADERS]; /**< array of local scores
+   between this header and the one at a distance equal
+   array position 
*/
 int max_score;/**< maximum score found after checking each child that
has a valid CRC
*/
 FLACFrameInfo fi; /**< decoded frame header info  
*/
@@ -190,14 +191,6 @@ static int find_headers_search_validate(FLACParseContext 
*fpc, int offset)
 }
 (*end_handle)->fi   = fi;
 (*end_handle)->offset   = offset;
-(*end_handle)->link_penalty = av_malloc(sizeof(int) *
-FLAC_MAX_SEQUENTIAL_HEADERS);
-if (!(*end_handle)->link_penalty) {
-av_freep(end_handle);
-av_log(fpc->avctx, AV_LOG_ERROR,
-   "couldn't allocate link_penalty\n");
-return AVERROR(ENOMEM);
-}
 
 for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
 (*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;
@@ -559,7 +552,6 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
curr->max_score, curr->offset, curr->next->offset);
 }
 temp = curr->next;
-av_freep(&curr->link_penalty);
 av_free(curr);
 fpc->nb_headers_buffered--;
 }
@@ -584,12 +576,10 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 
 for (curr = fpc->headers; curr != fpc->best_header; curr = temp) {
 temp = curr->next;
-av_freep(&curr->link_penalty);
 av_free(curr);
 fpc->nb_headers_buffered--;
 }
 fpc->headers = fpc->best_header->next;
-av_freep(&fpc->best_header->link_penalty);
 av_freep(&fpc->best_header);
 fpc->nb_headers_buffered--;
 }
@@ -745,7 +735,6 @@ static void flac_parse_close(AVCodecParserContext *c)
 
 while (curr) {
 temp = curr->next;
-av_freep(&curr->link_penalty);
 av_free(curr);
 curr = temp;
 }

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

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

[FFmpeg-cvslog] avcodec/flac_parser: Use native endianness when possible

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:13 2019 +0200| [5e546864b09379910721b35a14713982d933d9dd] | 
committer: Paul B Mahol

avcodec/flac_parser: Use native endianness when possible

FLAC sync codes contain a byte equal to 0xFF and so the function that
searches for sync codes first searched for this byte. It did this by
checking four bytes at once; these bytes have been read via AV_RB32, but
the test works just as well with native endianness.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e546864b09379910721b35a14713982d933d9dd
---

 libavcodec/flac_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 2721286464..5d0705ce63 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -221,7 +221,7 @@ static int find_headers_search(FLACParseContext *fpc, 
uint8_t *buf, int buf_size
 }
 
 for (; i < buf_size - 1; i += 4) {
-x = AV_RB32(buf + i);
+x = AV_RN32(buf + i);
 if (((x & ~(x + 0x01010101)) & 0x80808080)) {
 for (j = 0; j < 4; j++) {
 if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8)

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

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

[FFmpeg-cvslog] avcodec/flac_parser: Fix number of buffered headers

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:16 2019 +0200| [047a6d396f6919c469e35d6ef75bd9cae5a87523] | 
committer: Paul B Mahol

avcodec/flac_parser: Fix number of buffered headers

Only decrement the number of buffered headers if a header has actually
been freed.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=047a6d396f6919c469e35d6ef75bd9cae5a87523
---

 libavcodec/flac_parser.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 197f234e61..8c61f3a88c 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -562,7 +562,6 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 for (curr = best_child->next; curr; curr = curr->next)
 curr->offset -= best_child->offset;
 
-fpc->nb_headers_buffered--;
 best_child->offset = 0;
 fpc->headers   = best_child;
 if (fpc->nb_headers_buffered >= FLAC_MIN_HEADERS) {

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

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

[FFmpeg-cvslog] avcodec/flac_parser: Don't modify size of the input buffer

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:18 2019 +0200| [87b30f8af8c6d2da7364bf595d98c3c5d3485853] | 
committer: Paul B Mahol

avcodec/flac_parser: Don't modify size of the input buffer

When flushing, MAX_FRAME_HEADER_SIZE bytes (always zero) are supposed to
be written to the fifo buffer in order to be able to check the rest of
the buffer for frame headers. It was intended to write these by writing
a small buffer of size MAX_FRAME_HEADER_SIZE to the buffer. But the way
it was actually done ensured that this did not happen:

First, it would be checked whether the size of the input buffer was zero,
in which case it buf_size would be set to MAX_FRAME_HEADER_SIZE and
read_end would be set to indicate that MAX_FRAME_HEADER_SIZE bytes need
to be written. Then it would be made sure that there is enough space in
the fifo for the data to be written. Afterwards the data is written. The
check used here is for whether buf_size is zero or not. But if it was
zero initially, it is MAX_FRAME_HEADER_SIZE now, so that not the
designated buffer for writing MAX_FRAME_HEADER_SIZE is written; instead
the padded buffer (from the stack of av_parser_parse2()) is used. This
works because AV_INPUT_BUFFER_PADDING_SIZE >= MAX_FRAME_HEADER_SIZE.
Lateron, buf_size is set to zero again.

Given that since 7edbd536, the actual amount of data read is no longer
automatically equal to buf_size, it is completely unnecessary to modify
buf_size at all. Moreover, modifying it is dangerous: Some allocations
can fail and because buf_size is never reset to zero in this codepath,
the parser might return a value > 0 on flushing.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87b30f8af8c6d2da7364bf595d98c3c5d3485853
---

 libavcodec/flac_parser.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 1dcb3ef2db..376ba2bcfc 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -595,7 +595,6 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 /* Pad the end once if EOF, to check the final region for headers. */
 if (!buf_size) {
 fpc->end_padded  = 1;
-buf_size = MAX_FRAME_HEADER_SIZE;
 read_end = read_start + MAX_FRAME_HEADER_SIZE;
 } else {
 /* The maximum read size is the upper-bound of what the parser
@@ -668,7 +667,6 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 fpc->fifo_buf->wptr += fpc->fifo_buf->end -
 fpc->fifo_buf->buffer;
 }
-buf_size = 0;
 read_start = read_end = NULL;
 }
 }

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

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

[FFmpeg-cvslog] avcodec/flac_parser: Cosmetics

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:20 2019 +0200| [1d54309c8ac17254e95ad9f3cab0110a33b1dd2b] | 
committer: Paul B Mahol

avcodec/flac_parser: Cosmetics

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d54309c8ac17254e95ad9f3cab0110a33b1dd2b
---

 libavcodec/flac_parser.c | 35 +--
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 7ff7683c2e..9280246af2 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -113,8 +113,8 @@ static int frame_header_is_valid(AVCodecContext *avctx, 
const uint8_t *buf,
  * This function is based on av_fifo_generic_read, which is why there is a 
comment
  * about a memory barrier for SMP.
  */
-static uint8_t* flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len,
-   uint8_t** wrap_buf, int* allocated_size)
+static uint8_t *flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len,
+uint8_t **wrap_buf, int *allocated_size)
 {
 AVFifoBuffer *f   = fpc->fifo_buf;
 uint8_t *start= f->rptr + offset;
@@ -153,7 +153,7 @@ static uint8_t* flac_fifo_read_wrap(FLACParseContext *fpc, 
int offset, int len,
  * A second call to flac_fifo_read (with new offset and len) should be called
  * to get the post-wrap buf if the returned len is less than the requested.
  **/
-static uint8_t* flac_fifo_read(FLACParseContext *fpc, int offset, int *len)
+static uint8_t *flac_fifo_read(FLACParseContext *fpc, int offset, int *len)
 {
 AVFifoBuffer *f   = fpc->fifo_buf;
 uint8_t *start= f->rptr + offset;
@@ -189,8 +189,8 @@ static int find_headers_search_validate(FLACParseContext 
*fpc, int offset)
"couldn't allocate FLACHeaderMarker\n");
 return AVERROR(ENOMEM);
 }
-(*end_handle)->fi   = fi;
-(*end_handle)->offset   = offset;
+(*end_handle)->fi = fi;
+(*end_handle)->offset = offset;
 
 for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
 (*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;
@@ -201,9 +201,8 @@ static int find_headers_search_validate(FLACParseContext 
*fpc, int offset)
 return size;
 }
 
-static int find_headers_search(FLACParseContext *fpc, uint8_t *buf, int 
buf_size,
-   int search_start)
-
+static int find_headers_search(FLACParseContext *fpc, uint8_t *buf,
+   int buf_size, int search_start)
 {
 int size = 0, mod_offset = (buf_size - 1) % 4, i, j;
 uint32_t x;
@@ -464,7 +463,7 @@ static void score_sequences(FLACParseContext *fpc)
 }
 }
 
-static int get_best_header(FLACParseContext* fpc, const uint8_t **poutbuf,
+static int get_best_header(FLACParseContext *fpc, const uint8_t **poutbuf,
int *poutbuf_size)
 {
 FLACHeaderMarker *header = fpc->best_header;
@@ -490,7 +489,7 @@ static int get_best_header(FLACParseContext* fpc, const 
uint8_t **poutbuf,
 &fpc->wrap_buf_allocated_size);
 
 
-if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){
+if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS) {
 if (header->fi.is_var_size)
   fpc->pc->pts = header->fi.frame_or_sample_num;
 else if (header->best_child)
@@ -524,7 +523,7 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 s->duration = fi.blocksize;
 if (!avctx->sample_rate)
 avctx->sample_rate = fi.samplerate;
-if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){
+if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS) {
 fpc->pc->pts = fi.frame_or_sample_num;
 if (!fi.is_var_size)
   fpc->pc->pts *= fi.blocksize;
@@ -594,7 +593,7 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 
 /* Pad the end once if EOF, to check the final region for headers. */
 if (!buf_size) {
-fpc->end_padded  = 1;
+fpc->end_padded = 1;
 read_end = read_start + MAX_FRAME_HEADER_SIZE;
 } else {
 /* The maximum read size is the upper-bound of what the parser
@@ -691,13 +690,13 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
fpc->best_header->offset);
 
 /* Set duration to 0. It is unknown or invalid in a junk frame. */
-s->duration = 0;
-*poutbuf_size = fpc->best_header->offset;
-*poutbuf  = flac_fifo_read_wrap(fpc, 0, *poutbuf_size,
-&fpc->wrap_buf,
-
&fpc->wrap_buf_allocated_size);
+s->duration   = 0;
+*poutbuf_size = fpc->best_header->offset

[FFmpeg-cvslog] avcodec/flac_parser: Don't leave stale pointer in memory

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:19 2019 +0200| [5873feac54da8b8e1d6e4ccf4821c2ff09864cd9] | 
committer: Paul B Mahol

avcodec/flac_parser: Don't leave stale pointer in memory

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5873feac54da8b8e1d6e4ccf4821c2ff09864cd9
---

 libavcodec/flac_parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 376ba2bcfc..7ff7683c2e 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -734,6 +734,7 @@ static void flac_parse_close(AVCodecParserContext *c)
 av_free(curr);
 curr = temp;
 }
+fpc->headers = NULL;
 av_fifo_freep(&fpc->fifo_buf);
 av_freep(&fpc->wrap_buf);
 }

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

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

[FFmpeg-cvslog] avcodec/flac_parser: Remove superfluous checks

2019-10-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Oct  6 07:01:17 2019 +0200| [a1701e7591e5fcbe9111218cb583a8ea0fb0b1da] | 
committer: Paul B Mahol

avcodec/flac_parser: Remove superfluous checks

For a parser, the input buffer is always != NULL: In case of flushing,
the indicated size of the input buffer will be zero and the input buffer
will point to a zeroed buffer of size 0 + AV_INPUT_BUFFER_PADDING.
Therefore one does not need to check for whether said buffer is NULL or
not.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1701e7591e5fcbe9111218cb583a8ea0fb0b1da
---

 libavcodec/flac_parser.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 8c61f3a88c..1dcb3ef2db 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -584,17 +584,16 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 }
 
 /* Find and score new headers. */
-/* buf_size is to zero when padding, so check for this since we do */
+/* buf_size is zero when flushing, so check for this since we do   */
 /* not want to try to read more input once we have found the end.  */
-/* Note that as (non-modified) parameters, buf can be non-NULL,*/
-/* while buf_size is 0.*/
-while ((buf && buf_size && read_end < buf + buf_size &&
+/* Also note that buf can't be NULL.   */
+while ((buf_size && read_end < buf + buf_size &&
 fpc->nb_headers_buffered < FLAC_MIN_HEADERS)
-   || ((!buf || !buf_size) && !fpc->end_padded)) {
+   || (!buf_size && !fpc->end_padded)) {
 int start_offset;
 
 /* Pad the end once if EOF, to check the final region for headers. */
-if (!buf || !buf_size) {
+if (!buf_size) {
 fpc->end_padded  = 1;
 buf_size = MAX_FRAME_HEADER_SIZE;
 read_end = read_start + MAX_FRAME_HEADER_SIZE;
@@ -624,7 +623,7 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 goto handle_error;
 }
 
-if (buf && buf_size) {
+if (buf_size) {
 av_fifo_generic_write(fpc->fifo_buf, (void*) read_start,
   read_end - read_start, NULL);
 } else {
@@ -647,7 +646,7 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 fpc->nb_headers_buffered = nb_headers;
 /* Wait till FLAC_MIN_HEADERS to output a valid frame. */
 if (!fpc->end_padded && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) {
-if (buf && read_end < buf + buf_size) {
+if (read_end < buf + buf_size) {
 read_start = read_end;
 continue;
 } else {
@@ -682,7 +681,7 @@ static int flac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
 
 if (fpc->best_header && fpc->best_header->max_score <= 0) {
 // Only accept a bad header if there is no other option to continue
-if (!buf_size || !buf || read_end != buf || fpc->nb_headers_buffered < 
FLAC_MIN_HEADERS)
+if (!buf_size || read_end != buf || fpc->nb_headers_buffered < 
FLAC_MIN_HEADERS)
 fpc->best_header = NULL;
 }
 

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

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

[FFmpeg-cvslog] lavc/qsv: fix a memory leak in ff_qsv_set_display_handle()

2019-10-07 Thread Zhong Li
ffmpeg | branch: master | Zhong Li  | Sun Sep 29 16:01:06 
2019 +0800| [6f0dd6b4ab6536ef0506c121263de15a0be64d5d] | committer: Zhong Li

lavc/qsv: fix a memory leak in ff_qsv_set_display_handle()

Reported-by: Linjie Fu 
Signed-off-by: Zhong Li 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f0dd6b4ab6536ef0506c121263de15a0be64d5d
---

 libavcodec/qsv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 994c9ebcb0..a43f0d5c5a 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -838,6 +838,8 @@ int ff_qsv_close_internal_session(QSVSession *qs)
 if (qs->va_device_ctx) {
 qs->va_device_ctx->free(qs->va_device_ctx);
 }
+
+av_buffer_unref(&qs->va_device_ref);
 #endif
 return 0;
 }

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

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

[FFmpeg-cvslog] lavfi/normalize: remove the unused pointer

2019-10-07 Thread Zhong Li
ffmpeg | branch: master | Zhong Li  | Sun Sep 29 16:05:51 
2019 +0800| [8df91de9aa263df77bd3f59a65355a1ccca83f0c] | committer: Zhong Li

lavfi/normalize: remove the unused pointer

Signed-off-by: Zhong Li 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8df91de9aa263df77bd3f59a65355a1ccca83f0c
---

 libavfilter/vf_normalize.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavfilter/vf_normalize.c b/libavfilter/vf_normalize.c
index c955aeb7d2..4a96088ee5 100644
--- a/libavfilter/vf_normalize.c
+++ b/libavfilter/vf_normalize.c
@@ -147,14 +147,12 @@ static void normalize(NormalizeContext *s, AVFrame *in, 
AVFrame *out)
 min[c].in = max[c].in = in->data[0][s->co[c]];
 for (y = 0; y < in->height; y++) {
 uint8_t *inp = in->data[0] + y * in->linesize[0];
-uint8_t *outp = out->data[0] + y * out->linesize[0];
 for (x = 0; x < in->width; x++) {
 for (c = 0; c < 3; c++) {
 min[c].in = FFMIN(min[c].in, inp[s->co[c]]);
 max[c].in = FFMAX(max[c].in, inp[s->co[c]]);
 }
 inp += s->step;
-outp += s->step;
 }
 }
 

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

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

[FFmpeg-cvslog] Change libvpxenc default to crf=32.

2019-10-07 Thread elliottk
ffmpeg | branch: master | elliottk  | Tue 
Sep 24 16:24:13 2019 -0700| [14941d386acd90b92aaaf75fbdac2c07d33f167a] | 
committer: James Zern

Change libvpxenc default to crf=32.

Current default is 200kbps, which produces inconsistent
results (too high for low-res, too low for hi-res). Use
CRF instead, which will adapt. Affects VP9. Also have
VP8 use a default bitrate of 256kbps.

Signed-off-by: James Zern 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=14941d386acd90b92aaaf75fbdac2c07d33f167a
---

 libavcodec/libvpxenc.c | 74 ++
 libavcodec/version.h   |  2 +-
 2 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 95100b5516..286baa14a7 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -515,6 +515,66 @@ static void set_color_range(AVCodecContext *avctx)
 #endif
 #endif
 
+/**
+ * Set the target bitrate to VPX library default. Also set CRF to 32 if needed.
+ */
+static void set_vp8_defaults(AVCodecContext *avctx,
+ struct vpx_codec_enc_cfg *enccfg)
+{
+VPxContext *ctx = avctx->priv_data;
+av_assert0(!avctx->bit_rate);
+avctx->bit_rate = enccfg->rc_target_bitrate * 1000;
+if (enccfg->rc_end_usage == VPX_CQ) {
+av_log(avctx, AV_LOG_WARNING,
+   "Bitrate not specified for constrained quality mode, using 
default of %dkbit/sec\n",
+   enccfg->rc_target_bitrate);
+} else {
+enccfg->rc_end_usage = VPX_CQ;
+ctx->crf = 32;
+av_log(avctx, AV_LOG_WARNING,
+   "Neither bitrate nor constrained quality specified, using 
default CRF of %d and bitrate of %dkbit/sec\n",
+   ctx->crf, enccfg->rc_target_bitrate);
+}
+}
+
+
+#if CONFIG_LIBVPX_VP9_ENCODER
+/**
+ * Keep the target bitrate at 0 to engage constant quality mode. If CRF is not
+ * set, use 32.
+ */
+static void set_vp9_defaults(AVCodecContext *avctx,
+ struct vpx_codec_enc_cfg *enccfg)
+{
+VPxContext *ctx = avctx->priv_data;
+av_assert0(!avctx->bit_rate);
+if (enccfg->rc_end_usage != VPX_Q && ctx->lossless < 0) {
+enccfg->rc_end_usage = VPX_Q;
+ctx->crf = 32;
+av_log(avctx, AV_LOG_WARNING,
+   "Neither bitrate nor constrained quality specified, using 
default CRF of %d\n",
+   ctx->crf);
+}
+}
+#endif
+
+/**
+ * Called when the bitrate is not set. It sets appropriate default values for
+ * bitrate and CRF.
+ */
+static void set_vpx_defaults(AVCodecContext *avctx,
+ struct vpx_codec_enc_cfg *enccfg)
+{
+av_assert0(!avctx->bit_rate);
+#if CONFIG_LIBVPX_VP9_ENCODER
+if (avctx->codec_id == AV_CODEC_ID_VP9) {
+set_vp9_defaults(avctx, enccfg);
+return;
+}
+#endif
+set_vp8_defaults(avctx, enccfg);
+}
+
 static av_cold int vpx_init(AVCodecContext *avctx,
 const struct vpx_codec_iface *iface)
 {
@@ -585,18 +645,9 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 if (avctx->bit_rate) {
 enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
   AV_ROUND_NEAR_INF);
-#if CONFIG_LIBVPX_VP9_ENCODER
-} else if (enccfg.rc_end_usage == VPX_Q) {
-#endif
 } else {
-if (enccfg.rc_end_usage == VPX_CQ) {
-enccfg.rc_target_bitrate = 100;
-} else {
-avctx->bit_rate = enccfg.rc_target_bitrate * 1000;
-av_log(avctx, AV_LOG_WARNING,
-   "Neither bitrate nor constrained quality specified, using 
default bitrate of %dkbit/sec\n",
-   enccfg.rc_target_bitrate);
-}
+// Set bitrate to default value. Also sets CRF to default if needed.
+set_vpx_defaults(avctx, &enccfg);
 }
 
 if (avctx->codec_id == AV_CODEC_ID_VP9 && ctx->lossless == 1) {
@@ -1459,6 +1510,7 @@ static const AVOption vp9_options[] = {
 #undef LEGACY_OPTIONS
 
 static const AVCodecDefault defaults[] = {
+{ "b", "0" },
 { "qmin", "-1" },
 { "qmax", "-1" },
 { "g","-1" },
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 04b210371e..2e047a6f51 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  59
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

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

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

[FFmpeg-cvslog] avformat/mmst: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
14:47:57 2019 +0800| [cdf8253a061ceb3fee9bc0ebd403d434c8395b70] | committer: 
Steven Liu

avformat/mmst: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdf8253a061ceb3fee9bc0ebd403d434c8395b70
---

 libavformat/mmst.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/libavformat/mmst.c b/libavformat/mmst.c
index a97c2e04a2..533cbe7698 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -141,7 +141,7 @@ static int send_command_packet(MMSTContext *mmst)
 // write it out.
 write_result= ffurl_write(mms->mms_hd, mms->out_buffer, exact_length);
 if(write_result != exact_length) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Failed to write data of length %d: %d (%s)\n",
exact_length, write_result,
write_result < 0 ? strerror(AVUNERROR(write_result)) :
@@ -215,11 +215,11 @@ static int send_media_file_request(MMSTContext *mmst)
 static void handle_packet_stream_changing_type(MMSTContext *mmst)
 {
 MMSContext *mms = &mmst->mms;
-av_log(NULL, AV_LOG_TRACE, "Stream changing!\n");
+av_log(mms->mms_hd, AV_LOG_TRACE, "Stream changing!\n");
 
 // 40 is the packet header size, 7 is the prefix size.
 mmst->header_packet_id= AV_RL32(mms->in_buffer + 40 + 7);
-av_log(NULL, AV_LOG_TRACE, "Changed header prefix to 0x%x", 
mmst->header_packet_id);
+av_log(mms->mms_hd, AV_LOG_TRACE, "Changed header prefix to 0x%x", 
mmst->header_packet_id);
 }
 
 static int send_keepalive_packet(MMSTContext *mmst)
@@ -251,12 +251,12 @@ static MMSSCPacketType 
get_tcp_server_response(MMSTContext *mmst)
 read_result = ffurl_read_complete(mms->mms_hd, mms->in_buffer, 8);
 if (read_result != 8) {
 if(read_result < 0) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Error reading packet header: %d (%s)\n",
read_result, strerror(AVUNERROR(read_result)));
 packet_type = SC_PKT_CANCEL;
 } else {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"The server closed the connection\n");
 packet_type = SC_PKT_NO_DATA;
 }
@@ -270,7 +270,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext 
*mmst)
 mmst->incoming_flags= mms->in_buffer[3];
 read_result= ffurl_read_complete(mms->mms_hd, mms->in_buffer+8, 4);
 if(read_result != 4) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Reading command packet length failed: %d (%s)\n",
read_result,
read_result < 0 ? strerror(AVUNERROR(read_result)) :
@@ -279,11 +279,11 @@ static MMSSCPacketType 
get_tcp_server_response(MMSTContext *mmst)
 }
 
 length_remaining= AV_RL32(mms->in_buffer+8) + 4;
-av_log(NULL, AV_LOG_TRACE, "Length remaining is %d\n", 
length_remaining);
+av_log(mms->mms_hd, AV_LOG_TRACE, "Length remaining is %d\n", 
length_remaining);
 // read the rest of the packet.
 if (length_remaining < 0
 || length_remaining > sizeof(mms->in_buffer) - 12) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Incoming packet length %d exceeds bufsize 
%"SIZE_SPECIFIER"\n",
length_remaining, sizeof(mms->in_buffer) - 12);
 return AVERROR_INVALIDDATA;
@@ -291,7 +291,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext 
*mmst)
 read_result = ffurl_read_complete(mms->mms_hd, mms->in_buffer + 12,
 length_remaining) ;
 if (read_result != length_remaining) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Reading pkt data (length=%d) failed: %d (%s)\n",
length_remaining, read_result,
read_result < 0 ? strerror(AVUNERROR(read_result)) :
@@ -300,7 +300,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext 
*mmst)
 }
 packet_type= AV_RL16(mms->in_buffer+36);
 if (read_result >= 44 && (hr = AV_RL32(mms->in_buffer + 40))) {
-av_log(NULL, AV_LOG_ERROR,
+av_log(mms->mms_hd, AV_LOG_ERROR,
"Server sent a message with packet type 0x%x and error 
status code 0x%08x\n", packet_type, hr);
 return AVERROR(EINVAL);
 }
@@ -319,7 +319,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext 
*mmst)
 
 

[FFmpeg-cvslog] avcodec/mpegvideo_enc: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
15:03:04 2019 +0800| [76ab5ebbeea6c35e3901dfa077cd24a0db3fe8d8] | committer: 
Steven Liu

avcodec/mpegvideo_enc: add logging context to log

Reviewed-by: Michael Niedermayer 
Reviewed-by: Paul B Mahol 
Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76ab5ebbeea6c35e3901dfa077cd24a0db3fe8d8
---

 libavcodec/mpegvideo_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ae3b131229..f12e603215 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -165,7 +165,7 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
 }
 }
 if (shift) {
-av_log(NULL, AV_LOG_INFO,
+av_log(s->avctx, AV_LOG_INFO,
"Warning, QMAT_SHIFT is larger than %d, overflows possible\n",
QMAT_SHIFT - shift);
 }

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

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

[FFmpeg-cvslog] avformat/network: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
14:41:06 2019 +0800| [4ff97342ceefb8c90809953e7b39f1c1745ede58] | committer: 
Steven Liu

avformat/network: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ff97342ceefb8c90809953e7b39f1c1745ede58
---

 libavformat/network.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

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

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

[FFmpeg-cvslog] avfilter/vf_pad: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
15:12:43 2019 +0800| [985ed65117c7c82255bb0931442725aa6e5f6967] | committer: 
Steven Liu

avfilter/vf_pad: add logging context to log

Reviewed-by: Paul B Mahol 
Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=985ed65117c7c82255bb0931442725aa6e5f6967
---

 libavfilter/vf_pad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index ed155578e1..186d3f028d 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -210,7 +210,7 @@ static int config_input(AVFilterLink *inlink)
 return 0;
 
 eval_fail:
-av_log(NULL, AV_LOG_ERROR,
+av_log(ctx, AV_LOG_ERROR,
"Error when evaluating the expression '%s'\n", expr);
 return ret;
 

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

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

[FFmpeg-cvslog] avformat/avidec: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Wed Oct  2 
14:44:47 2019 +0800| [17236a2c402b815de889b1f0c54fd903c19a787c] | committer: 
Steven Liu

avformat/avidec: add logging context to log

Reviewed-by: Michael Niedermayer 
Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=17236a2c402b815de889b1f0c54fd903c19a787c
---

 libavformat/avidec.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

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

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

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

[FFmpeg-cvslog] avformat/hlsenc: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
14:31:36 2019 +0800| [db99b32a1bfc35077933a068a09a1a8dc695644e] | committer: 
Steven Liu

avformat/hlsenc: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db99b32a1bfc35077933a068a09a1a8dc695644e
---

 libavformat/hlsenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 1f2bdfbe4d..ac46a82704 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1305,7 +1305,7 @@ static int create_master_playlist(AVFormatContext *s,
 ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options);
 av_dict_free(&options);
 if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "Failed to open master play list file 
'%s'\n",
+av_log(s, AV_LOG_ERROR, "Failed to open master play list file '%s'\n",
 temp_filename);
 goto fail;
 }
@@ -1344,7 +1344,7 @@ static int create_master_playlist(AVFormatContext *s,
 
 m3u8_rel_name = get_relative_url(hls->master_m3u8_url, vs->m3u8_name);
 if (!m3u8_rel_name) {
-av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n");
+av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n");
 goto fail;
 }
 
@@ -1358,7 +1358,7 @@ static int create_master_playlist(AVFormatContext *s,
 }
 
 if (!vid_st && !aud_st) {
-av_log(NULL, AV_LOG_WARNING, "Media stream not found\n");
+av_log(s, AV_LOG_WARNING, "Media stream not found\n");
 continue;
 }
 
@@ -1399,7 +1399,7 @@ static int create_master_playlist(AVFormatContext *s,
 }
 }
 if (j == hls->nb_ccstreams)
-av_log(NULL, AV_LOG_WARNING, "mapping ccgroup %s not found\n",
+av_log(s, AV_LOG_WARNING, "mapping ccgroup %s not found\n",
 vs->ccgroup);
 }
 

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

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

[FFmpeg-cvslog] avfilter/boxblur: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
15:11:50 2019 +0800| [9b2155ad3f54ab5ed66b08fe9d10402c2d7922d9] | committer: 
Steven Liu

avfilter/boxblur: add logging context to log

Reviewed-by: Paul B Mahol 
Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b2155ad3f54ab5ed66b08fe9d10402c2d7922d9
---

 libavfilter/boxblur.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/boxblur.c b/libavfilter/boxblur.c
index 4534b456d9..2287396f2e 100644
--- a/libavfilter/boxblur.c
+++ b/libavfilter/boxblur.c
@@ -91,7 +91,7 @@ int ff_boxblur_eval_filter_params(AVFilterLink *inlink,
  NULL, NULL, NULL, NULL, NULL, 0, ctx); \
 comp->radius = res; \
 if (ret < 0) {  \
-av_log(NULL, AV_LOG_ERROR,  \
+av_log(ctx, AV_LOG_ERROR,  \
"Error when evaluating " #comp " radius expression '%s'\n", 
expr); \
 return ret; \
 }

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

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

[FFmpeg-cvslog] avcodec/pngdec: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
15:07:19 2019 +0800| [aea36b63571e161049280ce2445a1b736702b92a] | committer: 
Steven Liu

avcodec/pngdec: add logging context to log

Reviewed-by: Paul B Mahol 
Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aea36b63571e161049280ce2445a1b736702b92a
---

 libavcodec/pngdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 2d6c1b218e..d37dabcc4d 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -424,7 +424,7 @@ static int png_decode_idat(PNGDecContext *s, int length)
 s->zstream.next_out  = s->crow_buf;
 }
 if (ret == Z_STREAM_END && s->zstream.avail_in > 0) {
-av_log(NULL, AV_LOG_WARNING,
+av_log(s->avctx, AV_LOG_WARNING,
"%d undecompressed bytes left in buffer\n", 
s->zstream.avail_in);
 return 0;
 }

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

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

[FFmpeg-cvslog] avfilter/vf_crop: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
15:08:33 2019 +0800| [acc1256654fcb8c85d02857e3c1f069b1bf74f73] | committer: 
Steven Liu

avfilter/vf_crop: add logging context to log

Reviewed-by: Paul B Mahol 
Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=acc1256654fcb8c85d02857e3c1f069b1bf74f73
---

 libavfilter/vf_crop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 9fca7a7309..d6b4feb513 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -244,7 +244,7 @@ static int config_input(AVFilterLink *link)
 return 0;
 
 fail_expr:
-av_log(NULL, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", 
expr);
+av_log(ctx, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", 
expr);
 return ret;
 }
 

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

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

[FFmpeg-cvslog] avformat/udp: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
14:34:17 2019 +0800| [5db50dbf060fe9b8332c0c2274af66208ca6d887] | committer: 
Steven Liu

avformat/udp: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5db50dbf060fe9b8332c0c2274af66208ca6d887
---

 libavformat/udp.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index cf73d331e0..f4ec148a2f 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -274,7 +274,7 @@ static int udp_set_multicast_sources(URLContext *h,
 }
 return 0;
 #else
-av_log(NULL, AV_LOG_ERROR,
+av_log(h, AV_LOG_ERROR,
"Setting multicast sources only supported for IPv4\n");
 return AVERROR(EINVAL);
 #endif
@@ -283,7 +283,7 @@ static int udp_set_multicast_sources(URLContext *h,
 for (i = 0; i < nb_sources; i++) {
 struct ip_mreq_source mreqs;
 if (sources[i].ss_family != AF_INET) {
-av_log(NULL, AV_LOG_ERROR, "Source/block address %d is of 
incorrect protocol family\n", i + 1);
+av_log(h, AV_LOG_ERROR, "Source/block address %d is of incorrect 
protocol family\n", i + 1);
 return AVERROR(EINVAL);
 }
 
@@ -298,9 +298,9 @@ static int udp_set_multicast_sources(URLContext *h,
include ? IP_ADD_SOURCE_MEMBERSHIP : IP_BLOCK_SOURCE,
(const void *)&mreqs, sizeof(mreqs)) < 0) {
 if (include)
-ff_log_net_error(NULL, AV_LOG_ERROR, 
"setsockopt(IP_ADD_SOURCE_MEMBERSHIP)");
+ff_log_net_error(h, AV_LOG_ERROR, 
"setsockopt(IP_ADD_SOURCE_MEMBERSHIP)");
 else
-ff_log_net_error(NULL, AV_LOG_ERROR, 
"setsockopt(IP_BLOCK_SOURCE)");
+ff_log_net_error(h, AV_LOG_ERROR, 
"setsockopt(IP_BLOCK_SOURCE)");
 return ff_neterrno();
 }
 }

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

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

[FFmpeg-cvslog] avformat/rtmpptoto: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
14:36:52 2019 +0800| [35236fd729a37d69a79c708e06139d6aa54da123] | committer: 
Steven Liu

avformat/rtmpptoto: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35236fd729a37d69a79c708e06139d6aa54da123
---

 libavformat/rtmpproto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

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

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

[FFmpeg-cvslog] avfilter/vf_scale_qsv: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
15:10:36 2019 +0800| [3dead10fa3059583a3a46030e9762aae7ea58045] | committer: 
Steven Liu

avfilter/vf_scale_qsv: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3dead10fa3059583a3a46030e9762aae7ea58045
---

 libavfilter/vf_scale_qsv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index 3cc05b64f3..1cf5367969 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -541,7 +541,7 @@ static int qsvscale_config_props(AVFilterLink *outlink)
 return 0;
 
 fail:
-av_log(NULL, AV_LOG_ERROR,
+av_log(ctx, AV_LOG_ERROR,
"Error when evaluating the expression '%s'\n", expr);
 return ret;
 }

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

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

[FFmpeg-cvslog] avcodec/videotoolbox: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
15:04:41 2019 +0800| [4aa391388a67fb636e8127924274b00ec380e245] | committer: 
Steven Liu

avcodec/videotoolbox: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4aa391388a67fb636e8127924274b00ec380e245
---

 libavcodec/videotoolbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

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

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

[FFmpeg-cvslog] avformat/mms: add logging context to log

2019-10-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Mon Sep 30 
14:50:28 2019 +0800| [8c16c133d03539648814057162850d24a5de9a81] | committer: 
Steven Liu

avformat/mms: add logging context to log

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c16c133d03539648814057162850d24a5de9a81
---

 libavformat/mms.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

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

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

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

[FFmpeg-cvslog] avutil/avstring: support input path as a null pointer or empty string

2019-10-07 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Tue Sep 24 
19:23:58 2019 +0800| [a77fb510c2684a43980c79ff85ff36e094cae63c] | committer: 
Steven Liu

avutil/avstring: support input path as a null pointer or empty string

Linux and OSX systems support basename and dirname via , I plan to
make the wrapper interface conform to the standard interface first.
If it is feasible, I will continue to modify it to call the system interface
if there is already a system call interface.

You can get more description about the system interface by below command:
 "man 3 basename"

Reviewed-by: Marton Balint 
Reviewed-by: Tomas Härdin 
Reviewed-by: Steven Liu 
Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a77fb510c2684a43980c79ff85ff36e094cae63c
---

 libavutil/avstring.c | 12 
 libavutil/avstring.h | 13 +
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 4c068f5bc5..76a13ba3b5 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -257,8 +257,12 @@ char *av_strireplace(const char *str, const char *from, 
const char *to)
 
 const char *av_basename(const char *path)
 {
-char *p = strrchr(path, '/');
+char *p;
 
+if (!path || *path == '\0')
+return ".";
+
+p = strrchr(path, '/');
 #if HAVE_DOS_PATHS
 char *q = strrchr(path, '\\');
 char *d = strchr(path, ':');
@@ -274,11 +278,11 @@ const char *av_basename(const char *path)
 
 const char *av_dirname(char *path)
 {
-char *p = strrchr(path, '/');
+char *p = path ? strrchr(path, '/') : NULL;
 
 #if HAVE_DOS_PATHS
-char *q = strrchr(path, '\\');
-char *d = strchr(path, ':');
+char *q = path ? strrchr(path, '\\') : NULL;
+char *d = path ? strchr(path, ':')  : NULL;
 
 d = d ? d + 1 : d;
 
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index 37dd4e2da0..274335cfb9 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -274,16 +274,21 @@ char *av_strireplace(const char *str, const char *from, 
const char *to);
 
 /**
  * Thread safe basename.
- * @param path the path, on DOS both \ and / are considered separators.
+ * @param path the string to parse, on DOS both \ and / are considered 
separators.
  * @return pointer to the basename substring.
+ * If path does not contain a slash, the function returns a copy of path.
+ * If path is a NULL pointer or points to an empty string, a pointer
+ * to a string "." is returned.
  */
 const char *av_basename(const char *path);
 
 /**
  * Thread safe dirname.
- * @param path the path, on DOS both \ and / are considered separators.
- * @return the path with the separator replaced by the string terminator or 
".".
- * @note the function may change the input string.
+ * @param path the string to parse, on DOS both \ and / are considered 
separators.
+ * @return A pointer to a string that's the parent directory of path.
+ * If path is a NULL pointer or points to an empty string, a pointer
+ * to a string "." is returned.
+ * @note the function may modify the contents of the path, so copies should be 
passed.
  */
 const char *av_dirname(char *path);
 

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

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

[FFmpeg-cvslog] avformat/hlsenc: replace with av_dirname to get the directory

2019-10-07 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Tue Sep 24 
19:24:00 2019 +0800| [28bb73cee77e209a6445d081e7ea577ede29c50f] | committer: 
Steven Liu

avformat/hlsenc: replace with av_dirname to get the directory

Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28bb73cee77e209a6445d081e7ea577ede29c50f
---

 libavformat/hlsenc.c | 22 ++
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e5ccedc792..aefaeacf28 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -486,7 +486,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 float playlist_duration = 0.0f;
 int ret = 0, path_size, sub_path_size;
 int segment_cnt = 0;
-char *dirname = NULL, *p, *sub_path;
+char *dirname = NULL, *sub_path;
 char *path = NULL;
 char *vtt_dirname = NULL;
 AVDictionary *options = NULL;
@@ -517,13 +517,8 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 }
 
 if (segment && !hls->use_localtime_mkdir) {
-dirname = hls->segment_filename ? av_strdup(hls->segment_filename): 
av_strdup(vs->avf->url);
-if (!dirname) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-p = (char *)av_basename(dirname);
-*p = '\0';
+char *dirname_r = hls->segment_filename ? 
av_strdup(hls->segment_filename): av_strdup(vs->avf->url);
+dirname = (char*)av_dirname(dirname_r);
 }
 
 /* if %v is present in the file's directory
@@ -542,7 +537,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 }
 }
 
-av_free(dirname);
+av_freep(&dirname);
 dirname = r_dirname;
 }
 
@@ -578,13 +573,8 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 }
 
 if ((segment->sub_filename[0] != '\0')) {
-vtt_dirname = av_strdup(vs->vtt_avf->url);
-if (!vtt_dirname) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-p = (char *)av_basename(vtt_dirname);
-*p = '\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 = av_malloc(sub_path_size);
 if (!sub_path) {

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

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

[FFmpeg-cvslog] avformat/hlsenc: remove the unnecessary null pointer check

2019-10-07 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Tue Sep 24 
19:23:59 2019 +0800| [61aa77272a25d83e5ce5c63d93c64bb9a3e15557] | committer: 
Steven Liu

avformat/hlsenc: remove the unnecessary null pointer check

Reviewed-by: Steven Liu 
Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61aa77272a25d83e5ce5c63d93c64bb9a3e15557
---

 libavformat/hlsenc.c | 26 ++
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index ac46a82704..e5ccedc792 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1613,16 +1613,13 @@ static int hls_start(AVFormatContext *s, VariantStream 
*vs)
 if (c->use_localtime_mkdir) {
 const char *dir;
 char *fn_copy = av_strdup(oc->url);
-if (!fn_copy) {
-return AVERROR(ENOMEM);
-}
 dir = av_dirname(fn_copy);
 if (ff_mkdir_p(dir) == -1 && errno != EEXIST) {
 av_log(oc, AV_LOG_ERROR, "Could not create directory %s 
with use_localtime_mkdir\n", dir);
-av_free(fn_copy);
+av_freep(&fn_copy);
 return AVERROR(errno);
 }
-av_free(fn_copy);
+av_freep(&fn_copy);
 }
 } else {
 char *filename = NULL;
@@ -1784,11 +1781,6 @@ static int validate_name(int nb_vs, const char *fn)
 }
 
 fn_dup = av_strdup(fn);
-if (!fn_dup) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
 filename = av_basename(fn);
 subdir_name = av_dirname(fn_dup);
 
@@ -1846,11 +1838,6 @@ static int format_name(const char *buf, char **s, int 
index, const char *varname
 /* if %v is present in the file's directory, create sub-directory */
 if (av_stristr(dir, "%v") && proto && !strcmp(proto, "file")) {
 mod_buf_dup = av_strdup(*s);
-if (!mod_buf_dup) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
 dir = av_dirname(mod_buf_dup);
 if (ff_mkdir_p(dir) == -1 && errno != EEXIST) {
 ret = AVERROR(errno);
@@ -2151,11 +2138,6 @@ static int update_master_pl_info(AVFormatContext *s)
 int ret = 0;
 
 fn1 = av_strdup(s->url);
-if (!fn1) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
 dir = av_dirname(fn1);
 
 /**
@@ -2164,10 +2146,6 @@ static int update_master_pl_info(AVFormatContext *s)
  */
 if (dir && av_stristr(av_basename(dir), "%v")) {
 fn2 = av_strdup(dir);
-if (!fn2) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
 dir = av_dirname(fn2);
 }
 

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

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

[FFmpeg-cvslog] avformat/hlsenc: replace with av_freep for all av_free

2019-10-07 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Tue Sep 24 
19:24:01 2019 +0800| [afab93ccd097169b2a598768af4a9273332f3619] | committer: 
Steven Liu

avformat/hlsenc: replace with av_freep for all av_free

Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=afab93ccd097169b2a598768af4a9273332f3619
---

 libavformat/hlsenc.c | 64 ++--
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index aefaeacf28..cd4320114d 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -590,7 +590,7 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 if ((ret = vs->vtt_avf->io_open(vs->vtt_avf, &out, sub_path, 
AVIO_FLAG_WRITE, &options)) < 0) {
 if (hls->ignore_io_errors)
 ret = 0;
-av_free(sub_path);
+av_freep(&sub_path);
 goto fail;
 }
 ff_format_io_close(vs->vtt_avf, &out);
@@ -598,18 +598,18 @@ static int hls_delete_old_segments(AVFormatContext *s, 
HLSContext *hls,
 av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: 
%s\n",
sub_path, strerror(errno));
 }
-av_free(sub_path);
+av_freep(&sub_path);
 }
 av_freep(&path);
 previous_segment = segment;
 segment = previous_segment->next;
-av_free(previous_segment);
+av_freep(&previous_segment);
 }
 
 fail:
-av_free(path);
-av_free(dirname);
-av_free(vtt_dirname);
+av_freep(&path);
+av_freep(&dirname);
+av_freep(&vtt_dirname);
 
 return ret;
 }
@@ -887,7 +887,7 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
 strlen(vs->current_segment_final_filename_fmt)) {
 char * new_url = av_strdup(vs->current_segment_final_filename_fmt);
 if (!new_url) {
-av_free(en);
+av_freep(&en);
 return AVERROR(ENOMEM);
 }
 ff_format_set_url(vs->avf, new_url);
@@ -898,8 +898,8 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
"Invalid second level segment filename template '%s', "
"you can try to remove second_level_segment_size 
flag\n",
vs->avf->url);
-av_free(filename);
-av_free(en);
+av_freep(&filename);
+av_freep(&en);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(vs->avf, filename);
@@ -912,8 +912,8 @@ static int sls_flags_filename_process(struct 
AVFormatContext *s, HLSContext *hls
"Invalid second level segment filename template '%s', "
"you can try to remove second_level_segment_time 
flag\n",
vs->avf->url);
-av_free(filename);
-av_free(en);
+av_freep(&filename);
+av_freep(&en);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(vs->avf, filename);
@@ -985,7 +985,7 @@ static int sls_flag_use_localtime_filename(AVFormatContext 
*oc, HLSContext *c, V
 av_log(c, AV_LOG_ERROR, "Invalid second level segment filename 
template '%s', "
 "you can try to remove second_level_segment_index flag\n",
oc->url);
-av_free(filename);
+av_freep(&filename);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(oc, filename);
@@ -999,7 +999,7 @@ static int sls_flag_use_localtime_filename(AVFormatContext 
*oc, HLSContext *c, V
 av_log(c, AV_LOG_ERROR, "Invalid second level segment filename 
template '%s', "
 "you can try to remove second_level_segment_size 
flag\n",
oc->url);
-av_free(filename);
+av_freep(&filename);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(oc, filename);
@@ -1010,7 +1010,7 @@ static int 
sls_flag_use_localtime_filename(AVFormatContext *oc, HLSContext *c, V
 av_log(c, AV_LOG_ERROR, "Invalid second level segment filename 
template '%s', "
 "you can try to remove second_level_segment_time 
flag\n",
oc->url);
-av_free(filename);
+av_freep(&filename);
 return AVERROR(EINVAL);
 }
 ff_format_set_url(oc, filename);
@@ -1098,7 +1098,7 @@ static int hls_append_segment(struct AVFormatContext *s, 
HLSContext *hls,
 if ((ret = hls_delete_old_segments(s, hls, vs)) < 0)
 return ret;
 } else
-av_free(en);
+av_freep(&en);