Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2011-04-09 17:49:51 +0400
committerLuca Barbato <lu_zero@gentoo.org>2011-04-15 20:02:05 +0400
commit2d8591c27e2dc582a7020e2580e16278dbfbddff (patch)
tree5e251cc6e974c0b9e2c99b3f6e622b4983e4941a /libavformat/mov.c
parent4de339e219908ff44cbb1d823edeeead3b8facda (diff)
make containers pass palette change in AVPacket
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
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 61ceaac351..bd8cf031e0 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);