[FFmpeg-cvslog] mmaldec: send only a single EOS packet on flushing

2015-11-10 Thread wm4
ffmpeg | branch: master | wm4  | Tue Nov 10 13:47:01 
2015 +0100| [dafe4cd29cada351a2785433b24401fc602911c4] | committer: wm4

mmaldec: send only a single EOS packet on flushing

Fixes apparent mmal_port_disable() freezes in ffmmal_stop_decoder() when
calling ffmmal_decode() with flush semantics a large number of times in
a row.

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

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

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index d419096..281071c 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -476,6 +476,8 @@ static int ffmmal_add_packet(AVCodecContext *avctx, 
AVPacket *avpkt,
 if (!is_extradata)
 ctx->packets_sent++;
 } else {
+if (ctx->eos_sent)
+goto done;
 if (!ctx->packets_sent) {
 // Short-cut the flush logic to avoid upsetting MMAL.
 ctx->eos_sent = 1;

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


[FFmpeg-cvslog] avcodec/aacsbr_fixed: Try to initialize sum[0..1] differently to fix build with VS2012

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Nov 10 13:33:38 2015 +0100| [8a024f6a43444a73a3cd8d70abedde426b4e1986] | 
committer: Michael Niedermayer

avcodec/aacsbr_fixed: Try to initialize sum[0..1] differently to fix build with 
VS2012

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

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

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

diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index f942d74..8eb8c58 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -397,7 +397,8 @@ static void sbr_gain_calc(AACContext *ac, 
SpectralBandReplication *sbr,
 int delta = !((e == e_a[1]) || (e == e_a[0]));
 for (k = 0; k < sbr->n_lim; k++) {
 SoftFloat gain_boost, gain_max;
-SoftFloat sum[2] = { FLOAT_0, FLOAT_0 };
+SoftFloat sum[2];
+sum[0] = sum[1] = FLOAT_0;
 for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 
1] - sbr->kx[1]; m++) {
 const SoftFloat temp = av_div_sf(sbr->e_origmapped[e][m],
 av_add_sf(FLOAT_1, 
sbr->q_mapped[e][m]));

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


[FFmpeg-cvslog] avcodec/g729postfilter: Avoid function calls in FFMAX() arguments

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Nov 10 14:35:08 2015 +0100| [6e3244fb09f22d019906f3029d86a483179c55ec] | 
committer: Michael Niedermayer

avcodec/g729postfilter: Avoid function calls in FFMAX() arguments

This avoid double calling functions

Found-by: Muhammad Faiz 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/g729postfilter.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/g729postfilter.c b/libavcodec/g729postfilter.c
index 9a775c4..d9076ec 100644
--- a/libavcodec/g729postfilter.c
+++ b/libavcodec/g729postfilter.c
@@ -165,7 +165,8 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int 
pitch_delay_int,
 sig_scaled + RES_PREV_DATA_SIZE,
 subframe_size);
 if (ener) {
-sh_ener = FFMAX(av_log2(ener) - 14, 0);
+sh_ener = av_log2(ener) - 14;
+sh_ener = FFMAX(sh_ener, 0);
 ener >>= sh_ener;
 /* Search for best pitch delay.
 
@@ -320,7 +321,8 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int 
pitch_delay_int,
 gain_long_num = 0;
 sh_gain_long_num = 0;
 } else {
-tmp = FFMAX(av_log2(sum) - 14, 0);
+tmp = av_log2(sum) - 14;
+tmp = FFMAX(tmp, 0);
 sum >>= tmp;
 gain_long_num = sum;
 sh_gain_long_num = tmp;
@@ -329,7 +331,8 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int 
pitch_delay_int,
 /* Compute R'(k) correlation's denominator. */
 sum = adsp->scalarproduct_int16(residual_filt, residual_filt, 
subframe_size);
 
-tmp = FFMAX(av_log2(sum) - 14, 0);
+tmp = av_log2(sum) - 14;
+tmp = FFMAX(tmp, 0);
 sum >>= tmp;
 gain_long_den = sum;
 sh_gain_long_den = tmp;
@@ -541,9 +544,10 @@ void ff_g729_postfilter(AudioDSPContext *adsp, int16_t* 
ht_prev_data, int* voici
 
 /* long-term filter. If long-term prediction gain is larger than 3dB 
(returned value is
nonzero) then declare current subframe as periodic. */
-*voicing = FFMAX(*voicing, long_term_filter(adsp, pitch_delay_int,
+i = long_term_filter(adsp, pitch_delay_int,
 residual, residual_filt_buf + 
10,
-subframe_size));
+subframe_size);
+*voicing = FFMAX(*voicing, i);
 
 /* shift residual for using in next subframe */
 memmove(residual, residual + subframe_size, RES_PREV_DATA_SIZE * 
sizeof(int16_t));

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


[FFmpeg-cvslog] avutil/softfloat: use abort() instead of av_assert0(0)

2015-11-10 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon Nov  9 23:16:17 
2015 -0300| [9f4a41bf991916e105be9d78ed38612d3ffa4881] | committer: James Almer

avutil/softfloat: use abort() instead of av_assert0(0)

Fixes compilation of host tool aacps_fixed_tablegen.

Reviewed-by: Michael Niedermayer 
Signed-off-by: James Almer 

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

 libavutil/softfloat.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 5b285e3..7488753 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -180,7 +180,7 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
 if (val.mant == 0)
 val.exp = MIN_EXP;
 else if (val.mant < 0)
-av_assert0(0);
+abort();
 else
 {
 tabIndex = (val.mant - 0x2000) >> 20;

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


[FFmpeg-cvslog] Merge commit '1e7ff5ac6923996f7292c82f102c68384fbc9d97'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:38:09 2015 +0100| [d786cdff1ca5e24cff7207118bc6c8a4ed124cef] | committer: 
Hendrik Leppkes

Merge commit '1e7ff5ac6923996f7292c82f102c68384fbc9d97'

* commit '1e7ff5ac6923996f7292c82f102c68384fbc9d97':
  nut: Use the correct codec_tag when multiple are available

Not merged since ffnutenc handles the codec_tag differently

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] Merge commit '0b699920f3c0b2e30969b38ce59226653f9d80ec'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:43:17 2015 +0100| [2503aa6bd9125593f7a5c730915685e515f83907] | committer: 
Hendrik Leppkes

Merge commit '0b699920f3c0b2e30969b38ce59226653f9d80ec'

* commit '0b699920f3c0b2e30969b38ce59226653f9d80ec':
  lagarith: Correctly compute hash_shift

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] lagarith: Correctly compute hash_shift

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
14:46:17 2015 +0100| [0b699920f3c0b2e30969b38ce59226653f9d80ec] | committer: 
Luca Barbato

lagarith: Correctly compute hash_shift

All the values are unsigned.

Bug-Id: 907
CC: libav-sta...@libav.org

Signed-off-by: Luca Barbato 

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

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

diff --git a/libavcodec/lagarithrac.c b/libavcodec/lagarithrac.c
index edfb18f..f9e4e5c 100644
--- a/libavcodec/lagarithrac.c
+++ b/libavcodec/lagarithrac.c
@@ -45,7 +45,7 @@ void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int 
length)
 
 l->range= 0x80;
 l->low  = *l->bytestream >> 1;
-l->hash_shift   = FFMAX(l->scale - 8, 0);
+l->hash_shift   = FFMAX(l->scale, 8) - 8;
 
 for (i = j = 0; i < 256; i++) {
 unsigned r = i << l->hash_shift;

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


[FFmpeg-cvslog] nut: Use the correct codec_tag when multiple are available

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Thu Sep  3 
17:31:14 2015 +0200| [1e7ff5ac6923996f7292c82f102c68384fbc9d97] | committer: 
Luca Barbato

nut: Use the correct codec_tag when multiple are available

Some codecs use the codec_tag to signal specific information and
picking the first one would lead to a broken file.

Bug-Id: 883
CC: libav-sta...@libav.org

Signed-off-by: Luca Barbato 

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

 libavformat/nutenc.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index b7b0c9c..be6579d 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -438,7 +438,8 @@ static int write_streamheader(AVFormatContext *avctx, 
AVIOContext *bc,
 }
 ff_put_v(bc, 4);
 
-if (!codec_tag || codec->codec_id == AV_CODEC_ID_RAWVIDEO)
+if (av_codec_get_id(ff_nut_codec_tags, codec->codec_tag) == 
codec->codec_id ||
+!codec_tag || codec->codec_id == AV_CODEC_ID_RAWVIDEO)
 codec_tag = codec->codec_tag;
 
 if (codec_tag) {

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


[FFmpeg-cvslog] Merge commit '60f50374f1955442dc987abc4a6c61c2109620c2'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:50:12 2015 +0100| [8600fef123bf00403c8d591c5345ed03b683572d] | committer: 
Hendrik Leppkes

Merge commit '60f50374f1955442dc987abc4a6c61c2109620c2'

* commit '60f50374f1955442dc987abc4a6c61c2109620c2':
  rpza: Check the blocks left before processing one

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] rpza: Check the blocks left before processing one

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
04:07:42 2015 +0100| [60f50374f1955442dc987abc4a6c61c2109620c2] | committer: 
Luca Barbato

rpza: Check the blocks left before processing one

Bug-Id: 903
CC: libav-sta...@libav.org
Reported-By: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

Signed-off-by: Luca Barbato 

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

 libavcodec/rpza.c |   52 +++-
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
index f365a06..d1c959d 100644
--- a/libavcodec/rpza.c
+++ b/libavcodec/rpza.c
@@ -52,23 +52,25 @@ typedef struct RpzaContext {
 GetByteContext gb;
 } RpzaContext;
 
-#define ADVANCE_BLOCK() \
-{ \
-pixel_ptr += 4; \
-if (pixel_ptr >= width) \
-{ \
-pixel_ptr = 0; \
-row_ptr += stride * 4; \
-} \
-total_blocks--; \
-if (total_blocks < 0) \
-{ \
-av_log(s->avctx, AV_LOG_ERROR, "warning: block counter just went 
negative (this should not happen)\n"); \
-return; \
-} \
-}
+#define CHECK_BLOCK() \
+if (total_blocks < 1) {
\
+av_log(s->avctx, AV_LOG_ERROR, 
\
+   "Block counter just went negative (this should not happen)\n"); 
\
+return AVERROR_INVALIDDATA;
\
+}  
\
+
+#define ADVANCE_BLOCK() \
+{   \
+pixel_ptr += 4; \
+if (pixel_ptr >= width) \
+{   \
+pixel_ptr = 0;  \
+row_ptr  += stride * 4; \
+}   \
+total_blocks--; \
+}
 
-static void rpza_decode_stream(RpzaContext *s)
+static int rpza_decode_stream(RpzaContext *s)
 {
 int width = s->avctx->width;
 int stride = s->frame->linesize[0] / 2;
@@ -126,7 +128,8 @@ static void rpza_decode_stream(RpzaContext *s)
 /* Skip blocks */
 case 0x80:
 while (n_blocks--) {
-  ADVANCE_BLOCK();
+CHECK_BLOCK();
+ADVANCE_BLOCK();
 }
 break;
 
@@ -134,6 +137,7 @@ static void rpza_decode_stream(RpzaContext *s)
 case 0xa0:
 colorA = bytestream2_get_be16(&s->gb);
 while (n_blocks--) {
+CHECK_BLOCK();
 block_ptr = row_ptr + pixel_ptr;
 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
 for (pixel_x = 0; pixel_x < 4; pixel_x++){
@@ -177,8 +181,9 @@ static void rpza_decode_stream(RpzaContext *s)
 color4[2] |= ((21 * ta + 11 * tb) >> 5);
 
 if (bytestream2_get_bytes_left(&s->gb) < n_blocks * 4)
-return;
+return AVERROR_INVALIDDATA;
 while (n_blocks--) {
+CHECK_BLOCK();
 block_ptr = row_ptr + pixel_ptr;
 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
 uint8_t index = bytestream2_get_byteu(&s->gb);
@@ -196,7 +201,8 @@ static void rpza_decode_stream(RpzaContext *s)
 /* Fill block with 16 colors */
 case 0x00:
 if (bytestream2_get_bytes_left(&s->gb) < 30)
-return;
+return AVERROR_INVALIDDATA;
+CHECK_BLOCK();
 block_ptr = row_ptr + pixel_ptr;
 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
 for (pixel_x = 0; pixel_x < 4; pixel_x++){
@@ -216,9 +222,11 @@ static void rpza_decode_stream(RpzaContext *s)
 av_log(s->avctx, AV_LOG_ERROR, "Unknown opcode %d in rpza chunk."
  " Skip remaining %d bytes of chunk data.\n", opcode,
  bytestream2_get_bytes_left(&s->gb));
-return;
+return AVERROR_INVALIDDATA;
 } /* Opcode switch */
 }
+
+return 0;
 }
 
 static av_cold int rpza_decode_init(AVCodecContext *avctx)
@@ -249,7 +257,9 @@ static int rpza_decode_frame(AVCodecContext *avctx,
 return ret;
 }
 
-rpza_decode_stream(s);
+ret = rpza_decode_stream(s);
+if (ret < 0)
+return ret;
 
 if ((ret = av_frame_ref(data, s->frame)) < 0)
 return ret;

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


[FFmpeg-cvslog] cosmetics: msnwc_tcp: Reformat

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
04:07:44 2015 +0100| [f8d10511fef0bb3265f2d7bdfd38f90f60731d80] | committer: 
Luca Barbato

cosmetics: msnwc_tcp: Reformat

Signed-off-by: Luca Barbato 

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

 libavformat/msnwc_tcp.c |   47 ---
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index afdcac4..bb00c87 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -40,25 +40,26 @@ static int msnwc_tcp_probe(AVProbeData *p)
 {
 int i;
 
-for(i = 0 ; i + HEADER_SIZE <= p->buf_size ; i++) {
+for (i = 0; i + HEADER_SIZE <= p->buf_size; i++) {
 uint16_t width, height;
 uint32_t fourcc;
-const uint8_t *bytestream = p->buf+i;
+const uint8_t *bytestream = p->buf + i;
 
-if(bytestream_get_le16(&bytestream) != HEADER_SIZE)
+if (bytestream_get_le16(&bytestream) != HEADER_SIZE)
 continue;
 width  = bytestream_get_le16(&bytestream);
 height = bytestream_get_le16(&bytestream);
-if(!(width==320 && height==240) && !(width==160 && height==120))
+if (!(width == 320 &&
+  height == 240) && !(width == 160 && height == 120))
 continue;
 bytestream += 2; // keyframe
 bytestream += 4; // size
-fourcc = bytestream_get_le32(&bytestream);
-if(fourcc != MKTAG('M', 'L', '2', '0'))
+fourcc  = bytestream_get_le32(&bytestream);
+if (fourcc != MKTAG('M', 'L', '2', '0'))
 continue;
 
-if(i) {
-if(i < 14)  /* starts with SwitchBoard connection info */
+if (i) {
+if (i < 14) /* starts with SwitchBoard connection info */
 return AVPROBE_SCORE_MAX / 2;
 else/* starts in the middle of stream */
 return AVPROBE_SCORE_MAX / 3;
@@ -77,21 +78,21 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx)
 AVStream *st;
 
 st = avformat_new_stream(ctx, NULL);
-if(!st)
+if (!st)
 return AVERROR(ENOMEM);
 
-codec = st->codec;
+codec = st->codec;
 codec->codec_type = AVMEDIA_TYPE_VIDEO;
-codec->codec_id = AV_CODEC_ID_MIMIC;
-codec->codec_tag = MKTAG('M', 'L', '2', '0');
+codec->codec_id   = AV_CODEC_ID_MIMIC;
+codec->codec_tag  = MKTAG('M', 'L', '2', '0');
 
 avpriv_set_pts_info(st, 32, 1, 1000);
 
 /* Some files start with "connected\r\n\r\n".
  * So skip until we find the first byte of struct size */
-while(avio_r8(pb) != HEADER_SIZE && !pb->eof_reached);
+while (avio_r8(pb) != HEADER_SIZE && !pb->eof_reached) ;
 
-if(pb->eof_reached) {
+if (pb->eof_reached) {
 av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
 return -1;
 }
@@ -110,7 +111,7 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, 
AVPacket *pkt)
 avio_skip(pb, 2);
 avio_skip(pb, 2);
 keyframe = avio_rl16(pb);
-size = avio_rl32(pb);
+size = avio_rl32(pb);
 avio_skip(pb, 4);
 avio_skip(pb, 4);
 timestamp = avio_rl32(pb);
@@ -123,22 +124,22 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, 
AVPacket *pkt)
 
 avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */
 
-pkt->pts = timestamp;
-pkt->dts = timestamp;
+pkt->pts  = timestamp;
+pkt->dts  = timestamp;
 pkt->stream_index = 0;
 
 /* Some aMsn generated videos (or was it Mercury Messenger?) don't set
  * this bit and rely on the codec to get keyframe information */
-if(keyframe&1)
+if (keyframe & 1)
 pkt->flags |= AV_PKT_FLAG_KEY;
 
 return HEADER_SIZE + size;
 }
 
 AVInputFormat ff_msnwc_tcp_demuxer = {
-.name   = "msnwctcp",
-.long_name  = NULL_IF_CONFIG_SMALL("MSN TCP Webcam stream"),
-.read_probe = msnwc_tcp_probe,
-.read_header= msnwc_tcp_read_header,
-.read_packet= msnwc_tcp_read_packet,
+.name= "msnwctcp",
+.long_name   = NULL_IF_CONFIG_SMALL("MSN TCP Webcam stream"),
+.read_probe  = msnwc_tcp_probe,
+.read_header = msnwc_tcp_read_header,
+.read_packet = msnwc_tcp_read_packet,
 };

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


[FFmpeg-cvslog] msnwc_tcp: Correctly report failure

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
04:07:43 2015 +0100| [4dfbc7a7559ccab666a8fd39de4224eb4b02c768] | committer: 
Luca Barbato

msnwc_tcp: Correctly report failure

And prevent a memory leak

CC: libav-sta...@libav.org

Signed-off-by: Luca Barbato 

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

 libavformat/msnwc_tcp.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index b6d30fe..afdcac4 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -104,6 +104,7 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, 
AVPacket *pkt)
 AVIOContext *pb = ctx->pb;
 uint16_t keyframe;
 uint32_t size, timestamp;
+int ret;
 
 avio_skip(pb, 1); /* one byte has been read ahead */
 avio_skip(pb, 2);
@@ -114,8 +115,11 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, 
AVPacket *pkt)
 avio_skip(pb, 4);
 timestamp = avio_rl32(pb);
 
-if(!size || av_get_packet(pb, pkt, size) != size)
-return -1;
+if (!size)
+return AVERROR_INVALIDDATA;
+
+if ((ret = av_get_packet(pb, pkt, size)) < 0)
+return ret;
 
 avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */
 

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


[FFmpeg-cvslog] msnwc_tcp: Use the correct return values

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
04:07:45 2015 +0100| [452d659aa4a742106c70ffe9ef3df47ef5b81ea6] | committer: 
Luca Barbato

msnwc_tcp: Use the correct return values

Signed-off-by: Luca Barbato 

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

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

diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index bb00c87..6cf7f9f 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -68,7 +68,7 @@ static int msnwc_tcp_probe(AVProbeData *p)
 }
 }
 
-return -1;
+return 0;
 }
 
 static int msnwc_tcp_read_header(AVFormatContext *ctx)
@@ -94,7 +94,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx)
 
 if (pb->eof_reached) {
 av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
-return -1;
+return AVERROR_INVALIDDATA;
 }
 
 return 0;

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


[FFmpeg-cvslog] Merge commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:54:06 2015 +0100| [2e82d51714c74a20bd5e3440836c16d608e3df7a] | committer: 
Hendrik Leppkes

Merge commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768'

* commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768':
  msnwc_tcp: Correctly report failure

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] Merge commit 'f8d10511fef0bb3265f2d7bdfd38f90f60731d80'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:55:25 2015 +0100| [618817b6a8f29b4f24fd53c7bf916f070e182136] | committer: 
Hendrik Leppkes

Merge commit 'f8d10511fef0bb3265f2d7bdfd38f90f60731d80'

* commit 'f8d10511fef0bb3265f2d7bdfd38f90f60731d80':
  cosmetics: msnwc_tcp: Reformat

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] Merge commit '452d659aa4a742106c70ffe9ef3df47ef5b81ea6'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:56:14 2015 +0100| [b40e43c5c40158c2d9490fb0db1109a5387ff8d5] | committer: 
Hendrik Leppkes

Merge commit '452d659aa4a742106c70ffe9ef3df47ef5b81ea6'

* commit '452d659aa4a742106c70ffe9ef3df47ef5b81ea6':
  msnwc_tcp: Use the correct return values

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] mimic: Always return on failure

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
04:07:46 2015 +0100| [4a326923381f2bc0fb7d960c8f8366a5456bc4ab] | committer: 
Luca Barbato

mimic: Always return on failure

Bug-Id: 905
CC: libav-sta...@libav.org

Signed-off-by: Luca Barbato 

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

 libavcodec/mimic.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 379cffc..b8b3285 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -431,10 +431,9 @@ static int mimic_decode_frame(AVCodecContext *avctx, void 
*data,
 res = decode(ctx, quality, num_coeffs, !is_pframe);
 ff_thread_report_progress(&ctx->frames[ctx->cur_index], INT_MAX, 0);
 if (res < 0) {
-if (!(avctx->active_thread_type & FF_THREAD_FRAME)) {
+if (!(avctx->active_thread_type & FF_THREAD_FRAME))
 ff_thread_release_buffer(avctx, &ctx->frames[ctx->cur_index]);
-return res;
-}
+return res;
 }
 
 if ((res = av_frame_ref(data, ctx->frames[ctx->cur_index].f)) < 0)

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


[FFmpeg-cvslog] Merge commit '4a326923381f2bc0fb7d960c8f8366a5456bc4ab'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:56:48 2015 +0100| [446ac80ea594de6fca73dcba65fce8b06810fe96] | committer: 
Hendrik Leppkes

Merge commit '4a326923381f2bc0fb7d960c8f8366a5456bc4ab'

* commit '4a326923381f2bc0fb7d960c8f8366a5456bc4ab':
  mimic: Always return on failure

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] truemotion2: Fix the buffer check

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
04:07:47 2015 +0100| [de41b555cdea2dcacbe98ee9edc83a8c15c73c4c] | committer: 
Luca Barbato

truemotion2: Fix the buffer check

The variable skip contains the expected size in bytes.

Bug-Id: 906
CC: libav-sta...@libav.org

Signed-off-by: Luca Barbato 

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

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

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 84e8e2a..1726440 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -291,7 +291,7 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t 
*buf, int stream_id, i
 if (len == 0)
 return 4;
 
-if (len >= INT_MAX/4-1 || len < 0 || len > buf_size) {
+if (len >= INT_MAX / 4 - 1 || len < 0 || skip > buf_size) {
 av_log(ctx->avctx, AV_LOG_ERROR, "Error, invalid stream size.\n");
 return AVERROR_INVALIDDATA;
 }

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


[FFmpeg-cvslog] Merge commit 'de41b555cdea2dcacbe98ee9edc83a8c15c73c4c'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
17:58:14 2015 +0100| [0c1a6f577bbcb64dc26cf8edfc153728389a8c84] | committer: 
Hendrik Leppkes

Merge commit 'de41b555cdea2dcacbe98ee9edc83a8c15c73c4c'

* commit 'de41b555cdea2dcacbe98ee9edc83a8c15c73c4c':
  truemotion2: Fix the buffer check

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] Merge commit '50d2a3b5f34e6f99e5ffe17f2be5eb1815555960'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:00:51 2015 +0100| [3a8b37c5904fe6a92a0104c8f3879596fe3a3c24] | committer: 
Hendrik Leppkes

Merge commit '50d2a3b5f34e6f99e5ffe17f2be5eb181960'

* commit '50d2a3b5f34e6f99e5ffe17f2be5eb181960':
  flashsv: Initialize the block array

Not merged, blocks are already zeroed when appropriate.

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] flashsv: Initialize the block array

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sun Nov  1 
04:07:48 2015 +0100| [50d2a3b5f34e6f99e5ffe17f2be5eb181960] | committer: 
Luca Barbato

flashsv: Initialize the block array

Otherwise flashsv2_prime could be fed random data.

Bug-Id: 908
CC: libav-sta...@libav.org

Signed-off-by: Luca Barbato 

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

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

diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index ee854ac..2cf8f3f 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -339,12 +339,14 @@ static int flashsv_decode_frame(AVCodecContext *avctx, 
void *data,
 s->is_keyframe = (avpkt->flags & AV_PKT_FLAG_KEY) && (s->ver == 2);
 if (s->is_keyframe) {
 int err;
+int nb_blocks = (v_blocks + !!v_part) *
+(h_blocks + !!h_part) * sizeof(s->blocks[0]);
 if ((err = av_reallocp(&s->keyframedata, avpkt->size)) < 0)
 return err;
 memcpy(s->keyframedata, avpkt->data, avpkt->size);
-if ((err = av_reallocp(&s->blocks, (v_blocks + !!v_part) *
-   (h_blocks + !!h_part) * sizeof(s->blocks[0]))) 
< 0)
+if ((err = av_reallocp(&s->blocks, nb_blocks)) < 0)
 return err;
+memset(s->blocks, 0, nb_blocks);
 }
 
 ff_dlog(avctx, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",

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


[FFmpeg-cvslog] Merge commit 'f128b8e19ac7f702adae899ab91cc1e80f238761'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:01:36 2015 +0100| [df06cb561102488f09c9ef24494cc7dd843cad1a] | committer: 
Hendrik Leppkes

Merge commit 'f128b8e19ac7f702adae899ab91cc1e80f238761'

* commit 'f128b8e19ac7f702adae899ab91cc1e80f238761':
  mov: detect cover art pictures by content

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] avresample: Document avresample_open() a little better

2015-11-10 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Wed Nov  4 
09:16:46 2015 +0100| [e2854e731f843906d9a9a5b882bed872341999fd] | committer: 
Luca Barbato

avresample: Document avresample_open() a little better

Bug-Id: 911

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

 libavresample/avresample.h |4 
 1 file changed, 4 insertions(+)

diff --git a/libavresample/avresample.h b/libavresample/avresample.h
index b705a45..1dca6e4 100644
--- a/libavresample/avresample.h
+++ b/libavresample/avresample.h
@@ -167,9 +167,13 @@ AVAudioResampleContext *avresample_alloc_context(void);
 /**
  * Initialize AVAudioResampleContext.
  * @note The context must be configured using the AVOption API.
+ * @note The fields "in_channel_layout", "out_channel_layout",
+ *   "in_sample_rate", "out_sample_rate", "in_sample_fmt",
+ *   "out_sample_fmt" must be set.
  *
  * @see av_opt_set_int()
  * @see av_opt_set_dict()
+ * @see av_get_default_channel_layout()
  *
  * @param avr  audio resample context
  * @return 0 on success, negative AVERROR code on failure

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


[FFmpeg-cvslog] Merge commit 'e2854e731f843906d9a9a5b882bed872341999fd'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:07:41 2015 +0100| [240ac53a5cccaccb0a17d42ab443ec3425423373] | committer: 
Hendrik Leppkes

Merge commit 'e2854e731f843906d9a9a5b882bed872341999fd'

* commit 'e2854e731f843906d9a9a5b882bed872341999fd':
  avresample: Document avresample_open() a little better

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] mov: detect cover art pictures by content

2015-11-10 Thread wm4
ffmpeg | branch: master | wm4  | Sat Oct 31 14:36:38 
2015 +0100| [f128b8e19ac7f702adae899ab91cc1e80f238761] | committer: Luca Barbato

mov: detect cover art pictures by content

I've got some m4a samples that had jpeg cover art marked as png. Since
these files were supposedly written by iTunes, and other software can
read it (e.g. clementine does), this should be worked around.

Since png has a very simple to detect header, while it's apparently a
real pain to detect jpeg in the general case, try to detect png and
assume jpeg otherwise. Not bothering with bmp, as I have no test case.

Signed-off-by: Luca Barbato 

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

 libavformat/mov.c |8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 95dc1ee..9532213 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -200,6 +200,14 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, 
int type, int len)
 if (ret < 0)
 return ret;
 
+if (pkt.size >= 8 && id != AV_CODEC_ID_BMP) {
+if (AV_RB64(pkt.data) == 0x89504e470d0a1a0a) {
+id = AV_CODEC_ID_PNG;
+} else {
+id = AV_CODEC_ID_MJPEG;
+}
+}
+
 st->disposition  |= AV_DISPOSITION_ATTACHED_PIC;
 
 st->attached_pic  = pkt;

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


[FFmpeg-cvslog] vf_pad: fix x, y option expression evaluation

2015-11-10 Thread John Stebbins
ffmpeg | branch: master | John Stebbins  | Sun Oct 25 
11:36:10 2015 -0700| [2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5] | committer: 
Luca Barbato

vf_pad: fix x, y option expression evaluation

Calculation of x an y based on width and height did not work when
width == 0 or height == 0.  "0" substitutes the input width and
height, but did so too late for x, y expression evaluation.

Signed-off-by: Luca Barbato 

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

 libavfilter/vf_pad.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 634af4c..cddd2a6 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -167,12 +167,17 @@ static int config_input(AVFilterLink *inlink)
   NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 
0)
 goto eval_fail;
 s->h = var_values[VAR_OUT_H] = var_values[VAR_OH] = res;
+if (!s->h)
+var_values[VAR_OUT_H] = var_values[VAR_OH] = s->h = inlink->h;
+
 /* evaluate the width again, as it may depend on the evaluated output 
height */
 if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
   var_names, var_values,
   NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 
0)
 goto eval_fail;
 s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
+if (!s->w)
+var_values[VAR_OUT_W] = var_values[VAR_OW] = s->w = inlink->w;
 
 /* evaluate x and y */
 av_expr_parse_and_eval(&res, (expr = s->x_expr),
@@ -197,11 +202,6 @@ static int config_input(AVFilterLink *inlink)
 return AVERROR(EINVAL);
 }
 
-if (!s->w)
-s->w = inlink->w;
-if (!s->h)
-s->h = inlink->h;
-
 s->w &= ~((1 << s->hsub) - 1);
 s->h &= ~((1 << s->vsub) - 1);
 s->x &= ~((1 << s->hsub) - 1);

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


[FFmpeg-cvslog] Merge commit '2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:13:46 2015 +0100| [43266457b4f96e5f8becedf71971e4bb149afca3] | committer: 
Hendrik Leppkes

Merge commit '2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5'

* commit '2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5':
  vf_pad: fix x, y option expression evaluation

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] segafilm: implement seeking

2015-11-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Nov  5 12:04:51 
2015 +0100| [c012c6f1a8b34828a7870dc1854422934f14b79a] | committer: Vittorio 
Giovara

segafilm: implement seeking

Signed-off-by: Vittorio Giovara 

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

 libavformat/segafilm.c |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 4209197..e9d86c1 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -240,6 +240,11 @@ static int film_read_header(AVFormatContext *s)
 film->sample_table[i].stream = film->video_stream_index;
 film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFF;
 film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1;
+av_add_index_entry(s->streams[film->video_stream_index],
+   film->sample_table[i].sample_offset,
+   film->sample_table[i].pts,
+   film->sample_table[i].sample_size, 0,
+   film->sample_table[i].keyframe);
 }
 }
 
@@ -288,6 +293,23 @@ static int film_read_packet(AVFormatContext *s,
 return ret;
 }
 
+static int film_read_seek(AVFormatContext *s, int stream_index, int64_t 
timestamp, int flags)
+{
+FilmDemuxContext *film = s->priv_data;
+AVStream *st = s->streams[stream_index];
+int ret = av_index_search_timestamp(st, timestamp, flags);
+if (ret < 0)
+return ret;
+
+ret = avio_seek(s->pb, st->index_entries[ret].pos, SEEK_SET);
+if (ret < 0)
+return ret;
+
+film->current_sample = ret;
+
+return 0;
+}
+
 AVInputFormat ff_segafilm_demuxer = {
 .name   = "film_cpk",
 .long_name  = NULL_IF_CONFIG_SMALL("Sega FILM / CPK"),
@@ -296,4 +318,5 @@ AVInputFormat ff_segafilm_demuxer = {
 .read_header= film_read_header,
 .read_packet= film_read_packet,
 .read_close = film_read_close,
+.read_seek  = film_read_seek,
 };

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


[FFmpeg-cvslog] Merge commit 'c012c6f1a8b34828a7870dc1854422934f14b79a'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:16:11 2015 +0100| [b3453f44edae9160439f8cd8580d151554c87e5f] | committer: 
Hendrik Leppkes

Merge commit 'c012c6f1a8b34828a7870dc1854422934f14b79a'

* commit 'c012c6f1a8b34828a7870dc1854422934f14b79a':
  segafilm: implement seeking

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] Merge commit '1e791ee3aae63122afb10cbabe86a747aea58992'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:17:02 2015 +0100| [0e29820cd16461414236068992d9d35fa0ca058f] | committer: 
Hendrik Leppkes

Merge commit '1e791ee3aae63122afb10cbabe86a747aea58992'

* commit '1e791ee3aae63122afb10cbabe86a747aea58992':
  segafilm: set video and audio stream duration

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] segafilm: set video and audio stream duration

2015-11-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Nov  5 12:04:52 
2015 +0100| [1e791ee3aae63122afb10cbabe86a747aea58992] | committer: Vittorio 
Giovara

segafilm: set video and audio stream duration

Signed-off-by: Vittorio Giovara 

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

 libavformat/segafilm.c |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index e9d86c1..bbbf701 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -89,6 +89,7 @@ static int film_read_header(AVFormatContext *s)
 int i, ret;
 unsigned int data_offset;
 unsigned int audio_frame_counter;
+unsigned int video_frame_counter;
 
 film->sample_table = NULL;
 
@@ -212,7 +213,7 @@ static int film_read_header(AVFormatContext *s)
 avpriv_set_pts_info(st, 64, 1, film->audio_samplerate);
 }
 
-audio_frame_counter = 0;
+audio_frame_counter = video_frame_counter = 0;
 for (i = 0; i < film->sample_count; i++) {
 /* load the next sample record and transfer it to an internal struct */
 if (avio_read(pb, scratch, 16) != 16) {
@@ -240,6 +241,7 @@ static int film_read_header(AVFormatContext *s)
 film->sample_table[i].stream = film->video_stream_index;
 film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFF;
 film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1;
+video_frame_counter++;
 av_add_index_entry(s->streams[film->video_stream_index],
film->sample_table[i].sample_offset,
film->sample_table[i].pts,
@@ -248,6 +250,12 @@ static int film_read_header(AVFormatContext *s)
 }
 }
 
+if (film->audio_type)
+s->streams[film->audio_stream_index]->duration = audio_frame_counter;
+
+if (film->video_type)
+s->streams[film->video_stream_index]->duration = video_frame_counter;
+
 film->current_sample = 0;
 
 return 0;

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


[FFmpeg-cvslog] Merge commit '563e6d860391bac0511984e5c0842320b5c94d2d'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:18:05 2015 +0100| [42a088784b94847cd04802b36866cb9a8d196151] | committer: 
Hendrik Leppkes

Merge commit '563e6d860391bac0511984e5c0842320b5c94d2d'

* commit '563e6d860391bac0511984e5c0842320b5c94d2d':
  segafilm: drop the "song and dance" for cinepak

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] segafilm: drop the "song and dance" for cinepak

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Jan  7 
14:38:49 2014 +0100| [563e6d860391bac0511984e5c0842320b5c94d2d] | committer: 
Vittorio Giovara

segafilm: drop the "song and dance" for cinepak

This seems not to do anything any more since a long time, and removing
it avoids using uninitialized memory. Also change the error value
forwarding as done everywhere else.

Partly fixes: msan_uninit-mem_7fb7d24780d0_2744_R03T.CAK
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara 

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

 libavformat/segafilm.c |   15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index bbbf701..256c474 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -280,18 +280,9 @@ static int film_read_packet(AVFormatContext *s,
 /* position the stream (will probably be there anyway) */
 avio_seek(pb, sample->sample_offset, SEEK_SET);
 
-/* do a special song and dance when loading FILM Cinepak chunks */
-if ((sample->stream == film->video_stream_index) &&
-(film->video_type == AV_CODEC_ID_CINEPAK)) {
-pkt->pos= avio_tell(pb);
-if (av_new_packet(pkt, sample->sample_size))
-return AVERROR(ENOMEM);
-avio_read(pb, pkt->data, sample->sample_size);
-} else {
-ret= av_get_packet(pb, pkt, sample->sample_size);
-if (ret != sample->sample_size)
-ret = AVERROR(EIO);
-}
+ret = av_get_packet(pb, pkt, sample->sample_size);
+if (ret < 0)
+return ret;
 
 pkt->stream_index = sample->stream;
 pkt->pts = sample->pts;

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


[FFmpeg-cvslog] Merge commit 'fcc49924db6c5530a3346c45a6999244d92eaf48'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:18:17 2015 +0100| [947447bfdc6972dc1bbba1125b1e8c763a2ac177] | committer: 
Hendrik Leppkes

Merge commit 'fcc49924db6c5530a3346c45a6999244d92eaf48'

* commit 'fcc49924db6c5530a3346c45a6999244d92eaf48':
  vdpau: Remove a spurious CONFIG_H263_VDPAU_HWACCEL

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] vdpau: Remove a spurious CONFIG_H263_VDPAU_HWACCEL

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Nov  5 12:04:43 2015 +0100| [fcc49924db6c5530a3346c45a6999244d92eaf48] | 
committer: Vittorio Giovara

vdpau: Remove a spurious CONFIG_H263_VDPAU_HWACCEL

Fixes libavcodec/vdpau.c:282:5: warning:
"CONFIG_H263_VDPAU_HWACCEL" is not defined [-Wundef]

Removed in d35d0c723e3c8fc8cde76bf677f67928f5e179a8.

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 77b649b..dd48c04 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -279,7 +279,7 @@ int ff_vdpau_common_end_frame(AVCodecContext *avctx, 
AVFrame *frame,
 return vdpau_error(status);
 }
 
-#if CONFIG_H263_VDPAU_HWACCEL  || CONFIG_MPEG1_VDPAU_HWACCEL || \
+#if CONFIG_MPEG1_VDPAU_HWACCEL || \
 CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
 CONFIG_VC1_VDPAU_HWACCEL   || CONFIG_WMV3_VDPAU_HWACCEL
 int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)

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


[FFmpeg-cvslog] libopenh264enc: Set AVOption data type

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Nov  5 12:04:31 2015 +0100| [cc96018c79cd4dc823e0cef938da2131e4660fe5] | 
committer: Vittorio Giovara

libopenh264enc: Set AVOption data type

Signed-off-by: Vittorio Giovara 

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

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

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index c10409b..0671c6f 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -55,9 +55,9 @@ static const AVOption options[] = {
 { "auto", "Automatic number of slices according to number of threads", 0, 
AV_OPT_TYPE_CONST, { .i64 = SM_AUTO_SLICE }, 0, 0, VE, "slice_mode" },
 { "dyn", "Dynamic slicing", 0, AV_OPT_TYPE_CONST, { .i64 = SM_DYN_SLICE }, 
0, 0, VE, "slice_mode" },
 { "loopfilter", "Enable loop filter", OFFSET(loopfilter), AV_OPT_TYPE_INT, 
{ .i64 = 1 }, 0, 1, VE },
-{ "profile", "Set profile restrictions", OFFSET(profile), 
AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
-{ "max_nal_size", "Set maximum NAL size in bytes", OFFSET(max_nal_size), 
AV_OPT_TYPE_INT, { 0 }, 0, INT_MAX, VE },
-{ "allow_skip_frames", "Allow skipping frames to hit the target bitrate", 
OFFSET(skip_frames), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
+{ "profile", "Set profile restrictions", OFFSET(profile), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE },
+{ "max_nal_size", "Set maximum NAL size in bytes", OFFSET(max_nal_size), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
+{ "allow_skip_frames", "Allow skipping frames to hit the target bitrate", 
OFFSET(skip_frames), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
 { NULL }
 };
 

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


[FFmpeg-cvslog] Merge commit 'cc96018c79cd4dc823e0cef938da2131e4660fe5'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:19:15 2015 +0100| [23277aa24c1d3679ebb3f2f0ab13bea5c402fc8f] | committer: 
Hendrik Leppkes

Merge commit 'cc96018c79cd4dc823e0cef938da2131e4660fe5'

* commit 'cc96018c79cd4dc823e0cef938da2131e4660fe5':
  libopenh264enc: Set AVOption data type

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] Merge commit 'a0c71a575109f123978e345fa7eb4ac03cd4d3c3'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:23:22 2015 +0100| [de0e219a8aba72de201e85385c746cd1c04be1a2] | committer: 
Hendrik Leppkes

Merge commit 'a0c71a575109f123978e345fa7eb4ac03cd4d3c3'

* commit 'a0c71a575109f123978e345fa7eb4ac03cd4d3c3':
  lavf: initialize cur_dts to AV_NOPTS_VALUE for muxing

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] lavf: initialize cur_dts to AV_NOPTS_VALUE for muxing

2015-11-10 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Oct  7 
11:48:28 2015 +0200| [a0c71a575109f123978e345fa7eb4ac03cd4d3c3] | committer: 
Anton Khirnov

lavf: initialize cur_dts to AV_NOPTS_VALUE for muxing

The reasoning for setting it to zero only applies to demuxing.

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

 libavformat/utils.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 42f60d5..1fe7c6f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2549,16 +2549,18 @@ AVStream *avformat_new_stream(AVFormatContext *s, const 
AVCodec *c)
 
 /* default pts setting is MPEG-like */
 avpriv_set_pts_info(st, 33, 1, 9);
+/* we set the current DTS to 0 so that formats without any timestamps
+ * but durations get some timestamps, formats with some unknown
+ * timestamps have their first few packets buffered and the
+ * timestamps corrected before they are returned to the user */
+st->cur_dts = 0;
+} else {
+st->cur_dts = AV_NOPTS_VALUE;
 }
 
 st->index  = s->nb_streams;
 st->start_time = AV_NOPTS_VALUE;
 st->duration   = AV_NOPTS_VALUE;
-/* we set the current DTS to 0 so that formats without any timestamps
- * but durations get some timestamps, formats with some unknown
- * timestamps have their first few packets buffered and the
- * timestamps corrected before they are returned to the user */
-st->cur_dts   = 0;
 st->first_dts = AV_NOPTS_VALUE;
 st->probe_packets = MAX_PROBE_PACKETS;
 

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


[FFmpeg-cvslog] avconv: set packet duration for CFR video streams

2015-11-10 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sun Oct 11 
12:07:08 2015 +0200| [3efd71b4d0b4a73ccbbbdc092e6bbd54d92633f4] | committer: 
Anton Khirnov

avconv: set packet duration for CFR video streams

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

 avconv.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/avconv.c b/avconv.c
index 493f9d2..7334851 100644
--- a/avconv.c
+++ b/avconv.c
@@ -279,6 +279,11 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, 
OutputStream *ost)
 uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR,
   NULL);
 ost->quality = sd ? *(int *)sd : -1;
+
+if (ost->frame_rate.num) {
+pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
+ ost->st->time_base);
+}
 }
 
 while (bsfc) {

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


[FFmpeg-cvslog] Merge commit '3efd71b4d0b4a73ccbbbdc092e6bbd54d92633f4'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:25:51 2015 +0100| [d3d4bc4784d911236b232e56e4ae476c484381c8] | committer: 
Hendrik Leppkes

Merge commit '3efd71b4d0b4a73ccbbbdc092e6bbd54d92633f4'

* commit '3efd71b4d0b4a73ccbbbdc092e6bbd54d92633f4':
  avconv: set packet duration for CFR video streams

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] Merge commit 'aeda1121c91395d1f0d434bc7f227423aa2ff97d'

2015-11-10 Thread Hendrik Leppkes
ffmpeg | branch: master | Hendrik Leppkes  | Tue Nov 10 
18:42:08 2015 +0100| [3df9ec5ce7bc57ee303e715b949f65727a52c916] | committer: 
Hendrik Leppkes

Merge commit 'aeda1121c91395d1f0d434bc7f227423aa2ff97d'

* commit 'aeda1121c91395d1f0d434bc7f227423aa2ff97d':
  lavf: factor out freeing an AVStream

Merged-by: Hendrik Leppkes 

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



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


[FFmpeg-cvslog] lavf: factor out freeing an AVStream

2015-11-10 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sun Jul 20 
08:40:35 2014 +| [aeda1121c91395d1f0d434bc7f227423aa2ff97d] | committer: 
Anton Khirnov

lavf: factor out freeing an AVStream

It will be needed in other functions.

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

 libavformat/utils.c |   58 +--
 1 file changed, 33 insertions(+), 25 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1fe7c6f..734f83f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2442,10 +2442,39 @@ int av_read_pause(AVFormatContext *s)
 return AVERROR(ENOSYS);
 }
 
+static void free_stream(AVStream **pst)
+{
+AVStream *st = *pst;
+int i;
+
+if (!st)
+return;
+
+for (i = 0; i < st->nb_side_data; i++)
+av_freep(&st->side_data[i].data);
+av_freep(&st->side_data);
+
+if (st->parser)
+av_parser_close(st->parser);
+
+if (st->attached_pic.data)
+av_packet_unref(&st->attached_pic);
+
+av_dict_free(&st->metadata);
+av_freep(&st->probe_data.buf);
+av_free(st->index_entries);
+av_free(st->codec->extradata);
+av_free(st->codec->subtitle_header);
+av_free(st->codec);
+av_free(st->priv_data);
+av_free(st->info);
+
+av_freep(pst);
+}
+
 void avformat_free_context(AVFormatContext *s)
 {
-int i, j;
-AVStream *st;
+int i;
 
 if (!s)
 return;
@@ -2454,30 +2483,9 @@ void avformat_free_context(AVFormatContext *s)
 if (s->iformat && s->iformat->priv_class && s->priv_data)
 av_opt_free(s->priv_data);
 
-for (i = 0; i < s->nb_streams; i++) {
-/* free all data in a stream component */
-st = s->streams[i];
-
-for (j = 0; j < st->nb_side_data; j++)
-av_freep(&st->side_data[j].data);
-av_freep(&st->side_data);
-st->nb_side_data = 0;
+for (i = 0; i < s->nb_streams; i++)
+free_stream(&s->streams[i]);
 
-if (st->parser) {
-av_parser_close(st->parser);
-}
-if (st->attached_pic.data)
-av_packet_unref(&st->attached_pic);
-av_dict_free(&st->metadata);
-av_freep(&st->probe_data.buf);
-av_free(st->index_entries);
-av_free(st->codec->extradata);
-av_free(st->codec->subtitle_header);
-av_free(st->codec);
-av_free(st->priv_data);
-av_free(st->info);
-av_free(st);
-}
 for (i = s->nb_programs - 1; i >= 0; i--) {
 av_dict_free(&s->programs[i]->metadata);
 av_freep(&s->programs[i]->stream_index);

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


[FFmpeg-cvslog] avformat/wavdec: parse XMA2 tag

2015-11-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Nov  7 17:32:19 
2015 +0100| [a0f75c46d31c8421c376b8f9a75a6021c51ccdd3] | committer: Paul B Mahol

avformat/wavdec: parse XMA2 tag

Signed-off-by: Paul B Mahol 

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

 libavformat/wavdec.c |   58 +++---
 1 file changed, 55 insertions(+), 3 deletions(-)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index ef24e16..4190fc6 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -146,6 +146,49 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t 
size, AVStream **st)
 return 0;
 }
 
+static int wav_parse_xma2_tag(AVFormatContext *s, int64_t size, AVStream **st)
+{
+AVIOContext *pb = s->pb;
+int num_streams, i, channels = 0;
+
+if (size < 44)
+return AVERROR_INVALIDDATA;
+
+*st = avformat_new_stream(s, NULL);
+if (!*st)
+return AVERROR(ENOMEM);
+
+(*st)->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+(*st)->codec->codec_id   = AV_CODEC_ID_XMA2;
+(*st)->need_parsing  = AVSTREAM_PARSE_FULL_RAW;
+
+avio_skip(pb, 1);
+num_streams = avio_r8(pb);
+if (size < 40 + num_streams * 4)
+return AVERROR_INVALIDDATA;
+avio_skip(pb, 10);
+(*st)->codec->sample_rate = avio_rb32(pb);
+avio_skip(pb, 12);
+(*st)->duration = avio_rb32(pb);
+avio_skip(pb, 8);
+
+for (i = 0; i < num_streams; i++) {
+channels += avio_r8(pb);
+avio_skip(pb, 3);
+}
+(*st)->codec->channels = channels;
+
+if ((*st)->codec->channels <= 0 || (*st)->codec->sample_rate <= 0)
+return AVERROR_INVALIDDATA;
+
+avpriv_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate);
+if (ff_alloc_extradata((*st)->codec, 34))
+return AVERROR(ENOMEM);
+memset((*st)->codec->extradata, 0, 34);
+
+return 0;
+}
+
 static inline int wav_parse_bext_string(AVFormatContext *s, const char *key,
 int length)
 {
@@ -254,7 +297,7 @@ static int wav_read_header(AVFormatContext *s)
 AVIOContext *pb  = s->pb;
 AVStream *st = NULL;
 WAVDemuxContext *wav = s->priv_data;
-int ret, got_fmt = 0;
+int ret, got_fmt = 0, got_xma2 = 0;
 int64_t next_tag_ofs, data_ofs = -1;
 
 wav->unaligned = avio_tell(s->pb) & 1;
@@ -319,15 +362,24 @@ static int wav_read_header(AVFormatContext *s)
 switch (tag) {
 case MKTAG('f', 'm', 't', ' '):
 /* only parse the first 'fmt ' tag found */
-if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st)) < 0) {
+if (!got_xma2 && !got_fmt && (ret = wav_parse_fmt_tag(s, size, 
&st)) < 0) {
 return ret;
 } else if (got_fmt)
 av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n");
 
 got_fmt = 1;
 break;
+case MKTAG('X', 'M', 'A', '2'):
+/* only parse the first 'XMA2' tag found */
+if (!got_fmt && !got_xma2 && (ret = wav_parse_xma2_tag(s, size, 
&st)) < 0) {
+return ret;
+} else if (got_xma2)
+av_log(s, AV_LOG_WARNING, "found more than one 'XMA2' tag\n");
+
+got_xma2 = 1;
+break;
 case MKTAG('d', 'a', 't', 'a'):
-if (!got_fmt) {
+if (!got_fmt && !got_xma2) {
 av_log(s, AV_LOG_ERROR,
"found no 'fmt ' tag before the 'data' tag\n");
 return AVERROR_INVALIDDATA;

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


[FFmpeg-cvslog] avformat/wavdec: allow data chunk to be before fmt/xma2 chunk

2015-11-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Nov  8 12:27:42 
2015 +0100| [4e583eda5f5c334fe60d5628c805c3d197f35bc2] | committer: Paul B Mahol

avformat/wavdec: allow data chunk to be before fmt/xma2 chunk

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 4190fc6..d95596f 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -379,7 +379,7 @@ static int wav_read_header(AVFormatContext *s)
 got_xma2 = 1;
 break;
 case MKTAG('d', 'a', 't', 'a'):
-if (!got_fmt && !got_xma2) {
+if (!pb->seekable && !got_fmt && !got_xma2) {
 av_log(s, AV_LOG_ERROR,
"found no 'fmt ' tag before the 'data' tag\n");
 return AVERROR_INVALIDDATA;
@@ -474,6 +474,11 @@ static int wav_read_header(AVFormatContext *s)
 }
 
 break_loop:
+if (!got_fmt && !got_xma2) {
+av_log(s, AV_LOG_ERROR, "no 'fmt ' or 'XMA2' tag found\n");
+return AVERROR_INVALIDDATA;
+}
+
 if (data_ofs < 0) {
 av_log(s, AV_LOG_ERROR, "no 'data' tag found\n");
 return AVERROR_INVALIDDATA;

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


[FFmpeg-cvslog] aviflter/vf_waveform: speed up non-color filters

2015-11-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Nov 10 19:39:23 
2015 +0100| [5b349c8d7cc5dd26b3fbbce6e3883ce02861eeb7] | committer: Paul B Mahol

aviflter/vf_waveform: speed up non-color filters

Remove loops, output is also more interesting.

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_waveform.c |  196 +
 1 file changed, 56 insertions(+), 140 deletions(-)

diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index b68d429..d384258 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -565,15 +565,14 @@ static void flat(WaveformContext *s, AVFrame *in, AVFrame 
*out,
 const int c0 = c0_data[x] + 256;
 const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 
128);
 uint8_t *target;
-int p;
 
 target = d0 + x + d0_signed_linesize * c0;
 update(target, max, intensity);
+target = d1 + x + d1_signed_linesize * (c0 - c1);
+update(target, max, 1);
+target = d1 + x + d1_signed_linesize * (c0 + c1);
+update(target, max, 1);
 
-for (p = c0 - c1; p < c0 + c1; p++) {
-target = d1 + x + d1_signed_linesize * p;
-update(target, max, 1);
-}
 c0_data += c0_linesize;
 c1_data += c1_linesize;
 c2_data += c2_linesize;
@@ -598,21 +597,20 @@ static void flat(WaveformContext *s, AVFrame *in, AVFrame 
*out,
 int c0 = c0_data[x] + 256;
 const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 
128);
 uint8_t *target;
-int p;
 
-if (mirror)
+if (mirror) {
 target = d0_data - c0;
-else
+update(target, max, intensity);
+target = d1_data - (c0 - c1);
+update(target, max, 1);
+target = d1_data - (c0 + c1);
+update(target, max, 1);
+} else {
 target = d0_data + c0;
-
-update(target, max, intensity);
-
-for (p = c0 - c1; p < c0 + c1; p++) {
-if (mirror)
-target = d1_data - p;
-else
-target = d1_data + p;
-
+update(target, max, intensity);
+target = d1_data + (c0 - c1);
+update(target, max, 1);
+target = d1_data + (c0 + c1);
 update(target, max, 1);
 }
 }
@@ -669,30 +667,15 @@ static void aflat(WaveformContext *s, AVFrame *in, 
AVFrame *out,
 const int c1 = c1_data[x] - 128;
 const int c2 = c2_data[x] - 128;
 uint8_t *target;
-int p;
 
 target = d0 + x + d0_signed_linesize * c0;
 update(target, max, intensity);
 
-for (p = c0 + c1; p < c0; p++) {
-target = d1 + x + d1_signed_linesize * p;
-update(target, max, 1);
-}
-
-for (p = c0 + c1 - 1; p > c0; p--) {
-target = d1 + x + d1_signed_linesize * p;
-update(target, max, 1);
-}
+target = d1 + x + d1_signed_linesize * (c0 + c1);
+update(target, max, 1);
 
-for (p = c0 + c2; p < c0; p++) {
-target = d2 + x + d2_signed_linesize * p;
-update(target, max, 1);
-}
-
-for (p = c0 + c2 - 1; p > c0; p--) {
-target = d2 + x + d2_signed_linesize * p;
-update(target, max, 1);
-}
+target = d2 + x + d2_signed_linesize * (c0 + c2);
+update(target, max, 1);
 
 c0_data += c0_linesize;
 c1_data += c1_linesize;
@@ -722,48 +705,20 @@ static void aflat(WaveformContext *s, AVFrame *in, 
AVFrame *out,
 const int c1 = c1_data[x] - 128;
 const int c2 = c2_data[x] - 128;
 uint8_t *target;
-int p;
 
-if (mirror)
+if (mirror) {
 target = d0_data - c0;
-else
-target = d0_data + c0;
-
-update(target, max, intensity);
-
-for (p = c0 + c1; p < c0; p++) {
-if (mirror)
-target = d1_data - p;
-else
-target = d1_data + p;
-
+update(target, max, intensity);
+target = d1_data - (c0 +

[FFmpeg-cvslog] avcodec/wmaprodec: XMA1 actually have packet sequence numbers

2015-11-10 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Nov 10 21:24:30 
2015 +0100| [9c66428016c3d7219adec9a392d82f7ae89f9686] | committer: Paul B Mahol

avcodec/wmaprodec: XMA1 actually have packet sequence numbers

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 3b759f6..6a784b6 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1612,7 +1612,7 @@ static int decode_packet(AVCodecContext *avctx, void 
*data,
 
 /** parse packet header */
 init_get_bits(gb, buf, s->buf_bit_size);
-if (avctx->codec_id == AV_CODEC_ID_WMAPRO) {
+if (avctx->codec_id != AV_CODEC_ID_XMA2) {
 packet_sequence_number = get_bits(gb, 4);
 skip_bits(gb, 2);
 } else {
@@ -1631,7 +1631,7 @@ static int decode_packet(AVCodecContext *avctx, void 
*data,
 num_bits_prev_frame);
 
 /** check for packet loss */
-if (avctx->codec_id == AV_CODEC_ID_WMAPRO && !s->packet_loss &&
+if (avctx->codec_id != AV_CODEC_ID_XMA2 && !s->packet_loss &&
 ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) 
{
 s->packet_loss = 1;
 av_log(avctx, AV_LOG_ERROR,

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


[FFmpeg-cvslog] brstm: reject negative sample rate

2015-11-10 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Tue Nov 10 20:10:23 2015 +0100| [7b67fe20f6c5ce21ed1cac01fdb1906e515bc87e] | 
committer: Andreas Cadhalpun

brstm: reject negative sample rate

A negative sample rate causes assertion failures in av_rescale_rnd.

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Cadhalpun 

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

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

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index 4ac9881..bbdbcef 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -205,7 +205,7 @@ static int read_header(AVFormatContext *s)
 avio_skip(s->pb, 1); // padding
 
 st->codec->sample_rate = bfstm ? read32(s) : read16(s);
-if (!st->codec->sample_rate)
+if (st->codec->sample_rate <= 0)
 return AVERROR_INVALIDDATA;
 
 if (!bfstm)

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


[FFmpeg-cvslog] avcodec/gifdec: skip the data lzw consumed

2015-11-10 Thread Ni Hui
ffmpeg | branch: master | Ni Hui  | Tue Nov 10 22:03:36 
2015 +0800| [3ea60c505f3f6d489d31170d1fb40b4083c5074d] | committer: Michael 
Niedermayer

avcodec/gifdec: skip the data lzw consumed

this fixes the return code of avcodec_decode_video2 for gif decoding
and the gif frame data buffer is skipped properly

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

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

 libavcodec/gifdec.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 9f2e6eb..20ae903 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -130,7 +130,7 @@ static void gif_copy_img_rect(const uint32_t *src, uint32_t 
*dst,
 static int gif_read_image(GifState *s, AVFrame *frame)
 {
 int left, top, width, height, bits_per_pixel, code_size, flags, pw;
-int is_interleaved, has_local_palette, y, pass, y1, linesize, pal_size;
+int is_interleaved, has_local_palette, y, pass, y1, linesize, pal_size, 
lzwed_len;
 uint32_t *ptr, *pal, *px, *pr, *ptr1;
 int ret;
 uint8_t *idx;
@@ -293,7 +293,8 @@ static int gif_read_image(GifState *s, AVFrame *frame)
 
  decode_tail:
 /* read the garbage data until end marker is found */
-ff_lzw_decode_tail(s->lzw);
+lzwed_len = ff_lzw_decode_tail(s->lzw);
+bytestream2_skipu(&s->gb, lzwed_len);
 
 /* Graphic Control Extension's scope is single frame.
  * Remove its influence. */

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


[FFmpeg-cvslog] avcodec/lzw: ff_lzw_decode_tail() now returns the consumed bytes in lzw decompress

2015-11-10 Thread Ni Hui
ffmpeg | branch: master | Ni Hui  | Tue Nov 10 22:03:36 
2015 +0800| [c75640e9c9e1d4fb6f043ec5f8fc16bc06a885df] | committer: Michael 
Niedermayer

avcodec/lzw: ff_lzw_decode_tail() now returns the consumed bytes in lzw 
decompress

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

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

 libavcodec/lzw.c |3 ++-
 libavcodec/lzw.h |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c
index 6832c12..b0b9a34 100644
--- a/libavcodec/lzw.c
+++ b/libavcodec/lzw.c
@@ -93,7 +93,7 @@ static int lzw_get_code(struct LZWState * s)
 return c & s->curmask;
 }
 
-void ff_lzw_decode_tail(LZWState *p)
+int ff_lzw_decode_tail(LZWState *p)
 {
 struct LZWState *s = (struct LZWState *)p;
 
@@ -104,6 +104,7 @@ void ff_lzw_decode_tail(LZWState *p)
 }
 }else
 bytestream2_skip(&s->gb, bytestream2_get_bytes_left(&s->gb));
+return bytestream2_tell(&s->gb);
 }
 
 av_cold void ff_lzw_decode_open(LZWState **p)
diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
index 4653c1c..6af8a6b 100644
--- a/libavcodec/lzw.h
+++ b/libavcodec/lzw.h
@@ -47,7 +47,7 @@ void ff_lzw_decode_open(LZWState **p);
 void ff_lzw_decode_close(LZWState **p);
 int ff_lzw_decode_init(LZWState *s, int csize, const uint8_t *buf, int 
buf_size, int mode);
 int ff_lzw_decode(LZWState *s, uint8_t *buf, int len);
-void ff_lzw_decode_tail(LZWState *lzw);
+int ff_lzw_decode_tail(LZWState *lzw);
 
 /** LZW encode state */
 struct LZWEncodeState;

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


[FFmpeg-cvslog] avformat/mxfenc: Only store user comment related tags when needed

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Nov  9 14:24:26 2015 +0100| [d9726893f311b7bbbc9887db2c3ffbefaad78ca3] | 
committer: Michael Niedermayer

avformat/mxfenc: Only store user comment related tags when needed

Also support disabling them as they seem to cause problems to some
Users. They are also not allowed in IRT D-10 thus the default for
mxf_d10 is not to write them

This also decreases the filesize when no user comment are stored

Signed-off-by: Michael Niedermayer 

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

 doc/muxers.texi  |   15 ++
 libavformat/mxfenc.c |   47 +
 tests/ref/lavf/mxf   |   12 
 tests/ref/lavf/mxf_d10   |2 +-
 tests/ref/lavf/mxf_opatom|2 +-
 tests/ref/lavf/mxf_opatom_audio  |4 +--
 tests/ref/seek/lavf-mxf  |   44 +--
 tests/ref/seek/lavf-mxf_opatom_audio |   54 +-
 8 files changed, 108 insertions(+), 72 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 06483fa..b6d8823 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -874,6 +874,21 @@ ffmpeg -i file.mpg -c copy \
  -y out.ts
 @end example
 
+@section mxf, mxf_d10
+
+MXF muxer.
+
+@subsection Options
+
+The muxer options are:
+
+@table @option
+@item store_user_comments @var{bool}
+Set if user comments should be stored if available or never.
+IRT D-10 does not allow user comments. The default is thus to write them for
+mxf but not for mxf_d10
+@end table
+
 @section null
 
 Null muxer.
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index f2e0e4d..e4e4272 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -21,7 +21,8 @@
  */
 
 /*
- * signal_standard, color_siting and klv_fill_key version fixes sponsored by 
NOA GmbH
+ * signal_standard, color_siting, store_user_comments and klv_fill_key version
+ * fixes sponsored by NOA GmbH
  */
 
 /*
@@ -323,6 +324,7 @@ typedef struct MXFContext {
 int signal_standard;
 uint32_t tagged_value_count;
 AVRational audio_edit_rate;
+int store_user_comments;
 } MXFContext;
 
 static const uint8_t uuid_base[]= { 
0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
@@ -380,7 +382,6 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
 { 0x4404, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x10,0x02,0x05,0x00,0x00}},
 /* Package Modified Date */
 { 0x4402, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x01,0x03,0x03,0x02,0x01,0x00,0x00,0x00}},
 /* Package Name */
 { 0x4403, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x06,0x05,0x00,0x00}},
 /* Tracks Strong reference array */
-{ 0x4406, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x0C,0x00,0x00,0x00}},
 /* User Comments */
 { 0x4701, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x02,0x03,0x00,0x00}},
 /* Descriptor */
 // Track
 { 0x4801, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x01,0x07,0x01,0x01,0x00,0x00,0x00,0x00}},
 /* Track ID */
@@ -400,9 +401,6 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
 { 0x1501, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x03,0x01,0x05,0x00,0x00}},
 /* Start Time Code */
 { 0x1502, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x04,0x01,0x01,0x02,0x06,0x00,0x00}},
 /* Rounded Time Code Base */
 { 0x1503, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x04,0x01,0x01,0x05,0x00,0x00,0x00}},
 /* Drop Frame */
-// Tagged Value
-{ 0x5001, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x09,0x01,0x00,0x00}},
 /* Name */
-{ 0x5003, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x0A,0x01,0x00,0x00}},
 /* Value */
 // File Descriptor
 { 0x3F01, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x06,0x01,0x01,0x04,0x06,0x0B,0x00,0x00}},
 /* Sub Descriptors reference array */
 { 0x3006, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x06,0x01,0x01,0x03,0x05,0x00,0x00,0x00}},
 /* Linked Track ID */
@@ -448,6 +446,12 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
 { 0x3D0A, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}},
 /* Block Align */
 };
 
+static const MXFLocalTagPair mxf_user_comments_local_tag[] = {
+{ 0x4406, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x0C,0x00,0x00,0x00}},
 /* User Comments */
+{ 0x5001, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x09,0x01,0x00,0x00}},
 /* Name */
+{ 0x5003, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x0A,0x01,0x00,0x00}},
 /* Value */
+};
+
 static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int 
value)
 {
 avio_write(pb, uuid_base, 12);
@@ -525,10 +529,12 @@ static int mxf_get_essence_container_ul_index(enum 
AV

[FFmpeg-cvslog] avformat/mov: Add option to ignore chapters during parsing

2015-11-10 Thread Bryan Huh
ffmpeg | branch: master | Bryan Huh  | Tue Nov 10 11:11:26 2015 
-0800| [85e3c31fd54c106d45b0066e4fc3cf42d31ffb41] | committer: Michael 
Niedermayer

avformat/mov: Add option to ignore chapters during parsing

Chapter-indexing can be expensive since chapters may be interspersed
throughout the entire file and may require many seeks - especially
costly when consuming a video over a remote protocol like http.
Furthermore it is often unnecessary, especially when only trying to get
video info (e.g. via ffprobe).

Signed-off-by: Michael Niedermayer 

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

 libavformat/isom.h |1 +
 libavformat/mov.c  |7 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index dba30a2..a082e40 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -190,6 +190,7 @@ typedef struct MOVContext {
 int chapter_track;
 int use_absolute_path;
 int ignore_editlist;
+int ignore_chapters;
 int seek_individually;
 int64_t next_root_atom; ///< offset of the next root atom
 int export_all;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a7ba4d8..38d3659 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -462,6 +462,9 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 char str[256+1];
 int ret;
 
+if (c->ignore_chapters)
+return 0;
+
 if ((atom.size -= 5) < 0)
 return 0;
 
@@ -4635,7 +4638,7 @@ static int mov_read_header(AVFormatContext *s)
 av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", 
avio_tell(pb));
 
 if (pb->seekable) {
-if (mov->chapter_track > 0)
+if (mov->chapter_track > 0 && !mov->ignore_chapters)
 mov_read_chapters(s);
 for (i = 0; i < s->nb_streams; i++)
 if (s->streams[i]->codec->codec_tag == AV_RL32("tmcd"))
@@ -5046,6 +5049,8 @@ static const AVOption mov_options[] = {
 0, 1, FLAGS},
 {"ignore_editlist", "", OFFSET(ignore_editlist), AV_OPT_TYPE_INT, {.i64 = 
0},
 0, 1, FLAGS},
+{"ignore_chapters", "", OFFSET(ignore_chapters), AV_OPT_TYPE_BOOL, {.i64 = 
0},
+0, 1, FLAGS},
 {"use_mfra_for",
 "use mfra for fragment timestamps",
 OFFSET(use_mfra_for), AV_OPT_TYPE_INT, {.i64 = FF_MOV_FLAG_MFRA_AUTO},

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


[FFmpeg-cvslog] avutil/x86/intmath: Disable use of tzcnt on older intel compilers.

2015-11-10 Thread Matt Oliver
ffmpeg | branch: master | Matt Oliver  | Wed Nov 11 
00:13:42 2015 +1100| [91053990602de8da4df911692710f0e8362daac9] | committer: 
Matt Oliver

avutil/x86/intmath: Disable use of tzcnt on older intel compilers.

ICC versions older than atleast 12.1.6 dont have the tzcnt intrinsics.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Matt Oliver 

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

 libavutil/x86/intmath.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 0022737..b3e5750 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -32,7 +32,7 @@
 #include "config.h"
 
 #if HAVE_FAST_CLZ
-#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
+#if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER>=1216)) || 
defined(_MSC_VER)
 #   if defined(__INTEL_COMPILER)
 #   define ff_log2(x) (_bit_scan_reverse((x)|1))
 #   else

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


[FFmpeg-cvslog] dvdsubdec: validate offset2 similar to offset1

2015-11-10 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Tue Nov 10 22:14:39 2015 +0100| [f621749d1181987b3f815c6766ea66d6c5d55198] | 
committer: Andreas Cadhalpun

dvdsubdec: validate offset2 similar to offset1

If it is negative, it causes segmentation faults in decode_rle.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Cadhalpun 

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

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

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index ee06d55..014b0a3 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -353,7 +353,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, 
AVSubtitle *sub_header,
 }
 }
 the_end:
-if (offset1 >= 0) {
+if (offset1 >= 0 && offset2 >= 0) {
 int w, h;
 uint8_t *bitmap;
 

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


[FFmpeg-cvslog] avcodec/webvttdec: Fix uninitialized use of variable "again"

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 11 00:28:28 2015 +0100| [4819446eae451a6e58d6ae41faefb5529af4e783] | 
committer: Michael Niedermayer

avcodec/webvttdec: Fix uninitialized use of variable "again"

Fixes CID1338336
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c
index fb1a422..7354588 100644
--- a/libavcodec/webvttdec.c
+++ b/libavcodec/webvttdec.c
@@ -44,7 +44,7 @@ static const struct {
 
 static int webvtt_event_to_ass(AVBPrint *buf, const char *p)
 {
-int i, again, skip = 0;
+int i, again = 0, skip = 0;
 
 while (*p) {
 

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


[FFmpeg-cvslog] avfilter/avf_showcqt: Fix uninitialized return code

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 11 01:07:45 2015 +0100| [1b539fbfe36c450a6f45706e740fd4e205b8be16] | 
committer: Michael Niedermayer

avfilter/avf_showcqt: Fix uninitialized return code

Fixes CID1322329

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index c630ffd..d6e2928 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -993,7 +993,7 @@ static int plot_cqt(AVFilterContext *ctx)
 {
 AVFilterLink *outlink = ctx->outputs[0];
 ShowCQTContext *s = ctx->priv;
-int ret;
+int ret = 0;
 
 memcpy(s->fft_result, s->fft_data, s->fft_len * sizeof(*s->fft_data));
 av_fft_permute(s->fft_ctx, s->fft_result);

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


[FFmpeg-cvslog] ffmpeg_filter: remove redundant null ptr check

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 11 01:51:52 2015 +0100| [8f3a9603538b8633fb873fcee7ffcec72e849c42] | 
committer: Michael Niedermayer

ffmpeg_filter: remove redundant null ptr check

Fixes: CID1338331

Signed-off-by: Michael Niedermayer 

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

 ffmpeg_filter.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 9142a97..bf484bb 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -1053,8 +1053,7 @@ int configure_filtergraph(FilterGraph *fg)
  avcodec_get_name(ost->st->codec->codec_id), 
ost->file_index, ost->index);
 return AVERROR(EINVAL);
 }
-if (ost &&
-ost->enc->type == AVMEDIA_TYPE_AUDIO &&
+if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
 !(ost->enc->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
 av_buffersink_set_frame_size(ost->filter->filter,
  ost->enc_ctx->frame_size);

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


[FFmpeg-cvslog] avcodec/mjpegdec: Reinitialize IDCT on BPP changes

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Wed Nov  4 21:27:04 2015 +0100| [4567cba0b8b85ce9c4cef1dbf2bbe056ff5dc9e4] | 
committer: Michael Niedermayer

avcodec/mjpegdec: Reinitialize IDCT on BPP changes

Fixes misaligned access
Fixes: 
dc9262a469f6f315f74c087a7b3a7f35/signal_sigsegv_2e95bcd_9_9c0f9f4a9ba82aa9b3ab2b91ce4d5277.jpg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit cc35f6f4768ffe57cc4fcfa56ecb89aee409e3d5)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mjpegdec.c |   19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 1fb077a..6c6598f 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -98,6 +98,15 @@ static void parse_avid(MJpegDecodeContext *s, uint8_t *buf, 
int len)
 av_log(s->avctx, AV_LOG_INFO, "AVID: len:%d %d\n", len, len > 14 ? 
buf[12] : -1);
 }
 
+static void init_idct(AVCodecContext *avctx)
+{
+MJpegDecodeContext *s = avctx->priv_data;
+
+ff_idctdsp_init(&s->idsp, avctx);
+ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
+  ff_zigzag_direct);
+}
+
 av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
 {
 MJpegDecodeContext *s = avctx->priv_data;
@@ -112,9 +121,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
 s->avctx = avctx;
 ff_blockdsp_init(&s->bdsp, avctx);
 ff_hpeldsp_init(&s->hdsp, avctx->flags);
-ff_idctdsp_init(&s->idsp, avctx);
-ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
-  ff_zigzag_direct);
+init_idct(avctx);
 s->buffer_size   = 0;
 s->buffer= NULL;
 s->start_code= -1;
@@ -267,7 +274,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 
 /* XXX: verify len field validity */
 len = get_bits(&s->gb, 16);
-s->avctx->bits_per_raw_sample =
 bits= get_bits(&s->gb, 8);
 
 if (bits > 16 || bits < 1) {
@@ -275,6 +281,11 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 return AVERROR_INVALIDDATA;
 }
 
+if (s->avctx->bits_per_raw_sample != bits) {
+av_log(s->avctx, AV_LOG_INFO, "Changeing bps to %d\n", bits);
+s->avctx->bits_per_raw_sample = bits;
+init_idct(s->avctx);
+}
 if (s->pegasus_rct)
 bits = 9;
 if (bits == 9 && !s->pegasus_rct)

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


[FFmpeg-cvslog] avcodec/ffv1dec: Check for 0 quant tables

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Thu Nov  5 00:36:59 2015 +0100| [a6ae88bb25d64062766316cfaa46ecfa53e42a71] | 
committer: Michael Niedermayer

avcodec/ffv1dec: Check for 0 quant tables

Fixes assertion failure
Fixes: 
07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5745cf799a4389bc5d14f2b4daf32fe4631c50bc)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index b6c5e57..680abcf 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -569,7 +569,7 @@ static int read_extra_header(FFV1Context *f)
 }
 
 f->quant_table_count = get_symbol(c, state, 0);
-if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES)
+if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count)
 return AVERROR_INVALIDDATA;
 
 for (i = 0; i < f->quant_table_count; i++) {

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


[FFmpeg-cvslog] avcodec/hevc_ps: Check chroma_format_idc

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Thu Nov  5 14:52:33 2015 +0100| [ff30907205fc4a9666a7ee93ca456e3a5bcacbc0] | 
committer: Michael Niedermayer

avcodec/hevc_ps: Check chroma_format_idc

Fixes out of array access
Fixes: 
24d05e8b84676799c735c9e27d97895e/asan_heap-oob_1b70f6a_2955_7c3652a7f370f9f3ef40642bc2c99bb2.bit

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 93f30f825c08477fe8f76be00539e96014cc83c8)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 427cf09..14f908e 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -834,6 +834,10 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
unsigned int *sps_id,
 }
 
 sps->chroma_format_idc = get_ue_golomb_long(gb);
+if (sps->chroma_format_idc > 3U) {
+av_log(avctx, AV_LOG_ERROR, "chroma_format_idc %d is invalid\n", 
sps->chroma_format_idc);
+return AVERROR_INVALIDDATA;
+}
 
 if (sps->chroma_format_idc == 3)
 sps->separate_colour_plane_flag = get_bits1(gb);

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


[FFmpeg-cvslog] avformat/mpegts: Only start probing data streams within probe_packets

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Thu Nov  5 17:04:37 2015 +0100| [c7174d5204bf062f8017513ca4b64800ff0cdc5e] | 
committer: Michael Niedermayer

avformat/mpegts: Only start probing data streams within probe_packets

Fixes assertion failure
Fixes: 
4321db8ac331f5967ebfbfe80ce5eb78/signal_sigabrt_76ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3692d859f45fa8765fa5a330e79108b03c17c6bd)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index ed0a86b..65824dd 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -841,6 +841,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext 
*pes,
 if ((st->codec->codec_id == AV_CODEC_ID_NONE ||
 (st->request_probe > 0 && st->request_probe < 
AVPROBE_SCORE_STREAM_RETRY / 5)) &&
 !avcodec_is_open(st->codec) &&
+st->probe_packets > 0 &&
 stream_type == STREAM_TYPE_PRIVATE_DATA) {
 st->codec->codec_type = AVMEDIA_TYPE_DATA;
 st->codec->codec_id   = AV_CODEC_ID_BIN_DATA;

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


[FFmpeg-cvslog] libavutil/channel_layout: Check strtol*() for failure

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Thu Nov  5 19:24:33 2015 +0100| [1290037626007c0ca3ced286dc048f4c1cf7649a] | 
committer: Michael Niedermayer

libavutil/channel_layout: Check strtol*() for failure

Fixes assertion failure
Fixes: 
4f5814bb15d2dda6fc18ef9791b13816/signal_sigabrt_76ae7cc9_65_7209d160d168b76f311be6cd64a548eb.wv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit c9bfd6a8c35a2102e730aca12f6e09d1627f76b3)

Conflicts:

libavutil/channel_layout.c

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

 libavutil/channel_layout.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index f72b2cf..2932841 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -126,6 +126,8 @@ static uint64_t get_channel_layout_single(const char *name, 
int name_len)
 strlen(channel_names[i].name) == name_len &&
 !memcmp(channel_names[i].name, name, name_len))
 return (int64_t)1 << i;
+
+errno = 0;
 i = strtol(name, &end, 10);
 
 #if FF_API_GET_CHANNEL_LAYOUT_COMPAT
@@ -144,14 +146,15 @@ static uint64_t get_channel_layout_single(const char 
*name, int name_len)
 }
 } else {
 #endif
-if ((end + 1 - name == name_len && *end  == 'c'))
+if (!errno && (end + 1 - name == name_len && *end  == 'c'))
 return av_get_default_channel_layout(i);
 #if FF_API_GET_CHANNEL_LAYOUT_COMPAT
 }
 #endif
 
+errno = 0;
 layout = strtoll(name, &end, 0);
-if (end - name == name_len)
+if (!errno && end - name == name_len)
 return FFMAX(layout, 0);
 return 0;
 }

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


[FFmpeg-cvslog] avcodec/mpeg12dec: Do not call show_bits() with invalid bits

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Fri Nov  6 00:56:04 2015 +0100| [6e085f9a324e54925373a2816378426b7cfd0d04] | 
committer: Michael Niedermayer

avcodec/mpeg12dec: Do not call show_bits() with invalid bits

Fixes assertion failure
Fixes: 
63e50545709a6440d3d59f6426d58db9/signal_sigabrt_76ae7cc9_8189_3272a3010fd98ddf947c662bbde1ac13.ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 973c3dba27d0b1a88c70f6661b6a90d2f2e50665)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 0731605..f549b83 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1953,7 +1953,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
 (left && show_bits(&s->gb, FFMIN(left, 23)) && !is_d10) ||
 ((avctx->err_recognition & (AV_EF_BITSTREAM | 
AV_EF_AGGRESSIVE)) && left > 8)) {
 av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n",
-   left, show_bits(&s->gb, FFMIN(left, 23)));
+   left, left>0 ? show_bits(&s->gb, FFMIN(left, 23)) : 
0);
 return AVERROR_INVALIDDATA;
 } else
 goto eos;

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


[FFmpeg-cvslog] avcodec/h264_slice: Disable slice threads if there are multiple access units in a packet

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Sat Oct 31 21:36:00 2015 +0100| [aa34146e41b74d1db42239d0860537f55fca95b9] | 
committer: Michael Niedermayer

avcodec/h264_slice: Disable slice threads if there are multiple access units in 
a packet

Fixes null pointer dereference
Fixes part of Ticket4977

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 9368d2da3d33cac845f2fdf663df500b53625c5e)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/h264_slice.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index a346ccb..9642dc5 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1177,6 +1177,15 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264SliceContext *sl)
 av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n");
 return AVERROR_INVALIDDATA;
 }
+if (h->max_contexts > 1) {
+if (!h->single_decode_warning) {
+av_log(h->avctx, AV_LOG_WARNING, "Cannot decode multiple 
access units as slice threads\n");
+h->single_decode_warning = 1;
+}
+h->max_contexts = 1;
+return SLICE_SINGLETHREAD;
+}
+
 if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
 ret = ff_h264_field_end(h, h->slice_ctx, 1);
 h->current_slice = 0;

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


[FFmpeg-cvslog] avutil/file_open: avoid file handle inheritance on Windows

2015-11-10 Thread Tobias Rapp
ffmpeg | branch: release/2.8 | Tobias Rapp  | Thu Oct 29 
09:11:37 2015 +0100| [c6c801d993bb18e8cc67b43a1aa94e28ee4d3cd9] | committer: 
Michael Niedermayer

avutil/file_open: avoid file handle inheritance on Windows

Avoids inheritance of file handles on Windows systems similar to the
O_CLOEXEC/FD_CLOEXEC flag on Linux.

Fixes file lock issues in Windows applications when a child process
is started with handle inheritance enabled (standard input/output
redirection) while a FFmpeg transcoding is running in the parent
process.

Links relevant to the subject:

https://msdn.microsoft.com/en-us/library/w7sa2b22.aspx

Describes the _wsopen() function and the O_NOINHERIT flag. File handles
opened by _wsopen() are inheritable by default.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx

Describes handle inheritance when creating new processes. Handle
inheritance must be enabled (bInheritHandles = TRUE) e.g. when you want
to pass handles for stdin/stdout via lpStartupInfo.

Signed-off-by: Tobias Rapp 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 474665346616e446ecd1407002fdf5f88201bf72)

Signed-off-by: Michael Niedermayer 

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

 libavutil/file_open.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 3f9a67c..9e76127 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -77,6 +77,9 @@ int avpriv_open(const char *filename, int flags, ...)
 #ifdef O_CLOEXEC
 flags |= O_CLOEXEC;
 #endif
+#ifdef O_NOINHERIT
+flags |= O_NOINHERIT;
+#endif
 
 fd = open(filename, flags, mode);
 #if HAVE_FCNTL

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


[FFmpeg-cvslog] avcodec/microdvddec: Check for string end in 'P' case

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Fri Nov  6 22:24:23 2015 +0100| [11b4822ddb3eaa6627f2e83fa2e934d39d7ce2b1] | 
committer: Michael Niedermayer

avcodec/microdvddec: Check for string end in 'P' case

Fixes out of array read
Fixes: 
a9502b60f4cecc19475382aee255f73c/asan_heap-oob_1e87fba_2548_a8ad47f6dde36644fe9cdc444d4632d0.sub

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit c719cd6cf79ec21d974b81ba874580f4b8e9eb90)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/microdvddec.c b/libavcodec/microdvddec.c
index 96034a0..9035892 100644
--- a/libavcodec/microdvddec.c
+++ b/libavcodec/microdvddec.c
@@ -164,6 +164,8 @@ static char *microdvd_load_tags(struct microdvd_tag *tags, 
char *s)
 
 /* Position */
 case 'P':
+if (!*s)
+break;
 tag.persistent = MICRODVD_PERSISTENT_ON;
 tag.data1 = (*s++ == '1');
 if (*s != '}')

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


[FFmpeg-cvslog] avformat/xmv: factor return check out of if/else

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Fri Nov  6 02:11:01 2015 +0100| [2817eb514cb724290e9b2265bd89c47dfc76348c] | 
committer: Michael Niedermayer

avformat/xmv: factor return check out of if/else

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 9b6fac11da470274d4b93d46ef66527aa1824179)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index 45c2464..06c070c 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -549,16 +549,14 @@ static int xmv_read_packet(AVFormatContext *s,
 /* Fetch a video frame */
 
 result = xmv_fetch_video_packet(s, pkt);
-if (result)
-return result;
-
 } else {
 /* Fetch an audio frame */
 
 result = xmv_fetch_audio_packet(s, pkt, xmv->current_stream - 1);
-if (result)
-return result;
 }
+if (result)
+return result;
+
 
 /* Increase our counters */
 if (++xmv->current_stream >= xmv->stream_count) {

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


[FFmpeg-cvslog] apng: use correct size for output buffer

2015-11-10 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.8 | Andreas Cadhalpun 
 | Fri Nov  6 23:44:01 2015 +0100| 
[c0cd8747ef14dabb91261d910c34bc09c683773a] | committer: Michael Niedermayer

apng: use correct size for output buffer

The buffer needs s->bpp bytes, at maximum currently 10.
Assert that s->bpp is not larger.

This fixes a stack buffer overflow.

Reviewed-by: wm4 
Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Cadhalpun 
(cherry picked from commit 3e8e1a660ea182111057d56ec1cfad2c62250f4c)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index f0729a1..614c6a5 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1012,7 +1012,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, 
PNGDecContext *s,
 for (x = s->x_offset; x < s->x_offset + s->cur_w; ++x, foreground 
+= s->bpp, background += s->bpp) {
 size_t b;
 uint8_t foreground_alpha, background_alpha, output_alpha;
-uint8_t output[4];
+uint8_t output[10];
 
 // Since we might be blending alpha onto alpha, we use the 
following equations:
 // output_alpha = foreground_alpha + (1 - foreground_alpha) * 
background_alpha
@@ -1052,6 +1052,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, 
PNGDecContext *s,
 
 output_alpha = foreground_alpha + FAST_DIV255((255 - 
foreground_alpha) * background_alpha);
 
+av_assert0(s->bpp <= 10);
+
 for (b = 0; b < s->bpp - 1; ++b) {
 if (output_alpha == 0) {
 output[b] = 0;

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


[FFmpeg-cvslog] avcodec/dirac_parser: Fix undefined memcpy() use

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Fri Nov  6 21:58:42 2015 +0100| [2de2959305c57683e8ce9832395f465a2bc13dcf] | 
committer: Michael Niedermayer

avcodec/dirac_parser: Fix undefined memcpy() use

Fixes: 
9d375e415486edd1a0c826f2307d89a4/asan_generic_4a5159_1577_faa333e83dacdd9e4dd322380aeed537.iss

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit daefd8ab2f2aeb90cd53cb75445faffdc7a3cc79)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 45ded5a..83c35a2 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -123,7 +123,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, 
AVCodecContext *avctx,
 DiracParseContext *pc = s->priv_data;
 
 if (pc->overread_index) {
-memcpy(pc->buffer, pc->buffer + pc->overread_index,
+memmove(pc->buffer, pc->buffer + pc->overread_index,
pc->index - pc->overread_index);
 pc->index -= pc->overread_index;
 pc->overread_index = 0;

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


[FFmpeg-cvslog] jvdec: avoid unsigned overflow in comparison

2015-11-10 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.8 | Andreas Cadhalpun 
 | Fri Nov  6 21:04:34 2015 +0100| 
[e217224456affb22846bee9ac7c5c877f22bcd51] | committer: Michael Niedermayer

jvdec: avoid unsigned overflow in comparison

The return type of strlen is size_t, i.e. unsigned, so if pd->buf_size
is 3, the right side overflows leading to a wrong result of the
comparison and subsequently a heap buffer overflow.

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Cadhalpun 
(cherry picked from commit db374790c75fa4ef947abcb5019fcf21d0b2de85)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 4d4f0c7..a31c723 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -54,7 +54,7 @@ typedef struct JVDemuxContext {
 
 static int read_probe(AVProbeData *pd)
 {
-if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) <= 
pd->buf_size - 4 &&
+if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) + 4 <= 
pd->buf_size &&
 !memcmp(pd->buf + 4, MAGIC, strlen(MAGIC)))
 return AVPROBE_SCORE_MAX;
 return 0;

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


[FFmpeg-cvslog] avcodec/jpeg2000dec: Clip all tile coordinates

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Sat Nov  7 02:16:11 2015 +0100| [56419053bcaef67acb41dbc1934aa8eaec9acbe6] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Clip all tile coordinates

Fixes out of array access
Fixes: 
b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 43492ff3ab68a343c1264801baa1d5a02de10167)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index e0747b0..88a1677 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -826,10 +826,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int 
tileno)
 if (!tile->comp)
 return AVERROR(ENOMEM);
 
-tile->coord[0][0] = FFMAX(tilex   * s->tile_width  + s->tile_offset_x, 
s->image_offset_x);
-tile->coord[0][1] = FFMIN((tilex + 1) * s->tile_width  + s->tile_offset_x, 
s->width);
-tile->coord[1][0] = FFMAX(tiley   * s->tile_height + s->tile_offset_y, 
s->image_offset_y);
-tile->coord[1][1] = FFMIN((tiley + 1) * s->tile_height + s->tile_offset_y, 
s->height);
+tile->coord[0][0] = av_clip(tilex   * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+tile->coord[0][1] = av_clip((tilex + 1) * s->tile_width  + 
s->tile_offset_x, s->image_offset_x, s->width);
+tile->coord[1][0] = av_clip(tiley   * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
+tile->coord[1][1] = av_clip((tiley + 1) * s->tile_height + 
s->tile_offset_y, s->image_offset_y, s->height);
 
 for (compno = 0; compno < s->ncomponents; compno++) {
 Jpeg2000Component *comp = tile->comp + compno;

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


[FFmpeg-cvslog] avformat/xmv: Discard remainder of packet on error

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Fri Nov  6 02:13:36 2015 +0100| [b93a8bd838ddf4097f2cc7e6410e91dbaa7c727e] | 
committer: Michael Niedermayer

avformat/xmv: Discard remainder of packet on error

Fixes infinite loop
Fixes: 
9c48ae2680c5f23bca3d20ff0f325fd8/asan_generic_4c254d_1374_993f1e5967dd6f844b8d72f978ce2a6c.pss

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 79c4a338e4b2bf0bc6f81c9f455994f673a92f78)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index 06c070c..14d007a 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -554,8 +554,11 @@ static int xmv_read_packet(AVFormatContext *s,
 
 result = xmv_fetch_audio_packet(s, pkt, xmv->current_stream - 1);
 }
-if (result)
+if (result) {
+xmv->current_stream = 0;
+xmv->video.current_frame = xmv->video.frame_count;
 return result;
+}
 
 
 /* Increase our counters */

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


[FFmpeg-cvslog] ffmpeg: Don' t try and write sdp info if none of the outputs had an rtp format.

2015-11-10 Thread Simon Thelen
ffmpeg | branch: release/2.8 | Simon Thelen  | Mon Nov  2 
16:36:16 2015 +0100| [dac3598563ad14704efc40f52acb1eb3b294835d] | committer: 
Michael Niedermayer

ffmpeg: Don't try and write sdp info if none of the outputs had an rtp format.

Fixes a segfault when trying to write nonexistent rtp information.

Signed-off-by: Simon Thelen 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 70fb5eadc580a82c4b977a1233d70ad0041faba0)

Signed-off-by: Michael Niedermayer 

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

 ffmpeg.c |4 
 1 file changed, 4 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index 2b3085a..ce54374 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2447,6 +2447,9 @@ static void print_sdp(void)
 }
 }
 
+if (!j)
+goto fail;
+
 av_sdp_create(avc, j, sdp, sizeof(sdp));
 
 if (!sdp_filename) {
@@ -2462,6 +2465,7 @@ static void print_sdp(void)
 }
 }
 
+fail:
 av_freep(&avc);
 }
 

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


[FFmpeg-cvslog] avcodec/faxcompr: Add missing runs check in decode_uncompressed()

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Thu Nov  5 21:35:23 2015 +0100| [a7bbb7fb884a02a7b380ef7afa787fca756b9d82] | 
committer: Michael Niedermayer

avcodec/faxcompr: Add missing runs check in decode_uncompressed()

Fixes out of array access
Fixes: 
54e488b9da4abbceaf405d6492515697/asan_heap-oob_32769b0_160_a8755eb08ee8f9579348501945a33955.TIF

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit d4a731b84a08f0f3839eaaaf82e97d8d9c67da46)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 80df418..2a1d2bc 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -189,6 +189,10 @@ static int decode_uncompressed(AVCodecContext *avctx, 
GetBitContext *gb,
 *mode = !*mode;
 if (newmode != *mode) { //FIXME CHECK
 *(*runs)++ = 0;
+if (*runs >= runend) {
+av_log(avctx, AV_LOG_ERROR, "uncompressed run overrun\n");
+return AVERROR_INVALIDDATA;
+}
 *mode = newmode;
 }
 return 0;

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


[FFmpeg-cvslog] tests/fate/avformat: Fix fate-lavf

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Tue Nov 10 04:14:55 2015 +0100| [84f8157662f1aeea4520279e9b2b05b23d706ffc] | 
committer: Michael Niedermayer

tests/fate/avformat: Fix fate-lavf

The CMP variable seems to have been inherited from fate-api-seek which set it 
to null

the mxf reference needed a change due to 
c7e14a279fa7348db10ec824bb2d67858cb1c1ca

Signed-off-by: Michael Niedermayer 
(cherry picked from commit b83c849e8797fbb972ebd7f2919e0f085061f37f)

Signed-off-by: Michael Niedermayer 

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

 tests/fate/avformat.mak |1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak
index 1d13434..54bfb97 100644
--- a/tests/fate/avformat.mak
+++ b/tests/fate/avformat.mak
@@ -61,6 +61,7 @@ FATE_LAVF += $(FATE_LAVF_PIXFMT-yes)
 
 $(FATE_LAVF): $(AREF) $(VREF)
 $(FATE_LAVF): CMD = lavftest
+$(FATE_LAVF): CMP =
 
 FATE_AVCONV += $(FATE_LAVF)
 fate-lavf: $(FATE_LAVF)

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


[FFmpeg-cvslog] avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Wed Nov  4 18:08:52 2015 +0100| [fdb884263974b19584a4f37508d71bc60189f512] | 
committer: Michael Niedermayer

avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it

Fixes: 
04715144ba237443010554be0d05343f/asan_heap-oob_1eafc76_1737_c685b48041a563461839e4e7ab97abb8.jpg
Fixes out of array access

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit d24888ef19ba38b787b11d1ee091a3d94920c76a)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mjpegdec.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 61c8a5e..1fb077a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1093,7 +1093,10 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, 
int predictor,
 dc = mjpeg_decode_dc(s, s->dc_index[i]);
 if(dc == 0xF)
 return -1;
-if(bits<=8){
+if (   h * mb_x + x >= s->width
+|| v * mb_y + y >= s->height) {
+// Nothing to do
+} else if (bits<=8) {
 ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y 
+ y)) + (h * mb_x + x); //FIXME optimize this crap
 if(y==0 && toprow){
 if(x==0 && leftcol){
@@ -1161,7 +1164,10 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, 
int predictor,
 dc = mjpeg_decode_dc(s, s->dc_index[i]);
 if(dc == 0xF)
 return -1;
-if(bits<=8){
+if (   h * mb_x + x >= s->width
+|| v * mb_y + y >= s->height) {
+// Nothing to do
+} else if (bits<=8) {
 ptr = s->picture_ptr->data[c] +
   (linesize * (v * mb_y + y)) +
   (h * mb_x + x); //FIXME optimize this crap

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


[FFmpeg-cvslog] avformat/mxfenc: Only store user comment related tags when needed

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Mon Nov  9 14:24:26 2015 +0100| [9a6d581076508e9efb460d46cc6cda5243321d99] | 
committer: Michael Niedermayer

avformat/mxfenc: Only store user comment related tags when needed

Also support disabling them as they seem to cause problems to some
Users. They are also not allowed in IRT D-10 thus the default for
mxf_d10 is not to write them

This also decreases the filesize when no user comment are stored

Signed-off-by: Michael Niedermayer 
(cherry picked from commit d9726893f311b7bbbc9887db2c3ffbefaad78ca3)

Conflicts:

libavformat/mxfenc.c

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

 doc/muxers.texi  |   15 ++
 libavformat/mxfenc.c |   47 +
 tests/ref/lavf/mxf   |   12 
 tests/ref/lavf/mxf_d10   |2 +-
 tests/ref/lavf/mxf_opatom|2 +-
 tests/ref/lavf/mxf_opatom_audio  |4 +--
 tests/ref/seek/lavf-mxf  |   44 +--
 tests/ref/seek/lavf-mxf_opatom_audio |   54 +-
 8 files changed, 108 insertions(+), 72 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index ccd222c..9324550 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -839,6 +839,21 @@ ffmpeg -i file.mpg -c copy \
  -y out.ts
 @end example
 
+@section mxf, mxf_d10
+
+MXF muxer.
+
+@subsection Options
+
+The muxer options are:
+
+@table @option
+@item store_user_comments @var{bool}
+Set if user comments should be stored if available or never.
+IRT D-10 does not allow user comments. The default is thus to write them for
+mxf but not for mxf_d10
+@end table
+
 @section null
 
 Null muxer.
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 142c870..66e1f07 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -19,7 +19,8 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  *
- * signal_standard, color_siting and klv_fill_key version fixes sponsored by 
NOA GmbH
+ * signal_standard, color_siting, store_user_comments and klv_fill_key version
+ * fixes sponsored by NOA GmbH
  */
 
 /*
@@ -321,6 +322,7 @@ typedef struct MXFContext {
 int signal_standard;
 uint32_t tagged_value_count;
 AVRational audio_edit_rate;
+int store_user_comments;
 } MXFContext;
 
 static const uint8_t uuid_base[]= { 
0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
@@ -378,7 +380,6 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
 { 0x4404, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x10,0x02,0x05,0x00,0x00}},
 /* Package Modified Date */
 { 0x4402, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x01,0x03,0x03,0x02,0x01,0x00,0x00,0x00}},
 /* Package Name */
 { 0x4403, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x06,0x05,0x00,0x00}},
 /* Tracks Strong reference array */
-{ 0x4406, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x0C,0x00,0x00,0x00}},
 /* User Comments */
 { 0x4701, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x02,0x03,0x00,0x00}},
 /* Descriptor */
 // Track
 { 0x4801, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x01,0x07,0x01,0x01,0x00,0x00,0x00,0x00}},
 /* Track ID */
@@ -398,9 +399,6 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
 { 0x1501, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x03,0x01,0x05,0x00,0x00}},
 /* Start Time Code */
 { 0x1502, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x04,0x01,0x01,0x02,0x06,0x00,0x00}},
 /* Rounded Time Code Base */
 { 0x1503, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x04,0x01,0x01,0x05,0x00,0x00,0x00}},
 /* Drop Frame */
-// Tagged Value
-{ 0x5001, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x09,0x01,0x00,0x00}},
 /* Name */
-{ 0x5003, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x0A,0x01,0x00,0x00}},
 /* Value */
 // File Descriptor
 { 0x3F01, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x06,0x01,0x01,0x04,0x06,0x0B,0x00,0x00}},
 /* Sub Descriptors reference array */
 { 0x3006, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x06,0x01,0x01,0x03,0x05,0x00,0x00,0x00}},
 /* Linked Track ID */
@@ -446,6 +444,12 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
 { 0x3D0A, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}},
 /* Block Align */
 };
 
+static const MXFLocalTagPair mxf_user_comments_local_tag[] = {
+{ 0x4406, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x0C,0x00,0x00,0x00}},
 /* User Comments */
+{ 0x5001, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x02,0x01,0x02,0x09,0x01,0x00,0x00}},
 /* Name */
+{ 0x5003, 
{0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x0

[FFmpeg-cvslog] doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.

2015-11-10 Thread Simon Thelen
ffmpeg | branch: release/2.8 | Simon Thelen  | Mon Nov  2 
15:57:50 2015 +0100| [e5a2f5e74d09f7ac2233d4c2cdb0adf6745ba017] | committer: 
Michael Niedermayer

doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.

Signed-off-by: Simon Thelen 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit b02201efb531348406e48f9252bd39a6acebd2b7)

Signed-off-by: Michael Niedermayer 

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

 doc/ffmpeg.texi |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index f4ffc6c..0695f15 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1205,9 +1205,9 @@ The option is intended for cases where features are 
needed that cannot be
 specified to @command{ffserver} but can be to @command{ffmpeg}.
 
 @item -sdp_file @var{file} (@emph{global})
-Print sdp information to @var{file}.
+Print sdp information for an output stream to @var{file}.
 This allows dumping sdp information when at least one output isn't an
-rtp stream.
+rtp stream. (Requires at least one of the output formats to be rtp).
 
 @item -discard (@emph{input})
 Allows discarding specific streams or frames of streams at the demuxer.

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


[FFmpeg-cvslog] update versions for 2.8.2

2015-11-10 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Wed Nov 11 02:46:19 2015 +0100| [8d634be4cea1eac3a92b2441ac302b33cb395453] | 
committer: Michael Niedermayer

update versions for 2.8.2

Signed-off-by: Michael Niedermayer 

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

 Changelog|   41 +
 RELEASE  |2 +-
 doc/Doxyfile |2 +-
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 0e3b71f..3de18c8 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,47 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version 2.8.2
+- lavf/mov: add support for sidx fragment indexes
+- avformat/mxfenc: Only store user comment related tags when needed
+- tests/fate/avformat: Fix fate-lavf
+- doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.
+- ffmpeg: Don't try and write sdp info if none of the outputs had an rtp 
format.
+- apng: use correct size for output buffer
+- jvdec: avoid unsigned overflow in comparison
+- avcodec/jpeg2000dec: Clip all tile coordinates
+- avcodec/microdvddec: Check for string end in 'P' case
+- avcodec/dirac_parser: Fix undefined memcpy() use
+- avformat/xmv: Discard remainder of packet on error
+- avformat/xmv: factor return check out of if/else
+- avcodec/mpeg12dec: Do not call show_bits() with invalid bits
+- avcodec/faxcompr: Add missing runs check in decode_uncompressed()
+- libavutil/channel_layout: Check strtol*() for failure
+- avformat/mpegts: Only start probing data streams within probe_packets
+- avcodec/hevc_ps: Check chroma_format_idc
+- avcodec/ffv1dec: Check for 0 quant tables
+- avcodec/mjpegdec: Reinitialize IDCT on BPP changes
+- avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it
+- avutil/file_open: avoid file handle inheritance on Windows
+- avcodec/h264_slice: Disable slice threads if there are multiple access units 
in a packet
+- avformat/hls: update cookies on setcookie response
+- opusdec: Don't run vector_fmul_scalar on zero length arrays
+- avcodec/opusdec: Fix extra samples read index
+- avcodec/ffv1: Initialize vlc_state on allocation
+- avcodec/ffv1dec: update progress in case of broken pointer chains
+- avcodec/ffv1dec: Clear slice coordinates if they are invalid or slice header 
decoding fails for other reasons
+- rtsp: Allow $ as interleaved packet indicator before a complete response 
header
+- videodsp: don't overread edges in vfix3 emu_edge.
+- avformat/mp3dec: improve junk skipping heuristic
+- concatdec: fix file_start_time calculation regression
+- avcodec: loongson optimize h264dsp idct and loop filter with mmi
+- avcodec/jpeg2000dec: Clear properties in jpeg2000_dec_cleanup() too
+- avformat/hls: add support for EXT-X-MAP
+- avformat/hls: fix segment selection regression on track changes of live 
streams
+- configure: Require libkvazaar < 0.7.
+- avcodec/vp8: Do not use num_coeff_partitions in thread/buffer setup
+
+
 version 2.8.1:
 - swscale: fix ticket #4881
 - doc: fix spelling errors
diff --git a/RELEASE b/RELEASE
index dbe5900..1817afe 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-2.8.1
+2.8.2
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 694e32b..5e9a903 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME   = FFmpeg
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER = 2.8.1
+PROJECT_NUMBER = 2.8.2
 
 # With the PROJECT_LOGO tag one can specify a logo or icon that is included
 # in the documentation. The maximum height of the logo should not exceed 55

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


[FFmpeg-cvslog] lavf/mov: add support for sidx fragment indexes

2015-11-10 Thread Rodger Combs
ffmpeg | branch: release/2.8 | Rodger Combs  | Mon Jul 
20 15:00:35 2015 -0500| [edf5e88eac83807f6f80b1d18c57810c31c4d6fa] | committer: 
Michael Niedermayer

lavf/mov: add support for sidx fragment indexes

Fixes trac #3842
(cherry picked from commit 4ab56667594842283dc5ae07f0daba2a2cb4d3af)

Signed-off-by: Michael Niedermayer 

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

 libavformat/isom.h |2 +
 libavformat/mov.c  |  245 +++-
 2 files changed, 208 insertions(+), 39 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index aee9d6e..6e921c0 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -103,6 +103,7 @@ typedef struct MOVSbgp {
 typedef struct MOVFragmentIndexItem {
 int64_t moof_offset;
 int64_t time;
+int headers_read;
 } MOVFragmentIndexItem;
 
 typedef struct MOVFragmentIndex {
@@ -197,6 +198,7 @@ typedef struct MOVContext {
 int has_looked_for_mfra;
 MOVFragmentIndex** fragment_index_data;
 unsigned fragment_index_count;
+int fragment_index_complete;
 int atom_depth;
 unsigned int aax_mode;  ///< 'aax' file has been detected
 uint8_t file_key[20];
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a8d72b4..735e956 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3294,7 +3294,7 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVFragment *frag = &c->fragment;
 MOVTrackExt *trex = NULL;
 MOVFragmentIndex* index = NULL;
-int flags, track_id, i;
+int flags, track_id, i, found = 0;
 
 avio_r8(pb); /* version */
 flags = avio_rb24(pb);
@@ -3312,15 +3312,6 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_ERROR, "could not find corresponding trex\n");
 return AVERROR_INVALIDDATA;
 }
-for (i = 0; i < c->fragment_index_count; i++) {
-MOVFragmentIndex* candidate = c->fragment_index_data[i];
-if (candidate->track_id == frag->track_id) {
-av_log(c->fc, AV_LOG_DEBUG,
-   "found fragment index for track %u\n", frag->track_id);
-index = candidate;
-break;
-}
-}
 
 frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ?
  avio_rb64(pb) : flags & 
MOV_TFHD_DEFAULT_BASE_IS_MOOF ?
@@ -3334,24 +3325,33 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 frag->flags= flags & MOV_TFHD_DEFAULT_FLAGS ?
  avio_rb32(pb) : trex->flags;
 frag->time = AV_NOPTS_VALUE;
-if (index) {
-int i, found = 0;
-for (i = index->current_item; i < index->item_count; i++) {
-if (frag->implicit_offset == index->items[i].moof_offset) {
-av_log(c->fc, AV_LOG_DEBUG, "found fragment index entry "
-"for track %u and moof_offset %"PRId64"\n",
-frag->track_id, index->items[i].moof_offset);
-frag->time = index->items[i].time;
-index->current_item = i + 1;
-found = 1;
+for (i = 0; i < c->fragment_index_count; i++) {
+int j;
+MOVFragmentIndex* candidate = c->fragment_index_data[i];
+if (candidate->track_id == frag->track_id) {
+av_log(c->fc, AV_LOG_DEBUG,
+   "found fragment index for track %u\n", frag->track_id);
+index = candidate;
+for (j = index->current_item; j < index->item_count; j++) {
+if (frag->implicit_offset == index->items[j].moof_offset) {
+av_log(c->fc, AV_LOG_DEBUG, "found fragment index entry "
+"for track %u and moof_offset %"PRId64"\n",
+frag->track_id, index->items[j].moof_offset);
+frag->time = index->items[j].time;
+index->current_item = j + 1;
+found = 1;
+break;
+}
 }
-}
-if (!found) {
-av_log(c->fc, AV_LOG_WARNING, "track %u has a fragment index "
-   "but it doesn't have an (in-order) entry for moof_offset "
-   "%"PRId64"\n", frag->track_id, frag->implicit_offset);
+if (found)
+break;
 }
 }
+if (index && !found) {
+av_log(c->fc, AV_LOG_DEBUG, "track %u has a fragment index but "
+   "it doesn't have an (in-order) entry for moof_offset "
+   "%"PRId64"\n", frag->track_id, frag->implicit_offset);
+}
 av_log(c->fc, AV_LOG_TRACE, "frag flags 0x%x\n", frag->flags);
 return 0;
 }
@@ -3541,7 +3541,106 @@ static int mov_read_trun(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 return AVERROR_EOF;
 
 frag->implicit_offset = offset;
-st->duration = sc->track_end = dts +