diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-11-19 20:40:36 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-11-19 20:40:36 +0000 |
| commit | f113b2aaca7a65f7b37e12a7d9f3f99e2d834e81 (patch) | |
| tree | 6ea2ed1d480304a4aaf512e380cd013bbf42e86c /src/lib/ffmpeg_decoder.cc | |
| parent | fab7fa5a9ef1d069c7ca32e3669d0e37e896250c (diff) | |
Move position variables into the video/audio/subtitle decoder classes.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 8f196542a..ddc563b98 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -425,7 +425,7 @@ FFmpegDecoder::decode_audio_packet () LOG_WARNING ("Crazy timestamp %s", to_string (ct)); } - update_position (_audio_position, ct); + audio->set_position (ct); /* Give this data provided there is some, and its time is sane */ if (ct >= ContentTime() && data->frames() > 0) { @@ -478,7 +478,7 @@ FFmpegDecoder::decode_video_packet () shared_ptr<ImageProxy> (new RawImageProxy (image)), llrint (pts * _ffmpeg_content->active_video_frame_rate ()) ); - update_position (_video_position, ContentTime::from_seconds (pts)); + video->set_position (ContentTime::from_seconds (pts)); } else { LOG_WARNING_NC ("Dropping frame without PTS"); } @@ -509,7 +509,7 @@ FFmpegDecoder::decode_subtitle_packet () FFmpegSubtitlePeriod sub_period = subtitle_period (sub); ContentTimePeriod period; period.from = sub_period.from + _pts_offset; - update_position (_subtitle_position, period.from); + subtitle->set_position (period.from); if (sub_period.to) { /* We already know the subtitle period `to' time */ period.to = sub_period.to.get() + _pts_offset; @@ -644,16 +644,3 @@ FFmpegDecoder::decode_ass_subtitle (string ass, ContentTimePeriod period) subtitle->give_text (period, i); } } - -void -FFmpegDecoder::update_position (optional<ContentTime>& current, ContentTime p) -{ - /* current should err on the side of being too big, as then there is less - chance that we will erroneously decide not to seek when current > request. - */ - if (!current) { - current = p; - } else { - current = max (*current, p); - } -} |
