summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-07 01:40:29 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-07 01:40:29 +0100
commitb479e016128efe42e8b26ceb6c1b4a95b6d0c791 (patch)
tree30ab5e543d733f62a81deecce3a15404e46ce4f4
parent6ba2505a0e894eeb326cfee95df9e1c030bcde3e (diff)
parentd016d3074cc084ea813e389f046eee01ecd48b7e (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: Revert "v210enc: use FFALIGN()" doxygen: Do not include license boilerplates in Doxygen comment blocks. avplay: reset decoder flush state when seeking ape: skip packets with invalid size ape: calculate final packet size instead of guessing ape: stop reading after the last frame has been read ape: return AVERROR_EOF instead of AVERROR(EIO) when demuxing is finished ape: return error if seeking to the current packet fails in ape_read_packet() avcodec: Clarify AVFrame member documentation. v210dec: check for coded_frame allocation failure v210enc: use stride as it is already calculated v210enc: use FFALIGN() v210enc: return proper AVERROR codes instead of -1 v210enc: do not set coded_frame->key_frame v210enc: check for coded_frame allocation failure drawtext: add 'fix_bounds' option on coords fixing drawtext: fix text_{w, h} expression vars drawtext: add missing braces around an if() block. Conflicts: libavcodec/arm/vp8.h libavcodec/arm/vp8dsp_init_arm.c libavcodec/v210dec.c libavfilter/vf_drawtext.c libavformat/ape.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/filters.texi3
-rw-r--r--ffplay.c4
-rw-r--r--libavcodec/alacenc.c2
-rw-r--r--libavcodec/arm/vp8.h2
-rw-r--r--libavcodec/arm/vp8_armv6.S2
-rw-r--r--libavcodec/arm/vp8dsp_init_arm.c2
-rw-r--r--libavcodec/arm/vp8dsp_neon.S2
-rw-r--r--libavcodec/avcodec.h4
-rw-r--r--libavcodec/flacenc.c2
-rw-r--r--libavcodec/jfdctint.c2
-rw-r--r--libavcodec/lpc.c2
-rw-r--r--libavcodec/lpc.h2
-rw-r--r--libavcodec/ppc/vp8dsp_altivec.c2
-rw-r--r--libavcodec/v210enc.c6
-rw-r--r--libavcodec/vp8.c2
-rw-r--r--libavcodec/vp8.h2
-rw-r--r--libavfilter/vf_drawtext.c6
-rw-r--r--libavformat/ape.c32
-rw-r--r--libavformat/rtpdec_latm.c2
-rw-r--r--libavformat/rtpdec_mpeg4.c2
-rw-r--r--libavformat/rtpdec_qcelp.c2
21 files changed, 56 insertions, 29 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 135e1143e2..938a5e1704 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1256,6 +1256,9 @@ libfreetype flags.
@item tabsize
The size in number of spaces to use for rendering the tab.
Default value is 4.
+
+@item fix_bounds
+If true, check and fix text coords to avoid clipping.
@end table
The parameters for @var{x} and @var{y} are expressions containing the
diff --git a/ffplay.c b/ffplay.c
index 969142f532..19c430883c 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2145,8 +2145,10 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0)
return -1;
- if (pkt->data == flush_pkt.data)
+ if (pkt->data == flush_pkt.data) {
avcodec_flush_buffers(dec);
+ flush_complete = 0;
+ }
*pkt_temp = *pkt;
diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c
index e8d1bc03f2..fde3b53e5e 100644
--- a/libavcodec/alacenc.c
+++ b/libavcodec/alacenc.c
@@ -1,4 +1,4 @@
-/**
+/*
* ALAC audio encoder
* Copyright (c) 2008 Jaikrishnan Menon <realityman@gmx.net>
*
diff --git a/libavcodec/arm/vp8.h b/libavcodec/arm/vp8.h
index 55193394c5..d3fce4cafe 100644
--- a/libavcodec/arm/vp8.h
+++ b/libavcodec/arm/vp8.h
@@ -1,4 +1,4 @@
-/**
+/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
diff --git a/libavcodec/arm/vp8_armv6.S b/libavcodec/arm/vp8_armv6.S
index 8a3beb9fbb..9399bb28d7 100644
--- a/libavcodec/arm/vp8_armv6.S
+++ b/libavcodec/arm/vp8_armv6.S
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (C) 2010 Mans Rullgard
*
* This file is part of FFmpeg.
diff --git a/libavcodec/arm/vp8dsp_init_arm.c b/libavcodec/arm/vp8dsp_init_arm.c
index b56e6f42e0..14021c954d 100644
--- a/libavcodec/arm/vp8dsp_init_arm.c
+++ b/libavcodec/arm/vp8dsp_init_arm.c
@@ -1,4 +1,4 @@
-/**
+/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
diff --git a/libavcodec/arm/vp8dsp_neon.S b/libavcodec/arm/vp8dsp_neon.S
index b4ab1c7032..a9f698dfed 100644
--- a/libavcodec/arm/vp8dsp_neon.S
+++ b/libavcodec/arm/vp8dsp_neon.S
@@ -1,4 +1,4 @@
-/**
+/*
* VP8 NEON optimisations
*
* Copyright (c) 2010 Rob Clark <rob@ti.com>
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ee3833b0c8..8513cebde1 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -884,7 +884,7 @@ typedef struct AVFrame {
* For audio, only linesize[0] may be set. For planar audio, each channel
* plane must be the same size.
*
- * - encoding: Set by user (video only)
+ * - encoding: Set by user
* - decoding: set by AVCodecContext.get_buffer()
*/
int linesize[AV_NUM_DATA_POINTERS];
@@ -1134,7 +1134,7 @@ typedef struct AVFrame {
/**
* number of audio samples (per channel) described by this frame
- * - encoding: unused
+ * - encoding: Set by user
* - decoding: Set by libavcodec
*/
int nb_samples;
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index a1c3bca2dd..ecf883e652 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -1,4 +1,4 @@
-/**
+/*
* FLAC audio encoder
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
*
diff --git a/libavcodec/jfdctint.c b/libavcodec/jfdctint.c
index 0482bc5643..ed6b7ffca2 100644
--- a/libavcodec/jfdctint.c
+++ b/libavcodec/jfdctint.c
@@ -1,4 +1,4 @@
-/**
+/*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 3401226d0f..5faddc24a6 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -1,4 +1,4 @@
-/**
+/*
* LPC utility code
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
*
diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
index 8b70a9d5d7..c58e37c4bc 100644
--- a/libavcodec/lpc.h
+++ b/libavcodec/lpc.h
@@ -1,4 +1,4 @@
-/**
+/*
* LPC utility code
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
*
diff --git a/libavcodec/ppc/vp8dsp_altivec.c b/libavcodec/ppc/vp8dsp_altivec.c
index 8bb60aae0b..28d23cb9aa 100644
--- a/libavcodec/ppc/vp8dsp_altivec.c
+++ b/libavcodec/ppc/vp8dsp_altivec.c
@@ -1,4 +1,4 @@
-/**
+/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index 947797df14..a2efb5e83f 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -28,7 +28,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
{
if (avctx->width & 1) {
av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (avctx->pix_fmt != PIX_FMT_YUV422P10) {
@@ -62,9 +62,9 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
uint8_t *p = buf;
uint8_t *pdst = buf;
- if (buf_size < aligned_width * avctx->height * 8 / 3) {
+ if (buf_size < avctx->height * stride) {
av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
- return -1;
+ return AVERROR(ENOMEM);
}
#define CLIP(v) av_clip(v, 4, 1019)
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index d68a91ea54..370fb0070c 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1,4 +1,4 @@
-/**
+/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index 36c21df217..5d2a3b773d 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -1,4 +1,4 @@
-/**
+/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index f7727ef24f..7c216800a6 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -139,6 +139,7 @@ typedef struct {
short int draw_box; ///< draw box around text - true or false
int use_kerning; ///< font kerning is used - true/false
int tabsize; ///< tab size
+ int fix_bounds; ///< do we let it go out of frame bounds - t/f
FT_Library library; ///< freetype font library handle
FT_Face face; ///< freetype font face handle
@@ -184,6 +185,8 @@ static const AVOption drawtext_options[]= {
{"timecode", "set initial timecode", OFFSET(tc_opt_string), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX },
{"r", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX },
{"rate", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX },
+{"fix_bounds", "if true, check and fix text coords to avoid clipping",
+ OFFSET(fix_bounds), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 },
/* FT_LOAD_* flags */
{"ft_load_flags", "set font loading flags for libfreetype", OFFSET(ft_load_flags), AV_OPT_TYPE_FLAGS, {.dbl=FT_LOAD_DEFAULT|FT_LOAD_RENDER}, 0, INT_MAX, 0, "ft_load_flags" },
@@ -754,8 +757,9 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
/* get glyph */
dummy.code = code;
glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL);
- if (!glyph)
+ if (!glyph) {
load_glyph(ctx, &glyph, code);
+ }
y_min = FFMIN(glyph->bbox.yMin, y_min);
y_max = FFMAX(glyph->bbox.yMax, y_max);
diff --git a/libavformat/ape.c b/libavformat/ape.c
index d4d0ac9d57..549330d4aa 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -159,8 +159,8 @@ static int ape_read_header(AVFormatContext * s)
AVStream *st;
uint32_t tag;
int i;
- int total_blocks;
- int64_t pts;
+ int total_blocks, final_size = 0;
+ int64_t pts, file_size;
/* Skip any leading junk such as id3v2 tags */
ape->junklength = avio_tell(pb);
@@ -289,8 +289,17 @@ static int ape_read_header(AVFormatContext * s)
ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos;
ape->frames[i].skip = (ape->frames[i].pos - ape->frames[0].pos) & 3;
}
- ape->frames[ape->totalframes - 1].size = ape->finalframeblocks * 4;
ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks;
+ /* calculate final packet size from total file size, if available */
+ file_size = avio_size(pb);
+ if (file_size > 0) {
+ final_size = file_size - ape->frames[ape->totalframes - 1].pos -
+ ape->wavtaillength;
+ final_size -= final_size & 3;
+ }
+ if (file_size <= 0 || final_size <= 0)
+ final_size = ape->finalframeblocks * 8;
+ ape->frames[ape->totalframes - 1].size = final_size;
for (i = 0; i < ape->totalframes; i++) {
if(ape->frames[i].skip){
@@ -357,11 +366,12 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
uint32_t extra_size = 8;
if (url_feof(s->pb))
- return AVERROR(EIO);
- if (ape->currentframe > ape->totalframes)
- return AVERROR(EIO);
+ return AVERROR_EOF;
+ if (ape->currentframe >= ape->totalframes)
+ return AVERROR_EOF;
- avio_seek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
+ if (avio_seek(s->pb, ape->frames[ape->currentframe].pos, SEEK_SET) < 0)
+ return AVERROR(EIO);
/* Calculate how many blocks there are in this frame */
if (ape->currentframe == (ape->totalframes - 1))
@@ -369,6 +379,14 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
else
nblocks = ape->blocksperframe;
+ if (ape->frames[ape->currentframe].size <= 0 ||
+ ape->frames[ape->currentframe].size > INT_MAX - extra_size) {
+ av_log(s, AV_LOG_ERROR, "invalid packet size: %d\n",
+ ape->frames[ape->currentframe].size);
+ ape->currentframe++;
+ return AVERROR(EIO);
+ }
+
if (av_new_packet(pkt, ape->frames[ape->currentframe].size + extra_size) < 0)
return AVERROR(ENOMEM);
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index f08415dde7..a642b5a079 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -1,4 +1,4 @@
-/**
+/*
* RTP Depacketization of MP4A-LATM, RFC 3016
* Copyright (c) 2010 Martin Storsjo
*
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index f6547bc70e..9b388782b3 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -1,4 +1,4 @@
-/**
+/*
* Common code for the RTP depacketization of MPEG-4 formats.
* Copyright (c) 2010 Fabrice Bellard
* Romain Degez
diff --git a/libavformat/rtpdec_qcelp.c b/libavformat/rtpdec_qcelp.c
index 5eb6770297..d6ef4fce02 100644
--- a/libavformat/rtpdec_qcelp.c
+++ b/libavformat/rtpdec_qcelp.c
@@ -1,4 +1,4 @@
-/**
+/*
* RTP Depacketization of QCELP/PureVoice, RFC 2658
* Copyright (c) 2010 Martin Storsjo
*