Skip to content

Commit

Permalink
Merge remote-tracking branch 'qatar/master'
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
michaelni committed Feb 7, 2012
2 parents 6ba2505 + d016d30 commit b479e01
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 29 deletions.
3 changes: 3 additions & 0 deletions doc/filters.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion libavcodec/alacenc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* ALAC audio encoder
* Copyright (c) 2008 Jaikrishnan Menon <[email protected]>
*
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/arm/vp8.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/arm/vp8_armv6.S
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Copyright (C) 2010 Mans Rullgard
*
* This file is part of FFmpeg.
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/arm/vp8dsp_init_arm.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/arm/vp8dsp_neon.S
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* VP8 NEON optimisations
*
* Copyright (c) 2010 Rob Clark <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/flacenc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* FLAC audio encoder
* Copyright (c) 2006 Justin Ruggles <[email protected]>
*
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/jfdctint.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/lpc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* LPC utility code
* Copyright (c) 2006 Justin Ruggles <[email protected]>
*
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/lpc.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* LPC utility code
* Copyright (c) 2006 Justin Ruggles <[email protected]>
*
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/ppc/vp8dsp_altivec.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
Expand Down
6 changes: 3 additions & 3 deletions libavcodec/v210enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/vp8.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/vp8.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
Expand Down
6 changes: 5 additions & 1 deletion libavfilter/vf_drawtext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -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);
Expand Down
32 changes: 25 additions & 7 deletions libavformat/ape.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -357,18 +366,27 @@ 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))
nblocks = ape->finalframeblocks;
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);

Expand Down
2 changes: 1 addition & 1 deletion libavformat/rtpdec_latm.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* RTP Depacketization of MP4A-LATM, RFC 3016
* Copyright (c) 2010 Martin Storsjo
*
Expand Down
2 changes: 1 addition & 1 deletion libavformat/rtpdec_mpeg4.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Common code for the RTP depacketization of MPEG-4 formats.
* Copyright (c) 2010 Fabrice Bellard
* Romain Degez
Expand Down
2 changes: 1 addition & 1 deletion libavformat/rtpdec_qcelp.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* RTP Depacketization of QCELP/PureVoice, RFC 2658
* Copyright (c) 2010 Martin Storsjo
*
Expand Down

0 comments on commit b479e01

Please sign in to comment.