1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2012-02-07 01:40:29 +01:00
commit b479e01612
21 changed files with 56 additions and 29 deletions

View File

@ -1256,6 +1256,9 @@ libfreetype flags.
@item tabsize @item tabsize
The size in number of spaces to use for rendering the tab. The size in number of spaces to use for rendering the tab.
Default value is 4. Default value is 4.
@item fix_bounds
If true, check and fix text coords to avoid clipping.
@end table @end table
The parameters for @var{x} and @var{y} are expressions containing the The parameters for @var{x} and @var{y} are expressions containing the

View File

@ -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) if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0)
return -1; return -1;
if (pkt->data == flush_pkt.data) if (pkt->data == flush_pkt.data) {
avcodec_flush_buffers(dec); avcodec_flush_buffers(dec);
flush_complete = 0;
}
*pkt_temp = *pkt; *pkt_temp = *pkt;

View File

@ -1,4 +1,4 @@
/** /*
* ALAC audio encoder * ALAC audio encoder
* Copyright (c) 2008 Jaikrishnan Menon <realityman@gmx.net> * Copyright (c) 2008 Jaikrishnan Menon <realityman@gmx.net>
* *

View File

@ -1,4 +1,4 @@
/** /*
* This file is part of FFmpeg. * This file is part of FFmpeg.
* *
* FFmpeg is free software; you can redistribute it and/or * FFmpeg is free software; you can redistribute it and/or

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (C) 2010 Mans Rullgard * Copyright (C) 2010 Mans Rullgard
* *
* This file is part of FFmpeg. * This file is part of FFmpeg.

View File

@ -1,4 +1,4 @@
/** /*
* This file is part of FFmpeg. * This file is part of FFmpeg.
* *
* FFmpeg is free software; you can redistribute it and/or * FFmpeg is free software; you can redistribute it and/or

View File

@ -1,4 +1,4 @@
/** /*
* VP8 NEON optimisations * VP8 NEON optimisations
* *
* Copyright (c) 2010 Rob Clark <rob@ti.com> * Copyright (c) 2010 Rob Clark <rob@ti.com>

View File

@ -884,7 +884,7 @@ typedef struct AVFrame {
* For audio, only linesize[0] may be set. For planar audio, each channel * For audio, only linesize[0] may be set. For planar audio, each channel
* plane must be the same size. * plane must be the same size.
* *
* - encoding: Set by user (video only) * - encoding: Set by user
* - decoding: set by AVCodecContext.get_buffer() * - decoding: set by AVCodecContext.get_buffer()
*/ */
int linesize[AV_NUM_DATA_POINTERS]; int linesize[AV_NUM_DATA_POINTERS];
@ -1134,7 +1134,7 @@ typedef struct AVFrame {
/** /**
* number of audio samples (per channel) described by this frame * number of audio samples (per channel) described by this frame
* - encoding: unused * - encoding: Set by user
* - decoding: Set by libavcodec * - decoding: Set by libavcodec
*/ */
int nb_samples; int nb_samples;

View File

@ -1,4 +1,4 @@
/** /*
* FLAC audio encoder * FLAC audio encoder
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com> * Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
* *

View File

@ -1,4 +1,4 @@
/** /*
* This file is part of Libav. * This file is part of Libav.
* *
* Libav is free software; you can redistribute it and/or * Libav is free software; you can redistribute it and/or

View File

@ -1,4 +1,4 @@
/** /*
* LPC utility code * LPC utility code
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com> * Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
* *

View File

@ -1,4 +1,4 @@
/** /*
* LPC utility code * LPC utility code
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com> * Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
* *

View File

@ -1,4 +1,4 @@
/** /*
* VP8 compatible video decoder * VP8 compatible video decoder
* *
* Copyright (C) 2010 David Conrad * Copyright (C) 2010 David Conrad

View File

@ -28,7 +28,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
{ {
if (avctx->width & 1) { if (avctx->width & 1) {
av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n"); av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
return -1; return AVERROR(EINVAL);
} }
if (avctx->pix_fmt != PIX_FMT_YUV422P10) { 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 *p = buf;
uint8_t *pdst = 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"); av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
return -1; return AVERROR(ENOMEM);
} }
#define CLIP(v) av_clip(v, 4, 1019) #define CLIP(v) av_clip(v, 4, 1019)

View File

@ -1,4 +1,4 @@
/** /*
* VP8 compatible video decoder * VP8 compatible video decoder
* *
* Copyright (C) 2010 David Conrad * Copyright (C) 2010 David Conrad

View File

@ -1,4 +1,4 @@
/** /*
* VP8 compatible video decoder * VP8 compatible video decoder
* *
* Copyright (C) 2010 David Conrad * Copyright (C) 2010 David Conrad

View File

@ -139,6 +139,7 @@ typedef struct {
short int draw_box; ///< draw box around text - true or false short int draw_box; ///< draw box around text - true or false
int use_kerning; ///< font kerning is used - true/false int use_kerning; ///< font kerning is used - true/false
int tabsize; ///< tab size 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_Library library; ///< freetype font library handle
FT_Face face; ///< freetype font face 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 }, {"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 }, {"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 }, {"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 */
{"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" }, {"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 */ /* get glyph */
dummy.code = code; dummy.code = code;
glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL);
if (!glyph) if (!glyph) {
load_glyph(ctx, &glyph, code); load_glyph(ctx, &glyph, code);
}
y_min = FFMIN(glyph->bbox.yMin, y_min); y_min = FFMIN(glyph->bbox.yMin, y_min);
y_max = FFMAX(glyph->bbox.yMax, y_max); y_max = FFMAX(glyph->bbox.yMax, y_max);

View File

@ -159,8 +159,8 @@ static int ape_read_header(AVFormatContext * s)
AVStream *st; AVStream *st;
uint32_t tag; uint32_t tag;
int i; int i;
int total_blocks; int total_blocks, final_size = 0;
int64_t pts; int64_t pts, file_size;
/* Skip any leading junk such as id3v2 tags */ /* Skip any leading junk such as id3v2 tags */
ape->junklength = avio_tell(pb); 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 - 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[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; 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++) { for (i = 0; i < ape->totalframes; i++) {
if(ape->frames[i].skip){ if(ape->frames[i].skip){
@ -357,11 +366,12 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
uint32_t extra_size = 8; uint32_t extra_size = 8;
if (url_feof(s->pb)) if (url_feof(s->pb))
return AVERROR(EIO); return AVERROR_EOF;
if (ape->currentframe > ape->totalframes) if (ape->currentframe >= ape->totalframes)
return AVERROR(EIO); 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 */ /* Calculate how many blocks there are in this frame */
if (ape->currentframe == (ape->totalframes - 1)) if (ape->currentframe == (ape->totalframes - 1))
@ -369,6 +379,14 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
else else
nblocks = ape->blocksperframe; 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) if (av_new_packet(pkt, ape->frames[ape->currentframe].size + extra_size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -1,4 +1,4 @@
/** /*
* RTP Depacketization of MP4A-LATM, RFC 3016 * RTP Depacketization of MP4A-LATM, RFC 3016
* Copyright (c) 2010 Martin Storsjo * Copyright (c) 2010 Martin Storsjo
* *

View File

@ -1,4 +1,4 @@
/** /*
* Common code for the RTP depacketization of MPEG-4 formats. * Common code for the RTP depacketization of MPEG-4 formats.
* Copyright (c) 2010 Fabrice Bellard * Copyright (c) 2010 Fabrice Bellard
* Romain Degez * Romain Degez

View File

@ -1,4 +1,4 @@
/** /*
* RTP Depacketization of QCELP/PureVoice, RFC 2658 * RTP Depacketization of QCELP/PureVoice, RFC 2658
* Copyright (c) 2010 Martin Storsjo * Copyright (c) 2010 Martin Storsjo
* *