[libav-commits] lagarith: make offset array type unsigned

2012-05-06 Thread Kostya Shishkov
Module: libav
Branch: master
Commit: 1fdb5649d934df19237d5f53c10ae1fff5934e2a

Author:Kostya Shishkov kostya.shish...@gmail.com
Committer: Kostya Shishkov kostya.shish...@gmail.com
Date:  Sat May  5 13:45:03 2012 +0200

lagarith: make offset array type unsigned

This is logical and also fixes checking for the fourth plane offset.

---

 libavcodec/lagarith.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index d6921ea..b27e755 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -457,7 +457,7 @@ static int lag_decode_frame(AVCodecContext *avctx,
 AVFrame *const p = l-picture;
 uint8_t frametype = 0;
 uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9;
-int offs[4];
+uint32_t offs[4];
 uint8_t *srcs[4], *dst;
 int i, j, planes = 3;
 

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


[libav-commits] dfa: add some checks to ensure that decoder won't write past frame end

2012-05-06 Thread Kostya Shishkov
Module: libav
Branch: master
Commit: 8099187e897ddc90cb3902332c76fb2542dac308

Author:Kostya Shishkov kostya.shish...@gmail.com
Committer: Kostya Shishkov kostya.shish...@gmail.com
Date:  Thu May  3 20:10:36 2012 +0200

dfa: add some checks to ensure that decoder won't write past frame end

---

 libavcodec/dfa.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 788e9ca..4fe6519 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -164,6 +164,8 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, 
int width, int height
 } else if (bitbuf  (mask  1)) {
 frame += bytestream2_get_le16(gb) * 2;
 } else {
+if (frame_end - frame  width + 2)
+return AVERROR_INVALIDDATA;
 frame[0] = frame[1] =
 frame[width] = frame[width + 1] =  bytestream2_get_byte(gb);
 frame += 2;
@@ -224,6 +226,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, 
int width, int height
 const uint8_t *frame_end   = frame + width * height;
 uint8_t *line_ptr;
 int count, i, v, lines, segments;
+int y = 0;
 
 lines = bytestream2_get_le16(gb);
 if (lines  height)
@@ -234,10 +237,12 @@ static int decode_wdlt(GetByteContext *gb, uint8_t 
*frame, int width, int height
 return -1;
 segments = bytestream2_get_le16u(gb);
 while ((segments  0xC000) == 0xC000) {
+unsigned skip_lines = -(int16_t)segments;
 unsigned delta = -((int16_t)segments * width);
-if (frame_end - frame = delta)
+if (frame_end - frame = delta || y + lines + skip_lines  height)
 return -1;
 frame+= delta;
+y+= skip_lines;
 segments = bytestream2_get_le16(gb);
 }
 if (segments  0x8000) {
@@ -246,6 +251,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, 
int width, int height
 }
 line_ptr = frame;
 frame += width;
+y++;
 while (segments--) {
 if (frame - line_ptr = bytestream2_peek_byte(gb))
 return -1;

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


[libav-commits] avserver: check return value of ftruncate()

2012-05-06 Thread Mans Rullgard
Module: libav
Branch: master
Commit: 0de1319ee0109facefe9804ffe0f0d0df36b27ad

Author:Mans Rullgard m...@mansr.com
Committer: Mans Rullgard m...@mansr.com
Date:  Sat Apr 21 17:01:35 2012 +0100

avserver: check return value of ftruncate()

Signed-off-by: Mans Rullgard m...@mansr.com

---

 avserver.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/avserver.c b/avserver.c
index 2b16932..5777a08 100644
--- a/avserver.c
+++ b/avserver.c
@@ -2572,8 +2572,11 @@ static int http_start_receive_data(HTTPContext *c)
 if (c-stream-truncate) {
 /* truncate feed file */
 ffm_write_write_index(c-feed_fd, FFM_PACKET_SIZE);
-ftruncate(c-feed_fd, FFM_PACKET_SIZE);
 http_log(Truncating feed file '%s'\n, c-stream-feed_filename);
+if (ftruncate(c-feed_fd, FFM_PACKET_SIZE)  0) {
+http_log(Error truncating feed file: %s\n, strerror(errno));
+return -1;
+}
 } else {
 if ((c-stream-feed_write_index = ffm_read_write_index(fd))  0) {
 http_log(Error reading write index from feed file: %s\n, 
strerror(errno));

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


[libav-commits] rtsp: avoid const warnings from strtol() call

2012-05-06 Thread Mans Rullgard
Module: libav
Branch: master
Commit: ddce7dabd2dcabac1655e76901192ae6aedecb69

Author:Mans Rullgard m...@mansr.com
Committer: Mans Rullgard m...@mansr.com
Date:  Wed Apr 25 23:37:29 2012 +0100

rtsp: avoid const warnings from strtol() call

The strtol() interface makes it difficult to use with
const-qualified pointers.  With this change, although
the const is still lost, the compiler does not warn
about it.

Signed-off-by: Mans Rullgard m...@mansr.com

---

 libavformat/rtsp.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 9ee7a75..2ad2c4d 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -637,16 +637,17 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, 
RTSPStream *rtsp_st)
 #if CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER
 static void rtsp_parse_range(int *min_ptr, int *max_ptr, const char **pp)
 {
-const char *p;
+const char *q;
+char *p;
 int v;
 
-p = *pp;
-p += strspn(p, SPACE_CHARS);
-v = strtol(p, (char **)p, 10);
+q = *pp;
+q += strspn(q, SPACE_CHARS);
+v = strtol(q, p, 10);
 if (*p == '-') {
 p++;
 *min_ptr = v;
-v = strtol(p, (char **)p, 10);
+v = strtol(p, p, 10);
 *max_ptr = v;
 } else {
 *min_ptr = v;

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


[libav-commits] mpegmux: add stuffing to avoid incomplete PCM frames

2012-05-06 Thread Janne Grunau
Module: libav
Branch: master
Commit: 29d27b54251fe250f6fe512b7759a1405362ae67

Author:Janne Grunau janne-li...@jannau.net
Committer: Janne Grunau janne-li...@jannau.net
Date:  Tue Mar 13 18:12:06 2012 +0100

mpegmux: add stuffing to avoid incomplete PCM frames

Fixes https://bugzilla.libav.org/show_bug.cgi?id=244

---

 libavformat/mpegenc.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index bda8d83..7bcf289 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -832,6 +832,12 @@ static int flush_packet(AVFormatContext *ctx, int 
stream_index,
 
 if (stuffing_size  0)
 stuffing_size = 0;
+
+if (startcode == PRIVATE_STREAM_1  id = 0xa0) {
+if (payload_size  av_fifo_size(stream-fifo))
+stuffing_size += payload_size % stream-lpcm_align;
+}
+
 if (stuffing_size  16) {/*=16 for MPEG-1, =32 for MPEG-2*/
 pad_packet_bytes += stuffing_size;
 packet_size  -= stuffing_size;

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


[libav-commits] lavfi: always enable the scale filter and depend on sws.

2012-05-06 Thread Anton Khirnov
Module: libav
Branch: master
Commit: 25b3babe111a37697d98890400f5864f560ae167

Author:Anton Khirnov an...@khirnov.net
Committer: Anton Khirnov an...@khirnov.net
Date:  Sat May  5 10:22:55 2012 +0200

lavfi: always enable the scale filter and depend on sws.

The scale filter is used for internal colorspace conversions, so it must
always be present.

---

 configure|2 +-
 libavfilter/Makefile |5 ++---
 libavfilter/allfilters.c |8 ++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index b571a94..837e296 100755
--- a/configure
+++ b/configure
@@ -1530,11 +1530,11 @@ frei0r_src_filter_deps=frei0r dlopen strtok_r
 frei0r_src_filter_extralibs='$ldl'
 hqdn3d_filter_deps=gpl
 ocv_filter_deps=libopencv
-scale_filter_deps=swscale
 yadif_filter_deps=gpl
 
 # libraries
 avdevice_deps=avcodec avformat
+avfilter_deps=swscale
 avformat_deps=avcodec
 
 # programs
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6ee94e9..46fa93d 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -1,7 +1,6 @@
 NAME = avfilter
-FFLIBS = avutil
+FFLIBS = avutil swscale
 FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
-FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
 
 HEADERS = avfilter.h avfiltergraph.h buffersrc.h version.h vsrc_buffer.h
 
@@ -12,6 +11,7 @@ OBJS = allfilters.o   
  \
drawutils.o  \
formats.o\
graphparser.o\
+   vf_scale.o   \
vsrc_buffer.o
 
 OBJS-$(CONFIG_ANULL_FILTER)  += af_anull.o
@@ -46,7 +46,6 @@ OBJS-$(CONFIG_OCV_FILTER)+= vf_libopencv.o
 OBJS-$(CONFIG_OVERLAY_FILTER)+= vf_overlay.o
 OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
 OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
-OBJS-$(CONFIG_SCALE_FILTER)  += vf_scale.o
 OBJS-$(CONFIG_SELECT_FILTER) += vf_select.o
 OBJS-$(CONFIG_SETDAR_FILTER) += vf_aspect.o
 OBJS-$(CONFIG_SETPTS_FILTER) += vf_setpts.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index ba66941..198e152 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -66,7 +66,6 @@ void avfilter_register_all(void)
 REGISTER_FILTER (OVERLAY, overlay, vf);
 REGISTER_FILTER (PAD, pad, vf);
 REGISTER_FILTER (PIXDESCTEST, pixdesctest, vf);
-REGISTER_FILTER (SCALE,   scale,   vf);
 REGISTER_FILTER (SELECT,  select,  vf);
 REGISTER_FILTER (SETDAR,  setdar,  vf);
 REGISTER_FILTER (SETPTS,  setpts,  vf);
@@ -89,9 +88,14 @@ void avfilter_register_all(void)
 
 REGISTER_FILTER (NULLSINK,nullsink,vsink);
 
-/* vsrc_buffer is a part of public API = registered unconditionally */
+/* those filters are part of public or internal API = registered
+ * unconditionally */
 {
 extern AVFilter avfilter_vsrc_buffer;
 avfilter_register(avfilter_vsrc_buffer);
 }
+{
+extern AVFilter avfilter_vf_scale;
+avfilter_register(avfilter_vf_scale);
+}
 }

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


[libav-commits] avconv: remove stray useless comment.

2012-05-06 Thread Anton Khirnov
Module: libav
Branch: master
Commit: dce415e7f1aa5a8ac8bf6371b861162444f239c8

Author:Anton Khirnov an...@khirnov.net
Committer: Anton Khirnov an...@khirnov.net
Date:  Sat May  5 14:17:19 2012 +0200

avconv: remove stray useless comment.

---

 avconv.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/avconv.c b/avconv.c
index f702d9d..73f3bc3 100644
--- a/avconv.c
+++ b/avconv.c
@@ -598,7 +598,6 @@ static int configure_video_filters(FilterGraph *fg)
 InputStream  *ist = fg-inputs[0]-ist;
 OutputStream *ost = fg-outputs[0]-ost;
 AVFilterContext *last_filter, *filter;
-/** filter graph containing all filters including input  output */
 AVCodecContext *codec = ost-st-codec;
 SinkContext sink_ctx = { .pix_fmts = choose_pixel_fmts(ost) };
 AVRational sample_aspect_ratio;

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


[libav-commits] vf_split: support user-specifiable number of outputs.

2012-05-06 Thread Anton Khirnov
Module: libav
Branch: master
Commit: fd18ee0ff659fc73e56bd43f5b93ed82934c6c7f

Author:Anton Khirnov an...@khirnov.net
Committer: Anton Khirnov an...@khirnov.net
Date:  Fri Apr 27 07:41:32 2012 +0200

vf_split: support user-specifiable number of outputs.

---

 doc/filters.texi   |   13 +
 libavfilter/vf_split.c |   68 ++-
 2 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b012dc7..c5a56f4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1666,6 +1666,19 @@ not specified it will use the default value of 16.
 Adding this in the beginning of filter chains should make filtering
 faster due to better use of the memory cache.
 
+@section split
+
+Split input video into several identical outputs.
+
+The filter accepts a single parameter which specifies the number of outputs. If
+unspecified, it defaults to 2.
+
+For example
+@example
+avconv -i INPUT -filter_complex split=5 OUTPUT
+@end example
+will create 5 copies of the input video.
+
 @section transpose
 
 Transpose rows with columns in the input video and optionally flip it.
diff --git a/libavfilter/vf_split.c b/libavfilter/vf_split.c
index 54fdd21..da6b3ff 100644
--- a/libavfilter/vf_split.c
+++ b/libavfilter/vf_split.c
@@ -25,24 +25,67 @@
 
 #include avfilter.h
 
+static int split_init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+int i, nb_outputs = 2;
+
+if (args) {
+nb_outputs = strtol(args, NULL, 0);
+if (nb_outputs = 0) {
+av_log(ctx, AV_LOG_ERROR, Invalid number of outputs specified: 
%d.\n,
+   nb_outputs);
+return AVERROR(EINVAL);
+}
+}
+
+for (i = 0; i  nb_outputs; i++) {
+char name[32];
+AVFilterPad pad = { 0 };
+
+snprintf(name, sizeof(name), output%d, i);
+pad.type = AVMEDIA_TYPE_VIDEO;
+pad.name = av_strdup(name);
+
+avfilter_insert_outpad(ctx, i, pad);
+}
+
+return 0;
+}
+
+static void split_uninit(AVFilterContext *ctx)
+{
+int i;
+
+for (i = 0; i  ctx-output_count; i++)
+av_freep(ctx-output_pads[i].name);
+}
+
 static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
 {
-avfilter_start_frame(inlink-dst-outputs[0],
- avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
-avfilter_start_frame(inlink-dst-outputs[1],
- avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
+AVFilterContext *ctx = inlink-dst;
+int i;
+
+for (i = 0; i  ctx-output_count; i++)
+avfilter_start_frame(ctx-outputs[i],
+ avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
 }
 
 static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
 {
-avfilter_draw_slice(inlink-dst-outputs[0], y, h, slice_dir);
-avfilter_draw_slice(inlink-dst-outputs[1], y, h, slice_dir);
+AVFilterContext *ctx = inlink-dst;
+int i;
+
+for (i = 0; i  ctx-output_count; i++)
+avfilter_draw_slice(ctx-outputs[i], y, h, slice_dir);
 }
 
 static void end_frame(AVFilterLink *inlink)
 {
-avfilter_end_frame(inlink-dst-outputs[0]);
-avfilter_end_frame(inlink-dst-outputs[1]);
+AVFilterContext *ctx = inlink-dst;
+int i;
+
+for (i = 0; i  ctx-output_count; i++)
+avfilter_end_frame(ctx-outputs[i]);
 
 avfilter_unref_buffer(inlink-cur_buf);
 }
@@ -51,6 +94,9 @@ AVFilter avfilter_vf_split = {
 .name  = split,
 .description = NULL_IF_CONFIG_SMALL(Pass on the input to two outputs.),
 
+.init   = split_init,
+.uninit = split_uninit,
+
 .inputs= (AVFilterPad[]) {{ .name= default,
 .type= AVMEDIA_TYPE_VIDEO,
 .get_video_buffer= 
avfilter_null_get_video_buffer,
@@ -58,9 +104,5 @@ AVFilter avfilter_vf_split = {
 .draw_slice  = draw_slice,
 .end_frame   = end_frame, },
   { .name = NULL}},
-.outputs   = (AVFilterPad[]) {{ .name= output1,
-.type= AVMEDIA_TYPE_VIDEO, },
-  { .name= output2,
-.type= AVMEDIA_TYPE_VIDEO, },
-  { .name = NULL}},
+.outputs   = (AVFilterPad[]) {{ .name = NULL}},
 };

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


[libav-commits] lavfi/formats: use sizeof(var) instead of sizeof(type).

2012-05-06 Thread Anton Khirnov
Module: libav
Branch: master
Commit: d4ac703c7f5f024732be67ace1c8c62fba87360b

Author:Anton Khirnov an...@khirnov.net
Committer: Anton Khirnov an...@khirnov.net
Date:  Fri May  4 09:49:28 2012 +0200

lavfi/formats: use sizeof(var) instead of sizeof(type).

---

 libavfilter/formats.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 78b0277..9d048d7 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -45,7 +45,7 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, 
AVFilterFormats *b)
 AVFilterFormats *ret;
 unsigned i, j, k = 0, m_count;
 
-ret = av_mallocz(sizeof(AVFilterFormats));
+ret = av_mallocz(sizeof(*ret));
 
 /* merge list of formats */
 m_count = FFMIN(a-format_count, b-format_count);
@@ -65,7 +65,7 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, 
AVFilterFormats *b)
 return NULL;
 }
 
-ret-refs = av_malloc(sizeof(AVFilterFormats**)*(a-refcount+b-refcount));
+ret-refs = av_malloc(sizeof(*ret-refs) * (a-refcount + b-refcount));
 
 merge_ref(ret, a);
 merge_ref(ret, b);
@@ -92,7 +92,7 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts)
 for (count = 0; fmts[count] != -1; count++)
 ;
 
-formats   = av_mallocz(sizeof(AVFilterFormats));
+formats   = av_mallocz(sizeof(*formats));
 if (count)
 formats-formats  = av_malloc(sizeof(*formats-formats) * count);
 formats-format_count = count;
@@ -105,7 +105,7 @@ int avfilter_add_format(AVFilterFormats **avff, int fmt)
 {
 int *fmts;
 
-if (!(*avff)  !(*avff = av_mallocz(sizeof(AVFilterFormats
+if (!(*avff)  !(*avff = av_mallocz(sizeof(**avff
 return AVERROR(ENOMEM);
 
 fmts = av_realloc((*avff)-formats,
@@ -136,7 +136,7 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
 void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
 {
 *ref = f;
-f-refs = av_realloc(f-refs, sizeof(AVFilterFormats**) * ++f-refcount);
+f-refs = av_realloc(f-refs, sizeof(*f-refs) * ++f-refcount);
 f-refs[f-refcount-1] = ref;
 }
 
@@ -159,8 +159,8 @@ void avfilter_formats_unref(AVFilterFormats **ref)
 idx = find_ref_index(ref);
 
 if(idx = 0)
-memmove((*ref)-refs + idx, (*ref)-refs + idx+1,
-sizeof(AVFilterFormats**) * ((*ref)-refcount-idx-1));
+memmove((*ref)-refs + idx, (*ref)-refs + idx + 1,
+sizeof(*(*ref)-refs) * ((*ref)-refcount - idx - 1));
 
 if(!--(*ref)-refcount) {
 av_free((*ref)-formats);

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


[libav-commits] tests/utils: don't ignore the return value of fwrite()

2012-05-06 Thread Sean McGovern
Module: libav
Branch: master
Commit: be6009d32c1398b331a85a27984c287ba178b7a7

Author:Sean McGovern gsean...@gmail.com
Committer: Diego Biurrun di...@biurrun.de
Date:  Thu Apr 26 14:56:24 2012 -0400

tests/utils: don't ignore the return value of fwrite()

Signed-off-by: Diego Biurrun di...@biurrun.de

---

 tests/utils.c |   15 ---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/utils.c b/tests/utils.c
index 2a85bd8..5310a11 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -16,13 +16,22 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include errno.h
 #include stdio.h
 #include stdlib.h
+#include string.h
 
 #define SCALEBITS 8
 #define ONE_HALF  (1  (SCALEBITS - 1))
 #define FIX(x)((int) ((x) * (1L  SCALEBITS) + 0.5))
 
+#define err_if(expr) do {  \
+if (expr) {\
+fprintf(stderr, %s\n, strerror(errno));  \
+exit(1);   \
+}  \
+} while (0)
+
 static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb,
  unsigned char *cr, unsigned char *src,
  int width, int height)
@@ -108,14 +117,14 @@ static void pgmyuv_save(const char *filename, int w, int 
h,
 
 f = fopen(filename, wb);
 fprintf(f, P5\n%d %d\n%d\n, w, h * 3 / 2, 255);
-fwrite(lum_tab, 1, w * h, f);
+err_if(fwrite(lum_tab, 1, w * h, f) != w * h);
 h2 = h / 2;
 w2 = w / 2;
 cb = cb_tab;
 cr = cr_tab;
 for (i = 0; i  h2; i++) {
-fwrite(cb, 1, w2, f);
-fwrite(cr, 1, w2, f);
+err_if(fwrite(cb, 1, w2, f) != w2);
+err_if(fwrite(cr, 1, w2, f) != w2);
 cb += w2;
 cr += w2;
 }

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


[libav-commits] dvdec: drop const qualifier from variable to eliminate a warning

2012-05-06 Thread Diego Biurrun
Module: libav
Branch: master
Commit: b2e92e946c0b94e3e55a2ef45453940cf14ab619

Author:Diego Biurrun di...@biurrun.de
Committer: Diego Biurrun di...@biurrun.de
Date:  Mon Apr 16 11:38:02 2012 +0200

dvdec: drop const qualifier from variable to eliminate a warning

libavcodec/dvdec.c:344:12: warning: assignment discards ‘const’ qualifier from 
pointer target type

---

 libavcodec/dvdec.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index ffa9c6d..8a21267 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -313,7 +313,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
  void *data, int *data_size,
  AVPacket *avpkt)
 {
-const uint8_t *buf = avpkt-data;
+uint8_t *buf = avpkt-data;
 int buf_size = avpkt-size;
 DVVideoContext *s = avctx-priv_data;
 const uint8_t* vsc_pack;

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

[libav-commits] avcodec: Improve comment for thread_safe_callbacks to avoid misinterpretation.

2012-05-06 Thread Robert Nagy
Module: libav
Branch: master
Commit: ad0278661b2625e56e09d1ee96f404fc575a9edf

Author:Robert Nagy rona...@gmail.com
Committer: Diego Biurrun di...@biurrun.de
Date:  Sat Apr 14 20:31:45 2012 +0200

avcodec: Improve comment for thread_safe_callbacks to avoid misinterpretation.

Signed-off-by: Diego Biurrun di...@biurrun.de

---

 libavcodec/avcodec.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8ae8992..8020582 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2626,7 +2626,7 @@ typedef struct AVCodecContext {
 
 /**
  * Set by the client if its custom get_buffer() callback can be called
- * from another thread, which allows faster multithreaded decoding.
+ * synchronously from another thread, which allows faster multithreaded 
decoding.
  * draw_horiz_band() will be called from other threads regardless of this 
setting.
  * Ignored if the default get_buffer() is used.
  * - encoding: Set by user.

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


[libav-commits] Mark a number of variables only used in av_dlog() calls as av_unused.

2012-05-06 Thread Diego Biurrun
Module: libav
Branch: master
Commit: 30b1961c662ffba8eb430682af24f823e80cd345

Author:Diego Biurrun di...@biurrun.de
Committer: Diego Biurrun di...@biurrun.de
Date:  Thu Apr 19 14:48:16 2012 +0200

Mark a number of variables only used in av_dlog() calls as av_unused.

This fixes a number of unused-but-set gcc warnings.

---

 libavcodec/wmalosslessdec.c |3 ++-
 libavformat/mov.c   |6 --
 libavformat/nsvdec.c|5 +++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index d4c9c5a..cb7f667 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include libavutil/attributes.h
 #include avcodec.h
 #include internal.h
 #include get_bits.h
@@ -1041,7 +1042,7 @@ static int decode_frame(WmallDecodeCtx *s)
 /* no idea what these are for, might be the number of samples
that need to be skipped at the beginning or end of a stream */
 if (get_bits1(gb)) {
-int skip;
+int av_unused skip;
 
 /* usually true for the first frame */
 if (get_bits1(gb)) {
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 04deef6..35c9b6e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -25,6 +25,7 @@
 //#define DEBUG
 //#define MOV_EXPORT_ALL_METADATA
 
+#include libavutil/attributes.h
 #include libavutil/audioconvert.h
 #include libavutil/intreadwrite.h
 #include libavutil/intfloat.h
@@ -596,8 +597,9 @@ static int mov_read_dec3(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 AVStream *st;
-uint8_t version;
-uint32_t flags, layout_tag, bitmap, num_descr, label_mask;
+uint8_t av_unused version;
+uint32_t av_unused flags;
+uint32_t layout_tag, bitmap, num_descr, label_mask;
 int i;
 
 if (c-fc-nb_streams  1)
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 1a160c5..24e823e 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include libavutil/attributes.h
 #include libavutil/mathematics.h
 #include avformat.h
 #include internal.h
@@ -273,7 +274,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
 {
 NSVContext *nsv = s-priv_data;
 AVIOContext *pb = s-pb;
-unsigned int file_size;
+unsigned int av_unused file_size;
 unsigned int size;
 int64_t duration;
 int strings_size;
@@ -595,7 +596,7 @@ null_chunk_retry:
 av_dlog(s, NSV CHUNK %d aux, %u bytes video, %d bytes audio\n, auxcount, 
vsize, asize);
 /* skip aux stuff */
 for (i = 0; i  auxcount; i++) {
-uint32_t auxtag;
+uint32_t av_unused auxtag;
 auxsize = avio_rl16(pb);
 auxtag = avio_rl32(pb);
 av_dlog(s, NSV aux data: '%c%c%c%c', %d bytes\n,

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


[libav-commits] eatgv: check motion vectors

2012-05-06 Thread Kostya Shishkov
Module: libav
Branch: master
Commit: a390aa0ea4d537fca1cb3c188206fac927482065

Author:Kostya Shishkov kostya.shish...@gmail.com
Committer: Kostya Shishkov kostya.shish...@gmail.com
Date:  Sat May  5 14:27:35 2012 +0200

eatgv: check motion vectors

---

 libavcodec/eatgv.c |   14 --
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index 34b79af..9484ff1 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -136,7 +136,6 @@ static int unpack(const uint8_t *src, const uint8_t 
*src_end, unsigned char *dst
  * @return 0 on success, -1 on critical buffer underflow
  */
 static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t 
*buf_end){
-unsigned char *frame0_end = s-last_frame.data[0] + 
s-avctx-width*s-last_frame.linesize[0];
 int num_mvs;
 int num_blocks_raw;
 int num_blocks_packed;
@@ -205,12 +204,15 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t 
*buf, const uint8_t *b
 int src_stride;
 
 if (vector  num_mvs) {
-src = s-last_frame.data[0] +
-  (y*4 + s-mv_codebook[vector][1])*s-last_frame.linesize[0] +
-   x*4 + s-mv_codebook[vector][0];
-src_stride = s-last_frame.linesize[0];
-if (src+3*src_stride+3=frame0_end)
+int mx = x * 4 + s-mv_codebook[vector][0];
+int my = y * 4 + s-mv_codebook[vector][1];
+
+if (   mx  0 || mx + 4  s-avctx-width
+|| my  0 || my + 4  s-avctx-height)
 continue;
+
+src = s-last_frame.data[0] + mx + my * s-last_frame.linesize[0];
+src_stride = s-last_frame.linesize[0];
 }else{
 int offset = vector - num_mvs;
 if (offsetnum_blocks_raw)

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


[libav-commits] eatgv: check vector_bits

2012-05-06 Thread Michael Niedermayer
Module: libav
Branch: master
Commit: 71a3c59ed73f2cad401d192278d1fcab9a129606

Author:Michael Niedermayer michae...@gmx.at
Committer: Kostya Shishkov kostya.shish...@gmail.com
Date:  Sun Apr 15 13:29:50 2012 +0200

eatgv: check vector_bits

Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer michae...@gmx.at
Signed-off-by: Kostya Shishkov kostya.shish...@gmail.com

---

 libavcodec/eatgv.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index 9484ff1..60058b2 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -154,6 +154,12 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t 
*buf, const uint8_t *b
 vector_bits   = AV_RL16(buf[6]);
 buf += 12;
 
+if (vector_bits  MIN_CACHE_BITS || !vector_bits) {
+av_log(s-avctx, AV_LOG_ERROR,
+   Invalid value for motion vector bits: %d\n, vector_bits);
+return AVERROR_INVALIDDATA;
+}
+
 /* allocate codebook buffers as necessary */
 if (num_mvs  s-num_mvs) {
 s-mv_codebook = av_realloc(s-mv_codebook, num_mvs*2*sizeof(int));

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


[libav-commits] dfa: use more meaningful return codes

2012-05-06 Thread Kostya Shishkov
Module: libav
Branch: master
Commit: fb5c1aaea60a714dab3d4e6e71228855fd816222

Author:Kostya Shishkov kostya.shish...@gmail.com
Committer: Kostya Shishkov kostya.shish...@gmail.com
Date:  Sun May  6 09:46:19 2012 +0200

dfa: use more meaningful return codes

---

 libavcodec/dfa.c |   54 +++---
 1 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 4fe6519..7b6c5d5 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -49,7 +49,7 @@ static int decode_copy(GetByteContext *gb, uint8_t *frame, 
int width, int height
 const int size = width * height;
 
 if (bytestream2_get_buffer(gb, frame, size) != size)
-return -1;
+return AVERROR_INVALIDDATA;
 return 0;
 }
 
@@ -64,23 +64,23 @@ static int decode_tsw1(GetByteContext *gb, uint8_t *frame, 
int width, int height
 segments = bytestream2_get_le32(gb);
 offset   = bytestream2_get_le32(gb);
 if (frame_end - frame = offset)
-return -1;
+return AVERROR_INVALIDDATA;
 frame += offset;
 while (segments--) {
 if (bytestream2_get_bytes_left(gb)  2)
-return -1;
+return AVERROR_INVALIDDATA;
 if (mask == 0x1) {
 bitbuf = bytestream2_get_le16u(gb);
 mask = 1;
 }
 if (frame_end - frame  2)
-return -1;
+return AVERROR_INVALIDDATA;
 if (bitbuf  mask) {
 v = bytestream2_get_le16(gb);
 offset = (v  0x1FFF)  1;
 count = ((v  13) + 2)  1;
 if (frame - frame_start  offset || frame_end - frame  count)
-return -1;
+return AVERROR_INVALIDDATA;
 av_memcpy_backptr(frame, offset, count);
 frame += count;
 } else {
@@ -103,19 +103,19 @@ static int decode_dsw1(GetByteContext *gb, uint8_t 
*frame, int width, int height
 segments = bytestream2_get_le16(gb);
 while (segments--) {
 if (bytestream2_get_bytes_left(gb)  2)
-return -1;
+return AVERROR_INVALIDDATA;
 if (mask == 0x1) {
 bitbuf = bytestream2_get_le16u(gb);
 mask = 1;
 }
 if (frame_end - frame  2)
-return -1;
+return AVERROR_INVALIDDATA;
 if (bitbuf  mask) {
 v = bytestream2_get_le16(gb);
 offset = (v  0x1FFF)  1;
 count = ((v  13) + 2)  1;
 if (frame - frame_start  offset || frame_end - frame  count)
-return -1;
+return AVERROR_INVALIDDATA;
 // can't use av_memcpy_backptr() since it can overwrite following 
pixels
 for (v = 0; v  count; v++)
 frame[v] = frame[v - offset];
@@ -142,19 +142,19 @@ static int decode_dds1(GetByteContext *gb, uint8_t 
*frame, int width, int height
 segments = bytestream2_get_le16(gb);
 while (segments--) {
 if (bytestream2_get_bytes_left(gb)  2)
-return -1;
+return AVERROR_INVALIDDATA;
 if (mask == 0x1) {
 bitbuf = bytestream2_get_le16u(gb);
 mask = 1;
 }
 if (frame_end - frame  2)
-return -1;
+return AVERROR_INVALIDDATA;
 if (bitbuf  mask) {
 v = bytestream2_get_le16(gb);
 offset = (v  0x1FFF)  2;
 count = ((v  13) + 2)  1;
 if (frame - frame_start  offset || frame_end - frame  count*2 + 
width)
-return -1;
+return AVERROR_INVALIDDATA;
 for (i = 0; i  count; i++) {
 frame[0] = frame[1] =
 frame[width] = frame[width + 1] = frame[-offset];
@@ -186,32 +186,32 @@ static int decode_bdlt(GetByteContext *gb, uint8_t 
*frame, int width, int height
 
 count = bytestream2_get_le16(gb);
 if (count = height)
-return -1;
+return AVERROR_INVALIDDATA;
 frame += width * count;
 lines = bytestream2_get_le16(gb);
 if (count + lines  height)
-return -1;
+return AVERROR_INVALIDDATA;
 
 while (lines--) {
 if (bytestream2_get_bytes_left(gb)  1)
-return -1;
+return AVERROR_INVALIDDATA;
 line_ptr = frame;
 frame += width;
 segments = bytestream2_get_byteu(gb);
 while (segments--) {
 if (frame - line_ptr = bytestream2_peek_byte(gb))
-return -1;
+return AVERROR_INVALIDDATA;
 line_ptr += bytestream2_get_byte(gb);
 count = (int8_t)bytestream2_get_byte(gb);
 if (count = 0) {
 if (frame - line_ptr  count)
-return -1;
+return AVERROR_INVALIDDATA;
 if (bytestream2_get_buffer(gb, line_ptr, count) != count)
-return -1;
+return AVERROR_INVALIDDATA;
  

[libav-commits] celp filters: Do not read earlier than the start of the 'out' vector.

2012-05-06 Thread Alex Converse
Module: libav
Branch: release/0.7
Commit: 08c81f7365af96c1655767e68d6ec85bea50600c

Author:Alex Converse alex.conve...@gmail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Fri May  4 10:27:03 2012 -0700

celp filters: Do not read earlier than the start of the 'out' vector.

CC: libav-sta...@libav.org
(cherry picked from commit 37ddd3833219fa7b913fff3f56878b047e6b)

Signed-off-by: Reinhard Tartler siret...@tauware.de
(cherry picked from commit 9ea94c44b1b414ab3bc6e9220ebb77621423ca38)

Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/celp_filters.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/libavcodec/celp_filters.c b/libavcodec/celp_filters.c
index 25a6744..849cda4 100644
--- a/libavcodec/celp_filters.c
+++ b/libavcodec/celp_filters.c
@@ -133,9 +133,8 @@ void ff_celp_lp_synthesis_filterf(float *out, const float 
*filter_coeffs,
 out2 -= val * old_out2;
 out3 -= val * old_out3;
 
-old_out3 = out[-5];
-
 for (i = 5; i = filter_length; i += 2) {
+old_out3 = out[-i];
 val = filter_coeffs[i-1];
 
 out0 -= val * old_out3;
@@ -154,7 +153,6 @@ void ff_celp_lp_synthesis_filterf(float *out, const float 
*filter_coeffs,
 
 FFSWAP(float, old_out0, old_out2);
 old_out1 = old_out3;
-old_out3 = out[-i-2];
 }
 
 tmp0 = out0;

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


[libav-commits] motionpixels: Clip YUV values after applying a gradient.

2012-05-06 Thread Alex Converse
Module: libav
Branch: release/0.7
Commit: 50073e2395522b6e2b8698ff0dd06ffaf8cbf8ce

Author:Alex Converse alex.conve...@gmail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Wed May  2 12:08:03 2012 -0700

motionpixels: Clip YUV values after applying a gradient.

Prevents illegal reads on truncated and malformed input.

CC: libav-sta...@libav.org
(cherry picked from commit b5da848facd41169283d7bfe568b83bdfa7fc42e)

Signed-off-by: Reinhard Tartler siret...@tauware.de
(cherry picked from commit aaa6a666774eb02c351c84e80622a5c69e9b642e)

Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/motionpixels.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 23433a1..fd37622 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -190,10 +190,13 @@ static void mp_decode_line(MotionPixelsContext *mp, 
GetBitContext *gb, int y)
 p = mp_get_yuv_from_rgb(mp, x - 1, y);
 } else {
 p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
+p.y = av_clip(p.y, 0, 31);
 if ((x  3) == 0) {
 if ((y  3) == 0) {
 p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
+p.v = av_clip(p.v, -32, 31);
 p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
+p.u = av_clip(p.u, -32, 31);
 mp-hpt[((y / 4) * mp-avctx-width + x) / 4] = p;
 } else {
 p.v = mp-hpt[((y / 4) * mp-avctx-width + x) / 4].v;
@@ -217,9 +220,12 @@ static void mp_decode_frame_helper(MotionPixelsContext 
*mp, GetBitContext *gb)
 p = mp_get_yuv_from_rgb(mp, 0, y);
 } else {
 p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
+p.y = av_clip(p.y, 0, 31);
 if ((y  3) == 0) {
 p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
+p.v = av_clip(p.v, -32, 31);
 p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
+p.u = av_clip(p.u, -32, 31);
 }
 mp-vpt[y] = p;
 mp_set_rgb_from_yuv(mp, 0, y, p);

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


[libav-commits] h263: more strictly forbid frame size changes with frame-mt.

2012-05-06 Thread Ronald S. Bultje
Module: libav
Branch: release/0.7
Commit: 3fc967f6c7ab2a21e9e4cca93487286b431cd64a

Author:Ronald S. Bultje rsbul...@gmail.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Thu Mar 29 12:24:10 2012 -0700

h263: more strictly forbid frame size changes with frame-mt.

Prevents crashes because the old check was incomplete.

Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
(cherry picked from commit 2d22d4307dcc1461f39a2ffb9c8db6c6b23fd080)

Signed-off-by: Reinhard Tartler siret...@tauware.de
(cherry picked from commit 7fe4c8cb761b0fc8685dacf9f187311b9d124a52)

Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/h263dec.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index abdaf2b..021e172 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -426,6 +426,13 @@ retry:
 if (ret  0){
 av_log(s-avctx, AV_LOG_ERROR, header damaged\n);
 return -1;
+} else if ((s-width  != avctx-coded_width  ||
+s-height != avctx-coded_height ||
+(s-width  + 15)  4 != s-mb_width ||
+(s-height + 15)  4 != s-mb_height) 
+   (HAVE_THREADS  (s-avctx-active_thread_type  
FF_THREAD_FRAME))) {
+av_log_missing_feature(s-avctx, Width/height/bit depth/chroma idc 
changing with threads is, 0);
+return AVERROR_PATCHWELCOME;   // width / height changed during 
parallelized decoding
 }
 
 avctx-has_b_frames= !s-low_delay;
@@ -567,11 +574,6 @@ retry:
 /* H.263 could change picture size any time */
 ParseContext pc= s-parse_context; //FIXME move these demuxng hack to 
avformat
 
-if (HAVE_THREADS  (s-avctx-active_thread_typeFF_THREAD_FRAME)) {
-av_log_missing_feature(s-avctx, Width/height/bit depth/chroma 
idc changing with threads is, 0);
-return -1;   // width / height changed during parallelized decoding
-}
-
 s-parse_context.buffer=0;
 MPV_common_end(s);
 s-parse_context= pc;

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


[libav-commits] vqavideo: return error if image size is not a multiple of block size

2012-05-06 Thread Mans Rullgard
Module: libav
Branch: release/0.7
Commit: c71c77e56fcc6d469d45e1c8ce04aa053124d3f8

Author:Mans Rullgard m...@mansr.com
Committer: Reinhard Tartler siret...@tauware.de
Date:  Mon Apr 23 13:16:33 2012 +0100

vqavideo: return error if image size is not a multiple of block size

The decoder assumes in various places that the image size
is a multiple of the block size, and there is no obvious
way to support odd sizes.  Bailing out early if the header
specifies a bad size avoids various errors later on.

Fixes CVE-2012-0947.

Signed-off-by: Mans Rullgard m...@mansr.com
(cherry picked from commit 58b2e0f0f2fc96c1158e04f8aba95cbe6157a1a3)

Signed-off-by: Reinhard Tartler siret...@tauware.de
(cherry picked from commit d5207e2af81580dd5e6277b354c8b459c3624f26)

Signed-off-by: Reinhard Tartler siret...@tauware.de

---

 libavcodec/vqavideo.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index caffddb..81b08d1 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -155,6 +155,12 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
 return -1;
 }
 
+if (s-width   (s-vector_width  - 1) ||
+s-height  (s-vector_height - 1)) {
+av_log(avctx, AV_LOG_ERROR, Image size not multiple of block size\n);
+return AVERROR_INVALIDDATA;
+}
+
 /* allocate codebooks */
 s-codebook_size = MAX_CODEBOOK_SIZE;
 s-codebook = av_malloc(s-codebook_size);

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


[libav-commits] doc: clarify check for NULL pointer style

2012-05-06 Thread Luca Barbato
Module: libav
Branch: master
Commit: e004bc16a130486b5b1ceebdb899d72ee538

Author:Luca Barbato lu_z...@gentoo.org
Committer: Luca Barbato lu_z...@gentoo.org
Date:  Fri May  4 10:03:42 2012 -0700

doc: clarify check for NULL pointer style

Our code should be terse and clear.

---

 doc/developer.texi |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index de64239..fed28cd 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -73,6 +73,10 @@ const char *avfilter_configuration(void)
 @}
 @end example
 @item
+Do not check for NULL values by comparison, @samp{if (p)} and
+@samp{if (!p)} are correct; @samp{if (p == NULL)} and @samp{if (p != NULL)}
+are not.
+@item
 In case of a single-statement if, no curly braces are required:
 @example
 if (!pic || !picref)

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


[libav-commits] lavc: add sample rate and channel layout to AVFrame.

2012-05-06 Thread Anton Khirnov
Module: libav
Branch: master
Commit: 828bd088f3f74dcdb8451d58557b0d8caefa3227

Author:Anton Khirnov an...@khirnov.net
Committer: Anton Khirnov an...@khirnov.net
Date:  Fri May  4 19:12:31 2012 +0200

lavc: add sample rate and channel layout to AVFrame.

Rationale is the same as for video width/height etc.

---

 doc/APIchanges   |3 +++
 libavcodec/avcodec.h |   16 
 libavcodec/utils.c   |4 
 libavcodec/version.h |2 +-
 4 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index fd834f1..66a0786 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2011-04-18
 
 API changes, most recent first:
 
+2012-xx-xx - xxx - lavc 54.13.0 - avcodec.h
+  Add sample_rate and channel_layout fields to AVFrame.
+
 2012-xx-xx - xxx - lavr 0.0.1
   Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8020582..bec13e7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1207,6 +1207,22 @@ typedef struct AVFrame {
  * - decoding: Set by libavcodec.
  */
 uint8_t motion_subsample_log2;
+
+/**
+ * Sample rate of the audio data.
+ *
+ * - encoding: unused
+ * - decoding: set by get_buffer()
+ */
+int sample_rate;
+
+/**
+ * Channel layout of the audio data.
+ *
+ * - encoding: unused
+ * - decoding: set by get_buffer()
+ */
+uint64_t channel_layout;
 } AVFrame;
 
 struct AVCodecInternal;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4492486..2e8a86c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -356,6 +356,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame 
*frame)
 elseframe-pkt_pts = AV_NOPTS_VALUE;
 frame-reordered_opaque = avctx-reordered_opaque;
 
+frame-sample_rate= avctx-sample_rate;
+frame-format = avctx-sample_fmt;
+frame-channel_layout = avctx-channel_layout;
+
 if (avctx-debug  FF_DEBUG_BUFFERS)
 av_log(avctx, AV_LOG_DEBUG, default_get_buffer called on frame %p, 
internal audio buffer used\n, frame);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5119874..be39f4f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -27,7 +27,7 @@
  */
 
 #define LIBAVCODEC_VERSION_MAJOR 54
-#define LIBAVCODEC_VERSION_MINOR 12
+#define LIBAVCODEC_VERSION_MINOR 13
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

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


[libav-commits] lavfi: avfilter_merge_formats: handle case where inputs are same

2012-05-06 Thread Mina Nagy Zaki
Module: libav
Branch: master
Commit: 11b6a82412bcd372adf694a26d83b07d337e1325

Author:Mina Nagy Zaki mnz...@gmail.com
Committer: Anton Khirnov an...@khirnov.net
Date:  Wed Jun  8 19:24:25 2011 +0300

lavfi: avfilter_merge_formats: handle case where inputs are same

This fixes a double-free crash if lists are the same due to the two
merge_ref() calls at the end of the (useless) merging that happens.

Signed-off-by: Anton Khirnov an...@khirnov.net

---

 libavfilter/formats.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 9d048d7..206eff5 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -45,6 +45,9 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, 
AVFilterFormats *b)
 AVFilterFormats *ret;
 unsigned i, j, k = 0, m_count;
 
+if (a == b)
+return a;
+
 ret = av_mallocz(sizeof(*ret));
 
 /* merge list of formats */

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


[libav-commits] lavfi: support audio in avfilter_copy_frame_props().

2012-05-06 Thread Anton Khirnov
Module: libav
Branch: master
Commit: 0bbd874743538103c74f3c81df4f25b1bb3f1b2e

Author:Anton Khirnov an...@khirnov.net
Committer: Anton Khirnov an...@khirnov.net
Date:  Sat May  5 13:11:53 2012 +0200

lavfi: support audio in avfilter_copy_frame_props().

---

 libavfilter/avfilter.c |   27 +--
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index d426591..91eb7f97 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -684,19 +684,26 @@ int avfilter_init_filter(AVFilterContext *filter, const 
char *args, void *opaque
 
 int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
 {
-if (dst-type != AVMEDIA_TYPE_VIDEO)
-return AVERROR(EINVAL);
-
 dst-pts= src-pts;
 dst-format = src-format;
 
-dst-video-w   = src-width;
-dst-video-h   = src-height;
-dst-video-pixel_aspect= src-sample_aspect_ratio;
-dst-video-interlaced  = src-interlaced_frame;
-dst-video-top_field_first = src-top_field_first;
-dst-video-key_frame   = src-key_frame;
-dst-video-pict_type   = src-pict_type;
+switch (dst-type) {
+case AVMEDIA_TYPE_VIDEO:
+dst-video-w   = src-width;
+dst-video-h   = src-height;
+dst-video-pixel_aspect= src-sample_aspect_ratio;
+dst-video-interlaced  = src-interlaced_frame;
+dst-video-top_field_first = src-top_field_first;
+dst-video-key_frame   = src-key_frame;
+dst-video-pict_type   = src-pict_type;
+break;
+case AVMEDIA_TYPE_AUDIO:
+dst-audio-sample_rate = src-sample_rate;
+dst-audio-channel_layout  = src-channel_layout;
+break;
+default:
+return AVERROR(EINVAL);
+}
 
 return 0;
 }

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