[FFmpeg-cvslog] avformat: Export ticks_per_frame in st->codec

2016-09-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Sep  6 18:10:41 2016 +0200| [207d78176f868555ed7b5db4eb6ec9af9d3f700d] | 
committer: Michael Niedermayer

avformat: Export ticks_per_frame in st->codec

Fixes regressions with stream copy and output timebase/fps being twice as fine 
as needed
Makes the timebase and ticks per frame handled identical which should make the
code easier to understand and work with. It does not solve the problem without
st->codec access

Suggested-by: Hendrik Leppkes
Signed-off-by: Michael Niedermayer 

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

 libavformat/utils.c  | 4 +++-
 tests/ref/fate/copy-trac4914 | 4 ++--
 tests/ref/fate/copy-trac4914-avi | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7d23c4a..76cbff4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3825,8 +3825,10 @@ FF_DISABLE_DEPRECATION_WARNINGS
 st->codec->height = st->internal->avctx->height;
 }
 
-if (st->codec->codec_tag != MKTAG('t','m','c','d'))
+if (st->codec->codec_tag != MKTAG('t','m','c','d')) {
 st->codec->time_base = st->internal->avctx->time_base;
+st->codec->ticks_per_frame = st->internal->avctx->ticks_per_frame;
+}
 st->codec->framerate = st->avg_frame_rate;
 
 if (st->internal->avctx->subtitle_header) {
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index 9301c86..c977f30 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,2 +1,2 @@
-84316a64b609052d9974891686fbf607 *tests/data/fate/copy-trac4914.mxf
-566329 tests/data/fate/copy-trac4914.mxf
+8868ae16d99ed03916e9dc7105285471 *tests/data/fate/copy-trac4914.mxf
+560697 tests/data/fate/copy-trac4914.mxf
diff --git a/tests/ref/fate/copy-trac4914-avi b/tests/ref/fate/copy-trac4914-avi
index e23affc..0ee6675 100644
--- a/tests/ref/fate/copy-trac4914-avi
+++ b/tests/ref/fate/copy-trac4914-avi
@@ -1,2 +1,2 @@
-e948f10c90f526ae2c0cf234e1f54128 *tests/data/fate/copy-trac4914-avi.avi
-480886 tests/data/fate/copy-trac4914-avi.avi
+26e4202638bc384b82d2b5eb4d33a5f0 *tests/data/fate/copy-trac4914-avi.avi
+479494 tests/data/fate/copy-trac4914-avi.avi

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


[FFmpeg-cvslog] lavc/mediacodecdec_h264: fix SODB escaping

2016-09-07 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue 
Sep  6 16:30:07 2016 +0200| [f574012d5fe922684a5befa16828f22fe9a83ce8] | 
committer: Matthieu Bouron

lavc/mediacodecdec_h264: fix SODB escaping

Fixes escaping of consecutive 0x00, 0x00, 0x0{0-3} sequences.

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

 libavcodec/mediacodecdec_h264.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mediacodecdec_h264.c b/libavcodec/mediacodecdec_h264.c
index 18f186b..96e2a8a 100644
--- a/libavcodec/mediacodecdec_h264.c
+++ b/libavcodec/mediacodecdec_h264.c
@@ -104,9 +104,9 @@ static int h264_ps_to_nalu(const uint8_t *src, int 
src_size, uint8_t **out, int
 }
 *out = p = new;
 
-i = i + 3;
-memmove(p + i, p + i - 1, *out_size - i);
-p[i - 1] = 0x03;
+i = i + 2;
+memmove(p + i + 1, p + i, *out_size - (i + 1));
+p[i] = 0x03;
 }
 }
 done:

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


[FFmpeg-cvslog] avfilter: add avgblur filter

2016-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Sep  5 15:28:09 
2016 +0200| [424f0f9e3389af27772bc5e29424f443d9f44a66] | committer: Paul B Mahol

avfilter: add avgblur filter

Signed-off-by: Paul B Mahol 

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

 Changelog|   1 +
 doc/filters.texi |  18 +++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   2 +-
 libavfilter/vf_avgblur.c | 326 +++
 6 files changed, 348 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 1419e70..64695c8 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - added threads option per filter instance
 - weave filter
 - gblur filter
+- avgblur filter
 
 
 version 3.1:
diff --git a/doc/filters.texi b/doc/filters.texi
index a3a6abd..a3158be 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4402,6 +4402,24 @@ number in range [5, 129].
 Set what planes of frame filter will use for averaging. Default is all.
 @end table
 
+@section avgblur
+
+Apply average blur filter.
+
+The filter accepts the following options:
+
+@table @option
+@item sizeX
+Set horizontal kernel size.
+
+@item planes
+Set which planes to filter. By default all planes are filtered.
+
+@item sizeY
+Set vertical kernel size, if zero it will be same as @code{sizeX}.
+Default is @code{0}.
+@end table
+
 @section bbox
 
 Compute the bounding box for the non-black pixels in the input frame
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 52b148a..bfbeac4 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -124,6 +124,7 @@ OBJS-$(CONFIG_ALPHAEXTRACT_FILTER)   += 
vf_extractplanes.o
 OBJS-$(CONFIG_ALPHAMERGE_FILTER) += vf_alphamerge.o
 OBJS-$(CONFIG_ASS_FILTER)+= vf_subtitles.o
 OBJS-$(CONFIG_ATADENOISE_FILTER) += vf_atadenoise.o
+OBJS-$(CONFIG_AVGBLUR_FILTER)+= vf_avgblur.o
 OBJS-$(CONFIG_BBOX_FILTER)   += bbox.o vf_bbox.o
 OBJS-$(CONFIG_BENCH_FILTER)  += f_bench.o
 OBJS-$(CONFIG_BITPLANENOISE_FILTER)  += vf_bitplanenoise.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index ac8b41d..9549126 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -141,6 +141,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(ALPHAMERGE, alphamerge, vf);
 REGISTER_FILTER(ASS,ass,vf);
 REGISTER_FILTER(ATADENOISE, atadenoise, vf);
+REGISTER_FILTER(AVGBLUR,avgblur,vf);
 REGISTER_FILTER(BBOX,   bbox,   vf);
 REGISTER_FILTER(BENCH,  bench,  vf);
 REGISTER_FILTER(BITPLANENOISE,  bitplanenoise,  vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 6b59d1f..a416561 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   6
-#define LIBAVFILTER_VERSION_MINOR  60
+#define LIBAVFILTER_VERSION_MINOR  61
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_avgblur.c b/libavfilter/vf_avgblur.c
new file mode 100644
index 000..2bb2ab1
--- /dev/null
+++ b/libavfilter/vf_avgblur.c
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2016 Paul B Mahol
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
+ * SOFTWARE.
+ */
+
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct AverageBlurContext {
+const AVClass *class;
+
+int radius;
+int radiusV;
+int planes;
+
+int depth;
+int planewidth[4];
+int planeheight[4];
+float *buffer;
+int nb_plan

[FFmpeg-cvslog] avcodec/gif: don't honor transparency if palette changed

2016-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Sep  6 13:28:59 
2016 +0200| [7a258ef97e54a499b1ab8ad0244dbb8c48b4fd51] | committer: Paul B Mahol

avcodec/gif: don't honor transparency if palette changed

It generally does not work.

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 6af1f4a..d9c99d5 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -83,7 +83,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
 GIFContext *s = avctx->priv_data;
 int len = 0, height = avctx->height, width = avctx->width, x, y;
 int x_start = 0, y_start = 0, trans = s->transparent_index;
-int honor_transparency = (s->flags & GF_TRANSDIFF) && s->last_frame;
+int honor_transparency = (s->flags & GF_TRANSDIFF) && s->last_frame && 
!palette;
 const uint8_t *ptr;
 
 /* Crop image */

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


[FFmpeg-cvslog] avfilter/vf_palettegen: add mode for generating palette for each input frame

2016-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep  2 22:15:10 
2016 +0200| [93ae68d62a88f33723a5731b54d893a7d6d8f0b8] | committer: Paul B Mahol

avfilter/vf_palettegen: add mode for generating palette for each input frame

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_palettegen.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c
index fccc5ca..668a4ae 100644
--- a/libavfilter/vf_palettegen.c
+++ b/libavfilter/vf_palettegen.c
@@ -53,6 +53,7 @@ struct hist_node {
 enum {
 STATS_MODE_ALL_FRAMES,
 STATS_MODE_DIFF_FRAMES,
+STATS_MODE_SINGLE_FRAMES,
 NB_STATS_MODE
 };
 
@@ -80,9 +81,10 @@ typedef struct {
 static const AVOption palettegen_options[] = {
 { "max_colors", "set the maximum number of colors to use in the palette", 
OFFSET(max_colors), AV_OPT_TYPE_INT, {.i64=256}, 4, 256, FLAGS },
 { "reserve_transparent", "reserve a palette entry for transparency", 
OFFSET(reserve_transparent), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
-{ "stats_mode", "set statistics mode", OFFSET(stats_mode), 
AV_OPT_TYPE_INT, {.i64=STATS_MODE_ALL_FRAMES}, 0, NB_STATS_MODE, FLAGS, "mode" 
},
+{ "stats_mode", "set statistics mode", OFFSET(stats_mode), 
AV_OPT_TYPE_INT, {.i64=STATS_MODE_ALL_FRAMES}, 0, NB_STATS_MODE-1, FLAGS, 
"mode" },
 { "full", "compute full frame histograms", 0, AV_OPT_TYPE_CONST, 
{.i64=STATS_MODE_ALL_FRAMES}, INT_MIN, INT_MAX, FLAGS, "mode" },
 { "diff", "compute histograms only for the part that differs from 
previous frame", 0, AV_OPT_TYPE_CONST, {.i64=STATS_MODE_DIFF_FRAMES}, INT_MIN, 
INT_MAX, FLAGS, "mode" },
+{ "single", "compute new histogram for each frame", 0, 
AV_OPT_TYPE_CONST, {.i64=STATS_MODE_SINGLE_FRAMES}, INT_MIN, INT_MAX, FLAGS, 
"mode" },
 { NULL }
 };
 
@@ -480,8 +482,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
 AVFilterContext *ctx = inlink->dst;
 PaletteGenContext *s = ctx->priv;
-const int ret = s->prev_frame ? update_histogram_diff(s->histogram, 
s->prev_frame, in)
-  : update_histogram_frame(s->histogram, in);
+int ret = s->prev_frame ? update_histogram_diff(s->histogram, 
s->prev_frame, in)
+: update_histogram_frame(s->histogram, in);
 
 if (ret > 0)
 s->nb_refs += ret;
@@ -489,6 +491,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 if (s->stats_mode == STATS_MODE_DIFF_FRAMES) {
 av_frame_free(&s->prev_frame);
 s->prev_frame = in;
+} else if (s->stats_mode == STATS_MODE_SINGLE_FRAMES) {
+AVFrame *out;
+int i;
+
+out = get_palette_frame(ctx);
+out->pts = in->pts;
+av_frame_free(&in);
+ret = ff_filter_frame(ctx->outputs[0], out);
+for (i = 0; i < HIST_SIZE; i++)
+av_freep(&s->histogram[i].entries);
+av_freep(&s->refs);
+s->nb_refs = 0;
+s->nb_boxes = 0;
+memset(s->boxes, 0, sizeof(s->boxes));
+memset(s->histogram, 0, sizeof(s->histogram));
 } else {
 av_frame_free(&in);
 }
@@ -507,7 +524,7 @@ static int request_frame(AVFilterLink *outlink)
 int r;
 
 r = ff_request_frame(inlink);
-if (r == AVERROR_EOF && !s->palette_pushed && s->nb_refs) {
+if (r == AVERROR_EOF && !s->palette_pushed && s->nb_refs && s->stats_mode 
!= STATS_MODE_SINGLE_FRAMES) {
 r = ff_filter_frame(outlink, get_palette_frame(ctx));
 s->palette_pushed = 1;
 return r;

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


[FFmpeg-cvslog] avfilter/vf_paletteuse: add option to use new palette for each output frame

2016-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep  2 22:40:34 
2016 +0200| [b7e78c75cc254bebf880129ed3d9e57ec014fdd3] | committer: Paul B Mahol

avfilter/vf_paletteuse: add option to use new palette for each output frame

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

 libavfilter/vf_paletteuse.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index dece05a..e063ff7 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -86,6 +86,7 @@ typedef struct PaletteUseContext {
 uint32_t palette[AVPALETTE_COUNT];
 int palette_loaded;
 int dither;
+int new;
 set_frame_func set_frame;
 int bayer_scale;
 int ordered_dither[8*8];
@@ -122,6 +123,7 @@ static const AVOption paletteuse_options[] = {
 { "bruteforce","brute-force into the palette", 0, 
AV_OPT_TYPE_CONST, {.i64=COLOR_SEARCH_BRUTEFORCE},INT_MIN, INT_MAX, FLAGS, 
"search" },
 { "mean_err", "compute and print mean error", OFFSET(calc_mean_err), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
 { "debug_accuracy", "test color search accuracy", OFFSET(debug_accuracy), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
+{ "new", "take new palette for each output frame", OFFSET(new), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
 { NULL }
 };
 
@@ -928,6 +930,14 @@ static void load_palette(PaletteUseContext *s, const 
AVFrame *palette_frame)
 const uint32_t *p = (const uint32_t *)palette_frame->data[0];
 const int p_linesize = palette_frame->linesize[0] >> 2;
 
+if (s->new) {
+memset(s->palette, 0, sizeof(s->palette));
+memset(s->map, 0, sizeof(s->map));
+for (i = 0; i < CACHE_SIZE; i++)
+av_freep(&s->cache[i].entries);
+memset(s->cache, 0, sizeof(s->cache));
+}
+
 i = 0;
 for (y = 0; y < palette_frame->height; y++) {
 for (x = 0; x < palette_frame->width; x++)
@@ -937,7 +947,8 @@ static void load_palette(PaletteUseContext *s, const 
AVFrame *palette_frame)
 
 load_colormap(s);
 
-s->palette_loaded = 1;
+if (!s->new)
+s->palette_loaded = 1;
 }
 
 static AVFrame *load_apply_palette(AVFilterContext *ctx, AVFrame *main,

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


[FFmpeg-cvslog] af_hdcd: move decoding setup from init to config_input

2016-09-07 Thread Burt P
ffmpeg | branch: master | Burt P  | Sun Sep  4 09:49:44 2016 
-0500| [e700e21b6ff5765e344201997f80f26fe7792ee9] | committer: Burt P

af_hdcd: move decoding setup from init to config_input

Signed-off-by: Burt P 

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

 libavfilter/af_hdcd.c | 40 +---
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 6bc408c..641076a 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1777,31 +1777,15 @@ static av_cold void uninit(AVFilterContext *ctx)
 static av_cold int init(AVFilterContext *ctx)
 {
 HDCDContext *s = ctx->priv;
-int c;
 
 s->sample_count = 0;
 s->fctx = ctx;
 s->bad_config = 0;
 
-hdcd_detect_reset(&s->detect);
-for (c = 0; c < HDCD_MAX_CHANNELS; c++) {
-hdcd_reset(&s->state[c], 44100, s->cdt_ms);
-}
-
-av_log(ctx, AV_LOG_VERBOSE, "CDT period: %dms (%u samples @44100Hz)\n",
-s->cdt_ms, s->state[0].sustain_reset );
-av_log(ctx, AV_LOG_VERBOSE, "Process mode: %s\n",
-(s->process_stereo) ? "process stereo channels together" : "process 
each channel separately");
-av_log(ctx, AV_LOG_VERBOSE, "Force PE: %s\n",
-(s->force_pe) ? "on" : "off");
-av_log(ctx, AV_LOG_VERBOSE, "Analyze mode: [%d] %s\n",
-s->analyze_mode, ana_mode_str[s->analyze_mode] );
-if (s->disable_autoconvert)
+if (s->disable_autoconvert) {
+av_log(ctx, AV_LOG_VERBOSE, "Disabling automatic format 
conversion.\n");
 avfilter_graph_set_auto_convert(ctx->graph, 
AVFILTER_AUTO_CONVERT_NONE);
-av_log(ctx, AV_LOG_VERBOSE, "Auto-convert: %s (requested: %s)\n",
-(ctx->graph->disable_auto_convert) ? "disabled" : "enabled",
-(s->disable_autoconvert) ? "disable" : "do not disable" );
-
+}
 return 0;
 }
 
@@ -1809,11 +1793,29 @@ static int config_input(AVFilterLink *inlink) {
 AVFilterContext *ctx = inlink->dst;
 HDCDContext *s = ctx->priv;
 AVFilterLink *lk;
+int c;
+
+av_log(ctx, AV_LOG_VERBOSE, "Auto-convert: %s\n",
+(ctx->graph->disable_auto_convert) ? "disabled" : "enabled");
+
+hdcd_detect_reset(&s->detect);
+for (c = 0; c < HDCD_MAX_CHANNELS; c++) {
+hdcd_reset(&s->state[c], inlink->sample_rate, s->cdt_ms);
+}
+av_log(ctx, AV_LOG_VERBOSE, "CDT period: %dms (%u samples @44100Hz)\n",
+s->cdt_ms, s->state[0].sustain_reset );
 
 if (inlink->channels != 2 && s->process_stereo) {
 av_log(ctx, AV_LOG_WARNING, "process_stereo disabled (channels = %d)", 
inlink->channels);
 s->process_stereo = 0;
 }
+av_log(ctx, AV_LOG_VERBOSE, "Process mode: %s\n",
+(s->process_stereo) ? "process stereo channels together" : "process 
each channel separately");
+
+av_log(ctx, AV_LOG_VERBOSE, "Force PE: %s\n",
+(s->force_pe) ? "on" : "off");
+av_log(ctx, AV_LOG_VERBOSE, "Analyze mode: [%d] %s\n",
+s->analyze_mode, ana_mode_str[s->analyze_mode] );
 
 lk = inlink;
 while(lk != NULL) {

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


[FFmpeg-cvslog] af_hdcd: fix possible integer overflow

2016-09-07 Thread Burt P
ffmpeg | branch: master | Burt P  | Sun Sep  4 09:28:39 2016 
-0500| [91be2ad756d658acc24fec5bc46c1775158d28b0] | committer: Burt P

af_hdcd: fix possible integer overflow

Signed-off-by: Burt P 

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

 libavfilter/af_hdcd.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index cde2340..6bc408c 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1004,16 +1004,15 @@ AVFILTER_DEFINE_CLASS(hdcd);
 static void hdcd_reset(hdcd_state *state, unsigned rate, unsigned cdt_ms)
 {
 int i;
+uint64_t sustain_reset = (uint64_t)cdt_ms * rate / 1000;
 
 state->window = 0;
 state->readahead = 32;
 state->arg = 0;
 state->control = 0;
-
 state->running_gain = 0;
-
+state->sustain_reset = sustain_reset;
 state->sustain = 0;
-state->sustain_reset = cdt_ms*rate/1000;
 
 state->code_counterA = 0;
 state->code_counterA_almost = 0;
@@ -1789,8 +1788,8 @@ static av_cold int init(AVFilterContext *ctx)
 hdcd_reset(&s->state[c], 44100, s->cdt_ms);
 }
 
-av_log(ctx, AV_LOG_VERBOSE, "CDT period: %dms (%d samples @44100Hz)\n",
-s->cdt_ms, s->cdt_ms*44100/1000 );
+av_log(ctx, AV_LOG_VERBOSE, "CDT period: %dms (%u samples @44100Hz)\n",
+s->cdt_ms, s->state[0].sustain_reset );
 av_log(ctx, AV_LOG_VERBOSE, "Process mode: %s\n",
 (s->process_stereo) ? "process stereo channels together" : "process 
each channel separately");
 av_log(ctx, AV_LOG_VERBOSE, "Force PE: %s\n",

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


[FFmpeg-cvslog] af_hdcd: tweak hdcd_analyze_prepare() a bit

2016-09-07 Thread Burt P
ffmpeg | branch: master | Burt P  | Mon Sep  5 05:59:39 2016 
-0500| [eb0086588f1823841108ab1dee08683ab67cf507] | committer: Burt P

af_hdcd: tweak hdcd_analyze_prepare() a bit

* use the actual sample rate
* use a more sensible frequency for the tone
* update fate test result

Signed-off-by: Burt P 

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

 libavfilter/af_hdcd.c   | 9 ++---
 tests/fate/filter-audio.mak | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 641076a..a8a3d59 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -871,6 +871,7 @@ typedef struct {
  *  a code. -1 for timer never set. */
 int count_sustain_expired;
 
+int rate;   /**< sampling rate */
 int _ana_snb;   /**< used in the analyze mode tone generator */
 } hdcd_state;
 
@@ -1026,6 +1027,7 @@ static void hdcd_reset(hdcd_state *state, unsigned rate, 
unsigned cdt_ms)
 state->max_gain = 0;
 state->count_sustain_expired = -1;
 
+state->rate = rate;
 state->_ana_snb = 0;
 }
 
@@ -1297,7 +1299,8 @@ static int hdcd_scan_stereo(HDCDContext *ctx, const 
int32_t *samples, int max)
 
 /** replace audio with solid tone, but save LSBs */
 static void hdcd_analyze_prepare(hdcd_state *state, int32_t *samples, int 
count, int stride) {
-int n;
+int n, f = 300;
+int so = state->rate / f;
 for (n = 0; n < count * stride; n += stride) {
 /* in analyze mode, the audio is replaced by a solid tone, and
  * amplitude is changed to signal when the specified feature is
@@ -1306,9 +1309,9 @@ static void hdcd_analyze_prepare(hdcd_state *state, 
int32_t *samples, int count,
  * bit 1: Original sample was above PE level */
 int32_t save = (abs(samples[n]) - PEAK_EXT_LEVEL >= 0) ? 2 : 0; /* 
above PE level */
 save |= samples[n] & 1;  /* save LSB for HDCD 
packets */
-samples[n] = TONEGEN16(state->_ana_snb, 277.18, 44100, 0.1);
+samples[n] = TONEGEN16(state->_ana_snb, f, state->rate, 0.1);
 samples[n] = (samples[n] | 3) ^ ((~save) & 3);
-if (++state->_ana_snb > 0x3fff) state->_ana_snb = 0;
+if (++state->_ana_snb > so) state->_ana_snb = 0;
 }
 }
 
diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 2066fa9..cf92ef6 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -242,7 +242,7 @@ FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, HDCD, FLAC, 
FLAC, PCM_S24LE, PCM
 fate-filter-hdcd-analyze: SRC = $(TARGET_SAMPLES)/filter/hdcd.flac
 fate-filter-hdcd-analyze: CMD = md5 -i $(SRC) -af hdcd=analyze_mode=pe -f s24le
 fate-filter-hdcd-analyze: CMP = oneline
-fate-filter-hdcd-analyze: REF = 81a4f00f85a585bc0198e9a0670a8cde
+fate-filter-hdcd-analyze: REF = 6e39dc4629c1e84321c0d8bc069b42f6
 
 FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, HDCD, FLAC, FLAC, PCM_S24LE, 
PCM_S24LE) += fate-filter-hdcd-false-positive
 fate-filter-hdcd-false-positive: SRC = 
$(TARGET_SAMPLES)/filter/hdcd-false-positive.flac

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


[FFmpeg-cvslog] af_hdcd: some types renamed to remove _t

2016-09-07 Thread Burt P
ffmpeg | branch: master | Burt P  | Fri Aug 26 00:00:05 2016 
-0500| [5e553cab68ea7d4937ea8fb2993f5006fccbddcf] | committer: Burt P

af_hdcd: some types renamed to remove _t

Following a suggestion by Diego Biurrun.
_t is reserved for POSIX, apparently.

Signed-off-by: Burt P 

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

 libavfilter/af_hdcd.c | 58 +--
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 0272305..cde2340 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -872,13 +872,13 @@ typedef struct {
 int count_sustain_expired;
 
 int _ana_snb;   /**< used in the analyze mode tone generator */
-} hdcd_state_t;
+} hdcd_state;
 
 typedef enum {
 HDCD_PE_NEVER= 0, /**< All valid packets have PE set to off */
 HDCD_PE_INTERMITTENT = 1, /**< Some valid packets have PE set to on */
 HDCD_PE_PERMANENT= 2, /**< All valid packets have PE set to on  */
-} hdcd_pe_t;
+} hdcd_pe;
 
 static const char * const pe_str[] = {
 "never enabled",
@@ -890,31 +890,31 @@ typedef enum {
 HDCD_NONE= 0,  /**< HDCD packets do not (yet) appear  */
 HDCD_NO_EFFECT   = 1,  /**< HDCD packets appear, but all control codes 
are NOP */
 HDCD_EFFECTUAL   = 2,  /**< HDCD packets appear, and change the output 
in some way */
-} hdcd_detection_t;
+} hdcd_dv;
 
 typedef enum {
 HDCD_PVER_NONE   = 0, /**< No packets (yet) discovered */
 HDCD_PVER_A  = 1, /**< Packets of type A (8-bit control) 
discovered */
 HDCD_PVER_B  = 2, /**< Packets of type B (8-bit control, 8-bit 
XOR) discovered */
 HDCD_PVER_MIX= 3, /**< Packets of type A and B discovered, most 
likely an encoding error */
-} hdcd_pf_t;
+} hdcd_pf;
 
 static const char * const pf_str[] = {
 "?", "A", "B", "A+B"
 };
 
 typedef struct {
-hdcd_detection_t hdcd_detected;
-hdcd_pf_t packet_type;
+hdcd_dv hdcd_detected;
+hdcd_pf packet_type;
 int total_packets; /**< valid packets */
 int errors;/**< detectable errors */
-hdcd_pe_t peak_extend;
+hdcd_pe peak_extend;
 int uses_transient_filter;
 float max_gain_adjustment; /**< in dB, expected in the range -7.5 to 0.0 */
 int cdt_expirations;   /**< -1 for never set, 0 for set but never 
expired */
 
 int _active_count; /**< used internally */
-} hdcd_detection_data_t;
+} hdcd_detection_data;
 
 typedef enum {
 HDCD_ANA_OFF= 0,
@@ -923,7 +923,7 @@ typedef enum {
 HDCD_ANA_CDT= 3,
 HDCD_ANA_TGM= 4,
 HDCD_ANA_TOP= 5, /**< used in max value of AVOption */
-} hdcd_ana_mode_t;
+} hdcd_ana_mode;
 
 /** analyze mode descriptions: macro for AVOption definitions, array of const 
char for mapping mode to string */
 #define HDCD_ANA_OFF_DESC "disabled"
@@ -941,7 +941,7 @@ static const char * const ana_mode_str[] = {
 
 typedef struct HDCDContext {
 const AVClass *class;
-hdcd_state_t state[HDCD_MAX_CHANNELS];
+hdcd_state state[HDCD_MAX_CHANNELS];
 
 /* AVOption members */
 /** use hdcd_*_stereo() functions to process both channels together.
@@ -975,7 +975,7 @@ typedef struct HDCDContext {
 int val_target_gain;   /**< last matching target_gain in both channels */
 
 /* User information/stats */
-hdcd_detection_data_t detect;
+hdcd_detection_data detect;
 } HDCDContext;
 
 #define OFFSET(x) offsetof(HDCDContext, x)
@@ -1001,7 +1001,7 @@ static const AVOption hdcd_options[] = {
 
 AVFILTER_DEFINE_CLASS(hdcd);
 
-static void hdcd_reset(hdcd_state_t *state, unsigned rate, unsigned cdt_ms)
+static void hdcd_reset(hdcd_state *state, unsigned rate, unsigned cdt_ms)
 {
 int i;
 
@@ -1031,7 +1031,7 @@ static void hdcd_reset(hdcd_state_t *state, unsigned 
rate, unsigned cdt_ms)
 }
 
 /** update the user info/counters */
-static void hdcd_update_info(hdcd_state_t *state)
+static void hdcd_update_info(hdcd_state *state)
 {
 if (state->control & 16) state->count_peak_extend++;
 if (state->control & 32) state->count_transient_filter++;
@@ -1047,9 +1047,9 @@ typedef enum {
 HDCD_CODE_B_CHECKFAIL,
 HDCD_CODE_EXPECT_A,
 HDCD_CODE_EXPECT_B,
-} hdcd_code_result_t;
+} hdcd_code_result;
 
-static hdcd_code_result_t hdcd_code(const uint32_t bits, unsigned char *code)
+static hdcd_code_result hdcd_code(const uint32_t bits, unsigned char *code)
 {
 if ((bits & 0x0fa00500) == 0x0fa00500) {
 /* A: 8-bit code  0x7e0fa005[..] */
@@ -1078,7 +1078,7 @@ static hdcd_code_result_t hdcd_code(const uint32_t bits, 
unsigned char *code)
 return HDCD_CODE_NONE;
 }
 
-static int hdcd_integrate(HDCDContext *ctx, hdcd_state_t *state, int *flag, 
const int32_t *samples, int count, int stride)
+static int hdcd_integrate(HDCDContext *ctx, hdcd_state *state, int *flag, 
const int32_t *samples, in

[FFmpeg-cvslog] af_hdcd: hdcd_analyze_gen() using int instead of float

2016-09-07 Thread Burt P
ffmpeg | branch: master | Burt P  | Sat Sep  3 04:39:07 2016 
-0500| [38445d58f1a1cdc69bb11309e07aa99360bf466b] | committer: Burt P

af_hdcd: hdcd_analyze_gen() using int instead of float

Signed-off-by: Burt P 

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

 libavfilter/af_hdcd.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index a8a3d59..96d5a0f 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1318,11 +1318,10 @@ static void hdcd_analyze_prepare(hdcd_state *state, 
int32_t *samples, int count,
 /** encode a value in the given sample by adjusting the amplitude */
 static int32_t hdcd_analyze_gen(int32_t sample, unsigned int v, unsigned int 
maxv)
 {
-float sflt = sample, vv = v;
-vv /= maxv;
-if (vv > 1.0) vv = 1.0;
-sflt *= 1.0 + (vv * 18);
-return (int32_t)sflt;
+static const int r = 18, m = 1024;
+int64_t s64 = sample;
+v = m + (v * r * m / maxv);
+return (int32_t)(s64 * v / m);
 }
 
 /** behaves like hdcd_envelope(), but encodes processing information in

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


[FFmpeg-cvslog] lavc/avcodec: Improve av_parser_parse() documentation, mention padding.

2016-09-07 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sun Sep  4 
22:03:12 2016 +0200| [7a8e5ff1fd06c0363ed4bb26cda5262fcd925b74] | committer: 
Carl Eugen Hoyos

lavc/avcodec: Improve av_parser_parse() documentation, mention padding.

Fixes ticket #5809.

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

 libavcodec/avcodec.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4d92f69..01f9b29 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -5146,7 +5146,10 @@ AVCodecParserContext *av_parser_init(int codec_id);
  * @param poutbuf   set to pointer to parsed buffer or NULL if not yet 
finished.
  * @param poutbuf_size  set to size of parsed buffer or zero if not yet 
finished.
  * @param buf   input buffer.
- * @param buf_size  input length, to signal EOF, this should be 0 (so that 
the last frame can be output).
+ * @param buf_size  buffer size in bytes without the padding. I.e. the 
full buffer
+size is assumed to be buf_size + 
AV_INPUT_BUFFER_PADDING_SIZE.
+To signal EOF, this should be 0 (so that the last frame
+can be output).
  * @param pts   input presentation timestamp.
  * @param dts   input decoding timestamp.
  * @param pos   input byte position in stream.

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


[FFmpeg-cvslog] tests/fate:Add FATE for hls_flags append option

2016-09-07 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Wed Sep  7 
23:04:46 2016 +0800| [30a09eae981838e2b3a12abdac25756667befa8b] | committer: 
Michael Niedermayer

tests/fate:Add FATE for hls_flags append option

add tests/ref/fate/filter-hls-append for FATE
add hls-list-append fate use filter make audio data and test hls_flags
append options

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

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

 tests/fate/filter-audio.mak  |   14 +
 tests/ref/fate/filter-hls-append | 1156 ++
 2 files changed, 1170 insertions(+)

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index cf92ef6..809bf4e 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -143,6 +143,20 @@ FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER 
MPEGTS_DEMUXER AEVALSRC_FIL
 fate-filter-hls: tests/data/hls-list.m3u8
 fate-filter-hls: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/hls-list.m3u8
 
+tests/data/hls-list-append.m3u8: TAG = GEN
+tests/data/hls-list-append.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+-f lavfi -i "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t)::d=20" -f 
segment -segment_time 10 -map 0 -flags +bitexact -codec:a mp2fixed \
+-segment_list $(TARGET_PATH)/$@ -y 
$(TARGET_PATH)/tests/data/hls-append-out-%03d.ts 2>/dev/null; \
+$(TARGET_EXEC) $(TARGET_PATH)/$< \
+-f lavfi -i "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t)::d=20" -f hls 
-hls_time 10 -map 0 -flags +bitexact \
+-hls_flags append_list -codec:a mp2fixed -hls_segment_filename 
$(TARGET_PATH)/tests/data/hls-append-out-%03d.ts \
+$(TARGET_PATH)/tests/data/hls-list-append.m3u8 2>/dev/null
+
+FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER MPEGTS_DEMUXER 
AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-filter-hls-append
+fate-filter-hls-append: tests/data/hls-list-append.m3u8
+fate-filter-hls-append: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/hls-list-append.m3u8 -af asetpts=RTCTIME
+
 FATE_AMIX += fate-filter-amix-simple
 fate-filter-amix-simple: CMD = ffmpeg -filter_complex amix -i $(SRC) -ss 3 -i 
$(SRC1) -f f32le -
 fate-filter-amix-simple: REF = $(SAMPLES)/filter/amix_simple.pcm
diff --git a/tests/ref/fate/filter-hls-append b/tests/ref/fate/filter-hls-append
new file mode 100644
index 000..4a88b86
--- /dev/null
+++ b/tests/ref/fate/filter-hls-append
@@ -0,0 +1,1156 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 4
+0,  0,  0, 1152, 2304, 0x593ea430
+0,   1152,   1152, 1152, 2304, 0xde328304
+0,   2304,   2304, 1152, 2304, 0x12f673c9
+0,   3456,   3456, 1152, 2304, 0x4c7672a1
+0,   4608,   4608, 1152, 2304, 0xd38577f4
+0,   5760,   5760, 1152, 2304, 0xc9d677cc
+0,   6912,   6912, 1152, 2304, 0xc97e882a
+0,   8064,   8064, 1152, 2304, 0xaacf67ec
+0,   9216,   9216, 1152, 2304, 0x3a9b7ea5
+0,  10368,  10368, 1152, 2304, 0x30258348
+0,  11520,  11520, 1152, 2304, 0x08da8783
+0,  12672,  12672, 1152, 2304, 0x4830619e
+0,  13824,  13824, 1152, 2304, 0xcf476f69
+0,  14976,  14976, 1152, 2304, 0x377e7ce5
+0,  16128,  16128, 1152, 2304, 0x00a27fad
+0,  17280,  17280, 1152, 2304, 0xe4a46de3
+0,  18432,  18432, 1152, 2304, 0x938c8751
+0,  19584,  19584, 1152, 2304, 0x239982b5
+0,  20736,  20736, 1152, 2304, 0x9a0d7655
+0,  21888,  21888, 1152, 2304, 0x4adf7fbf
+0,  23040,  23040, 1152, 2304, 0xdb8b7b16
+0,  24192,  24192, 1152, 2304, 0x25908560
+0,  25344,  25344, 1152, 2304, 0xb5dd7be7
+0,  26496,  26496, 1152, 2304, 0x4368796d
+0,  27648,  27648, 1152, 2304, 0xba3a7fd0
+0,  28800,  28800, 1152, 2304, 0x5aae7456
+0,  29952,  29952, 1152, 2304, 0x40b58040
+0,  31104,  31104, 1152, 2304, 0x0d9d7783
+0,  32256,  32256, 1152, 2304, 0x44ae7b60
+0,  33408,  33408, 1152, 2304, 0xdd6366bd
+0,  34560,  34560, 1152, 2304, 0x04dc6e61
+0,  35712,  35712, 1152, 2304, 0x61b2783b
+0,  36864,  36864, 1152, 2304, 0x7bd47e7f
+0,  38016,  38016, 1152, 2304, 0x3e687793
+0,  39168,  39168, 1152, 2304, 0x92757bbb
+0,  40320,  40320, 1152, 2304, 0x05378308
+0,  41472,  41472, 1152, 2304, 0x1b1d7db8
+0,  42624,  42624, 1152, 2304, 0x983285f8
+0,  43776,  43776, 1152, 2304, 0xab2b7726
+0,  44

[FFmpeg-cvslog] avcodec/nvenc: use av_image_copy for copying frame data

2016-09-07 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Wed Sep  
7 15:49:28 2016 +0200| [96cba1c5524eb0cc1395aa7586e4c3b25092a7ec] | committer: 
Timo Rothenpieler

avcodec/nvenc: use av_image_copy for copying frame data

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

 libavcodec/nvenc.c | 94 --
 1 file changed, 21 insertions(+), 73 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 283f29f..c53341d 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1276,84 +1276,32 @@ static NvencSurface *get_free_frame(NvencContext *ctx)
 return NULL;
 }
 
-static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *inSurf,
-NV_ENC_LOCK_INPUT_BUFFER *lockBufferParams, const AVFrame *frame)
+static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *nv_surface,
+NV_ENC_LOCK_INPUT_BUFFER *lock_buffer_params, const AVFrame *frame)
 {
-uint8_t *buf = lockBufferParams->bufferDataPtr;
-int off = inSurf->height * lockBufferParams->pitch;
-
-if (frame->format == AV_PIX_FMT_YUV420P) {
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[0], frame->linesize[0],
-avctx->width, avctx->height);
-
-buf += off;
-
-av_image_copy_plane(buf, lockBufferParams->pitch >> 1,
-frame->data[2], frame->linesize[2],
-avctx->width >> 1, avctx->height >> 1);
-
-buf += off >> 2;
-
-av_image_copy_plane(buf, lockBufferParams->pitch >> 1,
-frame->data[1], frame->linesize[1],
-avctx->width >> 1, avctx->height >> 1);
-} else if (frame->format == AV_PIX_FMT_NV12) {
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[0], frame->linesize[0],
-avctx->width, avctx->height);
-
-buf += off;
-
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[1], frame->linesize[1],
-avctx->width, avctx->height >> 1);
-} else if (frame->format == AV_PIX_FMT_P010) {
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[0], frame->linesize[0],
-avctx->width << 1, avctx->height);
-
-buf += off;
-
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[1], frame->linesize[1],
-avctx->width << 1, avctx->height >> 1);
-} else if (frame->format == AV_PIX_FMT_YUV444P) {
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[0], frame->linesize[0],
-avctx->width, avctx->height);
-
-buf += off;
-
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[1], frame->linesize[1],
-avctx->width, avctx->height);
-
-buf += off;
-
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[2], frame->linesize[2],
-avctx->width, avctx->height);
-} else if (frame->format == AV_PIX_FMT_YUV444P16) {
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[0], frame->linesize[0],
-avctx->width << 1, avctx->height);
+int dst_linesize[4] = {
+lock_buffer_params->pitch,
+lock_buffer_params->pitch,
+lock_buffer_params->pitch,
+lock_buffer_params->pitch
+};
+uint8_t *dst_data[4];
+int ret;
 
-buf += off;
+if (frame->format == AV_PIX_FMT_YUV420P)
+dst_linesize[1] = dst_linesize[2] >>= 1;
 
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[1], frame->linesize[1],
-avctx->width << 1, avctx->height);
+ret = av_image_fill_pointers(dst_data, frame->format, nv_surface->height,
+ lock_buffer_params->bufferDataPtr, 
dst_linesize);
+if (ret < 0)
+return ret;
 
-buf += off;
+if (frame->format == AV_PIX_FMT_YUV420P)
+FFSWAP(uint8_t*, dst_data[1], dst_data[2]);
 
-av_image_copy_plane(buf, lockBufferParams->pitch,
-frame->data[2], frame->linesize[2],
-avctx->width << 1, avctx->height);
-} else {
-av_log(avctx, AV_LOG_FATAL, "Invalid pixel format!\n");
-return AVERROR(EINVAL);
-}
+av_image_copy(dst_data, dst_linesize,
+  (const uint8_t**)frame->data, frame->linesize, frame->format,
+  nv_surface->width, nv_surface->height);
 
 return 0;
 }

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


[FFmpeg-cvslog] avcodec/nvenc: correctly set inputPitch

2016-09-07 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Wed Sep  
7 18:15:22 2016 +0200| [fa3ecad071aadec810fe7fc8e74865778e477c5e] | committer: 
Timo Rothenpieler

avcodec/nvenc: correctly set inputPitch

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

 libavcodec/nvenc.c | 3 +++
 libavcodec/nvenc.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index c53341d..b335116 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1403,6 +1403,7 @@ static int nvenc_upload_frame(AVCodecContext *avctx, 
const AVFrame *frame,
 ctx->registered_frames[reg_idx].mapped = 1;
 nvenc_frame->reg_idx   = reg_idx;
 nvenc_frame->input_surface = 
nvenc_frame->in_map.mappedResource;
+nvenc_frame->pitch = frame->linesize[0];
 return 0;
 } else {
 NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 };
@@ -1415,6 +1416,7 @@ static int nvenc_upload_frame(AVCodecContext *avctx, 
const AVFrame *frame,
 return nvenc_print_error(avctx, nv_status, "Failed locking nvenc 
input buffer");
 }
 
+nvenc_frame->pitch = lockBufferParams.pitch;
 res = nvenc_copy_frame(avctx, nvenc_frame, &lockBufferParams, frame);
 
 nv_status = p_nvenc->nvEncUnlockInputBuffer(ctx->nvencoder, 
nvenc_frame->input_surface);
@@ -1655,6 +1657,7 @@ int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 pic_params.bufferFmt = inSurf->format;
 pic_params.inputWidth = avctx->width;
 pic_params.inputHeight = avctx->height;
+pic_params.inputPitch = inSurf->pitch;
 pic_params.outputBitstream = inSurf->output_surface;
 
 if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index c57f1ae..521902c 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -56,6 +56,7 @@ typedef struct NvencSurface
 int reg_idx;
 int width;
 int height;
+int pitch;
 
 NV_ENC_OUTPUT_PTR output_surface;
 NV_ENC_BUFFER_FORMAT format;

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


[FFmpeg-cvslog] avcodec/nvenc: support RGB input

2016-09-07 Thread Sven C. Dack
ffmpeg | branch: master | Sven C. Dack  | Wed Sep  7 
15:35:14 2016 +0200| [4aeb7a88ec69aff6490e7f94f5987f7525b7eab7] | committer: 
Timo Rothenpieler

avcodec/nvenc: support RGB input

nvenc still encodes as yuv, but does the conversion internally which
brings some performance gains.

Signed-off-by: Timo Rothenpieler 

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

 libavcodec/nvenc.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index b335116..bff204d 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -81,6 +81,8 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
 AV_PIX_FMT_P010,
 AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_YUV444P16,
+AV_PIX_FMT_0RGB32,
+AV_PIX_FMT_0BGR32,
 #if CONFIG_CUDA
 AV_PIX_FMT_CUDA,
 #endif
@@ -1032,6 +1034,14 @@ static av_cold int nvenc_alloc_surface(AVCodecContext 
*avctx, int idx)
 ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
 break;
 
+case AV_PIX_FMT_0RGB32:
+ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_ARGB;
+break;
+
+case AV_PIX_FMT_0BGR32:
+ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_ABGR;
+break;
+
 default:
 av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format\n");
 return AVERROR(EINVAL);

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


[FFmpeg-cvslog] ffmpeg_opt: Suggest to use "file:..." if a protocol was not found.

2016-09-07 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Tue Sep  6 
12:47:34 2016 +0200| [3e886e7307502bc6e1a8496ec25eca94b04825c5] | committer: 
Carl Eugen Hoyos

ffmpeg_opt: Suggest to use "file:..." if a protocol was not found.

Fixes Debian bug 785690.

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

 ffmpeg_opt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 2ea09cf..0c0d3a6 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -982,6 +982,8 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 err = avformat_open_input(&ic, filename, file_iformat, &o->g->format_opts);
 if (err < 0) {
 print_error(filename, err);
+if (err == AVERROR_PROTOCOL_NOT_FOUND)
+av_log(NULL, AV_LOG_ERROR, "Did you mean file:%s?\n", filename);
 exit_program(1);
 }
 if (scan_all_pmts_set)

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


[FFmpeg-cvslog] lavc/mediacodecdec_h264: use h264_parse.h instead of h264dec.h

2016-09-07 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon 
Sep  5 15:46:29 2016 +0200| [4b290078e4c6ab48847cb65b9ff48b720a5ac8d6] | 
committer: Matthieu Bouron

lavc/mediacodecdec_h264: use h264_parse.h instead of h264dec.h

ff_h264_decode_extradata is referenced by h264_parse.h and not
h264dec.h.

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

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

diff --git a/libavcodec/mediacodecdec_h264.c b/libavcodec/mediacodecdec_h264.c
index 9350a32..4f9d737 100644
--- a/libavcodec/mediacodecdec_h264.c
+++ b/libavcodec/mediacodecdec_h264.c
@@ -32,7 +32,7 @@
 #include "libavutil/atomic.h"
 
 #include "avcodec.h"
-#include "h264dec.h"
+#include "h264_parse.h"
 #include "internal.h"
 #include "mediacodecdec.h"
 #include "mediacodec_wrapper.h"

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


[FFmpeg-cvslog] lavc/mediacodecdec_h264: move bsf variable declaration at the top of the function

2016-09-07 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Mon 
Sep  5 15:38:13 2016 +0200| [256e99f6f055c8bea226799c843db5df3a3bb701] | 
committer: Matthieu Bouron

lavc/mediacodecdec_h264: move bsf variable declaration at the top of the 
function

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

 libavcodec/mediacodecdec_h264.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mediacodecdec_h264.c b/libavcodec/mediacodecdec_h264.c
index 96e2a8a..9350a32 100644
--- a/libavcodec/mediacodecdec_h264.c
+++ b/libavcodec/mediacodecdec_h264.c
@@ -129,6 +129,8 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 int is_avc = 0;
 int nal_length_size = 0;
 
+const AVBitStreamFilter *bsf = NULL;
+
 FFAMediaFormat *format = NULL;
 MediaCodecH264DecContext *s = avctx->priv_data;
 
@@ -205,7 +207,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext 
*avctx)
 goto done;
 }
 
-const AVBitStreamFilter *bsf = av_bsf_get_by_name("h264_mp4toannexb");
+bsf = av_bsf_get_by_name("h264_mp4toannexb");
 if(!bsf) {
 ret = AVERROR_BSF_NOT_FOUND;
 goto done;

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


[FFmpeg-cvslog] avfilter/vf_waveform: make possible to change background opacity

2016-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Sep  7 22:19:45 
2016 +0200| [4fb6f9de0cfcbeb51684e5754bea8f10d4a8a9bf] | committer: Paul B Mahol

avfilter/vf_waveform: make possible to change background opacity

Only useful if output pixel format have alpha.

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi  |  3 +++
 libavfilter/vf_waveform.c | 25 +
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index a3158be..86a9599 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -14162,6 +14162,9 @@ Set scale used for displaying graticule.
 @item ire
 @end table
 Default is digital.
+
+@item bgopacity, b
+Set background opacity.
 @end table
 
 @section weave
diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index c2b84fb..64abbf2 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -66,9 +66,10 @@ typedef struct WaveformContext {
 const AVClass *class;
 intmode;
 intacomp;
+intdcomp;
 intncomp;
 intpcomp;
-const uint8_t  *bg_color;
+uint8_tbg_color[4];
 float  fintensity;
 intintensity;
 intmirror;
@@ -76,6 +77,7 @@ typedef struct WaveformContext {
 intenvelope;
 intgraticule;
 float  opacity;
+float  bgopacity;
 intestart[4];
 inteend[4];
 int*emax[4][4];
@@ -97,6 +99,7 @@ typedef struct WaveformContext {
  int column, int mirror);
 void (*graticulef)(struct WaveformContext *s, AVFrame *out);
 const AVPixFmtDescriptor *desc;
+const AVPixFmtDescriptor *odesc;
 } WaveformContext;
 
 #define OFFSET(x) offsetof(WaveformContext, x)
@@ -147,6 +150,8 @@ static const AVOption waveform_options[] = {
 { "digital",NULL, 0, AV_OPT_TYPE_CONST, {.i64=DIGITAL},0, 0, 
FLAGS, "scale" },
 { "millivolts", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MILLIVOLTS}, 0, 0, 
FLAGS, "scale" },
 { "ire",NULL, 0, AV_OPT_TYPE_CONST, {.i64=IRE},0, 0, 
FLAGS, "scale" },
+{ "bgopacity", "set background opacity", OFFSET(bgopacity), 
AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGS },
+{ "b", "set background opacity", OFFSET(bgopacity), 
AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGS },
 { NULL }
 };
 
@@ -2650,13 +2655,15 @@ static int config_input(AVFilterLink *inlink)
 case AV_PIX_FMT_GBRP9:
 case AV_PIX_FMT_GBRP10:
 case AV_PIX_FMT_GBRP12:
-s->bg_color = black_gbrp_color;
+memcpy(s->bg_color, black_gbrp_color, sizeof(s->bg_color));
 s->graticulef = graticule_none;
 break;
 default:
-s->bg_color = black_yuva_color;
+memcpy(s->bg_color, black_yuva_color, sizeof(s->bg_color));
 }
 
+s->bg_color[3] *= s->bgopacity;
+
 return 0;
 }
 
@@ -2672,6 +2679,8 @@ static int config_output(AVFilterLink *outlink)
 comp++;
 }
 s->acomp = comp;
+s->odesc = av_pix_fmt_desc_get(outlink->format);
+s->dcomp = s->odesc->nb_components;
 
 av_freep(&s->peak);
 
@@ -2733,20 +2742,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*in)
 out->pts = in->pts;
 av_frame_set_color_range(out, AVCOL_RANGE_JPEG);
 
-for (k = 0; k < s->ncomp; k++) {
+for (k = 0; k < s->dcomp; k++) {
 if (s->bits <= 8) {
 for (i = 0; i < outlink->h ; i++)
-memset(out->data[s->desc->comp[k].plane] +
-   i * out->linesize[s->desc->comp[k].plane],
+memset(out->data[s->odesc->comp[k].plane] +
+   i * out->linesize[s->odesc->comp[k].plane],
s->bg_color[k], outlink->w);
 } else {
 const int mult = s->max / 256;
-uint16_t *dst = (uint16_t *)out->data[s->desc->comp[k].plane];
+uint16_t *dst = (uint16_t *)out->data[s->odesc->comp[k].plane];
 
 for (i = 0; i < outlink->h ; i++) {
 for (j = 0; j < outlink->w; j++)
 dst[j] = s->bg_color[k] * mult;
-dst += out->linesize[s->desc->comp[k].plane] / 2;
+dst += out->linesize[s->odesc->comp[k].plane] / 2;
 }
 }
 }

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


[FFmpeg-cvslog] avformat/hlsenc: implement program_date_time

2016-09-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Sep  7 21:34:44 2016 +0200| [2793ebd6cb8e945a3ac3b3bfb2dc1c3420f668d6] | 
committer: Michael Niedermayer

avformat/hlsenc: implement program_date_time

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

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

 doc/muxers.texi   |  3 +++
 libavformat/hlsenc.c  | 23 +++
 libavformat/version.h |  2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index c39a6a0..ccf8ea1 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -522,6 +522,9 @@ behavior on some players when the time between keyframes is 
inconsistent,
 but may make things worse on others, and can cause some oddities during
 seeking. This flag should be used with the @code{hls_time} option.
 
+@item hls_flags program_date_time
+Generate @code{EXT-X-PROGRAM-DATE-TIME} tags.
+
 @item hls_playlist_type event
 Emit @code{#EXT-X-PLAYLIST-TYPE:EVENT} in the m3u8 header. Forces
 @option{hls_list_size} to 0; the playlist can only be appended to.
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index c0b5ef2..a376312 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -64,6 +64,7 @@ typedef enum HLSFlags {
 HLS_OMIT_ENDLIST = (1 << 4),
 HLS_SPLIT_BY_TIME = (1 << 5),
 HLS_APPEND_LIST = (1 << 6),
+HLS_PROGRAM_DATE_TIME = (1 << 7),
 } HLSFlags;
 
 typedef enum {
@@ -128,6 +129,7 @@ typedef struct HLSContext {
 
 char *method;
 
+double initial_prog_date_time;
 } HLSContext;
 
 static int hls_delete_old_segments(HLSContext *hls) {
@@ -481,6 +483,7 @@ static int hls_window(AVFormatContext *s, int last)
 char *key_uri = NULL;
 char *iv_string = NULL;
 AVDictionary *options = NULL;
+double prog_date_time = hls->initial_prog_date_time;
 
 if (!use_rename && !warned_non_file++)
 av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
may lead to races and temporarly partial files\n");
@@ -533,6 +536,19 @@ static int hls_window(AVFormatContext *s, int last)
 if (hls->flags & HLS_SINGLE_FILE)
  avio_printf(out, "#EXT-X-BYTERANGE:%"PRIi64"@%"PRIi64"\n",
  en->size, en->pos);
+if (hls->flags & HLS_PROGRAM_DATE_TIME) {
+time_t tt;
+int milli;
+struct tm *tm, tmpbuf;
+char buf0[128], buf1[128];
+tt = (int64_t)prog_date_time;
+milli = av_clip(lrint(1000*(prog_date_time - tt)), 0, 999);
+tm = localtime_r(&tt, &tmpbuf);
+strftime(buf0, sizeof(buf0), "%FT%T", tm);
+strftime(buf1, sizeof(buf1), "%z", tm);
+avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, 
milli, buf1);
+prog_date_time += en->duration;
+}
 if (hls->baseurl)
 avio_printf(out, "%s", hls->baseurl);
 avio_printf(out, "%s\n", en->filename);
@@ -710,6 +726,12 @@ static int hls_write_header(AVFormatContext *s)
 hls->recording_time = (hls->init_time ? hls->init_time : hls->time) * 
AV_TIME_BASE;
 hls->start_pts  = AV_NOPTS_VALUE;
 
+if (hls->flags & HLS_PROGRAM_DATE_TIME) {
+time_t now0;
+time(&now0);
+hls->initial_prog_date_time = now0;
+}
+
 if (hls->format_options_str) {
 ret = av_dict_parse_string(&hls->format_options, 
hls->format_options_str, "=", ":", 0);
 if (ret < 0) {
@@ -1005,6 +1027,7 @@ static const AVOption options[] = {
 {"omit_endlist", "Do not append an endlist when ending stream", 0, 
AV_OPT_TYPE_CONST, {.i64 = HLS_OMIT_ENDLIST }, 0, UINT_MAX,   E, "flags"},
 {"split_by_time", "split the hls segment by time which user set by 
hls_time", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SPLIT_BY_TIME }, 0, UINT_MAX,   E, 
"flags"},
 {"append_list", "append the new segments into old hls segment list", 0, 
AV_OPT_TYPE_CONST, {.i64 = HLS_APPEND_LIST }, 0, UINT_MAX,   E, "flags"},
+{"program_date_time", "add EXT-X-PROGRAM-DATE-TIME", 0, AV_OPT_TYPE_CONST, 
{.i64 = HLS_PROGRAM_DATE_TIME }, 0, UINT_MAX,   E, "flags"},
 {"use_localtime", "set filename expansion with strftime at segment 
creation", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
 {"use_localtime_mkdir", "create last directory component in 
strftime-generated filename", OFFSET(use_localtime_mkdir), AV_OPT_TYPE_BOOL, 
{.i64 = 0 }, 0, 1, E },
 {"hls_playlist_type", "set the HLS playlist type", OFFSET(pl_type), 
AV_OPT_TYPE_INT, {.i64 = PLAYLIST_TYPE_NONE }, 0, PLAYLIST_TYPE_NB-1, E, 
"pl_type" },
diff --git a/libavformat/version.h b/libavformat/version.h
index 9a9efee..90ac534 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINO