[libav-commits] eamad: use the bytestream2 API instead of AV_RL

2014-07-27 Thread Anton Khirnov
Module: libav
Branch: master
Commit: 541427ab4d5b4b6f5a90a687a06decdb78e7bc3c

Author:Anton Khirnov an...@khirnov.net
Committer: Anton Khirnov an...@khirnov.net
Date:  Sun Jul 20 12:06:47 2014 +

eamad: use the bytestream2 API instead of AV_RL

This is safer and possibly fixes invalid reads on truncated data.

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

---

 libavcodec/eamad.c |   37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 19a6783..ceccfe4 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -29,6 +29,7 @@
  */
 
 #include avcodec.h
+#include bytestream.h
 #include bswapdsp.h
 #include get_bits.h
 #include aandcttab.h
@@ -235,30 +236,32 @@ static int decode_frame(AVCodecContext *avctx,
 {
 const uint8_t *buf = avpkt-data;
 int buf_size   = avpkt-size;
-const uint8_t *buf_end = buf+buf_size;
 MadContext *s = avctx-priv_data;
 AVFrame *frame= data;
+GetByteContext gb;
 int width, height;
 int chunk_type;
 int inter, ret;
 
-if (buf_size  17) {
-av_log(avctx, AV_LOG_ERROR, Input buffer too small\n);
-*got_frame = 0;
-return -1;
-}
+bytestream2_init(gb, buf, buf_size);
 
-chunk_type = AV_RL32(buf[0]);
+chunk_type = bytestream2_get_le32(gb);
 inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG);
-buf += 8;
+bytestream2_skip(gb, 10);
 
 av_reduce(avctx-time_base.num, avctx-time_base.den,
-  AV_RL16(buf[6]), 1000, 130);
+  bytestream2_get_le16(gb), 1000, 130);
+
+width  = bytestream2_get_le16(gb);
+height = bytestream2_get_le16(gb);
+bytestream2_skip(gb, 1);
+calc_quant_matrix(s, bytestream2_get_byte(gb));
+bytestream2_skip(gb, 2);
 
-width  = AV_RL16(buf[8]);
-height = AV_RL16(buf[10]);
-calc_quant_matrix(s, buf[13]);
-buf += 16;
+if (bytestream2_get_bytes_left(gb)  2) {
+av_log(avctx, AV_LOG_ERROR, Input data too small\n);
+return AVERROR_INVALIDDATA;
+}
 
 if (avctx-width != width || avctx-height != height) {
 av_frame_unref(s-last_frame);
@@ -285,12 +288,12 @@ static int decode_frame(AVCodecContext *avctx,
 }
 
 av_fast_padded_malloc(s-bitstream_buf, s-bitstream_buf_size,
-  buf_end - buf);
+  bytestream2_get_bytes_left(gb));
 if (!s-bitstream_buf)
 return AVERROR(ENOMEM);
-s-bbdsp.bswap16_buf(s-bitstream_buf, (const uint16_t *) buf,
- (buf_end - buf) / 2);
-init_get_bits(s-gb, s-bitstream_buf, 8*(buf_end-buf));
+s-bbdsp.bswap16_buf(s-bitstream_buf, (const uint16_t *)(buf + 
bytestream2_tell(gb)),
+ bytestream2_get_bytes_left(gb) / 2);
+init_get_bits(s-gb, s-bitstream_buf, 
8*(bytestream2_get_bytes_left(gb)));
 
 for (s-mb_y=0; s-mb_y  (avctx-height+15)/16; s-mb_y++)
 for (s-mb_x=0; s-mb_x  (avctx-width +15)/16; s-mb_x++)

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


[libav-commits] fate: support testing of release branches

2014-07-27 Thread Janne Grunau
Module: libav
Branch: master
Commit: 42eb9154a83e9a7aedb1168b2f1112af765cf2b5

Author:Janne Grunau janne-li...@jannau.net
Committer: Janne Grunau janne-li...@jannau.net
Date:  Sat Jul 26 23:29:46 2014 +0200

fate: support testing of release branches

Adding 'branch=release/10' to the fate config file will check the
release/10 branch instead of master. If no branch is specified it will
use 'master' so that existing config are still valid.

The server side changes are already deployed, see
https://fate.libav.org/v10/ for an example. The server supports only the
release/* branches.

The server enforces that a single slot tests always the same branch.
Please append -v$RELEASE to the slot of release branch configs or make
the slot otherwise unique.

A different fate samples dir is needed for each release branch. make
fate-rsync has the correct URL in each branch.

---

 tests/fate.sh |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/fate.sh b/tests/fate.sh
index 6e0c0c6..af0f6c0 100755
--- a/tests/fate.sh
+++ b/tests/fate.sh
@@ -19,6 +19,8 @@ test -n $slot|| die slot not specified
 test -n $repo|| die repo not specified
 test -d $samples || die samples location not specified
 
+: ${branch:=master}
+
 lock(){
 lock=$1/fate.lock
 (set -C; exec $lock) 2/dev/null || return
@@ -28,14 +30,14 @@ lock(){
 checkout(){
 case $repo in
 file:*|/*) src=${repo#file:}  ;;
-git:*) git clone --quiet $repo $src ;;
+git:*) git clone --quiet --branch $branch $repo $src ;;
 esac
 }
 
 update()(
 cd ${src} || return
 case $repo in
-git:*) git fetch --force; git reset --hard origin/master ;;
+git:*) git fetch --force; git reset --hard origin/$branch ;;
 esac
 )
 
@@ -79,7 +81,7 @@ clean(){
 
 report(){
 date=$(date -u +%Y%m%d%H%M%S)
-echo fate:0:${date}:${slot}:${version}:$1:$2:${comment} report
+echo fate:1:${date}:${slot}:${version}:$1:$2:${branch}:${comment} report
 cat ${build}/config.fate ${build}/tests/data/fate/*.rep report
 test -n $fate_recv  $tar report *.log | gzip | $fate_recv
 }

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


[libav-commits] eamad: use the bytestream2 API instead of AV_RL

2014-07-27 Thread Anton Khirnov
Module: libav
Branch: release/10
Commit: f9204ec56a4cf73843d1e5b8563d3584c2c05b47

Author:Anton Khirnov an...@khirnov.net
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sun Jul 20 12:06:47 2014 +

eamad: use the bytestream2 API instead of AV_RL

This is safer and possibly fixes invalid reads on truncated data.
(cherry-picked from commit 541427ab4d5b4b6f5a90a687a06decdb78e7bc3c)

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

Conflicts:
libavcodec/eamad.c

---

 libavcodec/eamad.c |   37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 22070a4..99a4e77 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -29,6 +29,7 @@
  */
 
 #include avcodec.h
+#include bytestream.h
 #include get_bits.h
 #include aandcttab.h
 #include eaidct.h
@@ -229,30 +230,32 @@ static int decode_frame(AVCodecContext *avctx,
 {
 const uint8_t *buf = avpkt-data;
 int buf_size   = avpkt-size;
-const uint8_t *buf_end = buf+buf_size;
 MadContext *s = avctx-priv_data;
 AVFrame *frame= data;
+GetByteContext gb;
 int width, height;
 int chunk_type;
 int inter, ret;
 
-if (buf_size  17) {
-av_log(avctx, AV_LOG_ERROR, Input buffer too small\n);
-*got_frame = 0;
-return -1;
-}
+bytestream2_init(gb, buf, buf_size);
 
-chunk_type = AV_RL32(buf[0]);
+chunk_type = bytestream2_get_le32(gb);
 inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG);
-buf += 8;
+bytestream2_skip(gb, 10);
 
 av_reduce(avctx-time_base.num, avctx-time_base.den,
-  AV_RL16(buf[6]), 1000, 130);
+  bytestream2_get_le16(gb), 1000, 130);
+
+width  = bytestream2_get_le16(gb);
+height = bytestream2_get_le16(gb);
+bytestream2_skip(gb, 1);
+calc_quant_matrix(s, bytestream2_get_byte(gb));
+bytestream2_skip(gb, 2);
 
-width  = AV_RL16(buf[8]);
-height = AV_RL16(buf[10]);
-calc_quant_matrix(s, buf[13]);
-buf += 16;
+if (bytestream2_get_bytes_left(gb)  2) {
+av_log(avctx, AV_LOG_ERROR, Input data too small\n);
+return AVERROR_INVALIDDATA;
+}
 
 if (avctx-width != width || avctx-height != height) {
 av_frame_unref(s-last_frame);
@@ -279,12 +282,12 @@ static int decode_frame(AVCodecContext *avctx,
 }
 
 av_fast_padded_malloc(s-bitstream_buf, s-bitstream_buf_size,
-  buf_end - buf);
+  bytestream2_get_bytes_left(gb));
 if (!s-bitstream_buf)
 return AVERROR(ENOMEM);
-s-dsp.bswap16_buf(s-bitstream_buf, (const uint16_t*)buf, 
(buf_end-buf)/2);
-init_get_bits(s-gb, s-bitstream_buf, 8*(buf_end-buf));
-
+s-dsp.bswap16_buf(s-bitstream_buf, (const uint16_t *)(buf + 
bytestream2_tell(gb)),
+ bytestream2_get_bytes_left(gb) / 2);
+init_get_bits(s-gb, s-bitstream_buf, 
8*(bytestream2_get_bytes_left(gb)));
 for (s-mb_y=0; s-mb_y  (avctx-height+15)/16; s-mb_y++)
 for (s-mb_x=0; s-mb_x  (avctx-width +15)/16; s-mb_x++)
 decode_mb(s, frame, inter);

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


[libav-commits] librtmp: Don't free the temp url at the end of rtmp_open

2014-07-27 Thread Martin Storsjö
Module: libav
Branch: release/10
Commit: f6b3dce952d66f87883a50d90d6e98416ee397df

Author:Martin Storsjö mar...@martin.st
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri Jul  4 22:13:39 2014 +0300

librtmp: Don't free the temp url at the end of rtmp_open

librtmp can keep pointers to this string internally, and may
use them at shutdown as well.

CC: libav-sta...@libav.org
Signed-off-by: Martin Storsjö mar...@martin.st
(cherry picked from commit 865461099e062de5a3a109c2a5be98004c11d8bd)
Signed-off-by: Reinhard Tartler siret...@tauware.de

Conflicts:
libavformat/librtmp.c

---

 libavformat/librtmp.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index 7133bd6..5682c9c 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -38,6 +38,7 @@ typedef struct LibRTMPContext {
 RTMP rtmp;
 char *app;
 char *playpath;
+char *temp_filename;
 } LibRTMPContext;
 
 static void rtmp_log(int level, const char *fmt, va_list args)
@@ -62,6 +63,7 @@ static int rtmp_close(URLContext *s)
 RTMP *r = ctx-rtmp;
 
 RTMP_Close(r);
+av_freep(ctx-temp_filename);
 return 0;
 }
 
@@ -101,7 +103,7 @@ static int rtmp_open(URLContext *s, const char *uri, int 
flags)
 if (ctx-app)  len += strlen(ctx-app)  + sizeof( app=);
 if (ctx-playpath) len += strlen(ctx-playpath) + sizeof( playpath=);
 
-if (!(filename = av_malloc(len)))
+if (!(ctx-temp_filename = filename = av_malloc(len)))
 return AVERROR(ENOMEM);
 
 av_strlcpy(filename, s-filename, len);
@@ -130,10 +132,9 @@ static int rtmp_open(URLContext *s, const char *uri, int 
flags)
 }
 
 s-is_streamed = 1;
-rc = 0;
+return 0;
 fail:
-if (filename != s-filename)
-av_freep(filename);
+av_freep(ctx-temp_filename);
 return rc;
 }
 

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

[libav-commits] arm: Avoid using the 'setend' instruction on ARMv7 and newer

2014-07-27 Thread Martin Storsjö
Module: libav
Branch: release/10
Commit: b8e57113ecba5494d4bf47c29634392ea5fdb17b

Author:Martin Storsjö mar...@martin.st
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri Jul  4 18:21:50 2014 +0300

arm: Avoid using the 'setend' instruction on ARMv7 and newer

This instruction is deprecated on ARMv8, and it is serializing on
some ARMv7 cores as well [1].

[1] http://article.gmane.org/gmane.linux.ports.arm.kernel/339293

CC: libav-sta...@libav.org
Signed-off-by: Martin Storsjö mar...@martin.st
(cherry picked from commit 79fce1ec8abd017593c003917fc123f7119a78d6)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/arm/h264dsp_init_arm.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/arm/h264dsp_init_arm.c 
b/libavcodec/arm/h264dsp_init_arm.c
index 92658e7..f9712d8 100644
--- a/libavcodec/arm/h264dsp_init_arm.c
+++ b/libavcodec/arm/h264dsp_init_arm.c
@@ -104,8 +104,12 @@ av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const 
int bit_depth,
 {
 int cpu_flags = av_get_cpu_flags();
 
-if (have_armv6(cpu_flags))
+if (have_armv6(cpu_flags)  !(have_vfpv3(cpu_flags) || 
have_neon(cpu_flags))) {
+// This function uses the 'setend' instruction which is deprecated
+// on ARMv8. This instruction is serializing on some ARMv7 cores as
+// well. Therefore, only use the function on ARMv6.
 c-h264_find_start_code_candidate = 
ff_h264_find_start_code_candidate_armv6;
+}
 if (have_neon(cpu_flags))
 h264dsp_init_neon(c, bit_depth, chroma_format_idc);
 }

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

[libav-commits] Prepare for 10.3 Release

2014-07-27 Thread Reinhard Tartler
Module: libav
Branch: release/10
Commit: 12bbd819cbdfdd2b41286c5ccabee7f5e5b6612a

Author:Reinhard Tartler siret...@tauware.de
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sun Jul 27 10:14:04 2014 -0400

Prepare for 10.3 Release

---

 RELEASE |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/RELEASE b/RELEASE
index e2498ea..260e375 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-10.2
+10.3

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


[libav-commits] avplay: Handle pixel aspect ratio properly

2014-07-27 Thread Martin Storsjö
Module: libav
Branch: release/10
Commit: 407912d17870a53e8a8cc072f192cadf358bc155

Author:Martin Storsjö mar...@martin.st
Committer: Reinhard Tartler siret...@tauware.de
Date:  Sun Jul  6 23:18:27 2014 +0300

avplay: Handle pixel aspect ratio properly

This was broken (left half-implemented) in 354468fc12.

CC: libav-sta...@libav.org
Signed-off-by: Martin Storsjö mar...@martin.st
(cherry picked from commit cf280ed004b5c618560f8f43d14ff264bd1e4c3d)
Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 avplay.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/avplay.c b/avplay.c
index b70ee54..2db8928 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1323,6 +1323,8 @@ static int queue_picture(VideoState *is, AVFrame 
*src_frame, double pts, int64_t
 
 vp = is-pictq[is-pictq_windex];
 
+vp-sar = src_frame-sample_aspect_ratio;
+
 /* alloc or resize hardware picture buffer */
 if (!vp-bmp || vp-reallocate ||
 #if CONFIG_AVFILTER

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