Merge remote-tracking branch 'qatar/master'

* qatar/master:
  mov_chan: Pass a separate AVIOContext for reading
  af_asyncts: check return value from lavr when flushing.
  mss2: simplify loop in decode_rle()
  mss12: avoid unnecessary division in arith*_get_bit()
  mss2: do not try to read too many palette entries
  mpegvideo: set AVFrame fields to NULL after freeing the base memory
  configure: Set the right cc_e flags for msvc

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-09-07 13:37:19 +02:00
commit fa85118510
11 changed files with 24 additions and 14 deletions

1
configure vendored
View File

@ -2590,6 +2590,7 @@ probe_cc(){
_ld_o='-Fe$@'
fi
_cc_o='-Fo $@'
_cc_e='-P -Fi $@'
_flags_filter=msvc_flags
_ld_lib='lib%.a'
_ld_path='-libpath:'

View File

@ -393,13 +393,16 @@ static void free_picture(MpegEncContext *s, Picture *pic)
av_freep(&pic->mb_mean);
av_freep(&pic->f.mbskip_table);
av_freep(&pic->qscale_table_base);
pic->f.qscale_table = NULL;
av_freep(&pic->mb_type_base);
pic->f.mb_type = NULL;
av_freep(&pic->f.dct_coeff);
av_freep(&pic->f.pan_scan);
pic->f.mb_type = NULL;
for (i = 0; i < 2; i++) {
av_freep(&pic->motion_val_base[i]);
av_freep(&pic->f.ref_index[i]);
pic->f.motion_val[i] = NULL;
}
if (pic->f.type == FF_BUFFER_TYPE_SHARED) {

View File

@ -103,7 +103,7 @@ av_cold int ff_mss12_decode_end(MSS12Context *ctx);
static int arith ## VERSION ## _get_bit(ArithCoder *c) \
{ \
int range = c->high - c->low + 1; \
int bit = (((c->value - c->low) << 1) + 1) / range; \
int bit = 2 * c->value - c->low >= c->high; \
\
if (bit) \
c->low += range >> 1; \

View File

@ -161,7 +161,7 @@ static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size)
return 0;
ncol = *buf++;
if (buf_size < 2 + ncol * 3)
if (ncol > ctx->free_colours || buf_size < 2 + ncol * 3)
return -1;
for (i = 0; i < ncol; i++)
*pal++ = AV_RB24(buf + 3 * i);
@ -335,8 +335,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, int pal_stride,
else
repeat = get_bits(gb, b);
while (b--)
repeat += 1 << b;
repeat += (1 << b) - 1;
if (last_symbol == -2) {
int skip = FFMIN(repeat, pal_dst + w - pp);

View File

@ -127,8 +127,13 @@ static int request_frame(AVFilterLink *link)
nb_samples);
if (!buf)
return AVERROR(ENOMEM);
avresample_convert(s->avr, (void**)buf->extended_data, buf->linesize[0],
nb_samples, NULL, 0, 0);
ret = avresample_convert(s->avr, (void**)buf->extended_data,
buf->linesize[0], nb_samples, NULL, 0, 0);
if (ret <= 0) {
avfilter_unref_bufferp(&buf);
return (ret < 0) ? ret : AVERROR_EOF;
}
buf->pts = s->pts;
return ff_filter_samples(link, buf);
}

View File

@ -278,7 +278,7 @@ static int aiff_read_header(AVFormatContext *s)
st->codec->block_align = AV_RB32(st->codec->extradata+11*4);
break;
case MKTAG('C','H','A','N'):
if(ff_mov_read_chan(s, st, size) < 0)
if(ff_mov_read_chan(s, pb, st, size) < 0)
return AVERROR_INVALIDDATA;
break;
default: /* Jump */

View File

@ -268,7 +268,7 @@ static int read_header(AVFormatContext *s)
break;
case MKBETAG('c','h','a','n'):
if ((ret = ff_mov_read_chan(s, st, size)) < 0)
if ((ret = ff_mov_read_chan(s, s->pb, st, size)) < 0)
return ret;
break;

View File

@ -197,7 +197,7 @@ int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries);
int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size);
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size);
void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout);
#endif /* AVFORMAT_ISOM_H */

View File

@ -676,7 +676,7 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size < 16)
return 0;
ff_mov_read_chan(c->fc, st, atom.size - 4);
ff_mov_read_chan(c->fc, pb, st, atom.size - 4);
return 0;
}
@ -2575,7 +2575,7 @@ static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size < 16)
return 0;
avio_skip(pb, 4);
ff_mov_read_chan(c->fc,c->fc->streams[0], atom.size - 4);
ff_mov_read_chan(c->fc, pb, c->fc->streams[0], atom.size - 4);
return 0;
}

View File

@ -543,9 +543,9 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
return tag;
}
int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size)
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
int64_t size)
{
AVIOContext *pb = s->pb;
uint32_t layout_tag, bitmap, num_descr, label_mask;
int i;

View File

@ -57,10 +57,12 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
* Read 'chan' tag from the input stream.
*
* @param s AVFormatContext
* @param pb AVIOContext
* @param st The stream to set codec values for
* @param size Remaining size in the 'chan' tag
* @return 0 if ok, or negative AVERROR code on failure
*/
int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size);
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
int64_t size);
#endif /* AVFORMAT_MOV_CHAN_H */