Re: [libav-devel] [PATCH] build: Support cparser

2013-09-19 Thread Martin Storsjö

On Thu, 12 Sep 2013, Luca Barbato wrote:


Initial cparser support.
---

Now with an embryonic section to check cflags.

configure | 22 ++
1 file changed, 22 insertions(+)

diff --git a/configure b/configure
index a0d2d54..0c31ec8 100755
--- a/configure
+++ b/configure
@@ -2371,6 +2371,18 @@ ccc_flags(){
   done
}

+cparser_flags(){
+for flag; do
+case $flag in
+-Wno-switch) echo -Wno-switch-enum ;;
+-Wno-format-zero-length) ;;
+-Wdisabled-optimization) ;;
+-Wno-pointer-sign)   echo -Wno-other ;;
+*)   echo $flag ;;
+esac
+done
+}
+
msvc_common_flags(){
for flag; do
case $flag in
@@ -2660,6 +2672,13 @@ probe_cc(){
if [ $pfx = hostcc ]; then
append _cflags -Dsnprintf=_snprintf
fi
+elif $_cc --version 2/dev/null | grep -q ^cparser; then
+_type=cparser
+_ident=$($_cc --version | head -n1)
+_depflags='-MMD'
+_cflags_speed='-O4'
+_cflags_size='-O2'
+_flags_filter=cparser_flags
fi

eval ${pfx}_type=\$_type
@@ -3980,6 +3999,9 @@ elif enabled clang; then
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes
check_cflags -Werror=return-type
+elif enabled cparser; then
+check_cflags -Wno-missing-variable-declarations
+check_cflags -Wno-empty-statement
elif enabled armcc; then
# 2523: use of inline assembler is deprecated
add_cflags -W${armcc_opt},--diag_suppress=2523
--
1.8.3.2


Looks ok enough to me.

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 4/4] avresample: headers cleanup

2013-09-19 Thread Vittorio Giovara
---
 libavresample/audio_convert.c|8 
 libavresample/audio_convert.h|4 +---
 libavresample/audio_data.c   |3 ++-
 libavresample/audio_data.h   |5 +++--
 libavresample/audio_mix.c|6 +++---
 libavresample/audio_mix.h|2 --
 libavresample/audio_mix_matrix.c |8 ++--
 libavresample/avresample-test.c  |3 ++-
 libavresample/avresample.h   |5 +++--
 libavresample/dither.c   |7 ---
 libavresample/internal.h |3 ++-
 libavresample/options.c  |7 ---
 libavresample/resample.c |6 +++---
 libavresample/resample.h |1 -
 libavresample/utils.c|   13 ++---
 15 files changed, 39 insertions(+), 42 deletions(-)

diff --git a/libavresample/audio_convert.c b/libavresample/audio_convert.c
index 371617c..e7c48a9 100644
--- a/libavresample/audio_convert.c
+++ b/libavresample/audio_convert.c
@@ -22,14 +22,14 @@
 #include stdint.h
 
 #include config.h
+#include audio_convert.h
+#include audio_data.h
+#include dither.h
+
 #include libavutil/common.h
-#include libavutil/libm.h
 #include libavutil/log.h
 #include libavutil/mem.h
 #include libavutil/samplefmt.h
-#include audio_convert.h
-#include audio_data.h
-#include dither.h
 
 enum ConvFuncType {
 CONV_FUNC_TYPE_FLAT,
diff --git a/libavresample/audio_convert.h b/libavresample/audio_convert.h
index 6a3089d..db78eec 100644
--- a/libavresample/audio_convert.h
+++ b/libavresample/audio_convert.h
@@ -21,10 +21,8 @@
 #ifndef AVRESAMPLE_AUDIO_CONVERT_H
 #define AVRESAMPLE_AUDIO_CONVERT_H
 
-#include libavutil/samplefmt.h
-#include avresample.h
-#include internal.h
 #include audio_data.h
+#include libavutil/samplefmt.h
 
 /**
  * Set conversion function if the parameters match.
diff --git a/libavresample/audio_data.c b/libavresample/audio_data.c
index c52f518..17cd7fe 100644
--- a/libavresample/audio_data.c
+++ b/libavresample/audio_data.c
@@ -21,9 +21,10 @@
 #include stdint.h
 #include string.h
 
-#include libavutil/mem.h
 #include audio_data.h
 
+#include libavutil/mem.h
+
 static const AVClass audio_data_class = {
 .class_name = AudioData,
 .item_name  = av_default_item_name,
diff --git a/libavresample/audio_data.h b/libavresample/audio_data.h
index 97236bb..0420db1 100644
--- a/libavresample/audio_data.h
+++ b/libavresample/audio_data.h
@@ -23,11 +23,12 @@
 
 #include stdint.h
 
+#include avresample.h
+#include internal.h
+
 #include libavutil/audio_fifo.h
 #include libavutil/log.h
 #include libavutil/samplefmt.h
-#include avresample.h
-#include internal.h
 
 /**
  * Audio buffer used for intermediate storage between conversion phases.
diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c
index e6f9417..a4ff3ec 100644
--- a/libavresample/audio_mix.c
+++ b/libavresample/audio_mix.c
@@ -20,14 +20,14 @@
 
 #include stdint.h
 
-#include libavutil/common.h
-#include libavutil/libm.h
-#include libavutil/samplefmt.h
 #include avresample.h
 #include internal.h
 #include audio_data.h
 #include audio_mix.h
 
+#include libavutil/common.h
+#include libavutil/samplefmt.h
+
 static const char *coeff_type_names[] = { q8, q15, flt };
 
 struct AudioMix {
diff --git a/libavresample/audio_mix.h b/libavresample/audio_mix.h
index 5bae5ab..1d8e633 100644
--- a/libavresample/audio_mix.h
+++ b/libavresample/audio_mix.h
@@ -23,10 +23,8 @@
 
 #include stdint.h
 
-#include libavutil/samplefmt.h
 #include avresample.h
 #include internal.h
-#include audio_data.h
 
 typedef void (mix_func)(uint8_t **src, void **matrix, int len, int out_ch,
 int in_ch);
diff --git a/libavresample/audio_mix_matrix.c b/libavresample/audio_mix_matrix.c
index 8da1b48..bf27509 100644
--- a/libavresample/audio_mix_matrix.c
+++ b/libavresample/audio_mix_matrix.c
@@ -21,13 +21,9 @@
 
 #include stdint.h
 
-#include libavutil/common.h
-#include libavutil/libm.h
-#include libavutil/samplefmt.h
 #include avresample.h
-#include internal.h
-#include audio_data.h
-#include audio_mix.h
+
+#include libavutil/common.h
 
 /* channel positions */
 #define FRONT_LEFT  0
diff --git a/libavresample/avresample-test.c b/libavresample/avresample-test.c
index 697b4ba..6300d99 100644
--- a/libavresample/avresample-test.c
+++ b/libavresample/avresample-test.c
@@ -22,6 +22,8 @@
 #include stdint.h
 #include stdio.h
 
+#include avresample.h
+
 #include libavutil/avstring.h
 #include libavutil/common.h
 #include libavutil/lfg.h
@@ -30,7 +32,6 @@
 #include libavutil/mem.h
 #include libavutil/opt.h
 #include libavutil/samplefmt.h
-#include avresample.h
 
 static double dbl_rand(AVLFG *lfg)
 {
diff --git a/libavresample/avresample.h b/libavresample/avresample.h
index d26f2ca..6f2bf9d 100644
--- a/libavresample/avresample.h
+++ b/libavresample/avresample.h
@@ -93,13 +93,14 @@
  *  avresample_free().
  */
 
+
+#include version.h
+
 #include libavutil/avutil.h
 #include libavutil/channel_layout.h
 #include libavutil/dict.h
 #include 

[libav-devel] [PATCH 3/4] swscale: headers cleanup

2013-09-19 Thread Vittorio Giovara
---
 libswscale/colorspace-test.c  |2 +-
 libswscale/input.c|   11 +++
 libswscale/options.c  |6 +++---
 libswscale/output.c   |   13 -
 libswscale/rgb2rgb.c  |6 ++
 libswscale/rgb2rgb.h  |3 ++-
 libswscale/swscale-test.c |5 -
 libswscale/swscale.c  |   12 
 libswscale/swscale.h  |3 ++-
 libswscale/swscale_internal.h |8 
 libswscale/swscale_unscaled.c |6 ++
 libswscale/utils.c|   34 +-
 libswscale/version.h  |6 --
 libswscale/x86/rgb2rgb.c  |1 -
 libswscale/x86/swscale.c  |3 ---
 libswscale/x86/yuv2rgb.c  |5 -
 libswscale/yuv2rgb.c  |7 ++-
 17 files changed, 54 insertions(+), 77 deletions(-)

diff --git a/libswscale/colorspace-test.c b/libswscale/colorspace-test.c
index fbf595d..ec5077b 100644
--- a/libswscale/colorspace-test.c
+++ b/libswscale/colorspace-test.c
@@ -19,7 +19,7 @@
  */
 
 #include stdio.h
-#include string.h  /* for memset() */
+#include string.h
 #include stdlib.h
 #include inttypes.h
 
diff --git a/libswscale/input.c b/libswscale/input.c
index 2e8d43f..ac3f166 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -19,21 +19,16 @@
  */
 
 #include assert.h
-#include math.h
 #include stdint.h
 #include stdio.h
-#include string.h
 
-#include libavutil/avutil.h
+#include config.h
+#include swscale_internal.h
+
 #include libavutil/bswap.h
 #include libavutil/cpu.h
 #include libavutil/intreadwrite.h
-#include libavutil/mathematics.h
 #include libavutil/pixdesc.h
-#include config.h
-#include rgb2rgb.h
-#include swscale.h
-#include swscale_internal.h
 
 #define RGB2YUV_SHIFT 15
 #define BY  ((int)(0.114 * 219 / 255 * (1  RGB2YUV_SHIFT) + 0.5))
diff --git a/libswscale/options.c b/libswscale/options.c
index e7765d6..ed95864 100644
--- a/libswscale/options.c
+++ b/libswscale/options.c
@@ -18,12 +18,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include libavutil/avutil.h
-#include libavutil/opt.h
-#include libavutil/pixfmt.h
 #include swscale.h
 #include swscale_internal.h
 
+#include libavutil/opt.h
+#include libavutil/pixfmt.h
+
 static const char *sws_context_to_name(void *ptr)
 {
 return swscaler;
diff --git a/libswscale/output.c b/libswscale/output.c
index e1d01b0..b0d2dca 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -18,23 +18,18 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include assert.h
-#include math.h
 #include stdint.h
 #include stdio.h
-#include string.h
+
+#include config.h
+#include swscale.h
+#include swscale_internal.h
 
 #include libavutil/attributes.h
-#include libavutil/avutil.h
 #include libavutil/bswap.h
 #include libavutil/cpu.h
 #include libavutil/intreadwrite.h
-#include libavutil/mathematics.h
 #include libavutil/pixdesc.h
-#include config.h
-#include rgb2rgb.h
-#include swscale.h
-#include swscale_internal.h
 
 DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_4)[2][8]={
 {  1,   3,   1,   3,   1,   3,   1,   3, },
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 21adfe1..32aa9e4 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -25,12 +25,10 @@
 
 #include inttypes.h
 
-#include libavutil/attributes.h
-#include libavutil/bswap.h
 #include config.h
 #include rgb2rgb.h
-#include swscale.h
-#include swscale_internal.h
+
+#include libavutil/attributes.h
 
 void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
 void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index 79c378d..a4cc622 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -28,9 +28,10 @@
 
 #include inttypes.h
 
-#include libavutil/avutil.h
 #include swscale.h
 
+#include libavutil/avutil.h
+
 /* A full collection of RGB to RGB(BGR) converters */
 extern void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size);
 extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c
index 12fa9ed..bcd5488 100644
--- a/libswscale/swscale-test.c
+++ b/libswscale/swscale-test.c
@@ -24,14 +24,17 @@
 #include inttypes.h
 #include stdarg.h
 
+//FIXME: why this undef?
 #undef HAVE_AV_CONFIG_H
+
+#include swscale.h
+
 #include libavutil/imgutils.h
 #include libavutil/mem.h
 #include libavutil/avutil.h
 #include libavutil/crc.h
 #include libavutil/pixdesc.h
 #include libavutil/lfg.h
-#include swscale.h
 
 /* HACK Duplicated from swscale_internal.h.
  * Should be removed when a cleaner pixel format system exists. */
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 7756e1b..0cacf55 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -19,21 +19,17 @@
  */
 
 #include assert.h
-#include inttypes.h

[libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Vittorio Giovara
I spent some time playing with include-what-you-use clang tool and found that 
libav headers could benefit from removing a few unused headers.
So I propose a first set of patches that modify which headers are included and 
in what order, specifically:

1. make sure there is a line between copyright header and the first include
2. include system headers first
3. include headers from the same library
4. include headers from other libav libraries
5. incldue headers from other libraries
6. any other ifdef library
7. make sure there ia a line between the last include or ifdef and the code
8. move any non-doxygen comment before the include, if applicable

I could only test this set on linux x86, so I would really appreciate help for 
the other platforms (or instructions for this).

When there is agreement on the modifications on this set I'll move on the lavc, 
lavfi, lavfo files and see if there is any other header that should be included.

Cheers,
Vittorio

Vittorio Giovara (4):
  cmdutils: headers cleanup
  avutil: headers cleanup
  swscale: headers cleanup
  avresample: headers cleanup

 avconv.c |   32 
 avconv.h |   12 +---
 avconv_filter.c  |2 --
 avconv_opt.c |3 ++-
 avplay.c |   30 --
 avprobe.c|6 --
 avserver.c   |   28 ++--
 cmdutils.c   |   15 ++-
 cmdutils.h   |3 +--
 libavresample/audio_convert.c|8 
 libavresample/audio_convert.h|4 +---
 libavresample/audio_data.c   |3 ++-
 libavresample/audio_data.h   |5 +++--
 libavresample/audio_mix.c|6 +++---
 libavresample/audio_mix.h|2 --
 libavresample/audio_mix_matrix.c |8 ++--
 libavresample/avresample-test.c  |3 ++-
 libavresample/avresample.h   |5 +++--
 libavresample/dither.c   |7 ---
 libavresample/internal.h |3 ++-
 libavresample/options.c  |7 ---
 libavresample/resample.c |6 +++---
 libavresample/resample.h |1 -
 libavresample/utils.c|   13 ++---
 libavutil/adler32.h  |1 +
 libavutil/audio_fifo.c   |1 -
 libavutil/avassert.h |1 +
 libavutil/avstring.h |1 +
 libavutil/bswap.h|3 ++-
 libavutil/channel_layout.c   |1 -
 libavutil/common.h   |2 +-
 libavutil/cpu.c  |3 +++
 libavutil/cpu.h  |5 +++--
 libavutil/crc.h  |1 +
 libavutil/des.c  |3 +--
 libavutil/dict.c |1 +
 libavutil/error.c|2 +-
 libavutil/eval.c |2 --
 libavutil/fifo.c |1 +
 libavutil/fifo.h |1 +
 libavutil/file.c |9 ++---
 libavutil/file_open.c|9 +
 libavutil/frame.c|1 +
 libavutil/frame.h|4 +---
 libavutil/imgutils.c |2 +-
 libavutil/imgutils.h |1 +
 libavutil/internal.h |1 +
 libavutil/intfloat.h |1 +
 libavutil/intfloat_readwrite.c   |1 +
 libavutil/intfloat_readwrite.h   |1 +
 libavutil/intreadwrite.h |1 +
 libavutil/lfg.c  |2 +-
 libavutil/libm.h |1 +
 libavutil/log.c  |   14 +++---
 libavutil/log.h  |2 +-
 libavutil/lzo.c  |1 -
 libavutil/md5.c  |1 +
 libavutil/mem.c  |   12 ++--
 libavutil/mem.h  |2 +-
 libavutil/opt.c  |2 --
 libavutil/opt.h  |1 -
 libavutil/parseutils.c   |1 -
 libavutil/pixfmt.h   |2 +-
 libavutil/random_seed.c  |   14 --
 libavutil/random_seed.h  |1 +
 libavutil/rational.c |2 +-
 libavutil/rational.h |1 +
 libavutil/rc4.c  |2 +-
 libavutil/samplefmt.c|7 +++
 libavutil/samplefmt.h|1 -
 libavutil/sha.c  |1 -
 libavutil/time.c |   12 +++-
 libavutil/timer.h|6 +++---
 libavutil/utils.c|2 +-
 libavutil/x86/cpu.c  |2 --
 libavutil/xtea.c |1 +
 libswscale/colorspace-test.c |2 +-
 libswscale/input.c   |   11 +++
 libswscale/options.c |6 +++---
 libswscale/output.c  |   13 -
 libswscale/rgb2rgb.c |6 ++
 libswscale/rgb2rgb.h |3 ++-
 libswscale/swscale-test.c|5 

[libav-devel] [PATCH 1/4] cmdutils: headers cleanup

2013-09-19 Thread Vittorio Giovara
---
 avconv.c|   32 
 avconv.h|   12 +---
 avconv_filter.c |2 --
 avconv_opt.c|3 ++-
 avplay.c|   30 --
 avprobe.c   |6 --
 avserver.c  |   28 ++--
 cmdutils.c  |   15 ++-
 cmdutils.h  |3 +--
 9 files changed, 64 insertions(+), 67 deletions(-)

diff --git a/avconv.c b/avconv.c
index 7351b77..9e82c90 100644
--- a/avconv.c
+++ b/avconv.c
@@ -19,36 +19,34 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include config.h
-#include ctype.h
 #include string.h
 #include math.h
 #include stdlib.h
 #include errno.h
 #include signal.h
 #include limits.h
+
+#include config.h
+#include avconv.h
+#include cmdutils.h
+
 #include libavformat/avformat.h
+
 #include libavdevice/avdevice.h
-#include libswscale/swscale.h
-#include libavresample/avresample.h
+
 #include libavutil/opt.h
 #include libavutil/channel_layout.h
-#include libavutil/parseutils.h
 #include libavutil/samplefmt.h
 #include libavutil/fifo.h
-#include libavutil/intreadwrite.h
 #include libavutil/dict.h
 #include libavutil/mathematics.h
 #include libavutil/pixdesc.h
-#include libavutil/avstring.h
-#include libavutil/libm.h
-#include libavutil/imgutils.h
 #include libavutil/time.h
-#include libavformat/os_support.h
+#include libavutil/avassert.h
 
-# include libavfilter/avfilter.h
-# include libavfilter/buffersrc.h
-# include libavfilter/buffersink.h
+#include libavfilter/avfilter.h
+#include libavfilter/buffersrc.h
+#include libavfilter/buffersink.h
 
 #if HAVE_SYS_RESOURCE_H
 #include sys/time.h
@@ -57,6 +55,7 @@
 #elif HAVE_GETPROCESSTIMES
 #include windows.h
 #endif
+
 #if HAVE_GETPROCESSMEMORYINFO
 #include windows.h
 #include psapi.h
@@ -70,13 +69,6 @@
 #include pthread.h
 #endif
 
-#include time.h
-
-#include avconv.h
-#include cmdutils.h
-
-#include libavutil/avassert.h
-
 const char program_name[] = avconv;
 const int program_birth_year = 2000;
 
diff --git a/avconv.h b/avconv.h
index 56876ec..5fa5514 100644
--- a/avconv.h
+++ b/avconv.h
@@ -19,15 +19,10 @@
 #ifndef AVCONV_H
 #define AVCONV_H
 
-#include config.h
-
 #include stdint.h
 #include stdio.h
 
-#if HAVE_PTHREADS
-#include pthread.h
-#endif
-
+#include config.h
 #include cmdutils.h
 
 #include libavformat/avformat.h
@@ -37,12 +32,15 @@
 
 #include libavfilter/avfilter.h
 
-#include libavutil/avutil.h
 #include libavutil/dict.h
 #include libavutil/fifo.h
 #include libavutil/pixfmt.h
 #include libavutil/rational.h
 
+#if HAVE_PTHREADS
+#include pthread.h
+#endif
+
 #define VSYNC_AUTO   -1
 #define VSYNC_PASSTHROUGH 0
 #define VSYNC_CFR 1
diff --git a/avconv_filter.c b/avconv_filter.c
index 348196f..22f7959 100644
--- a/avconv_filter.c
+++ b/avconv_filter.c
@@ -22,8 +22,6 @@
 
 #include libavfilter/avfilter.h
 
-#include libavresample/avresample.h
-
 #include libavutil/avassert.h
 #include libavutil/avstring.h
 #include libavutil/channel_layout.h
diff --git a/avconv_opt.c b/avconv_opt.c
index bd8e7e5..706df4b 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -34,13 +34,14 @@
 #include libavutil/avutil.h
 #include libavutil/channel_layout.h
 #include libavutil/intreadwrite.h
-#include libavutil/fifo.h
 #include libavutil/mathematics.h
 #include libavutil/opt.h
 #include libavutil/parseutils.h
 #include libavutil/pixdesc.h
 #include libavutil/pixfmt.h
 
+#include libswscale/swscale.h
+
 #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
 {\
 int i, ret;\
diff --git a/avplay.c b/avplay.c
index 00becbe..32558ab 100644
--- a/avplay.c
+++ b/avplay.c
@@ -19,43 +19,45 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include config.h
 #include inttypes.h
 #include math.h
 #include limits.h
+#include assert.h
+
+#include config.h
+#include cmdutils.h
+
 #include libavutil/avstring.h
 #include libavutil/colorspace.h
 #include libavutil/mathematics.h
-#include libavutil/pixdesc.h
-#include libavutil/imgutils.h
 #include libavutil/dict.h
-#include libavutil/parseutils.h
 #include libavutil/samplefmt.h
 #include libavutil/time.h
+#include libavutil/opt.h
+
 #include libavformat/avformat.h
+
 #include libavdevice/avdevice.h
+
 #include libswscale/swscale.h
+
 #include libavresample/avresample.h
-#include libavutil/opt.h
+
 #include libavcodec/avfft.h
 
 #if CONFIG_AVFILTER
-# include libavfilter/avfilter.h
-# include libavfilter/buffersink.h
-# include libavfilter/buffersrc.h
+#include libavfilter/avfilter.h
+#include libavfilter/buffersink.h
+#include libavfilter/buffersrc.h
 #endif
 
-#include cmdutils.h
-
-#include SDL.h
-#include SDL_thread.h
+#include SDL.h
+#include SDL_thread.h
 
 #ifdef __MINGW32__
 #undef main /* We don't want SDL to override our main() */
 #endif
 
-#include assert.h
-
 const char program_name[] = avplay;
 const int program_birth_year = 2003;
 
diff --git a/avprobe.c b/avprobe.c
index c7b3d39..be9255b 

[libav-devel] [PATCH 2/4] avutil: headers cleanup

2013-09-19 Thread Vittorio Giovara
---
 libavutil/adler32.h|1 +
 libavutil/audio_fifo.c |1 -
 libavutil/avassert.h   |1 +
 libavutil/avstring.h   |1 +
 libavutil/bswap.h  |3 ++-
 libavutil/channel_layout.c |1 -
 libavutil/common.h |2 +-
 libavutil/cpu.c|3 +++
 libavutil/cpu.h|5 +++--
 libavutil/crc.h|1 +
 libavutil/des.c|3 +--
 libavutil/dict.c   |1 +
 libavutil/error.c  |2 +-
 libavutil/eval.c   |2 --
 libavutil/fifo.c   |1 +
 libavutil/fifo.h   |1 +
 libavutil/file.c   |9 ++---
 libavutil/file_open.c  |9 +
 libavutil/frame.c  |1 +
 libavutil/frame.h  |4 +---
 libavutil/imgutils.c   |2 +-
 libavutil/imgutils.h   |1 +
 libavutil/internal.h   |1 +
 libavutil/intfloat.h   |1 +
 libavutil/intfloat_readwrite.c |1 +
 libavutil/intfloat_readwrite.h |1 +
 libavutil/intreadwrite.h   |1 +
 libavutil/lfg.c|2 +-
 libavutil/libm.h   |1 +
 libavutil/log.c|   14 +++---
 libavutil/log.h|2 +-
 libavutil/lzo.c|1 -
 libavutil/md5.c|1 +
 libavutil/mem.c|   12 ++--
 libavutil/mem.h|2 +-
 libavutil/opt.c|2 --
 libavutil/opt.h|1 -
 libavutil/parseutils.c |1 -
 libavutil/pixfmt.h |2 +-
 libavutil/random_seed.c|   14 --
 libavutil/random_seed.h|1 +
 libavutil/rational.c   |2 +-
 libavutil/rational.h   |1 +
 libavutil/rc4.c|2 +-
 libavutil/samplefmt.c  |7 +++
 libavutil/samplefmt.h  |1 -
 libavutil/sha.c|1 -
 libavutil/time.c   |   12 +++-
 libavutil/timer.h  |6 +++---
 libavutil/utils.c  |2 +-
 libavutil/x86/cpu.c|2 --
 libavutil/xtea.c   |1 +
 52 files changed, 84 insertions(+), 69 deletions(-)

diff --git a/libavutil/adler32.h b/libavutil/adler32.h
index a8ff6f9..02babb3 100644
--- a/libavutil/adler32.h
+++ b/libavutil/adler32.h
@@ -22,6 +22,7 @@
 #define AVUTIL_ADLER32_H
 
 #include stdint.h
+
 #include attributes.h
 
 /**
diff --git a/libavutil/audio_fifo.c b/libavutil/audio_fifo.c
index b562537..c7e4577 100644
--- a/libavutil/audio_fifo.c
+++ b/libavutil/audio_fifo.c
@@ -24,7 +24,6 @@
  * Audio FIFO
  */
 
-#include avutil.h
 #include audio_fifo.h
 #include common.h
 #include fifo.h
diff --git a/libavutil/avassert.h b/libavutil/avassert.h
index b223d26..2db15df 100644
--- a/libavutil/avassert.h
+++ b/libavutil/avassert.h
@@ -28,6 +28,7 @@
 #define AVUTIL_AVASSERT_H
 
 #include stdlib.h
+
 #include avutil.h
 #include log.h
 
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index b7d1098..32467a9 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -22,6 +22,7 @@
 #define AVUTIL_AVSTRING_H
 
 #include stddef.h
+
 #include attributes.h
 
 /**
diff --git a/libavutil/bswap.h b/libavutil/bswap.h
index 8a350e1..2f0be28 100644
--- a/libavutil/bswap.h
+++ b/libavutil/bswap.h
@@ -27,7 +27,8 @@
 #define AVUTIL_BSWAP_H
 
 #include stdint.h
-#include libavutil/avconfig.h
+
+#include avconfig.h
 #include attributes.h
 
 #ifdef HAVE_AV_CONFIG_H
diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index 79e398e..6fc78a0 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -24,7 +24,6 @@
  */
 
 #include avstring.h
-#include avutil.h
 #include channel_layout.h
 #include common.h
 
diff --git a/libavutil/common.h b/libavutil/common.h
index caa6b19..8f145b5 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -36,7 +36,7 @@
 
 #include attributes.h
 #include version.h
-#include libavutil/avconfig.h
+#include avconfig.h
 
 #if AV_HAVE_BIGENDIAN
 #   define AV_NE(be, le) (be)
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 8edebbc..fd6f946 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -26,9 +26,11 @@
 #define _GNU_SOURCE
 #include sched.h
 #endif
+
 #if HAVE_GETPROCESSAFFINITYMASK
 #include windows.h
 #endif
+
 #if HAVE_SYSCTL
 #if HAVE_SYS_PARAM_H
 #include sys/param.h
@@ -36,6 +38,7 @@
 #include sys/types.h
 #include sys/sysctl.h
 #endif
+
 #if HAVE_SYSCONF
 #include unistd.h
 #endif
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 8f2af28..f35b0c1 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -23,9 +23,10 @@
 
 #include version.h
 
-#define AV_CPU_FLAG_FORCE0x8000 /* force usage of selected flags (OR) 
*/
+/* force usage of selected flags (OR) */
+#define AV_CPU_FLAG_FORCE0x8000
 
-/* lower 16 bits - CPU features */
+/* lower 16 bits - CPU features */
 

Re: [libav-devel] [PATCH] avplay: Support selecting codecs

2013-09-19 Thread Martin Storsjö

On Wed, 18 Sep 2013, Luca Barbato wrote:


From: Justin Ruggles justin.rugg...@gmail.com

Signed-off-by: Luca Barbato lu_z...@gentoo.org
---

Updated a little, is being really useful to debug QSV.

avplay.c| 35 ++-
doc/avplay.texi |  4 
2 files changed, 34 insertions(+), 5 deletions(-)


In general, this is really nice and appreciated.


diff --git a/avplay.c b/avplay.c
index 00becbe..18c6364 100644
--- a/avplay.c
+++ b/avplay.c
@@ -231,6 +231,8 @@ static int screen_width  = 0;
static int screen_height = 0;
static int audio_disable;
static int video_disable;
+static const char *acodec_name;
+static const char *vcodec_name;
static int wanted_stream[AVMEDIA_TYPE_NB] = {
[AVMEDIA_TYPE_AUDIO]= -1,
[AVMEDIA_TYPE_VIDEO]= -1,
@@ -2024,10 +2026,11 @@ static int stream_component_open(VideoState *is, int 
stream_index)
{
AVFormatContext *ic = is-ic;
AVCodecContext *avctx;
-AVCodec *codec;
+AVCodec *codec = NULL;
SDL_AudioSpec wanted_spec, spec;
AVDictionary *opts;
AVDictionaryEntry *t = NULL;
+enum AVMediaType codec_type;

if (stream_index  0 || stream_index = ic-nb_streams)
return -1;
@@ -2035,7 +2038,26 @@ static int stream_component_open(VideoState *is, int 
stream_index)

opts = filter_codec_opts(codec_opts, avctx-codec_id, ic, 
ic-streams[stream_index], NULL);

-codec = avcodec_find_decoder(avctx-codec_id);
+codec_type = avcodec_get_type(avctx-codec_id);
+if (acodec_name  codec_type == AVMEDIA_TYPE_AUDIO ||
+vcodec_name  codec_type == AVMEDIA_TYPE_VIDEO) {
+const char *name;
+if (codec_type == AVMEDIA_TYPE_AUDIO)
+name = acodec_name;
+else
+name = vcodec_name;
+
+codec = avcodec_find_decoder_by_name(name);
+if (!codec) {
+av_log(NULL, AV_LOG_FATAL, Unknown decoder '%s'\n, name);
+} else if (codec-type != codec_type) {
+av_log(NULL, AV_LOG_FATAL, Invalid decoder type '%s'\n, name);
+codec = NULL;
+}
+} else {
+codec = avcodec_find_decoder(avctx-codec_id);
+}
+
avctx-debug_mv  = debug_mv;
avctx-workaround_bugs   = workaround_bugs;
avctx-idct_algo = idct;
@@ -2315,9 +2337,6 @@ static int decode_thread(void *arg)
 st_index[AVMEDIA_TYPE_AUDIO] :
 st_index[AVMEDIA_TYPE_VIDEO]),
NULL, 0);
-if (show_status) {
-av_dump_format(ic, 0, is-filename, 0);
-}

/* open the streams */
if (st_index[AVMEDIA_TYPE_AUDIO] = 0) {
@@ -2344,6 +2363,10 @@ static int decode_thread(void *arg)
goto fail;
}

+if (show_status) {
+av_dump_format(ic, 0, is-filename, 0);
+}
+


Why is this block moved?


for (;;) {
if (is-abort_request)
break;
@@ -2860,6 +2883,8 @@ static const OptionDef options[] = {
{ rdftspeed, OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { rdftspeed }, rdft 
speed, msecs },
{ default, HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { opt_default }, generic catch 
all option,  },
{ i, 0, { NULL }, avconv compatibility dummy option, },
+{ ac, HAS_ARG | OPT_STRING, { acodec_name }, audio codec name,  },
+{ vc, HAS_ARG | OPT_STRING, { vcodec_name }, video codec name,  },
{ NULL, },


Would it make more sense to name them acodec and vcodec as the (old) 
avconv options, instead of inventing yet another naming?


// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avplay: Support selecting codecs

2013-09-19 Thread Vittorio Giovara
On Thu, Sep 19, 2013 at 10:27 AM, Martin Storsjö mar...@martin.st wrote:
 for (;;) {
 if (is-abort_request)
 break;
 @@ -2860,6 +2883,8 @@ static const OptionDef options[] = {
 { rdftspeed, OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { rdftspeed
 }, rdft speed, msecs },
 { default, HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {
 opt_default }, generic catch all option,  },
 { i, 0, { NULL }, avconv compatibility dummy option, },
 +{ ac, HAS_ARG | OPT_STRING, { acodec_name }, audio codec name,
  },
 +{ vc, HAS_ARG | OPT_STRING, { vcodec_name }, video codec name,
  },
 { NULL, },


 Would it make more sense to name them acodec and vcodec as the (old) avconv
 options, instead of inventing yet another naming?

+1
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Martin Storsjö

On Thu, 19 Sep 2013, Vittorio Giovara wrote:


I spent some time playing with include-what-you-use clang tool and found that 
libav headers could benefit from removing a few unused headers.
So I propose a first set of patches that modify which headers are included and 
in what order, specifically:

1. make sure there is a line between copyright header and the first include
2. include system headers first
3. include headers from the same library
4. include headers from other libav libraries
5. incldue headers from other libraries
6. any other ifdef library


I'm not sure this order is the best one, especially if we are making 
things consistent. I'd rather have other libav libraries and other 
libraries before the local library headers. The same reason and logic that 
says system headers should be included first also applies in the same way 
for the libraries and their interdependencies. So it would be better to 
order them e.g. system headers, libavutil, libavcodec, libavformat or 
something like that.


// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] doxy: Document avlog

2013-09-19 Thread Vittorio Giovara
On Wed, Sep 18, 2013 at 3:30 PM, Luca Barbato lu_z...@gentoo.org wrote:
 Provide some information for every function and add a group.

Maybe the function documentation and group addition could be split in two?

 ---

 Please send updated patches instead of reviews.
 Note:
  @see is immediately after the body on purpose, do not move it down,
  looks much worse on the html output otherwise.

  libavutil/avutil.h |  6 
  libavutil/log.h| 98 
 ++
  2 files changed, 98 insertions(+), 6 deletions(-)

 diff --git a/libavutil/avutil.h b/libavutil/avutil.h
 index ddb34a1..6bb5510 100644
 --- a/libavutil/avutil.h
 +++ b/libavutil/avutil.h
 @@ -127,6 +127,12 @@
   *
   * @}
   *
 + * @defgroup lavu_log Logging Facility
 + *
 + * @{
 + *
 + * @}
 + *
   * @defgroup lavu_misc Other
   *
   * @{
 diff --git a/libavutil/log.h b/libavutil/log.h
 index 7b17330..5692bd5 100644
 --- a/libavutil/log.h
 +++ b/libavutil/log.h
 @@ -89,8 +89,19 @@ typedef struct AVClass {
  const struct AVClass* (*child_class_next)(const struct AVClass *prev);
  } AVClass;

 -/* av_log API */
 +/**
 + * @addtogroup lavu_log
 + *
 + * @{
 + *
 + * @defgroup lavu_log_constants Logging Constants
 + *
 + * @{
 + */

 +/**
 + * No output.
 + */
  #define AV_LOG_QUIET-8

  /**
 @@ -117,7 +128,14 @@ typedef struct AVClass {
   */
  #define AV_LOG_WARNING  24

 +/**
 + * Standard information
 + */
  #define AV_LOG_INFO 32
 +
 +/**
 + * Detailed information, usually not interesting.
 + */
  #define AV_LOG_VERBOSE  40

  /**
 @@ -126,10 +144,15 @@ typedef struct AVClass {
  #define AV_LOG_DEBUG48

  /**
 + * @}
 + */
 +
 +/**
   * Send the specified message to the log if the level is less than or equal
   * to the current av_log_level. By default, all logging messages are sent to
 - * stderr. This behavior can be altered by setting a different av_vlog 
 callback
 + * stderr. This behavior can be altered by setting a different logging 
 callback
   * function.
 + * @see av_log_set_callback
   *
   * @param avcl A pointer to an arbitrary struct of which the first field is a
   * pointer to an AVClass struct.
 @@ -137,15 +160,74 @@ typedef struct AVClass {
   * higher importance.
   * @param fmt The format string (printf-compatible) that specifies how
   * subsequent arguments are converted to output.
 - * @see av_vlog
   */
  void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 
 4);

 -void av_vlog(void *avcl, int level, const char *fmt, va_list);
 +
 +/**
 + * Send the specified message to the log if the level is less than or equal
 + * to the current av_log_level. By default, all logging messages are sent to
 + * stderr. This behavior can be altered by setting a different logging 
 callback
 + * function.

May I propose Log the specified message if the log level is less than ...

 + * @see av_log_set_callback
 + *
 + * @param avcl A pointer to an arbitrary struct of which the first field is a
 + *pointer to an AVClass struct.

How about  A pointer to an arbitrary struct whose first field is a
pointer to an AVClass struct

 + * @param level The importance level of the message, lower values signifying
 + *higher importance.
 + * @param fmt The format string (printf-compatible) that specifies how
 + *subsequent arguments are converted to output.
 + * @param vl The arguments referenced by the format string.
 + */
 +void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
 +
 +/**
 + * Get the current log level
 + * @see lavu_log_constants
 + *
 + * @return Current log level
 + */
  int av_log_get_level(void);
 -void av_log_set_level(int);
 -void av_log_set_callback(void (*)(void*, int, const char*, va_list));
 +
 +/**
 + * Set the log level
 + * @see lavu_log_constants
 + *
 + * @param level Logging level
 + */
 +void av_log_set_level(int level);
 +
 +/**
 + * Set the logging callback
 + *
 + * @see av_log_default_callback
 + *
 + * @param callback A logging function with a signature compatible.
 + */
 +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
 +
 +/**
 + * Default logging callback
 + *
 + * It prints to stderr the message, optionally colorizing them.

This function prints the message to stderr, optionally colorizing it.

 + *
 + * @param avcl A pointer to an arbitrary struct of which the first field is a
 + *pointer to an AVClass struct.

A pointer to an arbitrary struct of which whose first field is a
pointer to an AVClass struct

 + * @param level The importance level of the message, lower values signifying
 + *higher importance.
 + * @param fmt The format string (printf-compatible) that specifies how
 + *subsequent arguments are converted to output.
 + * @param ap The arguments referenced by the format string.
 + */
  void av_log_default_callback(void* ptr, int level, const char* fmt, va_list 
 vl);
 +
 +/**
 + * Return the context name
 + *
 + * @param  ctx The 

[libav-devel] [PATCH 2/3] http: Pass options through to the nested protocol

2013-09-19 Thread Martin Storsjö
When passing a dict to the nested protocol, it will consume
the used options from it, so a separate copy needs to be used
when reopening the connection multiple times.
---
 libavformat/http.c |   34 ++
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 10fcc50..57b9569 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -67,6 +67,7 @@ typedef struct {
 z_stream inflate_stream;
 uint8_t *inflate_buffer;
 #endif
+AVDictionary *chained_options;
 } HTTPContext;
 
 #define OFFSET(x) offsetof(HTTPContext, x)
@@ -104,7 +105,7 @@ void ff_http_init_auth_state(URLContext *dest, const 
URLContext *src)
 }
 
 /* return non zero if error */
-static int http_open_cnx(URLContext *h)
+static int http_open_cnx(URLContext *h, AVDictionary **options)
 {
 const char *path, *proxy_path, *lower_proto = tcp, *local_path;
 char hostname[1024], hoststr[1024], proto[10];
@@ -155,7 +156,7 @@ static int http_open_cnx(URLContext *h)
 
 if (!s-hd) {
 err = ffurl_open(s-hd, buf, AVIO_FLAG_READ_WRITE,
- h-interrupt_callback, NULL);
+ h-interrupt_callback, options);
 if (err  0)
 goto fail;
 }
@@ -208,21 +209,30 @@ static int http_open_cnx(URLContext *h)
 int ff_http_do_new_request(URLContext *h, const char *uri)
 {
 HTTPContext *s = h-priv_data;
+AVDictionary *options = NULL;
+int ret;
 
 s-off = 0;
 av_strlcpy(s-location, uri, sizeof(s-location));
 
-return http_open_cnx(h);
+av_dict_copy(options, s-chained_options, 0);
+ret = http_open_cnx(h, options);
+av_dict_free(options);
+return ret;
 }
 
-static int http_open(URLContext *h, const char *uri, int flags)
+static int http_open(URLContext *h, const char *uri, int flags,
+ AVDictionary **options)
 {
 HTTPContext *s = h-priv_data;
+int ret;
 
 h-is_streamed = 1;
 
 s-filesize = -1;
 av_strlcpy(s-location, uri, sizeof(s-location));
+if (options)
+av_dict_copy(s-chained_options, *options, 0);
 
 if (s-headers) {
 int len = strlen(s-headers);
@@ -230,7 +240,10 @@ static int http_open(URLContext *h, const char *uri, int 
flags)
 av_log(h, AV_LOG_WARNING, No trailing CRLF found in HTTP 
header.\n);
 }
 
-return http_open_cnx(h);
+ret = http_open_cnx(h, options);
+if (ret  0)
+av_dict_free(s-chained_options);
+return ret;
 }
 static int http_getc(HTTPContext *s)
 {
@@ -676,6 +689,7 @@ static int http_close(URLContext *h)
 
 if (s-hd)
 ffurl_close(s-hd);
+av_dict_free(s-chained_options);
 return ret;
 }
 
@@ -686,6 +700,7 @@ static int64_t http_seek(URLContext *h, int64_t off, int 
whence)
 int64_t old_off = s-off;
 uint8_t old_buf[BUFFER_SIZE];
 int old_buf_size;
+AVDictionary *options = NULL;
 
 if (whence == AVSEEK_SIZE)
 return s-filesize;
@@ -703,7 +718,9 @@ static int64_t http_seek(URLContext *h, int64_t off, int 
whence)
 s-off = off;
 
 /* if it fails, continue on old connection */
-if (http_open_cnx(h)  0) {
+av_dict_copy(options, s-chained_options, 0);
+if (http_open_cnx(h, options)  0) {
+av_dict_free(options);
 memcpy(s-buffer, old_buf, old_buf_size);
 s-buf_ptr = s-buffer;
 s-buf_end = s-buffer + old_buf_size;
@@ -711,6 +728,7 @@ static int64_t http_seek(URLContext *h, int64_t off, int 
whence)
 s-off = old_off;
 return -1;
 }
+av_dict_free(options);
 ffurl_close(old_hd);
 return off;
 }
@@ -725,7 +743,7 @@ http_get_file_handle(URLContext *h)
 #if CONFIG_HTTP_PROTOCOL
 URLProtocol ff_http_protocol = {
 .name= http,
-.url_open= http_open,
+.url_open2   = http_open,
 .url_read= http_read,
 .url_write   = http_write,
 .url_seek= http_seek,
@@ -740,7 +758,7 @@ URLProtocol ff_http_protocol = {
 #if CONFIG_HTTPS_PROTOCOL
 URLProtocol ff_https_protocol = {
 .name= https,
-.url_open= http_open,
+.url_open2   = http_open,
 .url_read= http_read,
 .url_write   = http_write,
 .url_seek= http_seek,
-- 
1.7.9.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/3] tls: Add support for listen mode

2013-09-19 Thread Martin Storsjö
Partially based on a patch by Peter Ross.
---
 libavformat/tls.c |   46 +++---
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index 55b7416..9d53a66 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -23,6 +23,7 @@
 #include url.h
 #include libavutil/avstring.h
 #include libavutil/opt.h
+#include libavutil/parseutils.h
 #if CONFIG_GNUTLS
 #include gnutls/gnutls.h
 #include gnutls/x509.h
@@ -69,6 +70,9 @@ typedef struct {
 int fd;
 char *ca_file;
 int verify;
+char *cert;
+char *key;
+int listen;
 } TLSContext;
 
 #define OFFSET(x) offsetof(TLSContext, x)
@@ -77,6 +81,9 @@ typedef struct {
 static const AVOption options[] = {
 {ca_file,Certificate Authority database file, OFFSET(ca_file), 
AV_OPT_TYPE_STRING, .flags = D|E },
 {tls_verify, Verify the peer certificate, OFFSET(verify),  
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E },
+{cert,   Certificate file,OFFSET(cert),
AV_OPT_TYPE_STRING, .flags = D|E },
+{key,Private key file,OFFSET(key), 
AV_OPT_TYPE_STRING, .flags = D|E },
+{listen, Listen for incoming connections, OFFSET(listen),  
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E },
 { NULL }
 };
 
@@ -133,7 +140,7 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 gnutls_x509_crt_t cert;
 const gnutls_datum_t *cert_list;
 #endif
-char buf[200], host[200];
+char buf[200], host[200], opts[50] = ;
 int numerichost = 0;
 struct addrinfo hints = { 0 }, *ai = NULL;
 const char *proxy_path;
@@ -141,8 +148,11 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 
 ff_tls_init();
 
+if (c-listen)
+snprintf(opts, sizeof(opts), ?listen=1);
+
 av_url_split(NULL, 0, NULL, 0, host, sizeof(host), port, NULL, 0, uri);
-ff_url_join(buf, sizeof(buf), tcp, NULL, host, port, NULL);
+ff_url_join(buf, sizeof(buf), tcp, NULL, host, port, %s, opts);
 
 hints.ai_flags = AI_NUMERICHOST;
 if (!getaddrinfo(host, NULL, hints, ai)) {
@@ -172,8 +182,8 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 c-fd = ffurl_get_file_handle(c-tcp);
 
 #if CONFIG_GNUTLS
-gnutls_init(c-session, GNUTLS_CLIENT);
-if (!numerichost)
+gnutls_init(c-session, c-listen ? GNUTLS_SERVER : GNUTLS_CLIENT);
+if (!c-listen  !numerichost)
 gnutls_server_name_set(c-session, GNUTLS_NAME_DNS, host, 
strlen(host));
 gnutls_certificate_allocate_credentials(c-cred);
 if (c-ca_file)
@@ -184,6 +194,16 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 #endif
 gnutls_certificate_set_verify_flags(c-cred, c-verify ?
 GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT : 
0);
+if (c-cert  c-key) {
+ret = gnutls_certificate_set_x509_key_file(c-cred, c-cert, c-key, 
GNUTLS_X509_FMT_PEM);
+if (ret  0) {
+av_log(h, AV_LOG_ERROR,
+   Unable to set cert/key files %s and %s: %s\n,
+   c-cert, c-key, gnutls_strerror(ret));
+ret = AVERROR(EIO);
+goto fail;
+}
+}
 gnutls_credentials_set(c-session, GNUTLS_CRD_CERTIFICATE, c-cred);
 gnutls_transport_set_ptr(c-session, (gnutls_transport_ptr_t)
  (intptr_t) c-fd);
@@ -225,7 +245,7 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 }
 }
 #elif CONFIG_OPENSSL
-c-ctx = SSL_CTX_new(TLSv1_client_method());
+c-ctx = SSL_CTX_new(c-listen ? TLSv1_server_method() : 
TLSv1_client_method());
 if (!c-ctx) {
 av_log(h, AV_LOG_ERROR, %s\n, ERR_error_string(ERR_get_error(), 
NULL));
 ret = AVERROR(EIO);
@@ -233,6 +253,18 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 }
 if (c-ca_file)
 SSL_CTX_load_verify_locations(c-ctx, c-ca_file, NULL);
+if (c-cert  !SSL_CTX_use_certificate_chain_file(c-ctx, c-cert)) {
+av_log(h, AV_LOG_ERROR, Unable to load cert file %s: %s\n,
+   c-cert, ERR_error_string(ERR_get_error(), NULL));
+ret = AVERROR(EIO);
+goto fail;
+}
+if (c-key  !SSL_CTX_use_PrivateKey_file(c-ctx, c-key, 
SSL_FILETYPE_PEM)) {
+av_log(h, AV_LOG_ERROR, Unable to load key file %s: %s\n,
+   c-key, ERR_error_string(ERR_get_error(), NULL));
+ret = AVERROR(EIO);
+goto fail;
+}
 // Note, this doesn't check that the peer certificate actually matches
 // the requested hostname.
 if (c-verify)
@@ -244,10 +276,10 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 goto fail;
 }
 SSL_set_fd(c-ssl, c-fd);
-if (!numerichost)
+if (!c-listen  !numerichost)
 SSL_set_tlsext_host_name(c-ssl, host);
 while (1) {
-ret = SSL_connect(c-ssl);
+

[libav-devel] [PATCH 1/3] tls: Add options for verifying the peer certificate

2013-09-19 Thread Martin Storsjö
A file containing the trusted CA certificates needs to be
supplied via the ca_file AVOption, unless the TLS library
has got a system default file/database set up.

This doesn't check the hostname of the peer certificate with
openssl, which requires a non-trivial piece of code for
manually matching the desired hostname to the string provided
by the certificate, not provided as a library function.

That is, with openssl, this only validates that the received
certificate is signed with the right CA, but not that it is
the actual server we think we're talking to.

Verification is still disabled by default since we can't count
on a proper CA database existing at all times.
---
Added support for gnutls_certificate_set_x509_system_trust and
some other minor fixes.
---
 libavformat/tls.c |   70 -
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index fecf096..55b7416 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -22,8 +22,10 @@
 #include avformat.h
 #include url.h
 #include libavutil/avstring.h
+#include libavutil/opt.h
 #if CONFIG_GNUTLS
 #include gnutls/gnutls.h
+#include gnutls/x509.h
 #define TLS_read(c, buf, size)  gnutls_record_recv(c-session, buf, size)
 #define TLS_write(c, buf, size) gnutls_record_send(c-session, buf, size)
 #define TLS_shutdown(c) gnutls_bye(c-session, GNUTLS_SHUT_RDWR)
@@ -65,8 +67,26 @@ typedef struct {
 SSL *ssl;
 #endif
 int fd;
+char *ca_file;
+int verify;
 } TLSContext;
 
+#define OFFSET(x) offsetof(TLSContext, x)
+#define D AV_OPT_FLAG_DECODING_PARAM
+#define E AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+{ca_file,Certificate Authority database file, OFFSET(ca_file), 
AV_OPT_TYPE_STRING, .flags = D|E },
+{tls_verify, Verify the peer certificate, OFFSET(verify),  
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E },
+{ NULL }
+};
+
+static const AVClass tls_class = {
+.class_name = tls,
+.item_name  = av_default_item_name,
+.option = options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
 static int do_tls_poll(URLContext *h, int ret)
 {
 TLSContext *c = h-priv_data;
@@ -108,6 +128,11 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 TLSContext *c = h-priv_data;
 int ret;
 int port;
+#if CONFIG_GNUTLS
+unsigned int status, cert_list_size;
+gnutls_x509_crt_t cert;
+const gnutls_datum_t *cert_list;
+#endif
 char buf[200], host[200];
 int numerichost = 0;
 struct addrinfo hints = { 0 }, *ai = NULL;
@@ -151,7 +176,14 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 if (!numerichost)
 gnutls_server_name_set(c-session, GNUTLS_NAME_DNS, host, 
strlen(host));
 gnutls_certificate_allocate_credentials(c-cred);
-gnutls_certificate_set_verify_flags(c-cred, 0);
+if (c-ca_file)
+gnutls_certificate_set_x509_trust_file(c-cred, c-ca_file, 
GNUTLS_X509_FMT_PEM);
+#if GNUTLS_VERSION_MAJOR = 3
+else
+gnutls_certificate_set_x509_system_trust(c-cred);
+#endif
+gnutls_certificate_set_verify_flags(c-cred, c-verify ?
+GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT : 
0);
 gnutls_credentials_set(c-session, GNUTLS_CRD_CERTIFICATE, c-cred);
 gnutls_transport_set_ptr(c-session, (gnutls_transport_ptr_t)
  (intptr_t) c-fd);
@@ -163,6 +195,35 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 if ((ret = do_tls_poll(h, ret))  0)
 goto fail;
 }
+if (c-verify) {
+if ((ret = gnutls_certificate_verify_peers2(c-session, status))  0) 
{
+av_log(h, AV_LOG_ERROR, Unable to verify peer certificate: %s\n,
+gnutls_strerror(ret));
+ret = AVERROR(EIO);
+goto fail;
+}
+if (status  GNUTLS_CERT_INVALID) {
+av_log(h, AV_LOG_ERROR, Peer certificate failed verification\n);
+ret = AVERROR(EIO);
+goto fail;
+}
+if (gnutls_certificate_type_get(c-session) != GNUTLS_CRT_X509) {
+av_log(h, AV_LOG_ERROR, Unsupported certificate type\n);
+ret = AVERROR(EIO);
+goto fail;
+}
+gnutls_x509_crt_init(cert);
+cert_list = gnutls_certificate_get_peers(c-session, cert_list_size);
+gnutls_x509_crt_import(cert, cert_list, GNUTLS_X509_FMT_DER);
+ret = gnutls_x509_crt_check_hostname(cert, host);
+gnutls_x509_crt_deinit(cert);
+if (!ret) {
+av_log(h, AV_LOG_ERROR, The certificate's owner does not match 
+hostname %s\n, host);
+ret = AVERROR(EIO);
+goto fail;
+}
+}
 #elif CONFIG_OPENSSL
 c-ctx = SSL_CTX_new(TLSv1_client_method());
 if (!c-ctx) {
@@ -170,6 +231,12 @@ static int 

[libav-devel] [PATCH] rtmpproto: Add a comment explaining the logic in handle_notify

2013-09-19 Thread Martin Storsjö
This explains why the cleanup in 5626f994f was wrong and why
ae0f316a was needed.
---
 libavformat/rtmpproto.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index e404d60..a0ef268 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2095,9 +2095,11 @@ static int handle_notify(URLContext *s, RTMPPacket *pkt) 
{
 
 // generate packet header and put data into buffer for FLV demuxer
 if (rt-flv_off  rt-flv_size) {
+// There is old unread data in the buffer, thus append at the end
 old_flv_size  = rt-flv_size;
 rt-flv_size += datatowritelength + 15;
 } else {
+// All data has been read, write the new data at the start of the 
buffer
 old_flv_size = 0;
 rt-flv_size = datatowritelength + 15;
 rt-flv_off  = 0;
-- 
1.7.9.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] tls: Add options for verifying the peer certificate

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 12:43:00PM +0300, Martin Storsjö wrote:
 --- a/libavformat/tls.c
 +++ b/libavformat/tls.c
 @@ -151,7 +176,14 @@ static int tls_open(URLContext *h, const char *uri, int 
 flags)
  if (!numerichost)
  gnutls_server_name_set(c-session, GNUTLS_NAME_DNS, host, 
 strlen(host));
  gnutls_certificate_allocate_credentials(c-cred);
 -gnutls_certificate_set_verify_flags(c-cred, 0);
 +if (c-ca_file)
 +gnutls_certificate_set_x509_trust_file(c-cred, c-ca_file, 
 GNUTLS_X509_FMT_PEM);
 +#if GNUTLS_VERSION_MAJOR = 3

Why not require gnutls  3 instead in configure?
3.0.0 was released more than two years ago.

 @@ -163,6 +195,35 @@ static int tls_open(URLContext *h, const char *uri, int 
 flags)
 +if ((ret = gnutls_certificate_verify_peers2(c-session, status))  
 0) {
 +av_log(h, AV_LOG_ERROR, Unable to verify peer certificate: 
 %s\n,
 +gnutls_strerror(ret));
 +}
 +if (!ret) {
 +av_log(h, AV_LOG_ERROR, The certificate's owner does not match 
 +hostname %s\n, host);

nit: I would suggest breaking after the second argument instead.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] aviobuf: Add functions for null buffers

2013-09-19 Thread Diego Biurrun
On Wed, Sep 18, 2013 at 10:07:21PM +0300, Martin Storsjö wrote:
 --- a/libavformat/avio_internal.h
 +++ b/libavformat/avio_internal.h
 @@ -119,4 +119,22 @@ int ffio_open_dyn_packet_buf(AVIOContext **s, int 
 max_packet_size);
  
 +/**
 + * Open a write only fake memory stream. The written data isn't stored

write-only, is not

I would suggest avoiding short forms in any sort of even moderately
formal written English.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] tls: Add options for verifying the peer certificate

2013-09-19 Thread Martin Storsjö

On Thu, 19 Sep 2013, Diego Biurrun wrote:


On Thu, Sep 19, 2013 at 12:43:00PM +0300, Martin Storsjö wrote:

--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -151,7 +176,14 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 if (!numerichost)
 gnutls_server_name_set(c-session, GNUTLS_NAME_DNS, host, 
strlen(host));
 gnutls_certificate_allocate_credentials(c-cred);
-gnutls_certificate_set_verify_flags(c-cred, 0);
+if (c-ca_file)
+gnutls_certificate_set_x509_trust_file(c-cred, c-ca_file, 
GNUTLS_X509_FMT_PEM);
+#if GNUTLS_VERSION_MAJOR = 3


Why not require gnutls  3 instead in configure?
3.0.0 was released more than two years ago.


Because many distributions are still on 2.x - the recently released debian 
stable is still on 2.12. Additionally, I really don't like dropping 
support for widely available libraries just because it would save us one 
ifdef, and so far we've been able to support 2.x just fine.



@@ -163,6 +195,35 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
+if ((ret = gnutls_certificate_verify_peers2(c-session, status))  0) 
{
+av_log(h, AV_LOG_ERROR, Unable to verify peer certificate: %s\n,
+gnutls_strerror(ret));
+}
+if (!ret) {
+av_log(h, AV_LOG_ERROR, The certificate's owner does not match 
+hostname %s\n, host);


nit: I would suggest breaking after the second argument instead.


Will update locally.

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] doxy: Document avlog

2013-09-19 Thread Luca Barbato
Vittorio Giovara vittorio.giov...@gmail.com wrote:
On Wed, Sep 18, 2013 at 3:30 PM, Luca Barbato lu_z...@gentoo.org
wrote:
 Provide some information for every function and add a group.

Maybe the function documentation and group addition could be split in
two?

Not really so impacting imho.

 ---

 Please send updated patches instead of reviews.




___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Luca Barbato
Vittorio Giovara vittorio.giov...@gmail.com wrote:
I spent some time playing with include-what-you-use clang tool and
found that libav headers could benefit from removing a few unused
headers.
So I propose a first set of patches that modify which headers are
included and in what order, specifically:

1. make sure there is a line between copyright header and the first
include
2. include system headers first
3. include headers from the same library
4. include headers from other libav libraries
5. include headers from other libraries
6. any other ifdef library
7. make sure there ia a line between the last include or ifdef and the
code
8. move any non-doxygen comment before the include, if applicable

Not sure.



I could only test this set on linux x86, so I would really appreciate
help for the other platforms (or instructions for this).

When there is agreement on the modifications on this set I'll move on
the lavc, lavfi, lavfo files and see if there is any other header that
should be included.

Cheers,
Vittorio

Vittorio Giovara (4):
  cmdutils: headers cleanup
  avutil: headers cleanup
  swscale: headers cleanup
  avresample: headers cleanup

avconv.c |   32

 avconv.h |   12 +---
 avconv_filter.c  |2 --
 avconv_opt.c |3 ++-
 avplay.c |   30 --
 avprobe.c|6 --
 avserver.c   |   28 ++--
 cmdutils.c   |   15 ++-
 cmdutils.h   |3 +--
 libavresample/audio_convert.c|8 
 libavresample/audio_convert.h|4 +---
 libavresample/audio_data.c   |3 ++-
 libavresample/audio_data.h   |5 +++--
 libavresample/audio_mix.c|6 +++---
 libavresample/audio_mix.h|2 --
 libavresample/audio_mix_matrix.c |8 ++--
 libavresample/avresample-test.c  |3 ++-
 libavresample/avresample.h   |5 +++--
 libavresample/dither.c   |7 ---
 libavresample/internal.h |3 ++-
 libavresample/options.c  |7 ---
 libavresample/resample.c |6 +++---
 libavresample/resample.h |1 -
 libavresample/utils.c|   13 ++---
 libavutil/adler32.h  |1 +
 libavutil/audio_fifo.c   |1 -
 libavutil/avassert.h |1 +
 libavutil/avstring.h |1 +
 libavutil/bswap.h|3 ++-
 libavutil/channel_layout.c   |1 -
 libavutil/common.h   |2 +-
 libavutil/cpu.c  |3 +++
 libavutil/cpu.h  |5 +++--
 libavutil/crc.h  |1 +
 libavutil/des.c  |3 +--
 libavutil/dict.c |1 +
 libavutil/error.c|2 +-
 libavutil/eval.c |2 --
 libavutil/fifo.c |1 +
 libavutil/fifo.h |1 +
 libavutil/file.c |9 ++---
 libavutil/file_open.c|9 +
 libavutil/frame.c|1 +
 libavutil/frame.h|4 +---
 libavutil/imgutils.c |2 +-
 libavutil/imgutils.h |1 +
 libavutil/internal.h |1 +
 libavutil/intfloat.h |1 +
 libavutil/intfloat_readwrite.c   |1 +
 libavutil/intfloat_readwrite.h   |1 +
 libavutil/intreadwrite.h |1 +
 libavutil/lfg.c  |2 +-
 libavutil/libm.h |1 +
 libavutil/log.c  |   14 +++---
 libavutil/log.h  |2 +-
 libavutil/lzo.c  |1 -
 libavutil/md5.c  |1 +
 libavutil/mem.c  |   12 ++--
 libavutil/mem.h  |2 +-
 libavutil/opt.c  |2 --
 libavutil/opt.h  |1 -
 libavutil/parseutils.c   |1 -
 libavutil/pixfmt.h   |2 +-
 libavutil/random_seed.c  |   14 --
 libavutil/random_seed.h  |1 +
 libavutil/rational.c |2 +-
 libavutil/rational.h |1 +
 libavutil/rc4.c  |2 +-
 libavutil/samplefmt.c|7 +++
 libavutil/samplefmt.h|1 -
 libavutil/sha.c  |1 -
 libavutil/time.c |   12 +++-
 libavutil/timer.h|6 +++---
 libavutil/utils.c|2 +-
 libavutil/x86/cpu.c  |2 --
 libavutil/xtea.c |1 +
 libswscale/colorspace-test.c |2 +-
 libswscale/input.c   |   11 +++
 libswscale/options.c |6 +++---
 libswscale/output.c  |   13 -
 libswscale/rgb2rgb.c |6 ++
 libswscale/rgb2rgb.h

Re: [libav-devel] [PATCH 1/3] tls: Add options for verifying the peer certificate

2013-09-19 Thread Martin Storsjö

On Thu, 19 Sep 2013, Martin Storsjö wrote:


On Thu, 19 Sep 2013, Diego Biurrun wrote:


On Thu, Sep 19, 2013 at 12:43:00PM +0300, Martin Storsjö wrote:

--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -151,7 +176,14 @@ static int tls_open(URLContext *h, const char *uri, 
int flags)

 if (!numerichost)
 gnutls_server_name_set(c-session, GNUTLS_NAME_DNS, host, 
strlen(host));

 gnutls_certificate_allocate_credentials(c-cred);
-gnutls_certificate_set_verify_flags(c-cred, 0);
+if (c-ca_file)
+gnutls_certificate_set_x509_trust_file(c-cred, c-ca_file, 
GNUTLS_X509_FMT_PEM);

+#if GNUTLS_VERSION_MAJOR = 3


Why not require gnutls  3 instead in configure?
3.0.0 was released more than two years ago.


Because many distributions are still on 2.x - the recently released debian 
stable is still on 2.12. Additionally, I really don't like dropping support 
for widely available libraries just because it would save us one ifdef, and 
so far we've been able to support 2.x just fine.


Also, gnutls 3 had some relatively big architectural changes which is one 
issue why people aren't in much of a hurry to upgrade. The latest 
maintainance releases on the 2.12 branch was only a few months ago. So 
judging from the date when 3.0.0 was released is not a good indicator when 
it comes to libraries like this.


// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 00/10] x86inc backports from x264

2013-09-19 Thread Hendrik Leppkes
On Wed, Sep 11, 2013 at 5:49 PM, Hendrik Leppkes h.lepp...@gmail.com wrote:
 Hi,

 in this set you'll find backports from most of the recent changes to x86inc 
 from x264.
 This is primarily motived by patch 7, which also fixes a crash in avresample 
 in current
 git master (Issue #496)

 Important points of note:
 A few patches regarding AVX/AVX2/FMA4 have not been backported, because the 
 first
 of these causes compile failures in avresample, which i've not managed to 
 properly debug.

 I may look at these again in the future, but probably not very soon.
 For the record, these patchs have been skipped: (note that some contain more 
 changes)
 - x86inc: Use VEX-encoded instructions in AVX functions
 - AVX2/FMA3 version of mbtree_propagate
 - x86: more AVX2 framework, AVX2 functions, plus some existing asm tweaks

 Another important point is related to patch 7.
 Some of the asm functions needed adjustment for this patch to work properly, 
 therefor
 it should be reviewed quite thoroughly. FATE passes on win64, both mingw and 
 msvc.

 - Hendrik


Ping on the unreviewed parts of the set?
Or do i have to spam it to the list again? :)
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 11:31:42AM +0300, Martin Storsjö wrote:
 On Thu, 19 Sep 2013, Vittorio Giovara wrote:
 I spent some time playing with include-what-you-use clang tool and found 
 that libav headers could benefit from removing a few unused headers.
 So I propose a first set of patches that modify which headers are included 
 and in what order, specifically:
 
 1. make sure there is a line between copyright header and the first include
 2. include system headers first
 3. include headers from the same library
 4. include headers from other libav libraries
 5. incldue headers from other libraries
 6. any other ifdef library
 
 I'm not sure this order is the best one, especially if we are making
 things consistent. I'd rather have other libav libraries and other
 libraries before the local library headers. The same reason and
 logic that says system headers should be included first also applies
 in the same way for the libraries and their interdependencies. So it
 would be better to order them e.g. system headers, libavutil,
 libavcodec, libavformat or something like that.

+1

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/4] avutil: headers cleanup

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 10:26:36AM +0200, Vittorio Giovara wrote:
 --- a/libavutil/bswap.h
 +++ b/libavutil/bswap.h
 @@ -27,7 +27,8 @@
  #define AVUTIL_BSWAP_H
  
  #include stdint.h
 -#include libavutil/avconfig.h
 +
 +#include avconfig.h
  #include attributes.h

Try compiling out of tree.

 --- a/libavutil/common.h
 +++ b/libavutil/common.h
 @@ -36,7 +36,7 @@
  
  #include attributes.h
  #include version.h
 -#include libavutil/avconfig.h
 +#include avconfig.h

same

 --- a/libavutil/cpu.h
 +++ b/libavutil/cpu.h
 @@ -23,9 +23,10 @@
  
  #include version.h
  
 -#define AV_CPU_FLAG_FORCE0x8000 /* force usage of selected flags 
 (OR) */
 +/* force usage of selected flags (OR) */
 +#define AV_CPU_FLAG_FORCE0x8000
  
 -/* lower 16 bits - CPU features */
 +/* lower 16 bits - CPU features */
  #define AV_CPU_FLAG_MMX  0x0001 /// standard MMX
  #define AV_CPU_FLAG_MMXEXT   0x0002 /// SSE integer functions or AMD 
 MMX ext
  #if FF_API_CPU_FLAG_MMX2

unrelated

 --- a/libavutil/des.c
 +++ b/libavutil/des.c
 @@ -18,8 +18,7 @@
   * License along with Libav; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
   */
 -#include inttypes.h
 -#include avutil.h
 +
  #include common.h
  #include intreadwrite.h
  #include des.h

This file needs stdint.h.

 --- a/libavutil/dict.c
 +++ b/libavutil/dict.c
 @@ -24,6 +24,7 @@
  #include dict.h
  #include internal.h
  #include mem.h
 +#include error.h

I suggest maintaining alphabetical order.

 --- a/libavutil/frame.c
 +++ b/libavutil/frame.c
 @@ -25,6 +25,7 @@
  #include imgutils.h
  #include mem.h
  #include samplefmt.h
 +#include pixfmt.h

same

 --- a/libavutil/frame.h
 +++ b/libavutil/frame.h
 @@ -22,13 +22,11 @@
  
  #include stdint.h
  
 -#include libavcodec/version.h
 -

A libavcodec #include in libavutil?  WTF?

 --- a/libavutil/imgutils.h
 +++ b/libavutil/imgutils.h
 @@ -28,6 +28,7 @@
   */
  
  #include avutil.h
 +
  #include pixdesc.h

This should remain as-is.

 --- a/libavutil/lfg.c
 +++ b/libavutil/lfg.c
 @@ -19,9 +19,9 @@
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
   */
  
 -#include inttypes.h
  #include limits.h
  #include math.h
 +
  #include lfg.h
  #include md5.h
  #include intreadwrite.h

This file needs stdint.h.

 --- a/libavutil/pixfmt.h
 +++ b/libavutil/pixfmt.h
 @@ -27,7 +27,7 @@
  
 -#include libavutil/avconfig.h
 +#include avconfig.h
  #include version.h

see above

 --- a/libavutil/rational.c
 +++ b/libavutil/rational.c
 @@ -25,12 +25,12 @@
  
 -#include avassert.h
  #include limits.h
  
  #include common.h
  #include mathematics.h
  #include rational.h
 +#include avassert.h

order

 --- a/libavutil/xtea.c
 +++ b/libavutil/xtea.c
 @@ -26,6 +26,7 @@
  #include intreadwrite.h
  #include xtea.h
  
 +
  void av_xtea_init(AVXTEA *ctx, const uint8_t key[16])
  {
  int i;

stray change

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/1] av_malloc: remove dead fallback to plain malloc()

2013-09-19 Thread Janne Grunau
configure enables memalign hack if none of the aligned allocation
methods are available.
---
 libavutil/mem.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 172180e..4d7fcf9 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -105,10 +105,7 @@ void *av_malloc(size_t size)
  * memalign(64) + 32 2546, 2545, 2571
  * memalign(64) + 64 2570, 2533, 2558
  *
- * BTW, malloc seems to do 8-byte alignment by default here.
  */
-#else
-ptr = malloc(size);
 #endif
 return ptr;
 }
-- 
1.8.3.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/1] av_malloc: remove dead fallback to plain malloc()

2013-09-19 Thread Derek Buitenhuis
On 9/19/2013 2:28 PM, Janne Grunau wrote:
 configure enables memalign hack if none of the aligned allocation
 methods are available.
 ---
  libavutil/mem.c | 3 ---
  1 file changed, 3 deletions(-)

LGTM.

- Derek
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/1] av_malloc: remove dead fallback to plain malloc()

2013-09-19 Thread Hendrik Leppkes
On Thu, Sep 19, 2013 at 3:28 PM, Janne Grunau janne-li...@jannau.net wrote:
 configure enables memalign hack if none of the aligned allocation
 methods are available.
 ---
  libavutil/mem.c | 3 ---
  1 file changed, 3 deletions(-)

 diff --git a/libavutil/mem.c b/libavutil/mem.c
 index 172180e..4d7fcf9 100644
 --- a/libavutil/mem.c
 +++ b/libavutil/mem.c
 @@ -105,10 +105,7 @@ void *av_malloc(size_t size)
   * memalign(64) + 32 2546, 2545, 2571
   * memalign(64) + 64 2570, 2533, 2558
   *
 - * BTW, malloc seems to do 8-byte alignment by default here.
   */
 -#else
 -ptr = malloc(size);
  #endif
  return ptr;
  }
 --
 1.8.3.2


Maybe a #error sanity check instead, to make sure its not screwed up
at some point?
Although it would fail every single test then anyway, so shrug, feel
free to ignore me =)
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 10:26:34AM +0200, Vittorio Giovara wrote:
 So I propose a first set of patches that modify which headers are
 included and in what order, specifically:

 1. make sure there is a line between copyright header and the first include
 2. include system headers first
 3. include headers from the same library
 4. include headers from other libav libraries
 5. incldue headers from other libraries
 6. any other ifdef library
 7. make sure there ia a line between the last include or ifdef and the code
 8. move any non-doxygen comment before the include, if applicable

Ifdeffed system headers should also be placed before libav headers.
You just have to #include config.h first in that case.

 I could only test this set on linux x86, so I would really appreciate
 help for the other platforms (or instructions for this).

Try installing some cross-compilers.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 10/10] x86inc: remove misaligned cpu flag

2013-09-19 Thread Derek Buitenhuis
On 9/11/2013 4:49 PM, Hendrik Leppkes wrote:
 From: Henrik Gramner hen...@gramner.com
 
 Prevents a crash if the misaligned exception mask bit is cleared for some 
 reason.
 
 Misaligned SSE functions are only used on AMD Phenom CPUs and the benefit is 
 miniscule.
 They also require modifying the MXCSR control register and by removing those 
 functions
 we can get rid of that complexity altogether.
 ---
  libavutil/x86/x86inc.asm | 9 -
  1 file changed, 4 insertions(+), 5 deletions(-)

Seems reasonable.

- Derek
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/1] av_malloc: remove dead fallback to plain malloc()

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 03:28:34PM +0200, Janne Grunau wrote:
 configure enables memalign hack if none of the aligned allocation
 methods are available.

Umm, no:

need_memalign=altivec neon sse

! enabled_any memalign posix_memalign aligned_malloc 
enabled_any $need_memalign  enable memalign_hack

If none of the aligned allocation methods are available, memalign_hack
is only enabled for situations where alignment is deemed necessary.

So on ARM w/o NEON, PPC w/o AltiVec, x86 w/o SSE, or any other arch,
there will be no fallback and av_malloc will not allocate any memory.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 10/11] rl2: Avoid a division by zero

2013-09-19 Thread Martin Storsjö
Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavformat/rl2.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index ac0532f..9effcef 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -107,6 +107,10 @@ static av_cold int rl2_read_header(AVFormatContext *s)
 rate = avio_rl16(pb);
 channels = avio_rl16(pb);
 def_sound_size = avio_rl16(pb);
+if (!channels) {
+av_log(s, AV_LOG_ERROR, Invalid number of channels\n);
+return AVERROR_INVALIDDATA;
+}
 
 /** setup video stream */
 st = avformat_new_stream(s, NULL);
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 05/11] svq3: Avoid a division by zero

2013-09-19 Thread Martin Storsjö
If the height is zero, the decompression will probably end up
failing due to not fitting into the allocated buffer later
anyway, so this doesn't need any more elaborate check.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavcodec/svq3.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 82fa632..a345788 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -980,7 +980,8 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
 int offset= get_bits_count(gb) + 7  3;
 uint8_t *buf;
 
-if ((uint64_t)watermark_width * 4  UINT_MAX / watermark_height)
+if (watermark_height  0 
+(uint64_t)watermark_width * 4  UINT_MAX / watermark_height)
 return -1;
 
 buf = av_malloc(buf_len);
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 03/11] mpegaudiodec: Validate that the number of channels fits at the given offset

2013-09-19 Thread Martin Storsjö
This is similar to the fix in 35cbc98b.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavcodec/mpegaudiodec.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index c18f433..423b4b0 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1939,7 +1939,8 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, 
void *data,
 
 avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header);
 
-if (ch + m-nb_channels  avctx-channels) {
+if (ch + m-nb_channels  avctx-channels ||
+s-coff[fr] + m-nb_channels  avctx-channels) {
 av_log(avctx, AV_LOG_ERROR, frame channel count exceeds codec 
 channel count\n);
 return AVERROR_INVALIDDATA;
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 08/11] yop: Clear all references to the AVBuffer in the local AVPacket

2013-09-19 Thread Martin Storsjö
This makes sure that it doesn't try to free an AVBuffer belonging
to an earlier packet when we free the local packet at the end.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavformat/yop.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/yop.c b/libavformat/yop.c
index 5fe6bdc..8caeb07 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -127,6 +127,12 @@ static int yop_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (yop-video_packet.data) {
 *pkt   =  yop-video_packet;
 yop-video_packet.data =  NULL;
+yop-video_packet.buf  =  NULL;
+#if FF_API_DESTRUCT_PACKET
+FF_DISABLE_DEPRECATION_WARNINGS
+yop-video_packet.destruct = NULL;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 yop-video_packet.size =  0;
 pkt-data[0]   =  yop-odd_frame;
 pkt-flags |= AV_PKT_FLAG_KEY;
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 06/11] segafilm: Validate the number of audio channels

2013-09-19 Thread Martin Storsjö
This avoids divisions by zero later.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavformat/segafilm.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index adf2475..ac9c873 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -111,6 +111,10 @@ static int film_read_header(AVFormatContext *s)
 return AVERROR(EIO);
 film-audio_samplerate = AV_RB16(scratch[24]);
 film-audio_channels = scratch[21];
+if (film-audio_channels == 0) {
+av_log(s, AV_LOG_ERROR, Invalid number of channels\n);
+return AVERROR_INVALIDDATA;
+}
 film-audio_bits = scratch[22];
 if (scratch[23] == 2)
 film-audio_type = AV_CODEC_ID_ADPCM_ADX;
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 02/11] asvdec: Verify the amount of extradata

2013-09-19 Thread Martin Storsjö
The init function reads one byte of extradata.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavcodec/asvdec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index 9f74abb..9ba2755 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -274,6 +274,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 const int scale   = avctx-codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;
 int i;
 
+if (avctx-extradata_size  1) {
+av_log(avctx, AV_LOG_ERROR, No extradata provided\n);
+return AVERROR_INVALIDDATA;
+}
+
 ff_asv_common_init(avctx);
 init_vlcs(a);
 ff_init_scantable(a-dsp.idct_permutation, a-scantable, ff_asv_scantab);
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 09/11] wtv: Add more sanity checks for a length read from the file

2013-09-19 Thread Martin Storsjö
Also make sure the existing length check can't overflow.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavformat/wtv.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index b003905..093f795 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -269,10 +269,15 @@ static AVIOContext * wtvfile_open2(AVFormatContext *s, 
const uint8_t *buf, int b
 dir_length  = AV_RL16(buf + 16);
 file_length = AV_RL64(buf + 24);
 name_size   = 2 * AV_RL32(buf + 32);
-if (buf + 48 + name_size  buf_end) {
+if (48 + name_size  buf_end - buf) {
 av_log(s, AV_LOG_ERROR, filename exceeds buffer size; remaining 
directory entries ignored\n);
 break;
 }
+if (name_size  0) {
+av_log(s, AV_LOG_ERROR,
+   bad filename length, remaining directory entries 
ignored\n);
+break;
+}
 first_sector = AV_RL32(buf + 40 + name_size);
 depth= AV_RL32(buf + 44 + name_size);
 
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 01/11] dcadec: Validate the lfe parameter

2013-09-19 Thread Martin Storsjö
We only seem to support values 1 and 2 (and 0 for it being disabled)
according to how I interpret lfe_interpolation_fir.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavcodec/dcadec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 209bca3..24bdb7e 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -580,6 +580,11 @@ static int dca_parse_frame_header(DCAContext *s)
 s-lfe   = get_bits(s-gb, 2);
 s-predictor_history = get_bits(s-gb, 1);
 
+if (s-lfe  2) {
+avpriv_request_sample(s-avctx, LFE  2);
+return AVERROR_PATCHWELCOME;
+}
+
 /* TODO: check CRC */
 if (s-crc_present)
 s-header_crc= get_bits(s-gb, 16);
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 07/11] fraps: Make the input buffer size checks more strict

2013-09-19 Thread Martin Storsjö
Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavcodec/fraps.c |   30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
index 66ecdef..b969031 100644
--- a/libavcodec/fraps.c
+++ b/libavcodec/fraps.c
@@ -145,10 +145,17 @@ static int decode_frame(AVCodecContext *avctx,
 uint32_t offs[4];
 int i, j, ret, is_chroma, planes;
 enum AVPixelFormat pix_fmt;
+int prev_pic_bit, expected_size;
+
+if (buf_size  4) {
+av_log(avctx, AV_LOG_ERROR, Too short packet\n);
+return AVERROR_INVALIDDATA;
+}
 
 header  = AV_RL32(buf);
 version = header  0xff;
 header_size = (header  (130))? 8 : 4; /* bit 30 means pad to 8 bytes */
+prev_pic_bit = header  (1U  31); /* bit 31 means same as previous pic */
 
 if (version  5) {
 av_log(avctx, AV_LOG_ERROR,
@@ -167,16 +174,18 @@ static int decode_frame(AVCodecContext *avctx,
 }
 avctx-pix_fmt = pix_fmt;
 
+expected_size = header_size;
+
 switch (version) {
 case 0:
 default:
 /* Fraps v0 is a reordered YUV420 */
-if ((buf_size != avctx-width * avctx-height * 3 / 2 + header_size) 
-(buf_size != header_size)) {
+if (!prev_pic_bit)
+expected_size += avctx-width * avctx-height * 3 / 2;
+if (buf_size != expected_size) {
 av_log(avctx, AV_LOG_ERROR,
Invalid frame length %d (should be %d)\n,
-   buf_size,
-   avctx-width * avctx-height * 3 / 2 + header_size);
+   buf_size, expected_size);
 return AVERROR_INVALIDDATA;
 }
 
@@ -190,8 +199,7 @@ static int decode_frame(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_ERROR, reget_buffer() failed\n);
 return ret;
 }
-/* bit 31 means same as previous pic */
-f-pict_type = (header  (1U  31)) ? AV_PICTURE_TYPE_P : 
AV_PICTURE_TYPE_I;
+f-pict_type = prev_pic_bit ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
 f-key_frame = f-pict_type == AV_PICTURE_TYPE_I;
 
 if (f-pict_type == AV_PICTURE_TYPE_I) {
@@ -215,11 +223,12 @@ static int decode_frame(AVCodecContext *avctx,
 
 case 1:
 /* Fraps v1 is an upside-down BGR24 */
-if ((buf_size != avctx-width * avctx-height * 3 + header_size) 
-(buf_size != header_size) ) {
+if (!prev_pic_bit)
+expected_size += avctx-width * avctx-height * 3;
+if (buf_size != expected_size) {
 av_log(avctx, AV_LOG_ERROR,
Invalid frame length %d (should be %d)\n,
-   buf_size, avctx-width * avctx-height * 3 + header_size);
+   buf_size, expected_size);
 return AVERROR_INVALIDDATA;
 }
 
@@ -227,8 +236,7 @@ static int decode_frame(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_ERROR, reget_buffer() failed\n);
 return ret;
 }
-/* bit 31 means same as previous pic */
-f-pict_type = (header  (1U31))? AV_PICTURE_TYPE_P : 
AV_PICTURE_TYPE_I;
+f-pict_type = prev_pic_bit ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
 f-key_frame = f-pict_type == AV_PICTURE_TYPE_I;
 
 if (f-pict_type == AV_PICTURE_TYPE_I) {
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 04/11] qpeg: Add checks for running out of rows in qpeg_decode_inter

2013-09-19 Thread Martin Storsjö
Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavcodec/qpeg.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index bb963ed..a3a5db5 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -191,6 +191,8 @@ static void qpeg_decode_inter(QpegContext *qctx, uint8_t 
*dst,
 filled = 0;
 dst -= stride;
 height--;
+if (height  0)
+break;
 }
 }
 } else if(code = 0xC0) { /* copy code: 0xC0..0xDF */
@@ -202,6 +204,8 @@ static void qpeg_decode_inter(QpegContext *qctx, uint8_t 
*dst,
 filled = 0;
 dst -= stride;
 height--;
+if (height  0)
+break;
 }
 }
 } else if(code = 0x80) { /* skip code: 0x80..0xBF */
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 11/11] r3d: Add more input value validation

2013-09-19 Thread Martin Storsjö
Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavformat/r3d.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 1da8b88..74a1f2b 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -85,7 +85,7 @@ static int r3d_read_red1(AVFormatContext *s)
 
 framerate.num = avio_rb16(s-pb);
 framerate.den = avio_rb16(s-pb);
-if (framerate.num  framerate.den) {
+if (framerate.num  0  framerate.den  0) {
 st-avg_frame_rate = framerate;
 }
 
@@ -281,6 +281,10 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket 
*pkt, Atom *atom)
 dts = avio_rb32(s-pb);
 
 st-codec-sample_rate = avio_rb32(s-pb);
+if (st-codec-sample_rate = 0) {
+av_log(s, AV_LOG_ERROR, Bad sample rate\n);
+return AVERROR_INVALIDDATA;
+}
 
 samples = avio_rb32(s-pb);
 
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 05/11] svq3: Avoid a division by zero

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 05:09:10PM +0300, Martin Storsjö wrote:
 If the height is zero, the decompression will probably end up
 failing due to not fitting into the allocated buffer later
 anyway, so this doesn't need any more elaborate check.
 
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavcodec/svq3.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
 index 82fa632..a345788 100644
 --- a/libavcodec/svq3.c
 +++ b/libavcodec/svq3.c
 @@ -980,7 +980,8 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
  int offset= get_bits_count(gb) + 7  3;
  uint8_t *buf;
  
 -if ((uint64_t)watermark_width * 4  UINT_MAX / watermark_height)
 +if (watermark_height  0 
 +(uint64_t)watermark_width * 4  UINT_MAX / watermark_height)
  return -1;
  
  buf = av_malloc(buf_len);
 -- 

looks OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 04/11] qpeg: Add checks for running out of rows in qpeg_decode_inter

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 05:09:09PM +0300, Martin Storsjö wrote:
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavcodec/qpeg.c |4 
  1 file changed, 4 insertions(+)
 
 diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
 index bb963ed..a3a5db5 100644
 --- a/libavcodec/qpeg.c
 +++ b/libavcodec/qpeg.c
 @@ -191,6 +191,8 @@ static void qpeg_decode_inter(QpegContext *qctx, uint8_t 
 *dst,
  filled = 0;
  dst -= stride;
  height--;
 +if (height  0)
 +break;
  }
  }
  } else if(code = 0xC0) { /* copy code: 0xC0..0xDF */
 @@ -202,6 +204,8 @@ static void qpeg_decode_inter(QpegContext *qctx, uint8_t 
 *dst,
  filled = 0;
  dst -= stride;
  height--;
 +if (height  0)
 +break;
  }
  }
  } else if(code = 0x80) { /* skip code: 0x80..0xBF */
 -- 

LGTM
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 03/11] mpegaudiodec: Validate that the number of channels fits at the given offset

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 05:09:08PM +0300, Martin Storsjö wrote:
 This is similar to the fix in 35cbc98b.
 
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavcodec/mpegaudiodec.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
 index c18f433..423b4b0 100644
 --- a/libavcodec/mpegaudiodec.c
 +++ b/libavcodec/mpegaudiodec.c
 @@ -1939,7 +1939,8 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, 
 void *data,
  
  avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header);
  
 -if (ch + m-nb_channels  avctx-channels) {
 +if (ch + m-nb_channels  avctx-channels ||
 +s-coff[fr] + m-nb_channels  avctx-channels) {
  av_log(avctx, AV_LOG_ERROR, frame channel count exceeds codec 
  channel count\n);
  return AVERROR_INVALIDDATA;
 -- 

probably OK as well
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 06/11] segafilm: Validate the number of audio channels

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 05:09:11PM +0300, Martin Storsjö wrote:
 This avoids divisions by zero later.
 
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavformat/segafilm.c |4 
  1 file changed, 4 insertions(+)
 
 diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
 index adf2475..ac9c873 100644
 --- a/libavformat/segafilm.c
 +++ b/libavformat/segafilm.c
 @@ -111,6 +111,10 @@ static int film_read_header(AVFormatContext *s)
  return AVERROR(EIO);
  film-audio_samplerate = AV_RB16(scratch[24]);
  film-audio_channels = scratch[21];
 +if (film-audio_channels == 0) {
 +av_log(s, AV_LOG_ERROR, Invalid number of channels\n);
 +return AVERROR_INVALIDDATA;
 +}
  film-audio_bits = scratch[22];
  if (scratch[23] == 2)
  film-audio_type = AV_CODEC_ID_ADPCM_ADX;
 -- 

why not check for too many channels too?
LGTM though
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 11/11] r3d: Add more input value validation

2013-09-19 Thread Luca Barbato
On 19/09/13 16:09, Martin Storsjö wrote:
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavformat/r3d.c |6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)
 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 2/2] h264_sei: check SEI size

2013-09-19 Thread Luca Barbato
On 19/09/13 16:26, Vittorio Giovara wrote:
 From: Michael Niedermayer michae...@gmx.at
 
 ---
  libavcodec/h264_sei.c |6 ++
  1 file changed, 6 insertions(+)
 

Seems fine.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Vittorio Giovara
On Thu, Sep 19, 2013 at 3:36 PM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Sep 19, 2013 at 10:26:34AM +0200, Vittorio Giovara wrote:
 So I propose a first set of patches that modify which headers are
 included and in what order, specifically:

 1. make sure there is a line between copyright header and the first include
 2. include system headers first
 3. include headers from the same library
 4. include headers from other libav libraries
 5. incldue headers from other libraries
 6. any other ifdef library
 7. make sure there ia a line between the last include or ifdef and the code
 8. move any non-doxygen comment before the include, if applicable

 Ifdeffed system headers should also be placed before libav headers.
 You just have to #include config.h first in that case.


Ok so, the order should be
1. make sure there is a line between copyright header and the first include
2. include system headers first
3. include config.h
4. any other ifdef system library
5. include headers from other libav libraries
6. incldue headers from other libraries
7 any other ifdef library
8. include headers from the same library
9. make sure there ia a line between the last include or ifdef and the code

And no reordering of comments, I'll just drop the cruft ones.
Is that fine with everyone?

 I could only test this set on linux x86, so I would really appreciate
 help for the other platforms (or instructions for this).

 Try installing some cross-compilers.


Ok I'll also check building out of tree...

Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/2] h264_sei: check SEI size

2013-09-19 Thread Vittorio Giovara
From: Michael Niedermayer michae...@gmx.at

---
 libavcodec/h264_sei.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index f72d72b..2ce71d9 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -190,6 +190,12 @@ int ff_h264_decode_sei(H264Context *h)
 size += show_bits(h-gb, 8);
 while (get_bits(h-gb, 8) == 255);
 
+if (size  get_bits_left(h-gb) / 8) {
+av_log(h-avctx, AV_LOG_ERROR, SEI type %d truncated at %d\n,
+   type, get_bits_left(h-gb));
+return AVERROR_INVALIDDATA;
+}
+
 switch (type) {
 case SEI_TYPE_PIC_TIMING: // Picture timing SEI
 ret = decode_picture_timing(h);
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 09/11] wtv: Add more sanity checks for a length read from the file

2013-09-19 Thread Luca Barbato
On 19/09/13 16:09, Martin Storsjö wrote:
 Also make sure the existing length check can't overflow.
 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/2] h264: do not discard NAL_SEI when skipping frames

2013-09-19 Thread Luca Barbato
On 19/09/13 16:26, Vittorio Giovara wrote:
 From: Rainer Hochecker fernetme...@online.de
 
 Setting AVDISCARD_NONREF (e.g. after flushing) resulted in 100% dropped 
 frames.
 ---
  libavcodec/h264.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

Probably shouldn't hurt.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 09/11] wtv: Add more sanity checks for a length read from the file

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 05:09:14PM +0300, Martin Storsjö wrote:
 Also make sure the existing length check can't overflow.
 
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavformat/wtv.c |7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/libavformat/wtv.c b/libavformat/wtv.c
 index b003905..093f795 100644
 --- a/libavformat/wtv.c
 +++ b/libavformat/wtv.c
 @@ -269,10 +269,15 @@ static AVIOContext * wtvfile_open2(AVFormatContext *s, 
 const uint8_t *buf, int b
  dir_length  = AV_RL16(buf + 16);
  file_length = AV_RL64(buf + 24);
  name_size   = 2 * AV_RL32(buf + 32);
 -if (buf + 48 + name_size  buf_end) {
 +if (48 + name_size  buf_end - buf) {
  av_log(s, AV_LOG_ERROR, filename exceeds buffer size; remaining 
 directory entries ignored\n);
  break;
  }
 +if (name_size  0) {
 +av_log(s, AV_LOG_ERROR,
 +   bad filename length, remaining directory entries 
 ignored\n);
 +break;
 +}
  first_sector = AV_RL32(buf + 40 + name_size);
  depth= AV_RL32(buf + 44 + name_size);
  
 -- 

It makes sense to reorder the checks IMO
but LGTM
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 01/11] dcadec: Validate the lfe parameter

2013-09-19 Thread Luca Barbato
On 19/09/13 16:09, Martin Storsjö wrote:
 We only seem to support values 1 and 2 (and 0 for it being disabled)
 according to how I interpret lfe_interpolation_fir.
 

While at it print the value read please.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 08/11] yop: Clear all references to the AVBuffer in the local AVPacket

2013-09-19 Thread Luca Barbato
On 19/09/13 16:09, Martin Storsjö wrote:
 This makes sure that it doesn't try to free an AVBuffer belonging
 to an earlier packet when we free the local packet at the end.
 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 10/11] rl2: Avoid a division by zero

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 05:09:15PM +0300, Martin Storsjö wrote:
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavformat/rl2.c |4 
  1 file changed, 4 insertions(+)
 
 diff --git a/libavformat/rl2.c b/libavformat/rl2.c
 index ac0532f..9effcef 100644
 --- a/libavformat/rl2.c
 +++ b/libavformat/rl2.c
 @@ -107,6 +107,10 @@ static av_cold int rl2_read_header(AVFormatContext *s)
  rate = avio_rl16(pb);
  channels = avio_rl16(pb);
  def_sound_size = avio_rl16(pb);
 +if (!channels) {
 +av_log(s, AV_LOG_ERROR, Invalid number of channels\n);
 +return AVERROR_INVALIDDATA;
 +}
  
  /** setup video stream */
  st = avformat_new_stream(s, NULL);
 -- 

I'd also error out on 42 channels but that's just me
the patch should be OK though
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2] h264: do not discard NAL_SEI when skipping frames

2013-09-19 Thread Vittorio Giovara
From: Rainer Hochecker fernetme...@online.de

Setting AVDISCARD_NONREF (e.g. after flushing) resulted in 100% dropped frames.
---
 libavcodec/h264.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 832b5c7..7797823 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4549,8 +4549,9 @@ static int decode_nal_units(H264Context *h, const uint8_t 
*buf, int buf_size,
 continue;
 }
 
-// FIXME do not discard SEI id
-if (avctx-skip_frame = AVDISCARD_NONREF  h-nal_ref_idc == 0)
+if (avctx-skip_frame = AVDISCARD_NONREF 
+h-nal_ref_idc == 0 
+h-nal_unit_type != NAL_SEI)
 continue;
 
 again:
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 02/11] asvdec: Verify the amount of extradata

2013-09-19 Thread Luca Barbato
On 19/09/13 16:09, Martin Storsjö wrote:
 The init function reads one byte of extradata.
 
Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Luca Barbato
On 19/09/13 16:40, Vittorio Giovara wrote:
 On Thu, Sep 19, 2013 at 3:36 PM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Sep 19, 2013 at 10:26:34AM +0200, Vittorio Giovara wrote:
 So I propose a first set of patches that modify which headers are
 included and in what order, specifically:

 1. make sure there is a line between copyright header and the first include
 2. include system headers first
 3. include headers from the same library
 4. include headers from other libav libraries
 5. incldue headers from other libraries
 6. any other ifdef library
 7. make sure there ia a line between the last include or ifdef and the code
 8. move any non-doxygen comment before the include, if applicable

 Ifdeffed system headers should also be placed before libav headers.
 You just have to #include config.h first in that case.

 
 Ok so, the order should be
 1. make sure there is a line between copyright header and the first include
 2. include system headers first
 3. include config.h
 4. any other ifdef system library
 5. include headers from other libav libraries
 6. incldue headers from other libraries
 7 any other ifdef library
 8. include headers from the same library
 9. make sure there ia a line between the last include or ifdef and the code

No

1 include config.h when needed
2 include external headers, system first
3 include non-local headers
4 include local headers

0/5 have a line separating the include block and the rest of the code.

I hope it is simpler and in line with what the others like.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 07/11] fraps: Make the input buffer size checks more strict

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 05:09:12PM +0300, Martin Storsjö wrote:
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavcodec/fraps.c |   30 +++---
  1 file changed, 19 insertions(+), 11 deletions(-)
 
 diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
 index 66ecdef..b969031 100644
 --- a/libavcodec/fraps.c
 +++ b/libavcodec/fraps.c
 @@ -145,10 +145,17 @@ static int decode_frame(AVCodecContext *avctx,
  uint32_t offs[4];
  int i, j, ret, is_chroma, planes;
  enum AVPixelFormat pix_fmt;
 +int prev_pic_bit, expected_size;
 +
 +if (buf_size  4) {
 +av_log(avctx, AV_LOG_ERROR, Too short packet\n);

nit: Packet is too short


at quick glance looks OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 10/11] rl2: Avoid a division by zero

2013-09-19 Thread Luca Barbato
On 19/09/13 16:09, Martin Storsjö wrote:
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavformat/rl2.c |4 
  1 file changed, 4 insertions(+)
 

Ok, I guess.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] h264_sei: log unknown sei messages

2013-09-19 Thread Vittorio Giovara
---
 libavcodec/h264_sei.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 2ce71d9..27a2c76 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -218,6 +218,7 @@ int ff_h264_decode_sei(H264Context *h)
 return ret;
 break;
 default:
+av_log(h-avctx, AV_LOG_DEBUG, unknown SEI type %d\n, type);
 skip_bits(h-gb, 8 * size);
 }
 
-- 
1.7.9.5

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] rtmpproto: Add a comment explaining the logic in handle_notify

2013-09-19 Thread Luca Barbato
On 19/09/13 11:49, Martin Storsjö wrote:
 This explains why the cleanup in 5626f994f was wrong and why
 ae0f316a was needed.
 ---
  libavformat/rtmpproto.c |2 ++
  1 file changed, 2 insertions(+)
 

Ok.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 0/4] [WIP] The Giant Headers Cleanup

2013-09-19 Thread Justin Ruggles

On 09/19/2013 10:45 AM, Luca Barbato wrote:

On 19/09/13 16:40, Vittorio Giovara wrote:

On Thu, Sep 19, 2013 at 3:36 PM, Diego Biurrun di...@biurrun.de wrote:

On Thu, Sep 19, 2013 at 10:26:34AM +0200, Vittorio Giovara wrote:

So I propose a first set of patches that modify which headers are
included and in what order, specifically:

1. make sure there is a line between copyright header and the first include
2. include system headers first
3. include headers from the same library
4. include headers from other libav libraries
5. incldue headers from other libraries
6. any other ifdef library
7. make sure there ia a line between the last include or ifdef and the code
8. move any non-doxygen comment before the include, if applicable


Ifdeffed system headers should also be placed before libav headers.
You just have to #include config.h first in that case.



Ok so, the order should be
1. make sure there is a line between copyright header and the first include
2. include system headers first
3. include config.h
4. any other ifdef system library
5. include headers from other libav libraries
6. incldue headers from other libraries
7 any other ifdef library
8. include headers from the same library
9. make sure there ia a line between the last include or ifdef and the code


No

1 include config.h when needed
2 include external headers, system first
3 include non-local headers
4 include local headers

0/5 have a line separating the include block and the rest of the code.

I hope it is simpler and in line with what the others like.


+1

-Justin


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avplay: Support selecting codecs

2013-09-19 Thread Luca Barbato
On 19/09/13 10:27, Martin Storsjö wrote:
 On Wed, 18 Sep 2013, Luca Barbato wrote:
 
 From: Justin Ruggles justin.rugg...@gmail.com

 Signed-off-by: Luca Barbato lu_z...@gentoo.org
 ---

 Updated a little, is being really useful to debug QSV.

 avplay.c| 35 ++-
 doc/avplay.texi |  4 
 2 files changed, 34 insertions(+), 5 deletions(-)
 
 In general, this is really nice and appreciated.
 
 diff --git a/avplay.c b/avplay.c
 index 00becbe..18c6364 100644
 --- a/avplay.c
 +++ b/avplay.c
 @@ -231,6 +231,8 @@ static int screen_width  = 0;
 static int screen_height = 0;
 static int audio_disable;
 static int video_disable;
 +static const char *acodec_name;
 +static const char *vcodec_name;
 static int wanted_stream[AVMEDIA_TYPE_NB] = {
 [AVMEDIA_TYPE_AUDIO]= -1,
 [AVMEDIA_TYPE_VIDEO]= -1,
 @@ -2024,10 +2026,11 @@ static int stream_component_open(VideoState
 *is, int stream_index)
 {
 AVFormatContext *ic = is-ic;
 AVCodecContext *avctx;
 -AVCodec *codec;
 +AVCodec *codec = NULL;
 SDL_AudioSpec wanted_spec, spec;
 AVDictionary *opts;
 AVDictionaryEntry *t = NULL;
 +enum AVMediaType codec_type;

 if (stream_index  0 || stream_index = ic-nb_streams)
 return -1;
 @@ -2035,7 +2038,26 @@ static int stream_component_open(VideoState
 *is, int stream_index)

 opts = filter_codec_opts(codec_opts, avctx-codec_id, ic,
 ic-streams[stream_index], NULL);

 -codec = avcodec_find_decoder(avctx-codec_id);
 +codec_type = avcodec_get_type(avctx-codec_id);
 +if (acodec_name  codec_type == AVMEDIA_TYPE_AUDIO ||
 +vcodec_name  codec_type == AVMEDIA_TYPE_VIDEO) {
 +const char *name;
 +if (codec_type == AVMEDIA_TYPE_AUDIO)
 +name = acodec_name;
 +else
 +name = vcodec_name;
 +
 +codec = avcodec_find_decoder_by_name(name);
 +if (!codec) {
 +av_log(NULL, AV_LOG_FATAL, Unknown decoder '%s'\n, name);
 +} else if (codec-type != codec_type) {
 +av_log(NULL, AV_LOG_FATAL, Invalid decoder type '%s'\n,
 name);
 +codec = NULL;
 +}
 +} else {
 +codec = avcodec_find_decoder(avctx-codec_id);
 +}
 +
 avctx-debug_mv  = debug_mv;
 avctx-workaround_bugs   = workaround_bugs;
 avctx-idct_algo = idct;
 @@ -2315,9 +2337,6 @@ static int decode_thread(void *arg)
  st_index[AVMEDIA_TYPE_AUDIO] :
  st_index[AVMEDIA_TYPE_VIDEO]),
 NULL, 0);
 -if (show_status) {
 -av_dump_format(ic, 0, is-filename, 0);
 -}

 /* open the streams */
 if (st_index[AVMEDIA_TYPE_AUDIO] = 0) {
 @@ -2344,6 +2363,10 @@ static int decode_thread(void *arg)
 goto fail;
 }

 +if (show_status) {
 +av_dump_format(ic, 0, is-filename, 0);
 +}
 +
 
 Why is this block moved?
 
 for (;;) {
 if (is-abort_request)
 break;
 @@ -2860,6 +2883,8 @@ static const OptionDef options[] = {
 { rdftspeed, OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {
 rdftspeed }, rdft speed, msecs },
 { default, HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {
 opt_default }, generic catch all option,  },
 { i, 0, { NULL }, avconv compatibility dummy option, },
 +{ ac, HAS_ARG | OPT_STRING, { acodec_name }, audio codec
 name,  },
 +{ vc, HAS_ARG | OPT_STRING, { vcodec_name }, video codec
 name,  },
 { NULL, },
 
 Would it make more sense to name them acodec and vcodec as the (old)
 avconv options, instead of inventing yet another naming?

It is in line with the other avplay short options, acodec and vcodec are
deprecated, I do not have time to add -c:{number,a,v,s} properly.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 06/11] segafilm: Validate the number of audio channels

2013-09-19 Thread Martin Storsjö

On Thu, 19 Sep 2013, Kostya Shishkov wrote:


On Thu, Sep 19, 2013 at 05:09:11PM +0300, Martin Storsjö wrote:

This avoids divisions by zero later.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavformat/segafilm.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index adf2475..ac9c873 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -111,6 +111,10 @@ static int film_read_header(AVFormatContext *s)
 return AVERROR(EIO);
 film-audio_samplerate = AV_RB16(scratch[24]);
 film-audio_channels = scratch[21];
+if (film-audio_channels == 0) {
+av_log(s, AV_LOG_ERROR, Invalid number of channels\n);
+return AVERROR_INVALIDDATA;
+}
 film-audio_bits = scratch[22];
 if (scratch[23] == 2)
 film-audio_type = AV_CODEC_ID_ADPCM_ADX;
--


why not check for too many channels too?


What would be a good limit here then - 42 here as well?

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 09/11] wtv: Add more sanity checks for a length read from the file

2013-09-19 Thread Martin Storsjö

On Thu, 19 Sep 2013, Kostya Shishkov wrote:


On Thu, Sep 19, 2013 at 05:09:14PM +0300, Martin Storsjö wrote:

Also make sure the existing length check can't overflow.

Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
 libavformat/wtv.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index b003905..093f795 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -269,10 +269,15 @@ static AVIOContext * wtvfile_open2(AVFormatContext *s, 
const uint8_t *buf, int b
 dir_length  = AV_RL16(buf + 16);
 file_length = AV_RL64(buf + 24);
 name_size   = 2 * AV_RL32(buf + 32);
-if (buf + 48 + name_size  buf_end) {
+if (48 + name_size  buf_end - buf) {
 av_log(s, AV_LOG_ERROR, filename exceeds buffer size; remaining 
directory entries ignored\n);
 break;
 }
+if (name_size  0) {
+av_log(s, AV_LOG_ERROR,
+   bad filename length, remaining directory entries 
ignored\n);
+break;
+}
 first_sector = AV_RL32(buf + 40 + name_size);
 depth= AV_RL32(buf + 44 + name_size);

--


It makes sense to reorder the checks IMO


That is, having the  0 check first?

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/5] asfenc: add ASF_Reserved_4 as defined in section 10.10 of the ASF spec

2013-09-19 Thread Vladimir Pantelic
Signed-off-by: Vladimir Pantelic vlado...@gmail.com
---
 libavformat/asf.c | 4 
 libavformat/asf.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/libavformat/asf.c b/libavformat/asf.c
index 52afa09..ec34b50 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -117,6 +117,10 @@ const ff_asf_guid ff_asf_marker_header = {
 0x01, 0xCD, 0x87, 0xF4, 0x51, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 
0x0C, 0x20, 0x53, 0x65
 };
 
+const ff_asf_guid ff_asf_reserved_4 = {
+0x20, 0xdb, 0xfe, 0x4c, 0xf6, 0x75, 0xCF, 0x11, 0x9c, 0x0f, 0x00, 
0xa0, 0xc9, 0x03, 0x49, 0xcb
+};
+
 /* I am not a number !!! This GUID is the one found on the PC used to
  * generate the stream */
 const ff_asf_guid ff_asf_my_guid = {
diff --git a/libavformat/asf.h b/libavformat/asf.h
index 6d418e8..4ac644e 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -104,6 +104,7 @@ extern const ff_asf_guid ff_asf_ext_stream_audio_stream;
 extern const ff_asf_guid ff_asf_metadata_header;
 extern const ff_asf_guid ff_asf_metadata_library_header;
 extern const ff_asf_guid ff_asf_marker_header;
+extern const ff_asf_guid ff_asf_reserved_4;
 extern const ff_asf_guid ff_asf_my_guid;
 extern const ff_asf_guid ff_asf_language_guid;
 extern const ff_asf_guid ff_asf_content_encryption;
-- 
1.8.1.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] asfenc: mux chapters in ASF files (v3)

2013-09-19 Thread Vladimir Pantelic
long awaited, finally we can have chapters in the bestest container format ever!

now handling chapters without a name

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 5/5] asfenc: mux chapters in ASF files using an ASF marker section

2013-09-19 Thread Vladimir Pantelic
ASF markers only have a start time, so we lose the chapter end times,
but that is ASF for you

Signed-off-by: Vladimir Pantelic vlado...@gmail.com
---
 Changelog|  1 +
 libavformat/asfenc.c | 66 +++-
 2 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 10ad63b..b0ff897 100644
--- a/Changelog
+++ b/Changelog
@@ -36,6 +36,7 @@ version 10:
 - WebP decoder
 - Error Resilient AAC syntax (ER AAC LC) decoding
 - Low Delay AAC (ER AAC LD) decoding
+- mux chapters in ASF files
 
 
 version 9:
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 7e1594b..e1a7189 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -20,6 +20,7 @@
  */
 
 #include libavutil/dict.h
+#include libavutil/mathematics.h
 #include avformat.h
 #include avio_internal.h
 #include internal.h
@@ -287,6 +288,64 @@ static int64_t unix_to_file_time(int ti)
 return t;
 }
 
+static int32_t get_send_time(ASFContext *asf, int64_t pres_time, uint64_t 
*offset)
+{
+int i;
+int32_t send_time = 0;
+*offset = asf-data_offset + DATA_HEADER_SIZE;
+for (i = 0; i  asf-nb_index_count; i++) {
+if (pres_time = asf-index_ptr[i].send_time)
+break;
+send_time = asf-index_ptr[i].send_time;
+*offset   = asf-index_ptr[i].offset;
+}
+
+return send_time / 1;
+}
+
+static int asf_write_markers(AVFormatContext *s)
+{
+ASFContext *asf = s-priv_data;
+AVIOContext *pb = s-pb;
+int i;
+AVRational scale = {1, 1000};
+int64_t hpos = put_header(pb, ff_asf_marker_header);
+
+put_guid(pb, ff_asf_reserved_4);  // ASF spec mandates this reserved value
+avio_wl32(pb, s-nb_chapters); // markers count
+avio_wl16(pb, 0);  // ASF spec mandates 0 for this
+avio_wl16(pb, 0);  // name length 0, no name given
+
+for (i = 0; i  s-nb_chapters; i++) {
+AVChapter *c = s-chapters[i];
+AVDictionaryEntry *t = av_dict_get(c-metadata, title, NULL, 0);
+int64_t pres_time = av_rescale_q(c-start, c-time_base, scale);
+uint64_t offset;
+int32_t send_time = get_send_time(asf, pres_time, offset);
+int len = 0;
+uint8_t *buf;
+AVIOContext *dyn_buf;
+if (t) {
+if (avio_open_dyn_buf(dyn_buf)  0)
+return AVERROR(ENOMEM);
+avio_put_str16le(dyn_buf, t-value);
+len = avio_close_dyn_buf(dyn_buf, buf);
+}
+avio_wl64(pb, offset);// offset of the packet with 
send_time
+avio_wl64(pb, pres_time + PREROLL_TIME * 1); // presentation time
+avio_wl16(pb, 12 + len);  // entry length
+avio_wl32(pb, send_time); // send time
+avio_wl32(pb, 0); // flags, should be 0
+avio_wl32(pb, len / 2);   // marker desc length in WCHARS!
+if (t) {
+avio_write(pb, buf, len); // marker desc
+av_freep(buf);
+}
+}
+end_header(pb, hpos);
+return 0;
+}
+
 /* write the header (used two times if non streamed) */
 static int asf_write_header1(AVFormatContext *s, int64_t file_size,
  int64_t data_chunk_size)
@@ -388,7 +447,12 @@ static int asf_write_header1(AVFormatContext *s, int64_t 
file_size,
 }
 end_header(pb, hpos);
 }
-
+/* chapters using ASF markers */
+if (!asf-is_streamed  s-nb_chapters) {
+int ret;
+if (ret = asf_write_markers(s))
+return ret;
+}
 /* stream headers */
 for (n = 0; n  s-nb_streams; n++) {
 int64_t es_pos;
-- 
1.8.1.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 4/5] asfenc: remember send time and offset of the index entries

2013-09-19 Thread Vladimir Pantelic
Signed-off-by: Vladimir Pantelic vlado...@gmail.com
---
 libavformat/asf.h| 2 ++
 libavformat/asfenc.c | 4 
 2 files changed, 6 insertions(+)

diff --git a/libavformat/asf.h b/libavformat/asf.h
index 4ac644e..2f6722a 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -78,6 +78,8 @@ typedef struct ASFMainHeader {
 typedef struct ASFIndex {
 uint32_t packet_number;
 uint16_t packet_count;
+uint64_t send_time;
+uint64_t offset;
 } ASFIndex;
 
 extern const ff_asf_guid ff_asf_header;
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index e37b6f7..7e1594b 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -762,12 +762,14 @@ static void put_frame(AVFormatContext *s, ASFStream 
*stream, AVStream *avst,
 static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
 ASFContext *asf = s-priv_data;
+AVIOContext *pb = s-pb;
 ASFStream *stream;
 int64_t duration;
 AVCodecContext *codec;
 int64_t packet_st, pts;
 int start_sec, i;
 int flags = pkt-flags;
+uint64_t offset = avio_tell(pb);
 
 codec  = s-streams[pkt-stream_index]-codec;
 stream = asf-streams[pkt-stream_index];
@@ -802,6 +804,8 @@ static int asf_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 // store
 asf-index_ptr[i].packet_number = (uint32_t)packet_st;
 asf-index_ptr[i].packet_count  = (uint16_t)(asf-nb_packets - 
packet_st);
+asf-index_ptr[i].send_time = start_sec * 
INT64_C(1000);
+asf-index_ptr[i].offset= offset;
 asf-maximum_packet = FFMAX(asf-maximum_packet,
 
(uint16_t)(asf-nb_packets - packet_st));
 }
-- 
1.8.1.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/5] asfdec: replace magic constant with DATA_HEADER_SIZE

2013-09-19 Thread Vladimir Pantelic
Signed-off-by: Vladimir Pantelic vlado...@gmail.com
---
 libavformat/asfenc.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 6be285c..e37b6f7 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -182,6 +182,8 @@
  1 - /* Payload Flags */  \
  2 * PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS)
 
+#define DATA_HEADER_SIZE 50
+
 typedef struct {
 uint32_t seqno;
 int is_streamed;
@@ -517,14 +519,14 @@ static int asf_write_header1(AVFormatContext *s, int64_t 
file_size,
 cur_pos = avio_tell(pb);
 header_size = cur_pos - header_offset;
 if (asf-is_streamed) {
-header_size += 8 + 30 + 50;
+header_size += 8 + 30 + DATA_HEADER_SIZE;
 
 avio_seek(pb, header_offset - 10 - 30, SEEK_SET);
 avio_wl16(pb, header_size);
 avio_seek(pb, header_offset - 2 - 30, SEEK_SET);
 avio_wl16(pb, header_size);
 
-header_size -= 8 + 30 + 50;
+header_size -= 8 + 30 + DATA_HEADER_SIZE;
 }
 header_size += 24 + 6;
 avio_seek(pb, header_offset - 14, SEEK_SET);
@@ -555,10 +557,10 @@ static int asf_write_header(AVFormatContext *s)
 asf-nb_index_count= 0;
 asf-maximum_packet= 0;
 
-/* the data-chunk-size has to be 50, which is data_size - asf-data_offset
- *  at the moment this function is done. It is needed to use asf as
- *  streamable format. */
-if (asf_write_header1(s, 0, 50)  0) {
+/* the data-chunk-size has to be 50 (DATA_HEADER_SIZE), which is
+ * data_size - asf-data_offset at the moment this function is done.
+ * It is needed to use asf as a streamable format. */
+if (asf_write_header1(s, 0, DATA_HEADER_SIZE)  0) {
 //av_free(asf);
 return -1;
 }
-- 
1.8.1.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/5] asfdec: substract preroll time from marker presentation time

2013-09-19 Thread Vladimir Pantelic
this was forgotten when we changed ASF to not output the preroll time

Signed-off-by: Vladimir Pantelic vlado...@gmail.com
---
 libavformat/asfdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index f3978f0..b99cb02 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -672,6 +672,7 @@ static int asf_read_metadata(AVFormatContext *s, int64_t 
size)
 static int asf_read_marker(AVFormatContext *s, int64_t size)
 {
 AVIOContext *pb = s-pb;
+ASFContext *asf = s-priv_data;
 int i, count, name_len, ret;
 char name[1024];
 
@@ -689,6 +690,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size)
 
 avio_rl64(pb); // offset, 8 bytes
 pres_time = avio_rl64(pb); // presentation time
+pres_time -= asf-hdr.preroll * 1;
 avio_rl16(pb); // entry length
 avio_rl32(pb); // send time
 avio_rl32(pb); // flags
-- 
1.8.1.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 06/11] segafilm: Validate the number of audio channels

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 06:38:45PM +0300, Martin Storsjö wrote:
 On Thu, 19 Sep 2013, Kostya Shishkov wrote:
 
 On Thu, Sep 19, 2013 at 05:09:11PM +0300, Martin Storsjö wrote:
 This avoids divisions by zero later.
 
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavformat/segafilm.c |4 
  1 file changed, 4 insertions(+)
 
 diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
 index adf2475..ac9c873 100644
 --- a/libavformat/segafilm.c
 +++ b/libavformat/segafilm.c
 @@ -111,6 +111,10 @@ static int film_read_header(AVFormatContext *s)
  return AVERROR(EIO);
  film-audio_samplerate = AV_RB16(scratch[24]);
  film-audio_channels = scratch[21];
 +if (film-audio_channels == 0) {
 +av_log(s, AV_LOG_ERROR, Invalid number of channels\n);
 +return AVERROR_INVALIDDATA;
 +}
  film-audio_bits = scratch[22];
  if (scratch[23] == 2)
  film-audio_type = AV_CODEC_ID_ADPCM_ADX;
 --
 
 why not check for too many channels too?
 
 What would be a good limit here then - 42 here as well?

I'd expect 2
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] build: Support cparser

2013-09-19 Thread Diego Biurrun
On Thu, Sep 12, 2013 at 08:17:15PM +0200, Luca Barbato wrote:
 Initial cparser support.
 ---

The second line is redundant, drop it.

 --- a/configure
 +++ b/configure
 @@ -3980,6 +3999,9 @@ elif enabled clang; then
  check_cflags -Werror=implicit-function-declaration
  check_cflags -Werror=missing-prototypes
  check_cflags -Werror=return-type
 +elif enabled cparser; then
 +check_cflags -Wno-missing-variable-declarations
 +check_cflags -Wno-empty-statement
  elif enabled armcc; then
  # 2523: use of inline assembler is deprecated
  add_cflags -W${armcc_opt},--diag_suppress=2523

Why not add_cflags?  Is there a chance cparser might not support
these flags?

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 09/11] wtv: Add more sanity checks for a length read from the file

2013-09-19 Thread Kostya Shishkov
On Thu, Sep 19, 2013 at 06:39:08PM +0300, Martin Storsjö wrote:
 On Thu, 19 Sep 2013, Kostya Shishkov wrote:
 
 On Thu, Sep 19, 2013 at 05:09:14PM +0300, Martin Storsjö wrote:
 Also make sure the existing length check can't overflow.
 
 Reported-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
 CC: libav-sta...@libav.org
 ---
  libavformat/wtv.c |7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/libavformat/wtv.c b/libavformat/wtv.c
 index b003905..093f795 100644
 --- a/libavformat/wtv.c
 +++ b/libavformat/wtv.c
 @@ -269,10 +269,15 @@ static AVIOContext * wtvfile_open2(AVFormatContext 
 *s, const uint8_t *buf, int b
  dir_length  = AV_RL16(buf + 16);
  file_length = AV_RL64(buf + 24);
  name_size   = 2 * AV_RL32(buf + 32);
 -if (buf + 48 + name_size  buf_end) {
 +if (48 + name_size  buf_end - buf) {
  av_log(s, AV_LOG_ERROR, filename exceeds buffer size; 
  remaining directory entries ignored\n);
  break;
  }
 +if (name_size  0) {
 +av_log(s, AV_LOG_ERROR,
 +   bad filename length, remaining directory entries 
 ignored\n);
 +break;
 +}
  first_sector = AV_RL32(buf + 40 + name_size);
  depth= AV_RL32(buf + 44 + name_size);
 
 --
 
 It makes sense to reorder the checks IMO
 
 That is, having the  0 check first?

Yes - it just feels safer than falsely passing current first check when
having negative name_size.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] rv34: Fix a memory leak on errors

2013-09-19 Thread Diego Biurrun
On Wed, Sep 18, 2013 at 11:08:33PM +0300, Martin Storsjö wrote:
 ---
  libavcodec/rv34.c |8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

probably OK

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/5] asfenc: add ASF_Reserved_4 as defined in section 10.10 of the ASF spec

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 05:50:36PM +0200, Vladimir Pantelic wrote:
 Signed-off-by: Vladimir Pantelic vlado...@gmail.com
 ---
  libavformat/asf.c | 4 
  libavformat/asf.h | 1 +
  2 files changed, 5 insertions(+)

This should be squashed into 5/5 IMO.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/5] asfdec: substract preroll time from marker presentation time

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 05:50:34PM +0200, Vladimir Pantelic wrote:
 this was forgotten when we changed ASF to not output the preroll time

Start sentences capitalized and end in a period.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 00/10] x86inc backports from x264

2013-09-19 Thread Diego Biurrun
On Wed, Sep 11, 2013 at 05:49:19PM +0200, Hendrik Leppkes wrote:
 
 Important points of note:
 A few patches regarding AVX/AVX2/FMA4 have not been backported, because the 
 first
 of these causes compile failures in avresample, which i've not managed to 
 properly debug.

Justin, can you help out with this?

I'd rather not do an incomplete backport if it can be helped.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] h264_sei: log unknown sei messages

2013-09-19 Thread Anton Khirnov

On Thu, 19 Sep 2013 17:28:41 +0200, Vittorio Giovara 
vittorio.giov...@gmail.com wrote:
 ---
  libavcodec/h264_sei.c |1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
 index 2ce71d9..27a2c76 100644
 --- a/libavcodec/h264_sei.c
 +++ b/libavcodec/h264_sei.c
 @@ -218,6 +218,7 @@ int ff_h264_decode_sei(H264Context *h)
  return ret;
  break;
  default:
 +av_log(h-avctx, AV_LOG_DEBUG, unknown SEI type %d\n, type);
  skip_bits(h-gb, 8 * size);

Ok, queued

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avplay: Support selecting codecs

2013-09-19 Thread Anton Khirnov

On Thu, 19 Sep 2013 16:18:24 +0200, Luca Barbato lu_z...@gentoo.org wrote:
 On 19/09/13 10:27, Martin Storsjö wrote:
  On Wed, 18 Sep 2013, Luca Barbato wrote:
  
  From: Justin Ruggles justin.rugg...@gmail.com
 
  Signed-off-by: Luca Barbato lu_z...@gentoo.org
  ---
 
  Updated a little, is being really useful to debug QSV.
 
  avplay.c| 35 ++-
  doc/avplay.texi |  4 
  2 files changed, 34 insertions(+), 5 deletions(-)
  
  In general, this is really nice and appreciated.
  
  diff --git a/avplay.c b/avplay.c
  index 00becbe..18c6364 100644
  --- a/avplay.c
  +++ b/avplay.c
  @@ -231,6 +231,8 @@ static int screen_width  = 0;
  static int screen_height = 0;
  static int audio_disable;
  static int video_disable;
  +static const char *acodec_name;
  +static const char *vcodec_name;
  static int wanted_stream[AVMEDIA_TYPE_NB] = {
  [AVMEDIA_TYPE_AUDIO]= -1,
  [AVMEDIA_TYPE_VIDEO]= -1,
  @@ -2024,10 +2026,11 @@ static int stream_component_open(VideoState
  *is, int stream_index)
  {
  AVFormatContext *ic = is-ic;
  AVCodecContext *avctx;
  -AVCodec *codec;
  +AVCodec *codec = NULL;
  SDL_AudioSpec wanted_spec, spec;
  AVDictionary *opts;
  AVDictionaryEntry *t = NULL;
  +enum AVMediaType codec_type;
 
  if (stream_index  0 || stream_index = ic-nb_streams)
  return -1;
  @@ -2035,7 +2038,26 @@ static int stream_component_open(VideoState
  *is, int stream_index)
 
  opts = filter_codec_opts(codec_opts, avctx-codec_id, ic,
  ic-streams[stream_index], NULL);
 
  -codec = avcodec_find_decoder(avctx-codec_id);
  +codec_type = avcodec_get_type(avctx-codec_id);
  +if (acodec_name  codec_type == AVMEDIA_TYPE_AUDIO ||
  +vcodec_name  codec_type == AVMEDIA_TYPE_VIDEO) {
  +const char *name;
  +if (codec_type == AVMEDIA_TYPE_AUDIO)
  +name = acodec_name;
  +else
  +name = vcodec_name;
  +
  +codec = avcodec_find_decoder_by_name(name);
  +if (!codec) {
  +av_log(NULL, AV_LOG_FATAL, Unknown decoder '%s'\n, name);
  +} else if (codec-type != codec_type) {
  +av_log(NULL, AV_LOG_FATAL, Invalid decoder type '%s'\n,
  name);
  +codec = NULL;
  +}
  +} else {
  +codec = avcodec_find_decoder(avctx-codec_id);
  +}
  +
  avctx-debug_mv  = debug_mv;
  avctx-workaround_bugs   = workaround_bugs;
  avctx-idct_algo = idct;
  @@ -2315,9 +2337,6 @@ static int decode_thread(void *arg)
   st_index[AVMEDIA_TYPE_AUDIO] :
   st_index[AVMEDIA_TYPE_VIDEO]),
  NULL, 0);
  -if (show_status) {
  -av_dump_format(ic, 0, is-filename, 0);
  -}
 
  /* open the streams */
  if (st_index[AVMEDIA_TYPE_AUDIO] = 0) {
  @@ -2344,6 +2363,10 @@ static int decode_thread(void *arg)
  goto fail;
  }
 
  +if (show_status) {
  +av_dump_format(ic, 0, is-filename, 0);
  +}
  +
  
  Why is this block moved?
  
  for (;;) {
  if (is-abort_request)
  break;
  @@ -2860,6 +2883,8 @@ static const OptionDef options[] = {
  { rdftspeed, OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {
  rdftspeed }, rdft speed, msecs },
  { default, HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {
  opt_default }, generic catch all option,  },
  { i, 0, { NULL }, avconv compatibility dummy option, },
  +{ ac, HAS_ARG | OPT_STRING, { acodec_name }, audio codec
  name,  },
  +{ vc, HAS_ARG | OPT_STRING, { vcodec_name }, video codec
  name,  },
  { NULL, },
  
  Would it make more sense to name them acodec and vcodec as the (old)
  avconv options, instead of inventing yet another naming?
 
 It is in line with the other avplay short options, acodec and vcodec are
 deprecated, I do not have time to add -c:{number,a,v,s} properly.
 

They are not deprecated.

And +1 for making that -vcodec/-acodec
Especially since -ac sets audio channels in avconv

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/5] asfdec: substract preroll time from marker presentation time

2013-09-19 Thread Vladimir Pantelic
On Sep 19, 2013 7:35 PM, Diego Biurrun di...@biurrun.de wrote:

 On Thu, Sep 19, 2013 at 05:50:34PM +0200, Vladimir Pantelic wrote:
  this was forgotten when we changed ASF to not output the preroll time

 Start sentences capitalized and end in a period.

period I forgot, capitalized is against my house style.


 Diego
 ___
 libav-devel mailing list
 libav-devel@libav.org
 https://lists.libav.org/mailman/listinfo/libav-devel
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/5] asfdec: substract preroll time from marker presentation time

2013-09-19 Thread Luca Barbato
On 19/09/13 19:35, Diego Biurrun wrote:
 On Thu, Sep 19, 2013 at 05:50:34PM +0200, Vladimir Pantelic wrote:
 this was forgotten when we changed ASF to not output the preroll time
 
 Start sentences capitalized and end in a period.

Subjects do not end with periods.

Please do not perpetuate bad style.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] doxy: Document avlog

2013-09-19 Thread Anton Khirnov

On Wed, 18 Sep 2013 15:30:26 +0200, Luca Barbato lu_z...@gentoo.org wrote:
 Provide some information for every function and add a group.
 ---
 
 Please send updated patches instead of reviews.
 Note:
  @see is immediately after the body on purpose, do not move it down,
  looks much worse on the html output otherwise.
 
  libavutil/avutil.h |  6 
  libavutil/log.h| 98 
 ++
  2 files changed, 98 insertions(+), 6 deletions(-)
 
 diff --git a/libavutil/avutil.h b/libavutil/avutil.h
 index ddb34a1..6bb5510 100644
 --- a/libavutil/avutil.h
 +++ b/libavutil/avutil.h
 @@ -127,6 +127,12 @@
   *
   * @}
   *
 + * @defgroup lavu_log Logging Facility
 + *
 + * @{
 + *
 + * @}
 + *
   * @defgroup lavu_misc Other
   *
   * @{
 diff --git a/libavutil/log.h b/libavutil/log.h
 index 7b17330..5692bd5 100644
 --- a/libavutil/log.h
 +++ b/libavutil/log.h
 @@ -89,8 +89,19 @@ typedef struct AVClass {
  const struct AVClass* (*child_class_next)(const struct AVClass *prev);
  } AVClass;
 
 -/* av_log API */
 +/**
 + * @addtogroup lavu_log
 + *
 + * @{
 + *
 + * @defgroup lavu_log_constants Logging Constants
 + *
 + * @{
 + */
 
 +/**
 + * No output.
 + */
  #define AV_LOG_QUIET-8
 
  /**
 @@ -117,7 +128,14 @@ typedef struct AVClass {
   */
  #define AV_LOG_WARNING  24
 
 +/**
 + * Standard information
 + */
  #define AV_LOG_INFO 32
 +
 +/**
 + * Detailed information, usually not interesting.

The caller judges what is interesting or not, it's not for us to decide.

 + */
  #define AV_LOG_VERBOSE  40
 
  /**
 @@ -126,10 +144,15 @@ typedef struct AVClass {
  #define AV_LOG_DEBUG48
 
  /**
 + * @}
 + */
 +
 +/**
   * Send the specified message to the log if the level is less than or equal
   * to the current av_log_level. By default, all logging messages are sent to
 - * stderr. This behavior can be altered by setting a different av_vlog 
 callback
 + * stderr. This behavior can be altered by setting a different logging 
 callback
   * function.
 + * @see av_log_set_callback
   *
   * @param avcl A pointer to an arbitrary struct of which the first field is a
   * pointer to an AVClass struct.
 @@ -137,15 +160,74 @@ typedef struct AVClass {
   * higher importance.
   * @param fmt The format string (printf-compatible) that specifies how
   * subsequent arguments are converted to output.
 - * @see av_vlog
   */
  void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 
 4);
 
 -void av_vlog(void *avcl, int level, const char *fmt, va_list);
 +
 +/**
 + * Send the specified message to the log if the level is less than or equal
 + * to the current av_log_level. By default, all logging messages are sent to
 + * stderr. This behavior can be altered by setting a different logging 
 callback
 + * function.
 + * @see av_log_set_callback
 + *
 + * @param avcl A pointer to an arbitrary struct of which the first field is a
 + *pointer to an AVClass struct.
 + * @param level The importance level of the message, lower values signifying
 + *higher importance.

It should mention that it should be one of the AV_LOG_ macros.
Same below


-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/5] asfdec: substract preroll time from marker presentation time

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 08:15:20PM +0200, Vladimir Pantelic wrote:
 On Sep 19, 2013 7:35 PM, Diego Biurrun di...@biurrun.de wrote:
 
  On Thu, Sep 19, 2013 at 05:50:34PM +0200, Vladimir Pantelic wrote:
   this was forgotten when we changed ASF to not output the preroll time
 
  Start sentences capitalized and end in a period.
 
 period I forgot, capitalized is against my house style.

Replace your house style with English :-) - you or whoever pushes.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] build: Support cparser

2013-09-19 Thread Luca Barbato
On 19/09/13 19:14, Diego Biurrun wrote:
 On Thu, Sep 12, 2013 at 08:17:15PM +0200, Luca Barbato wrote:
 Initial cparser support.
 ---
 
 The second line is redundant, drop it.
 
 --- a/configure
 +++ b/configure
 @@ -3980,6 +3999,9 @@ elif enabled clang; then
  check_cflags -Werror=implicit-function-declaration
  check_cflags -Werror=missing-prototypes
  check_cflags -Werror=return-type
 +elif enabled cparser; then
 +check_cflags -Wno-missing-variable-declarations
 +check_cflags -Wno-empty-statement
  elif enabled armcc; then
  # 2523: use of inline assembler is deprecated
  add_cflags -W${armcc_opt},--diag_suppress=2523
 
 Why not add_cflags?  Is there a chance cparser might not support
 these flags?

Can be done and will be pushed with add_cflags.

lu



___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/5] asfdec: substract preroll time from marker presentation time

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 08:48:24PM +0200, Luca Barbato wrote:
 On 19/09/13 19:35, Diego Biurrun wrote:
  On Thu, Sep 19, 2013 at 05:50:34PM +0200, Vladimir Pantelic wrote:
  this was forgotten when we changed ASF to not output the preroll time
  
  Start sentences capitalized and end in a period.
 
 Subjects do not end with periods.

I see more than a subject here.  I don't mean the title? :)

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Diego Biurrun
On Thu, Sep 19, 2013 at 04:22:48PM -0400, Alex Smith wrote:
 --- a/configure
 +++ b/configure
 @@ -3997,6 +3997,7 @@ elif enabled_any msvc icl; then
  enabled x86_32  disable aligned_stack
  enabled_all x86_32 debug  add_cflags -Oy-
  enabled debug  add_ldflags -debug
 +enabled pragma_deprecated

This is a nop.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
What?

The pragma test fails on msvc.

On Thu, Sep 19, 2013 at 4:39 PM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Sep 19, 2013 at 04:22:48PM -0400, Alex Smith wrote:
 This is a nop.

 Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.
---
 configure  |  5 +++--
 libavutil/attributes.h |  2 ++
 libavutil/internal.h   | 12 ++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 1e195d5..bb18877 100755
--- a/configure
+++ b/configure
@@ -2405,7 +2405,7 @@ msvc_flags(){
 -Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 
\
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-   -wd4996 -wd4273 ;;
+   -wd4273 ;;
 esac
 done
 }
@@ -2629,7 +2629,7 @@ probe_cc(){
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
 _flags='-nologo'
-_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64'
+_cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS 
-Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
@@ -3997,6 +3997,7 @@ elif enabled_any msvc icl; then
 enabled x86_32  disable aligned_stack
 enabled_all x86_32 debug  add_cflags -Oy-
 enabled debug  add_ldflags -debug
+enabled pragma_deprecated
 if enabled icl; then
 # basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
 check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 292a0a1..850a73f 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -72,6 +72,8 @@
 
 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define attribute_deprecated __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define attribute_deprecated __declspec(deprecated)
 #else
 #define attribute_deprecated
 #endif
diff --git a/libavutil/internal.h b/libavutil/internal.h
index b18860f..7b178c2 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -62,8 +62,16 @@
 #endif
 
 #if HAVE_PRAGMA_DEPRECATED
-#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic ignored 
\-Wdeprecated-declarations\)
-#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic warning 
\-Wdeprecated-declarations\)
+#if defined(__ICL)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:1478))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#elif defined(_MSC_VER)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:4996))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#else
+#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic 
ignored \-Wdeprecated-declarations\)
+#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic 
warning \-Wdeprecated-declarations\)
+#endif
 #else
 #define FF_DISABLE_DEPRECATION_WARNINGS
 #define FF_ENABLE_DEPRECATION_WARNINGS
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH v2] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Martin Storsjö

On Thu, 19 Sep 2013, Alex Smith wrote:


Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.
---
configure  |  5 +++--
libavutil/attributes.h |  2 ++
libavutil/internal.h   | 12 ++--
3 files changed, 15 insertions(+), 4 deletions(-)


This looks ok to me, although I didn't test it myself (yet).

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] msvc/icl: Use __declspec(noinline)

2013-09-19 Thread Alex Smith
---
 libavutil/attributes.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 850a73f..9f476c9 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -42,6 +42,8 @@
 
 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define av_noinline __attribute__((noinline))
+#elif defined(_MSC_VER)
+#define av_noinline __declspec(noinline)
 #else
 #define av_noinline
 #endif
-- 
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v2] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.
---
 configure  |  5 +++--
 libavutil/attributes.h |  2 ++
 libavutil/internal.h   | 12 ++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 1e195d5..8a7c6ce 100755
--- a/configure
+++ b/configure
@@ -2405,7 +2405,7 @@ msvc_flags(){
 -Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 
\
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-   -wd4996 -wd4273 ;;
+   -wd4273 ;;
 esac
 done
 }
@@ -2629,7 +2629,7 @@ probe_cc(){
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
 _flags='-nologo'
-_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h 
-Dstrtoll=_strtoi64'
+_cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS 
-Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
 if [ $pfx = hostcc ]; then
 append _cflags -Dsnprintf=_snprintf
 fi
@@ -3997,6 +3997,7 @@ elif enabled_any msvc icl; then
 enabled x86_32  disable aligned_stack
 enabled_all x86_32 debug  add_cflags -Oy-
 enabled debug  add_ldflags -debug
+enable pragma_deprecated
 if enabled icl; then
 # basically -fstrict-aliasing that does not work (correctly) on icl 
13.x
 check_cpp_condition windows.h __ICL  1300  add_cflags 
-Qansi-alias
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 292a0a1..850a73f 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -72,6 +72,8 @@

 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define attribute_deprecated __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define attribute_deprecated __declspec(deprecated)
 #else
 #define attribute_deprecated
 #endif
diff --git a/libavutil/internal.h b/libavutil/internal.h
index b18860f..7b178c2 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -62,8 +62,16 @@
 #endif

 #if HAVE_PRAGMA_DEPRECATED
-#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic ignored 
\-Wdeprecated-declarations\)
-#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic warning 
\-Wdeprecated-declarations\)
+#if defined(__ICL)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:1478))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#elif defined(_MSC_VER)
+#define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) 
__pragma(warning(disable:4996))
+#define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
+#else
+#define FF_DISABLE_DEPRECATION_WARNINGS _Pragma(GCC diagnostic 
ignored \-Wdeprecated-declarations\)
+#define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma(GCC diagnostic 
warning \-Wdeprecated-declarations\)
+#endif
 #else
 #define FF_DISABLE_DEPRECATION_WARNINGS
 #define FF_ENABLE_DEPRECATION_WARNINGS
--
1.8.1.msysgit.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] swscale/swscale_unscaled: fix alpha values for rgb/bgr - RGB32_1 / BGR32_1

2013-09-19 Thread Justin Ruggles
From: Michael Niedermayer michae...@gmx.at

Signed-off-by: Michael Niedermayer michae...@gmx.at
---
 libswscale/swscale_unscaled.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 3e5f49e..185dbfa 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -650,8 +650,13 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t 
*src[], int srcStride[],
 srcPtr += ALT32_CORR;
 
 if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == 
AV_PIX_FMT_BGR32_1) 
-!isRGBA32(srcFormat))
+!isRGBA32(srcFormat)) {
+int i;
+av_assert0(ALT32_CORR == 1);
+for (i = 0; i  srcSliceH; i++)
+dstPtr[dstStride[0] * (srcSliceY + i)] = 255;
 dstPtr += ALT32_CORR;
+}
 
 if (dstStride[0] * srcBpp == srcStride[0] * dstBpp  srcStride[0]  0 

 !(srcStride[0] % srcBpp))
-- 
1.8.1.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc/icl: Use __declspec(deprecated)

2013-09-19 Thread Alex Smith
On Thu, Sep 19, 2013 at 4:40 PM, Alex Smith alex.sm...@warpsharp.info wrote:
 What?

 The pragma test fails on msvc.

 On Thu, Sep 19, 2013 at 4:39 PM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Sep 19, 2013 at 04:22:48PM -0400, Alex Smith wrote:
 This is a nop.

 Diego

j/k, I'm stupid.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] swscale/swscale_unscaled: fix alpha values for rgb/bgr - RGB32_1 / BGR32_1

2013-09-19 Thread Justin Ruggles

On 09/19/2013 06:05 PM, Luca Barbato wrote:

On 19/09/13 23:51, Justin Ruggles wrote:

From: Michael Niedermayer michae...@gmx.at

Signed-off-by: Michael Niedermayer michae...@gmx.at
---
  libswscale/swscale_unscaled.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)



Replace the assert with AVERROR_BUG.


sws_scale() doesn't return an error.

@return  the height of the output slice


-Justin


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] swscale/swscale_unscaled: fix alpha values for rgb/bgr - RGB32_1 / BGR32_1

2013-09-19 Thread Luca Barbato
On 19/09/13 23:51, Justin Ruggles wrote:
 From: Michael Niedermayer michae...@gmx.at
 
 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---
  libswscale/swscale_unscaled.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 

Replace the assert with AVERROR_BUG.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel