[FFmpeg-cvslog] lavf: add avformat_transfer_internal_stream_timing_info() and use it in ffmpeg

2016-09-14 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Fri Sep  9 
16:38:21 2016 +0200| [ae1dd0c9a61627169b9464ba56d3fea7ba19d4a1] | committer: 
Clément Bœsch

lavf: add avformat_transfer_internal_stream_timing_info() and use it in ffmpeg

In lavf we have access to st->internal->avctx so it's a better place
than in ffmpeg*.c and will allow moving to codecpar.

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

 doc/APIchanges |  4 
 ffmpeg.c   | 52 
 libavformat/avformat.h | 23 ++
 libavformat/utils.c| 64 ++
 libavformat/version.h  |  4 ++--
 5 files changed, 97 insertions(+), 50 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7ac809c..158a0b2 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-09-xx - xxx - lavf 57.49.100 - avformat.h
+  Add avformat_transfer_internal_stream_timing_info helper to help with stream
+  copy.
+
 2016-08-29 - 4493390 - lavfi 6.58.100 - avfilter.h
   Add AVFilterContext.nb_threads.
 
diff --git a/ffmpeg.c b/ffmpeg.c
index 4225978..5d7d32a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2909,57 +2909,13 @@ static int transcode_init(void)
 enc_ctx->bits_per_coded_sample  = dec_ctx->bits_per_coded_sample;
 enc_ctx->bits_per_raw_sample= dec_ctx->bits_per_raw_sample;
 
-enc_ctx->time_base = ist->st->time_base;
-/*
- * Avi is a special case here because it supports variable fps but
- * having the fps and timebase differe significantly adds quite 
some
- * overhead
- */
-if(!strcmp(oc->oformat->name, "avi")) {
-if ( copy_tb<0 && ist->st->r_frame_rate.num
-   && av_q2d(ist->st->r_frame_rate) >= 
av_q2d(ist->st->avg_frame_rate)
-   && 0.5/av_q2d(ist->st->r_frame_rate) > 
av_q2d(ist->st->time_base)
-   && 0.5/av_q2d(ist->st->r_frame_rate) > 
av_q2d(dec_ctx->time_base)
-   && av_q2d(ist->st->time_base) < 1.0/500 && 
av_q2d(dec_ctx->time_base) < 1.0/500
- || copy_tb==2){
-enc_ctx->time_base.num = ist->st->r_frame_rate.den;
-enc_ctx->time_base.den = 2*ist->st->r_frame_rate.num;
-enc_ctx->ticks_per_frame = 2;
-} else if (   copy_tb<0 && 
av_q2d(dec_ctx->time_base)*dec_ctx->ticks_per_frame > 
2*av_q2d(ist->st->time_base)
- && av_q2d(ist->st->time_base) < 1.0/500
-|| copy_tb==0){
-enc_ctx->time_base = dec_ctx->time_base;
-enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
-enc_ctx->time_base.den *= 2;
-enc_ctx->ticks_per_frame = 2;
-}
-} else if(!(oc->oformat->flags & AVFMT_VARIABLE_FPS)
-  && strcmp(oc->oformat->name, "mov") && 
strcmp(oc->oformat->name, "mp4") && strcmp(oc->oformat->name, "3gp")
-  && strcmp(oc->oformat->name, "3g2") && 
strcmp(oc->oformat->name, "psp") && strcmp(oc->oformat->name, "ipod")
-  && strcmp(oc->oformat->name, "f4v")
-) {
-if(   copy_tb<0 && dec_ctx->time_base.den
-&& 
av_q2d(dec_ctx->time_base)*dec_ctx->ticks_per_frame > av_q2d(ist->st->time_base)
-&& av_q2d(ist->st->time_base) < 1.0/500
-   || copy_tb==0){
-enc_ctx->time_base = dec_ctx->time_base;
-enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
-}
-}
-if (   enc_ctx->codec_tag == AV_RL32("tmcd")
-&& dec_ctx->time_base.num < dec_ctx->time_base.den
-&& dec_ctx->time_base.num > 0
-&& 121LL*dec_ctx->time_base.num > dec_ctx->time_base.den) {
-enc_ctx->time_base = dec_ctx->time_base;
-}
-
 if (!ost->frame_rate.num)
 ost->frame_rate = ist->framerate;
-if(ost->frame_rate.num)
-enc_ctx->time_base = av_inv_q(ost->frame_rate);
+ost->st->avg_frame_rate = ost->frame_rate;
 
-av_reduce(&enc_ctx->time_base.num, &enc_ctx->time_base.den,
-enc_ctx->time_base.num, enc_ctx->time_base.den, 
INT_MAX);
+ret = avformat_transfer_internal_stream_timing_info(oc->oformat, 
ost->st, ist->st, copy_tb);
+if (ret < 0)
+return ret;
 
 if (ist->st->nb_side_data) {
 ost->st->side_data = av_realloc_array(NULL, 
ist->st->nb_side_data,
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 

[FFmpeg-cvslog] lavf/utils: simplify matching MOV-like formats

2016-09-14 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Wed Sep 14 
09:59:22 2016 +0200| [9112822e710983f7ebf3cef9efadd28d8714dd43] | committer: 
Clément Bœsch

lavf/utils: simplify matching MOV-like formats

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

 libavformat/utils.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index f4a836d..06c7582 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5318,9 +5318,7 @@ int avformat_transfer_internal_stream_timing_info(const 
AVOutputFormat *ofmt,
 enc_ctx->ticks_per_frame = 2;
 }
 } else if (!(ofmt->flags & AVFMT_VARIABLE_FPS)
-   && strcmp(ofmt->name, "mov") && strcmp(ofmt->name, "mp4") && 
strcmp(ofmt->name, "3gp")
-   && strcmp(ofmt->name, "3g2") && strcmp(ofmt->name, "psp") && 
strcmp(ofmt->name, "ipod")
-   && strcmp(ofmt->name, "f4v")) {
+   && !av_match_name(ofmt->name, "mov,mp4,3gp,3g2,psp,ipod,f4v")) {
 if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx->time_base.den
 && av_q2d(dec_ctx->time_base)*dec_ctx->ticks_per_frame > 
av_q2d(ist->time_base)
 && av_q2d(ist->time_base) < 1.0/500

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


[FFmpeg-cvslog] lavf/utils: add missing ismv in MOV-like formats

2016-09-14 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Wed Sep 14 
10:00:08 2016 +0200| [415f907ce8dcca87c9e7cfdc954b92df399d3d80] | committer: 
Clément Bœsch

lavf/utils: add missing ismv in MOV-like formats

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 06c7582..cbaeef0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5318,7 +5318,7 @@ int avformat_transfer_internal_stream_timing_info(const 
AVOutputFormat *ofmt,
 enc_ctx->ticks_per_frame = 2;
 }
 } else if (!(ofmt->flags & AVFMT_VARIABLE_FPS)
-   && !av_match_name(ofmt->name, "mov,mp4,3gp,3g2,psp,ipod,f4v")) {
+   && !av_match_name(ofmt->name, 
"mov,mp4,3gp,3g2,psp,ipod,ismv,f4v")) {
 if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx->time_base.den
 && av_q2d(dec_ctx->time_base)*dec_ctx->ticks_per_frame > 
av_q2d(ist->time_base)
 && av_q2d(ist->time_base) < 1.0/500

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


ffmpeg-cvslog@ffmpeg.org

2016-09-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Sep 14 02:31:11 2016 +0200| [e85c4a470651b58963095eb4dafb709313f33474] | 
committer: Michael Niedermayer

avformat/flvenc: Add () around &

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index a3623f8..9080f58 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -368,7 +368,7 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par) {
 avio_w8(pb, get_audio_flags(s, par));
 avio_w8(pb, 0); // AAC sequence header
 
-if (!par->extradata_size && flv->flags & 
FLV_AAC_SEQ_HEADER_DETECT) {
+if (!par->extradata_size && (flv->flags & 
FLV_AAC_SEQ_HEADER_DETECT)) {
 PutBitContext pbc;
 int samplerate_index;
 int channels = flv->audio_par->channels

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


[FFmpeg-cvslog] avformat/flvenc: add no_sequence_end flags for flvflags

2016-09-14 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Wed Sep 14 
10:00:52 2016 +0800| [c8528e54e57810535b94ccecbc9c711d67dd710f] | committer: 
Michael Niedermayer

avformat/flvenc: add no_sequence_end flags for flvflags

when split flv file by flv format at first, and cat flvs file
into one flv file, the flv sequence end is be used,
then the whole flv have many flv sequence end TAG.
this flags can give user an option to ignore write sequence end TAG

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

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

 libavformat/flvenc.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 9080f58..99903f5 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -63,6 +63,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
 
 typedef enum {
 FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
+FLV_NO_SEQUENCE_END = (1 << 1),
 } FLVFlags;
 
 typedef struct FLVContext {
@@ -527,13 +528,17 @@ static int flv_write_trailer(AVFormatContext *s)
 FLVContext *flv = s->priv_data;
 int i;
 
-/* Add EOS tag */
-for (i = 0; i < s->nb_streams; i++) {
-AVCodecParameters *par = s->streams[i]->codecpar;
-FLVStreamContext *sc = s->streams[i]->priv_data;
-if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
-(par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4))
-put_avc_eos_tag(pb, sc->last_ts);
+if (flv->flags & FLV_NO_SEQUENCE_END) {
+av_log(s, AV_LOG_DEBUG, "FLV no sequence end mode open\n");
+} else {
+/* Add EOS tag */
+for (i = 0; i < s->nb_streams; i++) {
+AVCodecParameters *par = s->streams[i]->codecpar;
+FLVStreamContext *sc = s->streams[i]->priv_data;
+if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
+(par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4))
+put_avc_eos_tag(pb, sc->last_ts);
+}
 }
 
 file_size = avio_tell(pb);
@@ -723,6 +728,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 static const AVOption options[] = {
 { "flvflags", "FLV muxer flags", offsetof(FLVContext, flags), 
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"flvflags" },
 { "aac_seq_header_detect", "Put AAC sequence header based on stream data", 
0, AV_OPT_TYPE_CONST, {.i64 = FLV_AAC_SEQ_HEADER_DETECT}, INT_MIN, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
+{ "no_sequence_end", "disable sequence end for FLV", 0, AV_OPT_TYPE_CONST, 
{.i64 = FLV_NO_SEQUENCE_END}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"flvflags" },
 { NULL },
 };
 

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


[FFmpeg-cvslog] avformat/utils: fix timebase error in avformat_seek_file()

2016-09-14 Thread Xinzheng Zhang
ffmpeg | branch: master | Xinzheng Zhang  | Wed Sep 14 
16:13:45 2016 +0800| [ecc04b4f2f29ac676e6c1d1ebf20ec45f5385f1e] | committer: 
Michael Niedermayer

avformat/utils: fix timebase error in avformat_seek_file()

When there is only one stream and stream_index has not specified,
The ts has been transferd by the timebase of stream0 without modifying the 
stream_index
In this condation it cause seek failure.

Signed-off-by: Michael Niedermayer 

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

 libavformat/utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index cbaeef0..d605a96 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2418,6 +2418,7 @@ int avformat_seek_file(AVFormatContext *s, int 
stream_index, int64_t min_ts,
 max_ts = av_rescale_rnd(max_ts, time_base.den,
 time_base.num * (int64_t)AV_TIME_BASE,
 AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX);
+stream_index = 0;
 }
 
 ret = s->iformat->read_seek2(s, stream_index, min_ts,

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


[FFmpeg-cvslog] avcodec/g726: Add missing ADDB output mask

2016-09-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Sep 14 13:06:53 2016 +0200| [a5af1240fce845f645440364c1335e0f8e44ee6c] | 
committer: Michael Niedermayer

avcodec/g726: Add missing ADDB output mask

Fixes: 1.poc
Fixes out of array read

Found-by: 连一汉 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index c7d138e..ca7f856 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -206,7 +206,7 @@ static int16_t g726_decode(G726Context* c, int I)
 
 if (I_sig)  /* get the sign */
 dq = -dq;
-re_signal = c->se + dq;
+re_signal = (int16_t)(c->se + dq);
 
 /* Update second order predictor coefficient A2 and A1 */
 pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;

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


[FFmpeg-cvslog] lavc: Enable a53cc by default for x264 and qsv_h264.

2016-09-14 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Fri Sep  9 
17:56:46 2016 +0200| [93e041026f3c02f622253f81e5c794b81e784a37] | committer: 
Carl Eugen Hoyos

lavc: Enable a53cc by default for x264 and qsv_h264.

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

 libavcodec/libx264.c | 2 +-
 libavcodec/qsvenc_h264.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index b730c91..9e12464 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -907,7 +907,7 @@ static const AVOption options[] = {
 {"level", "Specify level (as defined by Annex A)", OFFSET(level), 
AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
 {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), 
AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
 {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), 
AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
-{"a53cc",  "Use A53 Closed Captions (if available)",  
OFFSET(a53_cc),AV_OPT_TYPE_BOOL,   {.i64 = 0}, 0, 1, VE},
+{"a53cc",  "Use A53 Closed Captions (if available)",  
OFFSET(a53_cc),AV_OPT_TYPE_BOOL,   {.i64 = 1}, 0, 1, VE},
 {"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, 
{.str=NULL}, 0, 0, VE},
 { "crf",   "Select the quality for constant quality mode",
OFFSET(crf),   AV_OPT_TYPE_FLOAT,  {.dbl = -1 }, -1, FLT_MAX, VE },
 { "crf_max",   "In CRF mode, prevents VBV from lowering quality beyond 
this point.",OFFSET(crf_max), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE 
},
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 84513be..c1f6003 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -138,7 +138,7 @@ static const AVOption options[] = {
 { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_AVC_MAIN
 }, INT_MIN, INT_MAX, VE, "profile" },
 { "high", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_AVC_HIGH
 }, INT_MIN, INT_MAX, VE, "profile" },
 
-{ "a53cc" , "Use A53 Closed Captions (if available)", OFFSET(qsv.a53_cc), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VE},
+{ "a53cc" , "Use A53 Closed Captions (if available)", OFFSET(qsv.a53_cc), 
AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, VE},
 { NULL },
 };
 

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


[FFmpeg-cvslog] avcodec/h264_parser: set missing pts for top/bottom field frames

2016-09-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Sep 14 16:35:48 
2016 +0200| [01fa4fb69e40165c1e03bcf6939e7f4ad07b69b6] | committer: Paul B Mahol

avcodec/h264_parser: set missing pts for top/bottom field frames

Adopted from 4eb49fdde8f84d54a763cfb5d355527b525ee2bf revert.

Signed-off-by: Paul B Mahol 

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

 libavcodec/h264_parser.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 615884f..4dacb22 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -60,6 +60,7 @@ typedef struct H264ParseContext {
 uint8_t parse_history[6];
 int parse_history_count;
 int parse_last_mb;
+int64_t reference_dts;
 } H264ParseContext;
 
 
@@ -598,6 +599,26 @@ static int h264_parse(AVCodecParserContext *s,
 s->flags &= PARSER_FLAG_COMPLETE_FRAMES;
 }
 
+if (s->dts_sync_point >= 0) {
+int64_t den = avctx->time_base.den * avctx->pkt_timebase.num;
+if (den > 0) {
+int64_t num = avctx->time_base.num * avctx->pkt_timebase.den;
+if (s->dts != AV_NOPTS_VALUE) {
+// got DTS from the stream, update reference timestamp
+p->reference_dts = s->dts - av_rescale(s->dts_ref_dts_delta, 
num, den);
+} else if (p->reference_dts != AV_NOPTS_VALUE) {
+// compute DTS based on reference timestamp
+s->dts = p->reference_dts + av_rescale(s->dts_ref_dts_delta, 
num, den);
+}
+
+if (p->reference_dts != AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE)
+s->pts = s->dts + av_rescale(s->pts_dts_delta, num, den);
+
+if (s->dts_sync_point > 0)
+p->reference_dts = s->dts; // new reference
+}
+}
+
 *poutbuf  = buf;
 *poutbuf_size = buf_size;
 return next;
@@ -655,6 +676,7 @@ static av_cold int init(AVCodecParserContext *s)
 {
 H264ParseContext *p = s->priv_data;
 
+p->reference_dts = AV_NOPTS_VALUE;
 ff_h264dsp_init(&p->h264dsp, 8, 1);
 return 0;
 }

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


[FFmpeg-cvslog] avcodec/h264_parser: fix for possible overflow

2016-09-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Sep 14 21:14:07 
2016 +0200| [92dbd65700334ac9c77bf085fca7b72dd7445ffd] | committer: Paul B Mahol

avcodec/h264_parser: fix for possible overflow

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 4dacb22..3ed7d77 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -600,9 +600,9 @@ static int h264_parse(AVCodecParserContext *s,
 }
 
 if (s->dts_sync_point >= 0) {
-int64_t den = avctx->time_base.den * avctx->pkt_timebase.num;
+int64_t den = avctx->time_base.den * (int64_t)avctx->pkt_timebase.num;
 if (den > 0) {
-int64_t num = avctx->time_base.num * avctx->pkt_timebase.den;
+int64_t num = avctx->time_base.num * 
(int64_t)avctx->pkt_timebase.den;
 if (s->dts != AV_NOPTS_VALUE) {
 // got DTS from the stream, update reference timestamp
 p->reference_dts = s->dts - av_rescale(s->dts_ref_dts_delta, 
num, den);

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


[FFmpeg-cvslog] vf_colorspace: Add modern names for color range option

2016-09-14 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Wed 
Sep 14 23:09:03 2016 +0200| [76c28360b5612fac068b25107e43e4bc5c4652de] | 
committer: Ronald S. Bultje

vf_colorspace: Add modern names for color range option

Allows to use values returned from API and from ffprobe directly.

Signed-off-by: Vittorio Giovara 

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

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

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index b9ecb5f..e69be50 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -1038,7 +1038,9 @@ static const AVOption colorspace_options[] = {
 { "range",  "Output color range",
   OFFSET(user_rng),   AV_OPT_TYPE_INT, { .i64 = AVCOL_RANGE_UNSPECIFIED },
   AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
+ENUM("tv",  AVCOL_RANGE_MPEG,  "rng"),
 ENUM("mpeg",AVCOL_RANGE_MPEG,  "rng"),
+ENUM("pc",  AVCOL_RANGE_JPEG,  "rng"),
 ENUM("jpeg",AVCOL_RANGE_JPEG,  "rng"),
 
 { "primaries",  "Output color primaries",

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


[FFmpeg-cvslog] avformat/hlsenc: Emulate strftime("%z") using other functions if it does not work

2016-09-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Sep 15 01:01:51 2016 +0200| [6f062eb8d0e17398f225c537d5fd78f5ae880906] | 
committer: Michael Niedermayer

avformat/hlsenc: Emulate strftime("%z") using other functions if it does not 
work

This should fix the code on windows

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 46b439d..0ca5932 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -537,7 +537,7 @@ static int hls_window(AVFormatContext *s, int last)
  avio_printf(out, "#EXT-X-BYTERANGE:%"PRIi64"@%"PRIi64"\n",
  en->size, en->pos);
 if (hls->flags & HLS_PROGRAM_DATE_TIME) {
-time_t tt;
+time_t tt, wrongsecs;
 int milli;
 struct tm *tm, tmpbuf;
 char buf0[128], buf1[128];
@@ -545,8 +545,18 @@ static int hls_window(AVFormatContext *s, int last)
 milli = av_clip(lrint(1000*(prog_date_time - tt)), 0, 999);
 tm = localtime_r(&tt, &tmpbuf);
 strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm);
-if (!strftime(buf1, sizeof(buf1), "%z", tm))
-av_strlcpy(buf1, "Z", sizeof(buf1));
+if (!strftime(buf1, sizeof(buf1), "%z", tm) || buf1[1]<'0' 
||buf1[1]>'2') {
+int tz_min, dst = tm->tm_isdst;
+tm = gmtime_r(&tt, &tmpbuf);
+tm->tm_isdst = dst;
+wrongsecs = mktime(tm);
+tz_min = (abs(wrongsecs - tt) + 30) / 60;
+snprintf(buf1, sizeof(buf1),
+ "%c%02d%02d",
+ wrongsecs <= tt ? '+' : '-',
+ tz_min / 60,
+ tz_min % 60);
+}
 avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, 
milli, buf1);
 prog_date_time += en->duration;
 }

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