- We will do pts_to_use = pts_from_ffmpeg + pts_offset;
- */
-
- bool const have_video = c->first_video();
- bool const have_audio = c->audio_stream () && c->audio_stream()->first_audio;
-
- /* First, make one of them start at 0 */
-
- if (have_audio && have_video) {
- _pts_offset = - min (c->first_video().get(), c->audio_stream()->first_audio.get());
- } else if (have_video) {
- _pts_offset = - c->first_video().get();
- } else if (have_audio) {
- _pts_offset = - c->audio_stream()->first_audio.get();
- }
-
- /* Now adjust both so that the video pts starts on a frame */
- if (have_video && have_audio) {
- ContentTime first_video = c->first_video().get() + _pts_offset;
- ContentTime const old_first_video = first_video;
- _pts_offset += first_video.round_up (c->video_frame_rate ()) - old_first_video;
- }