|
|
|
@ -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); |
|
|
|
|