diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-04-17 23:36:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-17 23:43:54 +0200 |
commit | c40798441f47341c310b38e8f329cfb943924faf (patch) | |
tree | c23fbec614c59bcf14c7377d1c6ff7abdfa34353 /libavformat/avidec.c | |
parent | c96786008172f669e546ca987e7aaa3c3469be71 (diff) | |
parent | fd0c3403f611d31b944216cfa1585a2d28f7f0da (diff) | |
download | ffmpeg-c40798441f47341c310b38e8f329cfb943924faf.tar.gz |
Merge remote branch 'qatar/master'
* qatar/master:
ac3dec: fix processing of delta bit allocation information.
vc1: fix fate-vc1 after previous commit.
wmv3dec: fix playback of complex WMV3 files using simple_idct.
make av_dup_packet() more cautious on allocation failures
make containers pass palette change in AVPacket
introduce side information for AVPacket
Politic commits that have not been pulled:
Update regtest checksums after revision 6001dad.
Replace more FFmpeg references by Libav.
Replace references to ffmpeg-devel with libav-devel; fix roundup URL.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r-- | libavformat/avidec.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 7df37065ec..ebbd70ab9f 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -588,17 +588,16 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) /* Extract palette from extradata if bpp <= 8. */ /* This code assumes that extradata contains only palette. */ - /* This is true for all paletted codecs implemented in FFmpeg. */ + /* This is true for all paletted codecs implemented in Libav. */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { - st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) - st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); + ast->pal[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); #else - memcpy(st->codec->palctrl->palette, st->codec->extradata, + memcpy(ast->pal, st->codec->extradata, FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); #endif - st->codec->palctrl->palette_changed = 1; + ast->has_pal = 1; } print_tag("video", tag1, 0); @@ -932,14 +931,14 @@ resync: return err; if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){ - void *ptr= av_realloc(pkt->data, pkt->size + 4*256 + FF_INPUT_BUFFER_PADDING_SIZE); - if(ptr){ - ast->has_pal=0; - pkt->size += 4*256; - pkt->data= ptr; - memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256); - }else - av_log(s, AV_LOG_ERROR, "Failed to append palette\n"); + uint8_t *pal; + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); + if(!pal){ + av_log(s, AV_LOG_ERROR, "Failed to allocate data for palette\n"); + }else{ + memcpy(pal, ast->pal, AVPALETTE_SIZE); + ast->has_pal = 0; + } } if (CONFIG_DV_DEMUXER && avi->dv_demux) { @@ -1340,7 +1339,6 @@ static int avi_read_close(AVFormatContext *s) for(i=0;i<s->nb_streams;i++) { AVStream *st = s->streams[i]; AVIStream *ast = st->priv_data; - av_free(st->codec->palctrl); if (ast) { if (ast->sub_ctx) { av_freep(&ast->sub_ctx->pb); |