avformat/utils: inject audio skip side data before the side data merge code

This ensures that its handled the same way as other side data

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2013-11-21 00:15:05 +01:00
parent 01923bab98
commit f0f75dfa34
2 changed files with 16 additions and 13 deletions

View File

@@ -1398,6 +1398,18 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
if (!got_packet && s->parse_queue)
ret = read_from_packet_buffer(&s->parse_queue, &s->parse_queue_end, pkt);
if (ret >= 0) {
AVStream *st = s->streams[pkt->stream_index];
if (st->skip_samples) {
uint8_t *p = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
if (p) {
AV_WL32(p, st->skip_samples);
av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", st->skip_samples);
}
st->skip_samples = 0;
}
}
if(ret >= 0 && !(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
av_packet_merge_side_data(pkt);
@@ -1490,15 +1502,6 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
return_packet:
st = s->streams[pkt->stream_index];
if (st->skip_samples) {
uint8_t *p = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
if (p) {
AV_WL32(p, st->skip_samples);
av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", st->skip_samples);
}
st->skip_samples = 0;
}
if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY) {
ff_reduce_index(s, st->index);
av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME);