summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-17 23:36:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-17 23:43:54 +0200
commitc40798441f47341c310b38e8f329cfb943924faf (patch)
treec23fbec614c59bcf14c7377d1c6ff7abdfa34353 /libavformat/mov.c
parentc96786008172f669e546ca987e7aaa3c3469be71 (diff)
parentfd0c3403f611d31b944216cfa1585a2d28f7f0da (diff)
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/mov.c')
-rw-r--r--libavformat/mov.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 89b9adc7af..ad5d6a8d6e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1027,7 +1027,6 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
unsigned int color_start, color_count, color_end;
unsigned char r, g, b;
- st->codec->palctrl = av_malloc(sizeof(*st->codec->palctrl));
if (color_greyscale) {
int color_index, color_dec;
/* compute the greyscale palette */
@@ -1037,7 +1036,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
color_dec = 256 / (color_count - 1);
for (j = 0; j < color_count; j++) {
r = g = b = color_index;
- st->codec->palctrl->palette[j] =
+ sc->palette[j] =
(r << 16) | (g << 8) | (b);
color_index -= color_dec;
if (color_index < 0)
@@ -1058,7 +1057,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
r = color_table[j * 3 + 0];
g = color_table[j * 3 + 1];
b = color_table[j * 3 + 2];
- st->codec->palctrl->palette[j] =
+ sc->palette[j] =
(r << 16) | (g << 8) | (b);
}
} else {
@@ -1080,12 +1079,12 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
avio_r8(pb);
b = avio_r8(pb);
avio_r8(pb);
- st->codec->palctrl->palette[j] =
+ sc->palette[j] =
(r << 16) | (g << 8) | (b);
}
}
}
- st->codec->palctrl->palette_changed = 1;
+ sc->has_palette = 1;
}
} else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
int bits_per_sample, flags;
@@ -2433,6 +2432,17 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(sc->pb, pkt, sample->size);
if (ret < 0)
return ret;
+ if (sc->has_palette) {
+ uint8_t *pal;
+
+ pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+ if (!pal) {
+ av_log(mov->fc, AV_LOG_ERROR, "Cannot append palette to packet\n");
+ } else {
+ memcpy(pal, sc->palette, AVPALETTE_SIZE);
+ sc->has_palette = 0;
+ }
+ }
#if CONFIG_DV_DEMUXER
if (mov->dv_demux && sc->dv_audio_container) {
dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size);