diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-04 22:00:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-12 20:32:03 +0200 |
commit | 018601dbf940a43dc0367f99b4953da5db9693e0 (patch) | |
tree | 659945bcf00fb23fb71c0494e44fdabbbd167228 | |
parent | c916af995d15bb1eb1329cb73fdb1c761433e601 (diff) | |
download | ffmpeg-018601dbf940a43dc0367f99b4953da5db9693e0.tar.gz |
lavf: inject sample skip side data when requested by the demuxer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/avformat.h | 5 | ||||
-rw-r--r-- | libavformat/utils.c | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a435d516c6..7dad8e27fe 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -805,6 +805,11 @@ typedef struct AVStream { * should be discarded. */ int skip_to_keyframe; + + /** + * Number of samples to skip at the start of the frame decoded from the next packet. + */ + int skip_samples; } AVStream; #define AV_PROGRAM_RUNNING 1 diff --git a/libavformat/utils.c b/libavformat/utils.c index b1b48feffb..39527a6bb5 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1450,6 +1450,14 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) } return_packet: + + if(s->streams[pkt->stream_index]->skip_samples) { + uint8_t *p = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10); + AV_WL32(p, s->streams[pkt->stream_index]->skip_samples); + av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", s->streams[pkt->stream_index]->skip_samples); + s->streams[pkt->stream_index]->skip_samples = 0; + } + if (is_relative(pkt->dts)) pkt->dts -= RELATIVE_TS_BASE; if (is_relative(pkt->pts)) |