Re: [FFmpeg-cvslog] xcbgrab: XCB-based screen capture

2014-10-28 Thread Nicolas George
Le sextidi 6 brumaire, an CCXXIII, compn a écrit :
> so its name is changed in the makefile, but not the device name?

It seems that Anton noticed it too on the other side.

> from x11grab.c:
> 
> static const AVOption options[] = {
> { "draw_mouse", "draw the mouse pointer", OFFSET(draw_mouse), 
> AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, DEC },
> { "follow_mouse", "move the grabbing region when the mouse pointer 
> reaches within specified amount of pixels to the edge of region",
>   OFFSET(follow_mouse), AV_OPT_TYPE_INT, {.i64 = 0}, -1, INT_MAX, DEC, 
> "follow_mouse" },
> { "centered", "keep the mouse pointer at the center of grabbing 
> region when following",
>   0, AV_OPT_TYPE_CONST, {.i64 = -1}, INT_MIN, INT_MAX, DEC, 
> "follow_mouse" },

I am sorry, I do not understand the point you are trying to make by quoting
that piece of code. Are there options present in FFmpeg's x11grab that are
absent from this new xcbgrab, possibly because they were absent from libav's
x11grab? Or is it just related to your next point?

> is this file based on x11grab.c ? if so , copyrights need to be
> modified.

Depends on what you call "based on". This file is certainly based on
x11grab.c in the sense that it has been written to imitate x11grab.c in
terms of features and working logic, but that does not elicit copyright.
Regarding the code itself, my understanding reading Luca's messages is that
it is a new implementation. Of course, the parts that are far from the
back-end library and straightforward are bound to look similar.

> i've confused myself with x11grab x11grab_xlib and x11grab_xcb , is the
> name of this demuxer correct?

Well, this can be confusing if you did not follow the evolution of X.

X11 is the name of the protocol.
Xlib is the usual name of the most common library used to write client
applications.
libX11 is the technical name of Xlib, i.e. the file name and SONAME.
XCB is the usual name of the new client library produced by X.org /
Freedesktop.

Technically, XCB is slightly lower-level but more efficient than Xlib.

From an user's point of view, whether an application uses XCB or Xlib should
not matter. This is even truer nowadays, because most users have X.org's
implementation of Xlib, which is a wrapper around XCB.

Therefore, I think it is logical to have both devices called "x11grab", i.e.
"grab from an X11 server".

The same goes whenever there are several feature-equivalent implementations
for the same thing: you do not have both httpopenssl:// and httpgnutls://,
you just have https:// using one of the library internally.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '26ab504ad8d2b23535c9a0ad43bf1fd0e6aa0893'

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Oct 28 
10:58:03 2014 +0100| [ab9ba8887705e3a1db946e7f992bd5cf411f1f04] | committer: 
Michael Niedermayer

Merge commit '26ab504ad8d2b23535c9a0ad43bf1fd0e6aa0893'

* commit '26ab504ad8d2b23535c9a0ad43bf1fd0e6aa0893':
  vdpau/h264: request MAIN rather than BASELINE VDPAU profile for CBP

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] vdpau/h264: request MAIN rather than BASELINE VDPAU profile for CBP

2014-10-28 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sun Oct 26 
21:24:12 2014 +0200| [26ab504ad8d2b23535c9a0ad43bf1fd0e6aa0893] | committer: 
Anton Khirnov

vdpau/h264: request MAIN rather than BASELINE VDPAU profile for CBP

The H.264 Constrained Baseline Profile (CBP) is a subset of both the
Main Profile and the Baseline Profile. In principles, a hardware
decoder that supports either of those can decode CBP content. As it
happens, Main is supported by all VDPAU drivers, and Baseline is not.

So favor map CBP to MP for now. Hopefully in the future libvdpau will
offer an explicit choice for CBP.

This fixes bug 757.

Signed-off-by: Anton Khirnov 

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

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

diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c
index b759335..4103328 100644
--- a/libavcodec/vdpau_h264.c
+++ b/libavcodec/vdpau_h264.c
@@ -209,10 +209,10 @@ static int vdpau_h264_init(AVCodecContext *avctx)
 uint32_t level = avctx->level;
 
 switch (avctx->profile & ~FF_PROFILE_H264_INTRA) {
-case FF_PROFILE_H264_CONSTRAINED_BASELINE:
 case FF_PROFILE_H264_BASELINE:
 profile = VDP_DECODER_PROFILE_H264_BASELINE;
 break;
+case FF_PROFILE_H264_CONSTRAINED_BASELINE:
 case FF_PROFILE_H264_MAIN:
 profile = VDP_DECODER_PROFILE_H264_MAIN;
 break;

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


[FFmpeg-cvslog] vdpau: return MAIN instead of BASELINE for H.264 CBP

2014-10-28 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Sun Oct 26 
21:33:58 2014 +0200| [ce91b2eae6ea52fc1a7003566d26db20ca62d745] | committer: 
Anton Khirnov

vdpau: return MAIN instead of BASELINE for H.264 CBP

This is the same as the previous change, but for applications using the
old API (such as VLC 2.2).

Signed-off-by: Anton Khirnov 

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

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

diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 1d68e70..93b53dd 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -287,8 +287,8 @@ do {\
 }
 case AV_CODEC_ID_H264:
 switch (avctx->profile & ~FF_PROFILE_H264_INTRA) {
-case FF_PROFILE_H264_CONSTRAINED_BASELINE:
 case FF_PROFILE_H264_BASELINE: 
PROFILE(VDP_DECODER_PROFILE_H264_BASELINE);
+case FF_PROFILE_H264_CONSTRAINED_BASELINE:
 case FF_PROFILE_H264_MAIN: 
PROFILE(VDP_DECODER_PROFILE_H264_MAIN);
 case FF_PROFILE_H264_HIGH: 
PROFILE(VDP_DECODER_PROFILE_H264_HIGH);
 default:   return AVERROR(EINVAL);

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


[FFmpeg-cvslog] Merge commit 'ce91b2eae6ea52fc1a7003566d26db20ca62d745'

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Oct 28 
11:04:51 2014 +0100| [dd5123a04c67f74024128447e8ca9642241d6d45] | committer: 
Michael Niedermayer

Merge commit 'ce91b2eae6ea52fc1a7003566d26db20ca62d745'

* commit 'ce91b2eae6ea52fc1a7003566d26db20ca62d745':
  vdpau: return MAIN instead of BASELINE for H.264 CBP

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] Merge commit '4ad1eba011860224831ce0bb3123f6f55716b68a'

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Oct 28 
11:16:17 2014 +0100| [c2e995674fc2ed2a15082959ed36b7c9865c01f1] | committer: 
Michael Niedermayer

Merge commit '4ad1eba011860224831ce0bb3123f6f55716b68a'

* commit '4ad1eba011860224831ce0bb3123f6f55716b68a':
  lavd: fix building x11grab after a6674d2

no change as the buggy line was not in FFmpeg

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] lavd: fix building x11grab after a6674d2

2014-10-28 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Tue Oct 28 
07:22:00 2014 +0100| [4ad1eba011860224831ce0bb3123f6f55716b68a] | committer: 
Anton Khirnov

lavd: fix building x11grab after a6674d2

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

 libavdevice/Makefile |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index 1f113dd..2a21832 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -22,7 +22,7 @@ OBJS-$(CONFIG_SNDIO_INDEV)   += sndio_common.o 
sndio_dec.o
 OBJS-$(CONFIG_SNDIO_OUTDEV)  += sndio_common.o sndio_enc.o
 OBJS-$(CONFIG_V4L2_INDEV)+= v4l2.o
 OBJS-$(CONFIG_VFWCAP_INDEV)  += vfwcap.o
-OBJS-$(CONFIG_X11GRAB_XLIB_INDEV)+= x11grab.o
+OBJS-$(CONFIG_X11GRAB_INDEV) += x11grab.o
 OBJS-$(CONFIG_X11GRAB_XCB_INDEV) += xcbgrab.o
 
 # external libraries

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


[FFmpeg-cvslog] dv: increase VLC reading bits to 10

2014-10-28 Thread Christophe Gisquet
ffmpeg | branch: master | Christophe Gisquet  | 
Tue Oct 14 02:02:36 2014 +0200| [4fa772acbbac6467165de1ea67a7f303a029cb1d] | 
committer: Michael Niedermayer

dv: increase VLC reading bits to 10

This also requires a bump in the table size of bit patterns to 1664.
>From 356 to 348 cycles.

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 6cd8a89..2bc7fc5 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -50,7 +50,7 @@
 #include "simple_idct.h"
 
 /* XXX: also include quantization */
-RL_VLC_ELEM ff_dv_rl_vlc[1184];
+RL_VLC_ELEM ff_dv_rl_vlc[1664];
 
 static inline void dv_calc_mb_coordinates(const AVDVProfile *d, int chan,
   int seq, int slot, uint16_t *tbl)
@@ -243,7 +243,7 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx)
  * to accelerate the parsing of partial codes */
 init_vlc(&dv_vlc, TEX_VLC_BITS, j, new_dv_vlc_len,
  1, 1, new_dv_vlc_bits, 2, 2, 0);
-av_assert1(dv_vlc.table_size == 1184);
+av_assert1(dv_vlc.table_size == 1664);
 
 for (i = 0; i < dv_vlc.table_size; i++) {
 int code = dv_vlc.table[i][0];
diff --git a/libavcodec/dv.h b/libavcodec/dv.h
index e68d7b0..5d28263 100644
--- a/libavcodec/dv.h
+++ b/libavcodec/dv.h
@@ -90,9 +90,9 @@ enum dv_pack_type {
  */
 #define DV_MAX_BPM 8
 
-#define TEX_VLC_BITS 9
+#define TEX_VLC_BITS 10
 
-extern RL_VLC_ELEM ff_dv_rl_vlc[1184];
+extern RL_VLC_ELEM ff_dv_rl_vlc[1664];
 
 int ff_dv_init_dynamic_tables(DVVideoContext *s, const AVDVProfile *d);
 

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


[FFmpeg-cvslog] avdevice/xcbgrab: set avclass category

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Oct 28 
12:07:20 2014 +0100| [280da99a8fdd0533a1507643f24ee070a65785d3] | committer: 
Michael Niedermayer

avdevice/xcbgrab: set avclass category

Signed-off-by: Michael Niedermayer 

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

 libavdevice/xcbgrab.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 1b4830a..4909588 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -92,6 +92,7 @@ static const AVClass xcbgrab_class = {
 .item_name  = av_default_item_name,
 .option = options,
 .version= LIBAVUTIL_VERSION_INT,
+.category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
 static int xcbgrab_reposition(AVFormatContext *s,

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


[FFmpeg-cvslog] dvenc: mark encoder as intra

2014-10-28 Thread Christophe Gisquet
ffmpeg | branch: master | Christophe Gisquet  | 
Wed Oct 15 18:37:34 2014 +0200| [beb944786e62f204c68883e22a98de9e877ca7de] | 
committer: Michael Niedermayer

dvenc: mark encoder as intra

And thus allow various multithreading.

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index a3868c4..5d810e3 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -758,7 +758,7 @@ AVCodec ff_dvvideo_encoder = {
 .init   = dvvideo_encode_init,
 .encode2= dvvideo_encode_frame,
 .close  = dvvideo_encode_close,
-.capabilities   = CODEC_CAP_SLICE_THREADS,
+.capabilities   = CODEC_CAP_SLICE_THREADS | CODEC_CAP_FRAME_THREADS | 
CODEC_CAP_INTRA_ONLY,
 .pix_fmts   = (const enum AVPixelFormat[]) {
 AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV422P,
 AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE

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


Re: [FFmpeg-cvslog] xcbgrab: XCB-based screen capture

2014-10-28 Thread compn
On Tue, 28 Oct 2014 10:05:29 +0100
Nicolas George  wrote:

> Le sextidi 6 brumaire, an CCXXIII, compn a écrit :
> > from x11grab.c:
> > 
> > AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, DEC }, { "follow_mouse", "move
> > the grabbing region when the mouse pointer reaches within specified
> > amount of pixels to the edge of region", OFFSET(follow_mouse),

from xcbgrab.c:
+{ "follow_mouse", "Move the grabbing region when the mouse
pointer reaches within specified amount of pixels to the edge of
region.",

> Or is it just related to your next point?

yes

> 
> > is this file based on x11grab.c ? if so , copyrights need to be
> > modified.
> 
> Regarding the code itself, my understanding reading Luca's
> messages is that it is a new implementation. Of course, the parts
> that are far from the back-end library and straightforward are bound
> to look similar.

the message of follow_mouse is a direct copy (with a punctuation fix).

my question is, if its a copy/paste of the option description, do we
have to put some original author attribution into the copyright list at
the top of xcbgrab.c ? 

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


[FFmpeg-cvslog] avcodec/dxa: check dimensions

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Oct 28 
15:26:42 2014 +0100| [e70312dfc22c4e54d5716f28f28db8f99c74cc90] | committer: 
Michael Niedermayer

avcodec/dxa: check dimensions

Fixes out of array access
Fixes: asan_heap-oob_11222fb_21_020.dxa
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavcodec/dxa.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
index 0f64b5e..c8e3f71 100644
--- a/libavcodec/dxa.c
+++ b/libavcodec/dxa.c
@@ -329,6 +329,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 {
 DxaDecContext * const c = avctx->priv_data;
 
+if (avctx->width%4 || avctx->height%4) {
+avpriv_request_sample(avctx, "dimensions are not a multiple of 4");
+return AVERROR_INVALIDDATA;
+}
+
 c->prev = av_frame_alloc();
 if (!c->prev)
 return AVERROR(ENOMEM);

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


[FFmpeg-cvslog] avformat/mvdec: Check size for validity in var_read_string()

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Oct 28 
16:42:05 2014 +0100| [86e574928536ee5249d9cf4da9f5d8714611d706] | committer: 
Michael Niedermayer

avformat/mvdec: Check size for validity in var_read_string()

Fixes out of array read
Fixes: asan_heap-oob_49b1e5_12_011.movie
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 6e7c3ff..0f09498 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -57,7 +57,12 @@ static int mv_probe(AVProbeData *p)
 static char *var_read_string(AVIOContext *pb, int size)
 {
 int n;
-char *str = av_malloc(size + 1);
+char *str;
+
+if (size < 0 || size == INT_MAX)
+return NULL;
+
+str = av_malloc(size + 1);
 if (!str)
 return NULL;
 n = avio_get_str(pb, size, str, size + 1);

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


[FFmpeg-cvslog] avformat/mvdec: Check size in read_table() for validity

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue Oct 28 
16:59:50 2014 +0100| [f1c21a200bcbc9bbd54fc336016ac16c2e015012] | committer: 
Michael Niedermayer

avformat/mvdec: Check size in read_table() for validity

This check is redundant with the previous commit but it provides
better error messages and feedback while the previous commit
ensures that var_read_string() doesnt return uninitialized arrays
if it itself is feeded with an invalid size possibly through a
different future codepath.

Fixes: asan_heap-oob_49b1e5_12_011.movie
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavformat/mvdec.c |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 0f09498..c8a5ebf 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -223,7 +223,7 @@ static int parse_video_var(AVFormatContext *avctx, AVStream 
*st,
 return 0;
 }
 
-static void read_table(AVFormatContext *avctx, AVStream *st,
+static int read_table(AVFormatContext *avctx, AVStream *st,
int (*parse)(AVFormatContext *avctx, AVStream *st,
 const char *name, int size))
 {
@@ -238,11 +238,16 @@ static void read_table(AVFormatContext *avctx, AVStream 
*st,
 avio_read(pb, name, 16);
 name[sizeof(name) - 1] = 0;
 size = avio_rb32(pb);
+if (size < 0) {
+av_log(avctx, AV_LOG_ERROR, "entry size %d is invalid\n", size);
+return AVERROR_INVALIDDATA;
+}
 if (parse(avctx, st, name, size) < 0) {
 avpriv_request_sample(avctx, "Variable %s", name);
 avio_skip(pb, size);
 }
 }
+return 0;
 }
 
 static void read_index(AVIOContext *pb, AVStream *st)
@@ -268,6 +273,7 @@ static int mv_read_header(AVFormatContext *avctx)
 AVIOContext *pb = avctx->pb;
 AVStream *ast = NULL, *vst = NULL; //initialization to suppress warning
 int version, i;
+int ret;
 
 avio_skip(pb, 4);
 
@@ -340,7 +346,8 @@ static int mv_read_header(AVFormatContext *avctx)
 } else if (!version && avio_rb16(pb) == 3) {
 avio_skip(pb, 4);
 
-read_table(avctx, NULL, parse_global_var);
+if ((ret = read_table(avctx, NULL, parse_global_var)) < 0)
+return ret;
 
 if (mv->nb_audio_tracks > 1) {
 avpriv_request_sample(avctx, "Multiple audio streams support");
@@ -350,7 +357,8 @@ static int mv_read_header(AVFormatContext *avctx)
 if (!ast)
 return AVERROR(ENOMEM);
 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-read_table(avctx, ast, parse_audio_var);
+if ((read_table(avctx, ast, parse_audio_var)) < 0)
+return ret;
 if (mv->acompression == 100 &&
 mv->aformat == AUDIO_FORMAT_SIGNED &&
 ast->codec->bits_per_coded_sample == 16) {
@@ -376,7 +384,8 @@ static int mv_read_header(AVFormatContext *avctx)
 if (!vst)
 return AVERROR(ENOMEM);
 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-read_table(avctx, vst, parse_video_var);
+if ((ret = read_table(avctx, vst, parse_video_var))<0)
+return ret;
 }
 
 if (mv->nb_audio_tracks)

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


[FFmpeg-cvslog] mxfdec: Tighten RIP length bounds in mxf_read_random_index_pack()

2014-10-28 Thread Tomas Härdin
ffmpeg | branch: master | Tomas Härdin  | Tue Oct 28 
14:36:27 2014 +0100| [1a25c336aaaf9b0a412b0accc7107574e77a1511] | committer: 
Michael Niedermayer

mxfdec: Tighten RIP length bounds in mxf_read_random_index_pack()

Signed-off-by: Michael Niedermayer 

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

 libavformat/mxfdec.c |   27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index fd08bf7..8da87e4 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2261,16 +2261,33 @@ static void mxf_read_random_index_pack(AVFormatContext 
*s)
 {
 MXFContext *mxf = s->priv_data;
 uint32_t length;
-int64_t file_size;
+int64_t file_size, max_rip_length, min_rip_length;
 KLVPacket klv;
 
 if (!s->pb->seekable)
 return;
 
 file_size = avio_size(s->pb);
+
+/* S377m says to check the RIP length for "silly" values, without defining 
"silly".
+ * The limit below assumes a file with nothing but partition packs and a 
RIP.
+ * Before changing this, consider that a muxer may place each sample in 
its own partition.
+ *
+ * 105 is the size of the smallest possible PartitionPack
+ * 12 is the size of each RIP entry
+ * 28 is the size of the RIP header and footer, assuming an 8-byte BER
+ */
+max_rip_length = ((file_size - mxf->run_in) / 105) * 12 + 28;
+max_rip_length = FFMIN(max_rip_length, INT_MAX); //2 GiB and up is also 
silly
+
+/* We're only interested in RIPs with at least two entries.. */
+min_rip_length = 16+1+24+4;
+
+/* See S377m section 11 */
 avio_seek(s->pb, file_size - 4, SEEK_SET);
 length = avio_rb32(s->pb);
-if (length <= 32 || length >= FFMIN(file_size, INT_MAX))
+
+if (length < min_rip_length || length > max_rip_length)
 goto end;
 avio_seek(s->pb, file_size - length, SEEK_SET);
 if (klv_read_packet(&klv, s->pb) < 0 ||
@@ -2281,6 +2298,12 @@ static void mxf_read_random_index_pack(AVFormatContext 
*s)
 avio_skip(s->pb, klv.length - 12);
 mxf->footer_partition = avio_rb64(s->pb);
 
+/* sanity check */
+if (mxf->run_in + mxf->footer_partition >= file_size) {
+av_log(s, AV_LOG_WARNING, "bad FooterPartition in RIP - ignoring\n");
+mxf->footer_partition = 0;
+}
+
 end:
 avio_seek(s->pb, mxf->run_in, SEEK_SET);
 }

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


[FFmpeg-cvslog] mxfdec: Break out parts of mxf_read_header() into separate functions

2014-10-28 Thread Tomas Härdin
ffmpeg | branch: master | Tomas Härdin  | Tue Oct 28 
13:33:04 2014 +0100| [fc1b89d887a572f3c6e814a5374453e803931580] | committer: 
Michael Niedermayer

mxfdec: Break out parts of mxf_read_header() into separate functions

Signed-off-by: Michael Niedermayer 

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

 libavformat/mxfdec.c |   69 ++
 1 file changed, 47 insertions(+), 22 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index b01dd0c..31adece 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2031,6 +2031,51 @@ static int mxf_read_local_tags(MXFContext *mxf, 
KLVPacket *klv, MXFMetadataReadF
 }
 
 /**
+ * Matches any partition pack key, in other words:
+ * - HeaderPartition
+ * - BodyPartition
+ * - FooterPartition
+ * @return non-zero if the key is a partition pack key, zero otherwise
+ */
+static int mxf_is_partition_pack_key(UID key)
+{
+//NOTE: this is a little lax since it doesn't constraint key[14]
+return !memcmp(key, mxf_header_partition_pack_key, 13) &&
+key[13] >= 2 && key[13] <= 4;
+}
+
+/**
+ * Parses a metadata KLV
+ * @return <0 on error, 0 otherwise
+ */
+static int mxf_parse_klv(MXFContext *mxf, KLVPacket klv, MXFMetadataReadFunc 
*read,
+ int ctx_size, enum MXFMetadataSetType 
type)
+{
+AVFormatContext *s = mxf->fc;
+int res;
+if (klv.key[5] == 0x53) {
+res = mxf_read_local_tags(mxf, &klv, read, ctx_size, type);
+} else {
+uint64_t next = avio_tell(s->pb) + klv.length;
+res = read(mxf, s->pb, 0, klv.length, klv.key, klv.offset);
+
+/* only seek forward, else this can loop for a long time */
+if (avio_tell(s->pb) > next) {
+av_log(s, AV_LOG_ERROR, "read past end of KLV @ %#"PRIx64"\n",
+   klv.offset);
+return AVERROR_INVALIDDATA;
+}
+
+avio_seek(s->pb, next, SEEK_SET);
+}
+if (res < 0) {
+av_log(s, AV_LOG_ERROR, "error reading header metadata\n");
+return res;
+}
+return 0;
+}
+
+/**
  * Seeks to the previous partition, if possible
  * @return <= 0 if we should stop parsing, > 0 if we should keep going
  */
@@ -2292,8 +2337,7 @@ static int mxf_read_header(AVFormatContext *s)
 if (mxf_parse_handle_essence(mxf) <= 0)
 break;
 continue;
-} else if (!memcmp(klv.key, mxf_header_partition_pack_key, 13) &&
-   klv.key[13] >= 2 && klv.key[13] <= 4 && 
mxf->current_partition) {
+} else if (mxf_is_partition_pack_key(klv.key) && 
mxf->current_partition) {
 /* next partition pack - keep going, seek to previous partition or 
stop */
 if(mxf_parse_handle_partition_or_eof(mxf) <= 0)
 break;
@@ -2304,27 +2348,8 @@ static int mxf_read_header(AVFormatContext *s)
 
 for (metadata = mxf_metadata_read_table; metadata->read; metadata++) {
 if (IS_KLV_KEY(klv.key, metadata->key)) {
-int res;
-if (klv.key[5] == 0x53) {
-res = mxf_read_local_tags(mxf, &klv, metadata->read, 
metadata->ctx_size, metadata->type);
-} else {
-uint64_t next = avio_tell(s->pb) + klv.length;
-res = metadata->read(mxf, s->pb, 0, klv.length, klv.key, 
klv.offset);
-
-/* only seek forward, else this can loop for a long time */
-if (avio_tell(s->pb) > next) {
-av_log(s, AV_LOG_ERROR, "read past end of KLV @ 
%#"PRIx64"\n",
-   klv.offset);
-return AVERROR_INVALIDDATA;
-}
-
-avio_seek(s->pb, next, SEEK_SET);
-}
-if (res < 0) {
-av_log(s, AV_LOG_ERROR, "error reading header metadata\n");
-ret = res;
+if ((ret = mxf_parse_klv(mxf, klv, metadata->read, 
metadata->ctx_size, metadata->type)) < 0)
 goto fail;
-}
 break;
 } else {
 av_log(s, AV_LOG_VERBOSE, "Dark key " PRIxUID "\n",

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


[FFmpeg-cvslog] mxfdec: Merge last_partition and footer_partition

2014-10-28 Thread Tomas Härdin
ffmpeg | branch: master | Tomas Härdin  | Tue Oct 28 
14:27:06 2014 +0100| [b83affdc94a90a3e6cddc5e21ec06c14089a9208] | committer: 
Michael Niedermayer

mxfdec: Merge last_partition and footer_partition

FooterPartition offset specified in RIP takes precedence over any value written
in PartitionPacks. This fixes the same issue f06f6da tries to fix without
introducing an extra variable.

Signed-off-by: Michael Niedermayer 

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

 libavformat/mxfdec.c |   24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index ef4b368..fd08bf7 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -227,7 +227,6 @@ typedef struct {
 struct AVAES *aesc;
 uint8_t *local_tags;
 int local_tags_count;
-uint64_t last_partition;
 uint64_t footer_partition;
 KLVPacket current_klv_data;
 int current_klv_index;
@@ -2141,30 +2140,27 @@ static int mxf_parse_handle_essence(MXFContext *mxf)
 if (mxf->parsing_backward) {
 return mxf_seek_to_previous_partition(mxf);
 } else {
-uint64_t offset = mxf->footer_partition ? mxf->footer_partition
-: mxf->last_partition;
-
-if (!offset) {
-av_dlog(mxf->fc, "no last partition\n");
+if (!mxf->footer_partition) {
+av_dlog(mxf->fc, "no FooterPartition\n");
 return 0;
 }
 
-av_dlog(mxf->fc, "seeking to last partition\n");
+av_dlog(mxf->fc, "seeking to FooterPartition\n");
 
 /* remember where we were so we don't end up seeking further back than 
this */
 mxf->last_forward_tell = avio_tell(pb);
 
 if (!pb->seekable) {
-av_log(mxf->fc, AV_LOG_INFO, "file is not seekable - not parsing 
last partition\n");
+av_log(mxf->fc, AV_LOG_INFO, "file is not seekable - not parsing 
FooterPartition\n");
 return -1;
 }
 
-/* seek to last partition and parse backward */
-if ((ret = avio_seek(pb, mxf->run_in + offset, SEEK_SET)) < 0) {
+/* seek to FooterPartition and parse backward */
+if ((ret = avio_seek(pb, mxf->run_in + mxf->footer_partition, 
SEEK_SET)) < 0) {
 av_log(mxf->fc, AV_LOG_ERROR,
-   "failed to seek to last partition @ 0x%" PRIx64
+   "failed to seek to FooterPartition @ 0x%" PRIx64
" (%"PRId64") - partial file?\n",
-   mxf->run_in + offset, ret);
+   mxf->run_in + mxf->footer_partition, ret);
 return ret;
 }
 
@@ -2202,7 +2198,7 @@ static void mxf_compute_essence_containers(MXFContext 
*mxf)
 continue;   /* BodySID == 0 -> no essence */
 
 if (x >= mxf->partitions_count - 1)
-break;  /* last partition - can't compute length (and we 
don't need to) */
+break;  /* FooterPartition - can't compute length (and we 
don't need to) */
 
 /* essence container spans to the next partition */
 p->essence_length = mxf->partitions[x+1].this_partition - 
p->essence_offset;
@@ -2283,7 +2279,7 @@ static void mxf_read_random_index_pack(AVFormatContext *s)
 goto end;
 
 avio_skip(s->pb, klv.length - 12);
-mxf->last_partition = avio_rb64(s->pb);
+mxf->footer_partition = avio_rb64(s->pb);
 
 end:
 avio_seek(s->pb, mxf->run_in, SEEK_SET);

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


[FFmpeg-cvslog] mxfdec: Parse PreviousPartition in mxf_seek_to_previous_partition()

2014-10-28 Thread Tomas Härdin
ffmpeg | branch: master | Tomas Härdin  | Tue Oct 28 
13:38:18 2014 +0100| [37c36861550f2a30f5bc6b9a4b18d34cb75da460] | committer: 
Michael Niedermayer

mxfdec: Parse PreviousPartition in mxf_seek_to_previous_partition()

Without this patch the demuxer can get stuck in a loop if PreviousPartition
points somewhere where there's no PartitionPack, or if klv_read_packet() syncs
back up to the current partition.

This should fix Ticket3278 properly and unbreak Ticket4040.

Signed-off-by: Michael Niedermayer 

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

 libavformat/mxfdec.c |   35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 31adece..5c9d808 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -89,6 +89,7 @@ typedef struct {
 int64_t header_byte_count;
 int64_t index_byte_count;
 int pack_length;
+int64_t pack_ofs;   ///< absolute offset of pack in file, 
including run-in
 } MXFPartition;
 
 typedef struct {
@@ -472,6 +473,7 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 memset(partition, 0, sizeof(*partition));
 mxf->partitions_count++;
 partition->pack_length = avio_tell(pb) - klv_offset + size;
+partition->pack_ofs= klv_offset;
 
 switch(uid[13]) {
 case 2:
@@ -547,6 +549,7 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 partition->index_sid, partition->body_sid);
 
 /* sanity check PreviousPartition if set */
+//NOTE: this isn't actually enough, see mxf_seek_to_previous_partition()
 if (partition->previous_partition &&
 mxf->run_in + partition->previous_partition >= klv_offset) {
 av_log(mxf->fc, AV_LOG_ERROR,
@@ -2076,23 +2079,53 @@ static int mxf_parse_klv(MXFContext *mxf, KLVPacket 
klv, MXFMetadataReadFunc *re
 }
 
 /**
- * Seeks to the previous partition, if possible
+ * Seeks to the previous partition and parses it, if possible
  * @return <= 0 if we should stop parsing, > 0 if we should keep going
  */
 static int mxf_seek_to_previous_partition(MXFContext *mxf)
 {
 AVIOContext *pb = mxf->fc->pb;
+KLVPacket klv;
+int64_t current_partition_ofs;
+int ret;
 
 if (!mxf->current_partition ||
 mxf->run_in + mxf->current_partition->previous_partition <= 
mxf->last_forward_tell)
 return 0;   /* we've parsed all partitions */
 
 /* seek to previous partition */
+current_partition_ofs = mxf->current_partition->pack_ofs;   //includes 
run-in
 avio_seek(pb, mxf->run_in + mxf->current_partition->previous_partition, 
SEEK_SET);
 mxf->current_partition = NULL;
 
 av_dlog(mxf->fc, "seeking to previous partition\n");
 
+/* Make sure this is actually a PartitionPack, and if so parse it.
+ * See deadlock2.mxf
+ */
+if ((ret = klv_read_packet(&klv, pb)) < 0) {
+av_log(mxf->fc, AV_LOG_ERROR, "failed to read PartitionPack KLV\n");
+return ret;
+}
+
+if (!mxf_is_partition_pack_key(klv.key)) {
+av_log(mxf->fc, AV_LOG_ERROR, "PreviousPartition @ %" PRIx64 " isn't a 
PartitionPack\n", klv.offset);
+return AVERROR_INVALIDDATA;
+}
+
+/* We can't just check ofs >= current_partition_ofs because 
PreviousPartition
+ * can point to just before the current partition, causing 
klv_read_packet()
+ * to sync back up to it. See deadlock3.mxf
+ */
+if (klv.offset >= current_partition_ofs) {
+av_log(mxf->fc, AV_LOG_ERROR, "PreviousPartition for PartitionPack @ %"
+   PRIx64 " indirectly points to itself\n", current_partition_ofs);
+return AVERROR_INVALIDDATA;
+}
+
+if ((ret = mxf_parse_klv(mxf, klv, mxf_read_partition_pack, 0, 0)) < 0)
+return ret;
+
 return 1;
 }
 

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


[FFmpeg-cvslog] Revert "avformat/mxfdec: detect loops during header parsing"

2014-10-28 Thread Tomas Härdin
ffmpeg | branch: master | Tomas Härdin  | Tue Oct 28 
13:33:47 2014 +0100| [1b17b64ee4d6d7070e0ef3ab312e5f81f45dad49] | committer: 
Michael Niedermayer

Revert "avformat/mxfdec: detect loops during header parsing"

This reverts commit 1c010fd035c1a14dc73827b84f21f593e969a5d6.

Signed-off-by: Michael Niedermayer 

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

 libavformat/mxfdec.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 5c9d808..ef4b368 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2294,8 +2294,6 @@ static int mxf_read_header(AVFormatContext *s)
 MXFContext *mxf = s->priv_data;
 KLVPacket klv;
 int64_t essence_offset = 0;
-int64_t last_pos = -1;
-uint64_t last_pos_index = 1;
 int ret;
 
 mxf->last_forward_tell = INT64_MAX;
@@ -2313,12 +2311,7 @@ static int mxf_read_header(AVFormatContext *s)
 
 while (!avio_feof(s->pb)) {
 const MXFMetadataReadTableEntry *metadata;
-if (avio_tell(s->pb) == last_pos) {
-av_log(mxf->fc, AV_LOG_ERROR, "MXF structure loop detected\n");
-return AVERROR_INVALIDDATA;
-}
-if ((1ULL<<61) % last_pos_index++ == 0)
-last_pos = avio_tell(s->pb);
+
 if (klv_read_packet(&klv, s->pb) < 0) {
 /* EOF - seek to previous partition or stop */
 if(mxf_parse_handle_partition_or_eof(mxf) <= 0)

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


[FFmpeg-cvslog] avcodec/dnxhddec: treat pix_fmt like width/height

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed Oct 29 
00:57:07 2014 +0100| [f3c0e0bf6f53df0977f3878d4f5cec99dff8de9e] | committer: 
Michael Niedermayer

avcodec/dnxhddec: treat pix_fmt like width/height

Fixes out of array accesses
Fixes: asan_heap-oob_22c9a39_16_015.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavcodec/dnxhddec.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 787c6c5..0680074 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -38,6 +38,7 @@ typedef struct DNXHDContext {
 BlockDSPContext bdsp;
 int64_t cid;///< compression id
 unsigned int width, height;
+enum AVPixelFormat pix_fmt;
 unsigned int mb_width, mb_height;
 uint32_t mb_scan_index[68]; /* max for 1080p */
 int cur_field;  ///< current interlaced field
@@ -141,7 +142,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 
 ctx->is_444 = 0;
 if (buf[0x4] == 0x2) {
-ctx->avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
+ctx->pix_fmt = AV_PIX_FMT_YUV444P10;
 ctx->avctx->bits_per_raw_sample = 10;
 if (ctx->bit_depth != 10) {
 ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
@@ -151,7 +152,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 }
 ctx->is_444 = 1;
 } else if (buf[0x21] & 0x40) {
-ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
 ctx->avctx->bits_per_raw_sample = 10;
 if (ctx->bit_depth != 10) {
 ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
@@ -160,7 +161,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 ctx->decode_dct_block = dnxhd_decode_dct_block_10;
 }
 } else {
-ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ctx->pix_fmt = AV_PIX_FMT_YUV422P;
 ctx->avctx->bits_per_raw_sample = 8;
 if (ctx->bit_depth != 8) {
 ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
@@ -446,7 +447,13 @@ decode_coding_unit:
avctx->width, avctx->height, ctx->width, ctx->height);
 first_field = 1;
 }
+if (avctx->pix_fmt != AV_PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {
+av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",
+   av_get_pix_fmt_name(avctx->pix_fmt), 
av_get_pix_fmt_name(ctx->pix_fmt));
+first_field = 1;
+}
 
+avctx->pix_fmt = ctx->pix_fmt;
 ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
 if (ret < 0)
 return ret;

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


[FFmpeg-cvslog] Merge remote-tracking branch 'cehoyos/master'

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed Oct 29 
02:01:10 2014 +0100| [5b864470808a352ff7ccfbe44eae3eeae2cccd6e] | committer: 
Michael Niedermayer

Merge remote-tracking branch 'cehoyos/master'

* cehoyos/master:
  Mention in the documentation that fieldmatch needs cfr input.
  Use v4l2 input format automatically if filename starts with "/dev/video"
  Print a warning if a subtitle demuxer changes utf16 to utf8.
  Do not set the lame quality if the user didn't request it.

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] Do not set the lame quality if the user didn't request it.

2014-10-28 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Wed Oct 29 
01:31:06 2014 +0100| [26122145559f55b6061281bd96a66cebdc5ac33f] | committer: 
Carl Eugen Hoyos

Do not set the lame quality if the user didn't request it.

This makes FFmpeg's mp3 output more similar to lame's output.

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

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

diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index 661d1c0..d8a444d 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -106,9 +106,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext 
*avctx)
 lame_set_out_samplerate(s->gfp, avctx->sample_rate);
 
 /* algorithmic quality */
-if (avctx->compression_level == FF_COMPRESSION_DEFAULT)
-lame_set_quality(s->gfp, 5);
-else
+if (avctx->compression_level != FF_COMPRESSION_DEFAULT)
 lame_set_quality(s->gfp, avctx->compression_level);
 
 /* rate control */

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


[FFmpeg-cvslog] Use v4l2 input format automatically if filename starts with "/dev/video"

2014-10-28 Thread Andrey Utkin
ffmpeg | branch: master | Andrey Utkin  | Wed 
Oct 29 01:59:25 2014 +0100| [b608fba67265eae1d46d043793073afae80f4b42] | 
committer: Carl Eugen Hoyos

Use v4l2 input format automatically if filename starts with "/dev/video"

Signed-off-by: Carl Eugen Hoyos 

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

 libavdevice/v4l2.c |8 
 1 file changed, 8 insertions(+)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index cf7a92c..59bb78b 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -806,6 +806,13 @@ static int device_try_init(AVFormatContext *ctx,
 return ret;
 }
 
+static int v4l2_read_probe(AVProbeData *p)
+{
+if (av_strstart(p->filename, "/dev/video", NULL))
+return AVPROBE_SCORE_MAX - 1;
+return 0;
+}
+
 static int v4l2_read_header(AVFormatContext *ctx)
 {
 struct video_data *s = ctx->priv_data;
@@ -1033,6 +1040,7 @@ AVInputFormat ff_v4l2_demuxer = {
 .name   = "video4linux2,v4l2",
 .long_name  = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
 .priv_data_size = sizeof(struct video_data),
+.read_probe = v4l2_read_probe,
 .read_header= v4l2_read_header,
 .read_packet= v4l2_read_packet,
 .read_close = v4l2_read_close,

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


[FFmpeg-cvslog] Print a warning if a subtitle demuxer changes utf16 to utf8.

2014-10-28 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Wed Oct 29 
01:32:44 2014 +0100| [19a6431ec247e4842236292cc5f8cfc8f87da11e] | committer: 
Carl Eugen Hoyos

Print a warning if a subtitle demuxer changes utf16 to utf8.

This does not fix anything but gives users a chance to
know that they must not pass -sub_charenc UTF-16 to ffmpeg.

Fixes ticket #4059.

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

 libavformat/assdec.c  |2 +-
 libavformat/realtextdec.c |2 +-
 libavformat/samidec.c |2 +-
 libavformat/srtdec.c  |2 +-
 libavformat/subtitles.c   |7 +--
 libavformat/subtitles.h   |4 +++-
 6 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index ccbf4c0..c62e76f 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -112,7 +112,7 @@ static int ass_read_header(AVFormatContext *s)
 int res = 0;
 AVStream *st;
 FFTextReader tr;
-ff_text_init_avio(&tr, s->pb);
+ff_text_init_avio(s, &tr, s->pb);
 
 st = avformat_new_stream(s, NULL);
 if (!st)
diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c
index 19af108..fff85d6 100644
--- a/libavformat/realtextdec.c
+++ b/libavformat/realtextdec.c
@@ -65,7 +65,7 @@ static int realtext_read_header(AVFormatContext *s)
 char c = 0;
 int res = 0, duration = read_ts("60"); // default duration is 60 seconds
 FFTextReader tr;
-ff_text_init_avio(&tr, s->pb);
+ff_text_init_avio(s, &tr, s->pb);
 
 if (!st)
 return AVERROR(ENOMEM);
diff --git a/libavformat/samidec.c b/libavformat/samidec.c
index 4dbf2cf..948e1ed 100644
--- a/libavformat/samidec.c
+++ b/libavformat/samidec.c
@@ -54,7 +54,7 @@ static int sami_read_header(AVFormatContext *s)
 char c = 0;
 int res = 0, got_first_sync_point = 0;
 FFTextReader tr;
-ff_text_init_avio(&tr, s->pb);
+ff_text_init_avio(s, &tr, s->pb);
 
 if (!st)
 return AVERROR(ENOMEM);
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 02d75f1..b35e50f 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -87,7 +87,7 @@ static int srt_read_header(AVFormatContext *s)
 AVStream *st = avformat_new_stream(s, NULL);
 int res = 0;
 FFTextReader tr;
-ff_text_init_avio(&tr, s->pb);
+ff_text_init_avio(s, &tr, s->pb);
 
 if (!st)
 return AVERROR(ENOMEM);
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 95faca6..7f4bdef 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -24,7 +24,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 
-void ff_text_init_avio(FFTextReader *r, AVIOContext *pb)
+void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
 {
 int i;
 r->pb = pb;
@@ -45,13 +45,16 @@ void ff_text_init_avio(FFTextReader *r, AVIOContext *pb)
 r->buf_pos += 3;
 }
 }
+if (s && (r->type == FF_UTF16LE || r->type == FF_UTF16BE))
+av_log(s, AV_LOG_WARNING,
+   "UTF16 is automatically converted to UTF8, do not specify a 
character encoding\n");
 }
 
 void ff_text_init_buf(FFTextReader *r, void *buf, size_t size)
 {
 memset(&r->buf_pb, 0, sizeof(r->buf_pb));
 ffio_init_context(&r->buf_pb, buf, size, 0, NULL, NULL, NULL, NULL);
-ff_text_init_avio(r, &r->buf_pb);
+ff_text_init_avio(NULL, r, &r->buf_pb);
 }
 
 int64_t ff_text_pos(FFTextReader *r)
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index 903c24d..eb719ea 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -49,14 +49,16 @@ typedef struct {
  * Initialize the FFTextReader from the given AVIOContext. This function will
  * read some bytes from pb, and test for UTF-8 or UTF-16 BOMs. Further accesses
  * to FFTextReader will read more data from pb.
+ * If s is not NULL, the user will be warned if a UTF-16 conversion takes 
place.
  *
  * The purpose of FFTextReader is to transparently convert read data to UTF-8
  * if the stream had a UTF-16 BOM.
  *
+ * @param s Pointer to provide av_log context
  * @param r object which will be initialized
  * @param pb stream to read from (referenced as long as FFTextReader is in use)
  */
-void ff_text_init_avio(FFTextReader *r, AVIOContext *pb);
+void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb);
 
 /**
  * Similar to ff_text_init_avio(), but sets it up to read from a bounded 
buffer.

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


[FFmpeg-cvslog] Mention in the documentation that fieldmatch needs cfr input.

2014-10-28 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Wed Oct 29 
01:59:52 2014 +0100| [238ed47faeadf4ed0008da774cf61d6b224e4254] | committer: 
Carl Eugen Hoyos

Mention in the documentation that fieldmatch needs cfr input.

This can be improved in the decimate filter but for the moment
explicitely mentioning that mixed telecined and progressive
content is unsupported is an improvement.

Fixes ticket #3968.

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

 doc/filters.texi |4 
 1 file changed, 4 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index c70ddf3..01eb893 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4447,6 +4447,10 @@ and VIVTC/VFM (VapourSynth project). The later is a 
light clone of TFM from
 which @code{fieldmatch} is based on. While the semantic and usage are very
 close, some behaviour and options names can differ.
 
+The filter currently only works for constant frame rate input. Do not use it
+if your input has mixed telecined and progressive content with changing
+framerate.
+
 The filter accepts the following options:
 
 @table @option

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


[FFmpeg-cvslog] avformat/mxfdec: fix null pointer dereference

2014-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed Oct 29 
03:54:06 2014 +0100| [c1e035ea89c16b8da91fae6983973a7186e138f6] | committer: 
Michael Niedermayer

avformat/mxfdec: fix null pointer dereference

Fixes: signal_sigsegv_b5b3d4_2_001.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 8da87e4..b533e2a 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1457,7 +1457,7 @@ static int mxf_parse_physical_source_package(MXFContext 
*mxf, MXFTrack *source_t
 break;
 
 /* the name of physical source package is name of the reel or tape */
-if (physical_package->name[0])
+if (physical_package->name && physical_package->name[0])
 av_dict_set(&st->metadata, "reel_name", physical_package->name, 0);
 
 /* the source timecode is calculated by adding the start_position of 
the sourceclip from the file source package track

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