[FFmpeg-cvslog] avfilter/vf_scale: cosmetics

2019-09-27 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Thu Sep 26 
23:36:54 2019 +0800| [b9d479bac45bb4ce42b3f685bce5cad8d89f8f71] | committer: 
Michael Niedermayer

avfilter/vf_scale: cosmetics

Signed-off-by: Limin Wang 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index cb42794086..41ddec7661 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -396,16 +396,16 @@ static int scale_slice(AVFilterLink *link, AVFrame 
*out_buf, AVFrame *cur_pic, s
 int in_stride[4],out_stride[4];
 int i;
 
-for(i=0; i<4; i++){
+for (i=0; i<4; i++) {
 int vsub= ((i+1)&2) ? scale->vsub : 0;
  in_stride[i] = cur_pic->linesize[i] * mul;
 out_stride[i] = out_buf->linesize[i] * mul;
  in[i] = cur_pic->data[i] + ((y>>vsub)+field) * cur_pic->linesize[i];
 out[i] = out_buf->data[i] +field  * out_buf->linesize[i];
 }
-if(scale->input_is_pal)
+if (scale->input_is_pal)
  in[1] = cur_pic->data[1];
-if(scale->output_is_pal)
+if (scale->output_is_pal)
 out[1] = out_buf->data[1];
 
 return sws_scale(sws, in, in_stride, y/mul, h,
@@ -425,7 +425,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 if (in->colorspace == AVCOL_SPC_YCGCO)
 av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo 
colorspace.\n");
 
-if(   in->width  != link->w
+if (  in->width  != link->w
|| in->height != link->h
|| in->format != link->format
|| in->sample_aspect_ratio.den != link->sample_aspect_ratio.den || 
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num) {
@@ -445,7 +445,6 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 link->dst->inputs[0]->sample_aspect_ratio.den = 
in->sample_aspect_ratio.den;
 link->dst->inputs[0]->sample_aspect_ratio.num = 
in->sample_aspect_ratio.num;
 
-
 if ((ret = config_props(outlink)) < 0)
 return ret;
 }
@@ -469,7 +468,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 out->width  = outlink->w;
 out->height = outlink->h;
 
-if(scale->output_is_pal)
+if (scale->output_is_pal)
 avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == 
AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format);
 
 in_range = in->color_range;
@@ -520,10 +519,10 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
   (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,
   INT_MAX);
 
-if(scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)){
+if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) {
 scale_slice(link, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
 scale_slice(link, out, in, scale->isws[1], 0,  link->h   /2, 2, 1);
-}else if (scale->nb_slices) {
+} else if (scale->nb_slices) {
 int i, slice_h, slice_start, slice_end = 0;
 const int nb_slices = FFMIN(scale->nb_slices, link->h);
 for (i = 0; i < nb_slices; i++) {
@@ -532,7 +531,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 slice_h = slice_end - slice_start;
 scale_slice(link, out, in, scale->sws, slice_start, slice_h, 1, 0);
 }
-}else{
+} else {
 scale_slice(link, out, in, scale->sws, 0, link->h, 1, 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] swscale/swscale: cosmetics

2019-09-27 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Thu Sep 26 
23:44:59 2019 +0800| [cde1d70a39ade9dba264122727051108a7e7f398] | committer: 
Michael Niedermayer

swscale/swscale: cosmetics

Signed-off-by: Limin Wang 
Signed-off-by: Michael Niedermayer 

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

 libswscale/swscale.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index b4f958ad21..4ecfa88ff7 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -271,7 +271,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 int lastInLumBuf = c->lastInLumBuf;
 int lastInChrBuf = c->lastInChrBuf;
 
-
 int lumStart = 0;
 int lumEnd = c->descIndex[0];
 int chrStart = lumEnd;
@@ -283,13 +282,11 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 SwsSlice *vout_slice = &c->slice[c->numSlice-1];
 SwsFilterDescriptor *desc = c->desc;
 
-
 int needAlpha = c->needAlpha;
 
 int hasLumHoles = 1;
 int hasChrHoles = 1;
 
-
 if (isPacked(c->srcFormat)) {
 src[1] =
 src[2] =
@@ -570,7 +567,6 @@ static av_cold void sws_init_swscale(SwsContext *c)
 
 ff_sws_init_input_funcs(c);
 
-
 if (c->srcBpc == 8) {
 if (c->dstBpc <= 14) {
 c->hyScale = c->hcScale = hScale8To15_c;
@@ -788,8 +784,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 }
 
 if (c->gamma_flag && c->cascaded_context[0]) {
-
-
 ret = sws_scale(c->cascaded_context[0],
 srcSlice, srcStride, srcSliceY, srcSliceH,
 c->cascaded_tmp, c->cascaded_tmpStride);
@@ -983,7 +977,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 c->sliceDir = 0;
 ret = c->swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, 
dstStride2);
 
-
 if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {
 int dstY = c->dstY ? c->dstY : srcSliceY + srcSliceH;
 uint16_t *dst16 = (uint16_t*)(dst2[0] + (dstY - ret) * dstStride2[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] avformat/nut: add pcm_s64 support

2019-09-27 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep 27 12:12:42 
2019 +0200| [044167a171d5fafdea75046759e3bfcc2d8889b6] | committer: Paul B Mahol

avformat/nut: add pcm_s64 support

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

 libavformat/nut.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/nut.c b/libavformat/nut.c
index 937f452878..d6993239a3 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -227,6 +227,8 @@ const AVCodecTag ff_nut_audio_tags[] = {
 { AV_CODEC_ID_PCM_S24LE,MKTAG('P', 'S', 'D', 24 ) },
 { AV_CODEC_ID_PCM_S32BE,MKTAG(32 , 'D', 'S', 'P') },
 { AV_CODEC_ID_PCM_S32LE,MKTAG('P', 'S', 'D', 32 ) },
+{ AV_CODEC_ID_PCM_S64BE,MKTAG(64 , 'D', 'S', 'P') },
+{ AV_CODEC_ID_PCM_S64LE,MKTAG('P', 'S', 'D', 64 ) },
 { AV_CODEC_ID_PCM_S8,   MKTAG('P', 'S', 'D',  8 ) },
 { AV_CODEC_ID_PCM_U16BE,MKTAG(16 , 'D', 'U', 'P') },
 { AV_CODEC_ID_PCM_U16LE,MKTAG('P', 'U', 'D', 16 ) },

___
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/g729dec: set packet duration and correctly set timebase info

2019-09-27 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep 27 12:38:23 
2019 +0200| [35a12d2071efa5c408e6dd4a4a6d0cf930fb3eb3] | committer: Paul B Mahol

avformat/g729dec: set packet duration and correctly set timebase info

Fixes #6704.

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

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

diff --git a/libavformat/g729dec.c b/libavformat/g729dec.c
index 7b67fc488c..c58855cb99 100644
--- a/libavformat/g729dec.c
+++ b/libavformat/g729dec.c
@@ -61,8 +61,7 @@ static int g729_read_header(AVFormatContext *s)
 return AVERROR(EINVAL);
 }
 
-avpriv_set_pts_info(st, st->codecpar->block_align << 3, 1,
-st->codecpar->sample_rate);
+avpriv_set_pts_info(st, 64, 80, st->codecpar->sample_rate);
 
 return 0;
 }
@@ -76,6 +75,7 @@ static int g729_read_packet(AVFormatContext *s, AVPacket *pkt)
 
 pkt->stream_index = 0;
 pkt->dts = pkt->pts = pkt->pos / st->codecpar->block_align;
+pkt->duration = 1;
 
 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] avformat/dhav: fix demuxer since recent breakage

2019-09-27 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep 27 14:25:18 
2019 +0200| [bb697f30ab28604c57f4ac396f31116fd765d4b8] | committer: Paul B Mahol

avformat/dhav: fix demuxer since recent breakage

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

 libavformat/dhav.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index 6a67f981c7..120b8e4318 100644
--- a/libavformat/dhav.c
+++ b/libavformat/dhav.c
@@ -289,8 +289,9 @@ static int read_chunk(AVFormatContext *s)
 static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 DHAVContext *dhav = s->priv_data;
-int ret;
+int ret, stream_index;
 
+retry:
 while ((ret = read_chunk(s)) == 0)
 ;
 
@@ -357,10 +358,18 @@ static int dhav_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 avpriv_set_pts_info(st, 64, 1, 1000);
 }
 
+stream_index = dhav->type == 0xf0 ? dhav->audio_stream_index : 
dhav->video_stream_index;
+if (stream_index < 0) {
+avio_skip(s->pb, ret);
+if (avio_rl32(s->pb) == MKTAG('d','h','a','v'))
+avio_skip(s->pb, 4);
+goto retry;
+}
+
 ret = av_get_packet(s->pb, pkt, ret);
 if (ret < 0)
 return ret;
-pkt->stream_index = dhav->type == 0xf0 ? dhav->audio_stream_index : 
dhav->video_stream_index;
+pkt->stream_index = stream_index;
 if (dhav->type != 0xfc)
 pkt->flags   |= AV_PKT_FLAG_KEY;
 if (pkt->stream_index >= 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] avformat: use avpriv_mpeg4audio_get_config2()

2019-09-27 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Sep 21 20:06:48 
2019 -0300| [35bbaa665246c363a1d623ea9b1e43f770e2768c] | committer: James Almer

avformat: use avpriv_mpeg4audio_get_config2()

Signed-off-by: James Almer 

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

 libavformat/adtsenc.c | 2 +-
 libavformat/isom.c| 4 ++--
 libavformat/latmenc.c | 2 +-
 libavformat/matroskaenc.c | 3 +--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 3c2840c6ab..d937e2bea9 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -53,7 +53,7 @@ static int adts_decode_extradata(AVFormatContext *s, 
ADTSContext *adts, const ui
 int off;
 
 init_get_bits(&gb, buf, size * 8);
-off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
+off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
 if (off < 0)
 return off;
 skip_bits_long(&gb, off);
diff --git a/libavformat/isom.c b/libavformat/isom.c
index fa2e318099..edd0d81063 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -547,8 +547,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return ret;
 if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
 MPEG4AudioConfig cfg = {0};
-ret = avpriv_mpeg4audio_get_config(&cfg, st->codecpar->extradata,
-   st->codecpar->extradata_size * 
8, 1);
+ret = avpriv_mpeg4audio_get_config2(&cfg, st->codecpar->extradata,
+st->codecpar->extradata_size, 
1, fc);
 if (ret < 0)
 return ret;
 st->codecpar->channels = cfg.channels;
diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 1b16d752b6..db867ebf1a 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -62,7 +62,7 @@ static int latm_decode_extradata(AVFormatContext *s, uint8_t 
*buf, int size)
 av_log(s, AV_LOG_ERROR, "Extradata is larger than currently 
supported.\n");
 return AVERROR_INVALIDDATA;
 }
-ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
+ctx->off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
 if (ctx->off < 0)
 return ctx->off;
 
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index cef504fa05..a64ffdb690 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -717,8 +717,7 @@ static int get_aac_sample_rates(AVFormatContext *s, uint8_t 
*extradata, int extr
 MPEG4AudioConfig mp4ac;
 int ret;
 
-ret = avpriv_mpeg4audio_get_config(&mp4ac, extradata,
-   extradata_size * 8, 1);
+ret = avpriv_mpeg4audio_get_config2(&mp4ac, extradata, extradata_size, 1, 
s);
 /* Don't abort if the failure is because of missing extradata. Assume in 
that
  * case a bitstream filter will provide the muxer with the extradata in the
  * first packet.

___
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/mpeg4audio: add avpriv_mpeg4audio_get_config2()

2019-09-27 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Sep 21 19:57:11 
2019 -0300| [f96a8b015f2fa62b18a613ebdb3c26da50951652] | committer: James Almer

avcodec/mpeg4audio: add avpriv_mpeg4audio_get_config2()

Identical to avpriv_mpeg4audio_get_config() except taking a size argument in
bytes, and featuring a new logging context paremeter.

Schedule avpriv_mpeg4audio_get_config() for removal as soon as major is bumped
as well.

Signed-off-by: James Almer 

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

 libavcodec/aacdec_template.c |  2 +-
 libavcodec/mpeg4audio.c  | 22 --
 libavcodec/mpeg4audio.h  | 17 -
 3 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 6e086e00df..8726c8b828 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -975,7 +975,7 @@ static int decode_audio_specific_config_gb(AACContext *ac,
 int i, ret;
 GetBitContext gbc = *gb;
 
-if ((i = ff_mpeg4audio_get_config_gb(m4ac, &gbc, sync_extension)) < 0)
+if ((i = ff_mpeg4audio_get_config_gb(m4ac, &gbc, sync_extension, avctx)) < 
0)
 return AVERROR_INVALIDDATA;
 
 if (m4ac->sampling_index > 12) {
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 219714752f..6962a42537 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -84,7 +84,7 @@ static inline int get_sample_rate(GetBitContext *gb, int 
*index)
 }
 
 int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
-int sync_extension)
+int sync_extension, void *logctx)
 {
 int specific_config_bitindex, ret;
 int start_bit_index = get_bits_count(gb);
@@ -152,6 +152,7 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
 return specific_config_bitindex - start_bit_index;
 }
 
+#if LIBAVCODEC_VERSION_MAJOR < 59
 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
  int bit_size, int sync_extension)
 {
@@ -165,5 +166,22 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, 
const uint8_t *buf,
 if (ret < 0)
 return ret;
 
-return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension);
+return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension, NULL);
+}
+#endif
+
+int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf,
+  int size, int sync_extension, void *logctx)
+{
+GetBitContext gb;
+int ret;
+
+if (size <= 0)
+return AVERROR_INVALIDDATA;
+
+ret = init_get_bits8(&gb, buf, size);
+if (ret < 0)
+return ret;
+
+return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension, logctx);
 }
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index b9cea8af17..00aa680c13 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -53,11 +53,13 @@ extern const uint8_t ff_mpeg4audio_channels[8];
  * @param[in] cMPEG4AudioConfig structure to fill.
  * @param[in] gb   Extradata from container.
  * @param[in] sync_extension look for a sync extension after config if true.
+ * @param[in] logctx opaque struct starting with an AVClass element, used for 
logging.
  * @return On error -1 is returned, on success AudioSpecificConfig bit index 
in extradata.
  */
 int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
-int sync_extension);
+int sync_extension, void *logctx);
 
+#if LIBAVCODEC_VERSION_MAJOR < 59
 /**
  * Parse MPEG-4 systems extradata from a raw buffer to retrieve audio 
configuration.
  * @param[in] cMPEG4AudioConfig structure to fill.
@@ -68,6 +70,19 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
  */
 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
  int bit_size, int sync_extension);
+#endif
+
+/**
+ * Parse MPEG-4 systems extradata from a raw buffer to retrieve audio 
configuration.
+ * @param[in] cMPEG4AudioConfig structure to fill.
+ * @param[in] buf  Extradata from container.
+ * @param[in] size Extradata size in bytes.
+ * @param[in] sync_extension look for a sync extension after config if true.
+ * @param[in] logctx opaque struct starting with an AVClass element, used for 
logging.
+ * @return negative AVERROR code on error, AudioSpecificConfig bit index in 
extradata on success.
+ */
+int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf,
+  int size, int sync_extension, void *logctx);
 
 enum AudioObjectType {
 AOT_NULL,

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

To unsubscribe, visit

[FFmpeg-cvslog] avcodec: use avpriv_mpeg4audio_get_config2()

2019-09-27 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Sep 21 20:04:33 
2019 -0300| [d582cc17e1f668c3b3ff5c3e36cc68c85161f0a7] | committer: James Almer

avcodec: use avpriv_mpeg4audio_get_config2()

Signed-off-by: James Almer 

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

 libavcodec/aac_adtstoasc_bsf.c | 4 ++--
 libavcodec/alsdec.c| 4 ++--
 libavcodec/mpegaudiodec_template.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
index 6541b1189c..e378296950 100644
--- a/libavcodec/aac_adtstoasc_bsf.c
+++ b/libavcodec/aac_adtstoasc_bsf.c
@@ -134,8 +134,8 @@ static int aac_adtstoasc_init(AVBSFContext *ctx)
 /* Validate the extradata if the stream is already MPEG-4 
AudioSpecificConfig */
 if (ctx->par_in->extradata) {
 MPEG4AudioConfig mp4ac;
-int ret = avpriv_mpeg4audio_get_config(&mp4ac, ctx->par_in->extradata,
-   ctx->par_in->extradata_size * 
8, 1);
+int ret = avpriv_mpeg4audio_get_config2(&mp4ac, ctx->par_in->extradata,
+ctx->par_in->extradata_size, 
1, ctx);
 if (ret < 0) {
 av_log(ctx, AV_LOG_ERROR, "Error parsing AudioSpecificConfig 
extradata!\n");
 return ret;
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 56313d206c..fafc3a757b 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -302,8 +302,8 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
 if ((ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size)) < 
0)
 return ret;
 
-config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata,
- avctx->extradata_size * 8, 1);
+config_offset = avpriv_mpeg4audio_get_config2(&m4ac, avctx->extradata,
+  avctx->extradata_size, 1, 
avctx);
 
 if (config_offset < 0)
 return AVERROR_INVALIDDATA;
diff --git a/libavcodec/mpegaudiodec_template.c 
b/libavcodec/mpegaudiodec_template.c
index 9cce88e263..3f1674e827 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -1851,8 +1851,8 @@ static av_cold int decode_init_mp3on4(AVCodecContext * 
avctx)
 return AVERROR_INVALIDDATA;
 }
 
-avpriv_mpeg4audio_get_config(&cfg, avctx->extradata,
- avctx->extradata_size * 8, 1);
+avpriv_mpeg4audio_get_config2(&cfg, avctx->extradata,
+  avctx->extradata_size, 1, avctx);
 if (!cfg.chan_config || cfg.chan_config > 7) {
 av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
 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] avcodec/mpeg4audio: fix doxy for ff_mpeg4audio_get_config_gb()

2019-09-27 Thread James Almer
ffmpeg | branch: master | James Almer  | Fri Sep 27 10:43:36 
2019 -0300| [75c7484fcb18dce4a9c00733dfcd8611877adbf6] | committer: James Almer

avcodec/mpeg4audio: fix doxy for ff_mpeg4audio_get_config_gb()

Signed-off-by: James Almer 

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

 libavcodec/mpeg4audio.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index 00aa680c13..4b390e0f42 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -54,7 +54,7 @@ extern const uint8_t ff_mpeg4audio_channels[8];
  * @param[in] gb   Extradata from container.
  * @param[in] sync_extension look for a sync extension after config if true.
  * @param[in] logctx opaque struct starting with an AVClass element, used for 
logging.
- * @return On error -1 is returned, on success AudioSpecificConfig bit index 
in extradata.
+ * @return negative AVERROR code on error, on success AudioSpecificConfig bit 
index in extradata.
  */
 int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
 int sync_extension, void *logctx);
@@ -66,7 +66,7 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
  * @param[in] buf  Extradata from container.
  * @param[in] bit_size Extradata size in bits.
  * @param[in] sync_extension look for a sync extension after config if true.
- * @return On error -1 is returned, on success AudioSpecificConfig bit index 
in extradata.
+ * @return negative AVERROR code on error, on success AudioSpecificConfig bit 
index in extradata.
  */
 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
  int bit_size, int sync_extension);

___
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/mpeg4audio: add chan_config check to avoid indeterminate channels

2019-09-27 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Sep 21 
19:29:47 2019 +0800| [333109f46961946d3c6fab05210a8d543697c91b] | committer: 
James Almer

lavc/mpeg4audio: add chan_config check to avoid indeterminate channels

add chan_config check to avoid indeterminate channels.

Signed-off-by: Jun Zhao 
Signed-off-by: James Almer 

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

 libavcodec/mpeg4audio.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 6962a42537..e4d6716f7f 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -93,6 +93,10 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
 c->chan_config = get_bits(gb, 4);
 if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
 c->channels = ff_mpeg4audio_channels[c->chan_config];
+else {
+av_log(logctx, AV_LOG_ERROR, "Invalid chan_config %d\n", 
c->chan_config);
+return AVERROR_INVALIDDATA;
+}
 c->sbr = -1;
 c->ps  = -1;
 if (c->object_type == AOT_SBR || (c->object_type == AOT_PS &&

___
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] lavu/qsv: remove redundant version query

2019-09-27 Thread Zhong Li
ffmpeg | branch: master | Zhong Li  | Fri Sep 20 04:45:25 
2019 +0800| [0686651aab1de86cf25ec3c611fe82f9f5d7099c] | committer: Zhong Li

lavu/qsv: remove redundant version query

Signed-off-by: Zhong Li 

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

 libavutil/hwcontext_qsv.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 0329a81ec3..b1b67400de 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1180,11 +1180,6 @@ static int 
qsv_device_derive_from_child(AVHWDeviceContext *ctx,
 goto fail;
 }
 
-ret = MFXQueryVersion(hwctx->session,&ver);
-if (ret == MFX_ERR_NONE) {
-av_log(ctx, AV_LOG_VERBOSE, "MFX compile/runtime API: %d.%d/%d.%d\n",
-   MFX_VERSION_MAJOR, MFX_VERSION_MINOR, ver.Major, ver.Minor);
-}
 return 0;
 
 fail:

___
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] libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

2019-09-27 Thread Ross Nicholson
ffmpeg | branch: master | Ross Nicholson  | Thu Sep 19 
16:12:33 2019 +0100| [460f74495fa93c4bb85503c5443580e2bb857efa] | committer: 
Aman Gupta

libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

Signed-off-by: Aman Gupta 

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

 libavformat/rtsp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c153cac88b..859defa592 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1318,6 +1318,9 @@ static int 
rtsp_send_cmd_with_content_async(AVFormatContext *s,
 char buf[4096], *out_buf;
 char base64buf[AV_BASE64_SIZE(sizeof(buf))];
 
+if (!rt->rtsp_hd_out)
+return ENOTCONN;
+
 /* Add in RTSP headers */
 out_buf = buf;
 rt->seq++;

___
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/nvenc: add multiple reference frames support

2019-09-27 Thread Roman Arzumanyan
ffmpeg | branch: master | Roman Arzumanyan  | Fri Sep 
27 17:56:11 2019 +0200| [567b5e33d9d77919ee920c091f4273c5b38fc821] | committer: 
Timo Rothenpieler

avcodec/nvenc: add multiple reference frames support

Signed-off-by: Timo Rothenpieler 

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

 libavcodec/nvenc.c   | 23 +++
 libavcodec/nvenc.h   |  5 +
 libavcodec/version.h |  2 +-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 158e304a0c..8a7347b84e 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -403,6 +403,19 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 }
 #endif
 
+#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES
+ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES);
+if(avctx->refs != NV_ENC_NUM_REF_FRAMES_AUTOSELECT && ret <= 0) {
+av_log(avctx, AV_LOG_VERBOSE, "Multiple reference frames are not 
supported\n");
+return AVERROR(ENOSYS);
+}
+#else
+if(avctx->refs != 0) {
+av_log(avctx, AV_LOG_VERBOSE, "Multiple reference frames need SDK 9.1 
at build time\n");
+return AVERROR(ENOSYS);
+}
+#endif
+
 ctx->support_dyn_bitrate = nvenc_check_cap(avctx, 
NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE);
 
 return 0;
@@ -1010,6 +1023,11 @@ static av_cold int 
nvenc_setup_h264_config(AVCodecContext *avctx)
 h264->useBFramesAsRef = ctx->b_ref_mode;
 #endif
 
+#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES
+h264->numRefL0 = avctx->refs;
+h264->numRefL1 = avctx->refs;
+#endif
+
 return 0;
 }
 
@@ -1094,6 +1112,11 @@ static av_cold int 
nvenc_setup_hevc_config(AVCodecContext *avctx)
 hevc->useBFramesAsRef = ctx->b_ref_mode;
 #endif
 
+#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES
+hevc->numRefL0 = avctx->refs;
+hevc->numRefL1 = avctx->refs;
+#endif
+
 return 0;
 }
 
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 892a001f69..46ad7972bc 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -54,6 +54,11 @@ typedef void ID3D11Device;
 #define NVENC_HAVE_HEVC_BFRAME_REF_MODE
 #endif
 
+// SDK 9.1 compile time feature checks
+#if NVENCAPI_CHECK_VERSION(9, 1)
+#define NVENC_HAVE_MULTIPLE_REF_FRAMES
+#endif
+
 typedef struct NvencSurface
 {
 NV_ENC_INPUT_PTR input_surface;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 67f2a90739..04b210371e 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 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #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] avcodec/nvenc: make use of new GetLastErrorString function

2019-09-27 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Fri Sep 
27 19:09:11 2019 +0200| [ab0ef1abdf53e257f7628f2d264adc80038f3bcb] | committer: 
Timo Rothenpieler

avcodec/nvenc: make use of new GetLastErrorString function

Signed-off-by: Timo Rothenpieler 

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

 libavcodec/nvenc.c | 18 ++
 libavcodec/nvenc.h |  1 +
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 2de2bfdacb..bbb43ddad8 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -110,13 +110,23 @@ static int nvenc_map_error(NVENCSTATUS err, const char 
**desc)
 return AVERROR_UNKNOWN;
 }
 
-static int nvenc_print_error(void *log_ctx, NVENCSTATUS err,
+static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err,
  const char *error_string)
 {
 const char *desc;
-int ret;
-ret = nvenc_map_error(err, &desc);
-av_log(log_ctx, AV_LOG_ERROR, "%s: %s (%d)\n", error_string, desc, err);
+const char *details = "(no details)";
+int ret = nvenc_map_error(err, &desc);
+
+#ifdef NVENC_HAVE_GETLASTERRORSTRING
+NvencContext *ctx = avctx->priv_data;
+NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs;
+
+if (p_nvenc && ctx->nvencoder)
+details = p_nvenc->nvEncGetLastErrorString(ctx->nvencoder);
+#endif
+
+av_log(avctx, AV_LOG_ERROR, "%s: %s (%d): %s\n", error_string, desc, err, 
details);
+
 return ret;
 }
 
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index cdba998ffd..a269bd97bb 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -58,6 +58,7 @@ typedef void ID3D11Device;
 #if NVENCAPI_CHECK_VERSION(9, 1)
 #define NVENC_HAVE_MULTIPLE_REF_FRAMES
 #define NVENC_HAVE_CUSTREAM_PTR
+#define NVENC_HAVE_GETLASTERRORSTRING
 #endif
 
 typedef struct NvencSurface

___
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/nvenc: switch to dedicated dpb_size option

2019-09-27 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Fri Sep 
27 17:55:23 2019 +0200| [e929b2f248a9c49761475e07d1a089e05912d1c6] | committer: 
Timo Rothenpieler

avcodec/nvenc: switch to dedicated dpb_size option

Signed-off-by: Timo Rothenpieler 

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

 libavcodec/nvenc.c  | 10 +-
 libavcodec/nvenc.h  |  1 +
 libavcodec/nvenc_h264.c |  2 ++
 libavcodec/nvenc_hevc.c |  2 ++
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 316e4a3679..158e304a0c 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -949,9 +949,9 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext 
*avctx)
 h264->repeatSPSPPS  = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;
 h264->outputAUD = ctx->aud;
 
-if (avctx->refs >= 0) {
+if (ctx->dpb_size >= 0) {
 /* 0 means "let the hardware decide" */
-h264->maxNumRefFrames = avctx->refs;
+h264->maxNumRefFrames = ctx->dpb_size;
 }
 if (avctx->gop_size >= 0) {
 h264->idrPeriod = cc->gopLength;
@@ -1041,9 +1041,9 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext 
*avctx)
 hevc->repeatSPSPPS  = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;
 hevc->outputAUD = ctx->aud;
 
-if (avctx->refs >= 0) {
+if (ctx->dpb_size >= 0) {
 /* 0 means "let the hardware decide" */
-hevc->maxNumRefFramesInDPB = avctx->refs;
+hevc->maxNumRefFramesInDPB = ctx->dpb_size;
 }
 if (avctx->gop_size >= 0) {
 hevc->idrPeriod = cc->gopLength;
@@ -1175,7 +1175,7 @@ static av_cold int nvenc_setup_encoder(AVCodecContext 
*avctx)
 
 if (ctx->bluray_compat) {
 ctx->aud = 1;
-avctx->refs = FFMIN(FFMAX(avctx->refs, 0), 6);
+ctx->dpb_size = FFMIN(FFMAX(avctx->refs, 0), 6);
 avctx->max_b_frames = FFMIN(avctx->max_b_frames, 3);
 switch (avctx->codec->id) {
 case AV_CODEC_ID_H264:
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index ddd6168409..892a001f69 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -192,6 +192,7 @@ typedef struct NvencContext
 int coder;
 int b_ref_mode;
 int a53_cc;
+int dpb_size;
 } NvencContext;
 
 int ff_nvenc_encode_init(AVCodecContext *avctx);
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index a6623f5f35..d5c7370aaa 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -138,6 +138,8 @@ static const AVOption options[] = {
 { "middle",   "",   0, 
   AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0,   VE, "b_ref_mode" },
 #endif
 { "a53cc","Use A53 Closed Captions (if available)", 
OFFSET(a53_cc),   AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1, VE },
+{ "dpb_size", "Specifies the DPB size used for encoding (0 means 
automatic)",
+OFFSET(dpb_size),  
   AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
 { NULL }
 };
 
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index d567d960ba..c668b97f86 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -127,6 +127,8 @@ static const AVOption options[] = {
 { "each", "",   0, 
   AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0,   VE, "b_ref_mode" },
 { "middle",   "",   0, 
   AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0,   VE, "b_ref_mode" },
 #endif
+{ "dpb_size", "Specifies the DPB size used for encoding (0 means 
automatic)",
+OFFSET(dpb_size),  
   AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
 { 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/nvenc: pass CUstream to nvenc when available

2019-09-27 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Fri Sep 
27 18:30:10 2019 +0200| [51a23343d9c736217d8845b7442fafc373726433] | committer: 
Timo Rothenpieler

avcodec/nvenc: pass CUstream to nvenc when available

Signed-off-by: Timo Rothenpieler 

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

 libavcodec/nvenc.c | 20 
 libavcodec/nvenc.h |  2 ++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 8a7347b84e..2de2bfdacb 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -460,6 +460,7 @@ static av_cold int nvenc_check_device(AVCodecContext 
*avctx, int idx)
 goto fail;
 
 ctx->cu_context = ctx->cu_context_internal;
+ctx->cu_stream = NULL;
 
 if ((ret = nvenc_pop_context(avctx)) < 0)
 goto fail2;
@@ -546,6 +547,7 @@ static av_cold int nvenc_setup_device(AVCodecContext *avctx)
 
 if (cuda_device_hwctx) {
 ctx->cu_context = cuda_device_hwctx->cuda_ctx;
+ctx->cu_stream = cuda_device_hwctx->stream;
 }
 #if CONFIG_D3D11VA
 else if (d3d11_device_hwctx) {
@@ -1245,15 +1247,25 @@ static av_cold int nvenc_setup_encoder(AVCodecContext 
*avctx)
 return res;
 
 nv_status = p_nvenc->nvEncInitializeEncoder(ctx->nvencoder, 
&ctx->init_encode_params);
+if (nv_status != NV_ENC_SUCCESS) {
+nvenc_pop_context(avctx);
+return nvenc_print_error(avctx, nv_status, "InitializeEncoder failed");
+}
+
+#ifdef NVENC_HAVE_CUSTREAM_PTR
+if (ctx->cu_context) {
+nv_status = p_nvenc->nvEncSetIOCudaStreams(ctx->nvencoder, 
&ctx->cu_stream, &ctx->cu_stream);
+if (nv_status != NV_ENC_SUCCESS) {
+nvenc_pop_context(avctx);
+return nvenc_print_error(avctx, nv_status, "SetIOCudaStreams 
failed");
+}
+}
+#endif
 
 res = nvenc_pop_context(avctx);
 if (res < 0)
 return res;
 
-if (nv_status != NV_ENC_SUCCESS) {
-return nvenc_print_error(avctx, nv_status, "InitializeEncoder failed");
-}
-
 if (ctx->encode_config.frameIntervalP > 1)
 avctx->has_b_frames = 2;
 
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 46ad7972bc..cdba998ffd 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -57,6 +57,7 @@ typedef void ID3D11Device;
 // SDK 9.1 compile time feature checks
 #if NVENCAPI_CHECK_VERSION(9, 1)
 #define NVENC_HAVE_MULTIPLE_REF_FRAMES
+#define NVENC_HAVE_CUSTREAM_PTR
 #endif
 
 typedef struct NvencSurface
@@ -132,6 +133,7 @@ typedef struct NvencContext
 NV_ENC_CONFIG encode_config;
 CUcontext cu_context;
 CUcontext cu_context_internal;
+CUstream cu_stream;
 ID3D11Device *d3d11_device;
 
 int nb_surfaces;

___
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/ffmpeg: -timelimit is in user time

2019-09-27 Thread Lou Logan
ffmpeg | branch: master | Lou Logan  | Thu Sep 26 10:18:57 2019 
-0800| [419e5e794285b9c4df34251a92698e9e75aa5e35] | committer: Lou Logan

doc/ffmpeg: -timelimit is in user time

Signed-off-by: Lou Logan 
Signed-off-by: Michael Niedermayer 

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

 doc/ffmpeg.texi  | 2 +-
 fftools/ffmpeg_opt.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 1da18d9d0b..92337d 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1383,7 +1383,7 @@ it will usually display as 0 if not supported.
 Show benchmarking information during the encode.
 Shows real, system and user time used in various steps (audio/video 
encode/decode).
 @item -timelimit @var{duration} (@emph{global})
-Exit after ffmpeg has been running for @var{duration} seconds.
+Exit after ffmpeg has been running for @var{duration} seconds in CPU user time.
 @item -dump (@emph{global})
 Dump each input packet to stderr.
 @item -hex (@emph{global})
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index b2aa63e7ee..661441c161 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -3443,7 +3443,7 @@ const OptionDef options[] = {
 { "stdin",  OPT_BOOL | OPT_EXPERT,   { 
&stdin_interaction },
   "enable or disable interaction on standard input" },
 { "timelimit",  HAS_ARG | OPT_EXPERT,{ 
.func_arg = opt_timelimit },
-"set max runtime in seconds", "limit" },
+"set max runtime in seconds in CPU user time", "limit" },
 { "dump",   OPT_BOOL | OPT_EXPERT,   { 
&do_pkt_dump },
 "dump each input packet" },
 { "hex",OPT_BOOL | OPT_EXPERT,   { 
&do_hex_dump },

___
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] ffmpeg_opt: remove errant space

2019-09-27 Thread Lou Logan
ffmpeg | branch: master | Lou Logan  | Fri Sep 27 15:17:15 2019 
-0800| [04858650b1787c132c865530084855b36027b8a7] | committer: Lou Logan

ffmpeg_opt: remove errant space

Signed-off-by: Lou Logan 

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

 fftools/ffmpeg_opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 661441c161..fa22eb361d 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -932,7 +932,7 @@ static void assert_file_overwrite(const char *filename)
 if (!file_overwrite) {
 if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 
0) == 0) {
 if (stdin_interaction && !no_file_overwrite) {
-fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", 
filename);
+fprintf(stderr,"File '%s' already exists. Overwrite? [y/N] ", 
filename);
 fflush(stderr);
 term_exit();
 signal(SIGINT, SIG_DFL);

___
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] aformat/movenc: add missing padding to output track extradata

2019-09-27 Thread James Almer
ffmpeg | branch: release/4.1 | James Almer  | Wed Sep 25 
14:21:07 2019 -0300| [3ecbb180ef3b0524459d9bea9260c94356055b0e] | committer: 
James Almer

aformat/movenc: add missing padding to output track extradata

Fixes ticket #8183.

Tested-by: Thierry Foucu 
Signed-off-by: James Almer 
(cherry picked from commit 58aa0ed8f10753ee90f4a4a1f4f3da803cf7c145)

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

 libavformat/movenc.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2a45302ebb..1a1bd9eaad 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5298,12 +5298,13 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 !TAG_IS_AVCI(trk->tag) &&
 (par->codec_id != AV_CODEC_ID_DNXHD)) {
 trk->vos_len  = par->extradata_size;
-trk->vos_data = av_malloc(trk->vos_len);
+trk->vos_data = av_malloc(trk->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
 if (!trk->vos_data) {
 ret = AVERROR(ENOMEM);
 goto err;
 }
 memcpy(trk->vos_data, par->extradata, trk->vos_len);
+memset(trk->vos_data + trk->vos_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 }
 
 if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
@@ -5380,12 +5381,13 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket 
*pkt)
  par->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
 /* copy frame to create needed atoms */
 trk->vos_len  = size;
-trk->vos_data = av_malloc(size);
+trk->vos_data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
 if (!trk->vos_data) {
 ret = AVERROR(ENOMEM);
 goto err;
 }
 memcpy(trk->vos_data, pkt->data, size);
+memset(trk->vos_data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 }
 
 if (trk->entry >= trk->cluster_capacity) {
@@ -6007,12 +6009,13 @@ static int 
mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
 cur += strspn(cur, "\n\r");
 }
 if (have_palette) {
-track->vos_data = av_malloc(16*4);
+track->vos_data = av_malloc(16*4 + AV_INPUT_BUFFER_PADDING_SIZE);
 if (!track->vos_data)
 return AVERROR(ENOMEM);
 for (i = 0; i < 16; i++) {
 AV_WB32(track->vos_data + i * 4, palette[i]);
 }
+memset(track->vos_data + 16*4, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 track->vos_len = 16 * 4;
 }
 st->codecpar->width = width;
@@ -6364,11 +6367,12 @@ static int mov_write_header(AVFormatContext *s)
 mov_create_dvd_sub_decoder_specific_info(track, st);
 else if (!TAG_IS_AVCI(track->tag) && st->codecpar->codec_id != 
AV_CODEC_ID_DNXHD) {
 track->vos_len  = st->codecpar->extradata_size;
-track->vos_data = av_malloc(track->vos_len);
+track->vos_data = av_malloc(track->vos_len + 
AV_INPUT_BUFFER_PADDING_SIZE);
 if (!track->vos_data) {
 return AVERROR(ENOMEM);
 }
 memcpy(track->vos_data, st->codecpar->extradata, 
track->vos_len);
+memset(track->vos_data + track->vos_len, 0, 
AV_INPUT_BUFFER_PADDING_SIZE);
 }
 }
 
@@ -6624,10 +6628,11 @@ static int mov_write_trailer(AVFormatContext *s)
 AVCodecParameters *par = track->par;
 
 track->vos_len  = par->extradata_size;
-track->vos_data = av_malloc(track->vos_len);
+track->vos_data = av_malloc(track->vos_len + 
AV_INPUT_BUFFER_PADDING_SIZE);
 if (!track->vos_data)
 return AVERROR(ENOMEM);
 memcpy(track->vos_data, par->extradata, track->vos_len);
+memset(track->vos_data + track->vos_len, 0, 
AV_INPUT_BUFFER_PADDING_SIZE);
 }
 mov->need_rewrite_extradata = 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] lavc/mpeg4audio: add chan_config check to avoid indeterminate channels

2019-09-27 Thread Jun Zhao
ffmpeg | branch: release/4.1 | Jun Zhao  | Sat Sep 21 
19:29:47 2019 +0800| [4fbeaaa2208e723707bcc8bed7cac4e3a7da5359] | committer: 
James Almer

lavc/mpeg4audio: add chan_config check to avoid indeterminate channels

add chan_config check to avoid indeterminate channels.

Signed-off-by: Jun Zhao 
Signed-off-by: James Almer 
(cherry picked from commit 333109f46961946d3c6fab05210a8d543697c91b)

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

 libavcodec/mpeg4audio.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 219714752f..2dbd972eaf 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -93,6 +93,10 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
 c->chan_config = get_bits(gb, 4);
 if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
 c->channels = ff_mpeg4audio_channels[c->chan_config];
+else {
+av_log(NULL, AV_LOG_ERROR, "Invalid chan_config %d\n", c->chan_config);
+return AVERROR_INVALIDDATA;
+}
 c->sbr = -1;
 c->ps  = -1;
 if (c->object_type == AOT_SBR || (c->object_type == AOT_PS &&

___
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/mpeg4audio: add chan_config check to avoid indeterminate channels

2019-09-27 Thread Jun Zhao
ffmpeg | branch: release/4.2 | Jun Zhao  | Sat Sep 21 
19:29:47 2019 +0800| [61853f7503530ae11ed407a80463dc7ac2e7362d] | committer: 
James Almer

lavc/mpeg4audio: add chan_config check to avoid indeterminate channels

add chan_config check to avoid indeterminate channels.

Signed-off-by: Jun Zhao 
Signed-off-by: James Almer 
(cherry picked from commit 333109f46961946d3c6fab05210a8d543697c91b)

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

 libavcodec/mpeg4audio.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 219714752f..2dbd972eaf 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -93,6 +93,10 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
 c->chan_config = get_bits(gb, 4);
 if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
 c->channels = ff_mpeg4audio_channels[c->chan_config];
+else {
+av_log(NULL, AV_LOG_ERROR, "Invalid chan_config %d\n", c->chan_config);
+return AVERROR_INVALIDDATA;
+}
 c->sbr = -1;
 c->ps  = -1;
 if (c->object_type == AOT_SBR || (c->object_type == AOT_PS &&

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