diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-30 15:45:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-30 16:23:46 +0200 |
commit | a5f23d8da08ec6a0840eca906b83412903545b02 (patch) | |
tree | 1375b3ecc5dbf346d074769acf3cf280b89012fb | |
parent | b7c6685268d76436aead0aa9deb8716764ecb650 (diff) | |
download | ffmpeg-a5f23d8da08ec6a0840eca906b83412903545b02.tar.gz |
mpegts: factor seek_back() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mpegts.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 288a84e13b..e2e734e32a 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1986,6 +1986,15 @@ static int parse_pcr(int64_t *ppcr_high, int *ppcr_low, return 0; } +static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { + + /* NOTE: We attempt to seek on non-seekable files as well, as the + * probe buffer usually is big enough. Only warn if the seek failed + * on files where the seek should work. */ + if (avio_seek(pb, pos, SEEK_SET) < 0) + av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); +} + static int mpegts_read_header(AVFormatContext *s) { MpegTSContext *ts = s->priv_data; @@ -2009,11 +2018,7 @@ static int mpegts_read_header(AVFormatContext *s) /* normal demux */ /* first do a scan to get all the services */ - /* NOTE: We attempt to seek on non-seekable files as well, as the - * probe buffer usually is big enough. Only warn if the seek failed - * on files where the seek should work. */ - if (avio_seek(pb, pos, SEEK_SET) < 0) - av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); + seek_back(s, pb, pos); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); |