MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ffmpeg_seek

Function ffmpeg_seek

libhb/stream.c:6581–6606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6579}
6580
6581static int ffmpeg_seek( hb_stream_t *stream, float frac )
6582{
6583 AVFormatContext *ic = stream->ffmpeg_ic;
6584 int res;
6585 if ( frac > 0. )
6586 {
6587 int64_t pos = (double)stream->ffmpeg_ic->duration * (double)frac +
6588 ffmpeg_initial_timestamp( stream );
6589 res = avformat_seek_file( ic, -1, 0, pos, pos, AVSEEK_FLAG_BACKWARD);
6590 if (res < 0)
6591 {
6592 hb_error("avformat_seek_file failed");
6593 }
6594 }
6595 else
6596 {
6597 int64_t pos = ffmpeg_initial_timestamp( stream );
6598 res = avformat_seek_file( ic, -1, 0, pos, pos, AVSEEK_FLAG_BACKWARD);
6599 if (res < 0)
6600 {
6601 hb_error("avformat_seek_file failed");
6602 }
6603 }
6604 stream->need_keyframe = 1;
6605 return 1;
6606}
6607
6608// Assumes that we are always seeking forward
6609static int ffmpeg_seek_ts( hb_stream_t *stream, int64_t ts )

Callers 1

hb_stream_seekFunction · 0.85

Calls 2

ffmpeg_initial_timestampFunction · 0.85
hb_errorFunction · 0.85

Tested by

no test coverage detected