From 49f7b473b0446811f8e1f61ae0b88ec0e0b5328a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 9 Jan 2014 23:50:21 +0000 Subject: Remove some deprecated FFmpeg stuff. --- src/lib/ffmpeg_decoder.cc | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index d9b779659..b672b2c1f 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -167,8 +167,6 @@ FFmpegDecoder::pass () return; } - avcodec_get_frame_defaults (_frame); - shared_ptr film = _film.lock (); assert (film); @@ -345,8 +343,6 @@ FFmpegDecoder::seek (VideoContent::Frame frame, bool accurate) continue; } - avcodec_get_frame_defaults (_frame); - int finished = 0; r = avcodec_decode_video2 (video_codec_context(), _frame, &finished, &_packet); if (r >= 0 && finished) { -- cgit v1.2.3 From 057400eb1718e8769592e34e07d90405eb95605f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 14 Jan 2014 10:39:07 +0000 Subject: Scale subtitle times with frame rate change if they are part of a piece of video content. --- ChangeLog | 5 +++++ src/lib/ffmpeg_decoder.cc | 2 +- src/lib/player.cc | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/ChangeLog b/ChangeLog index b35298c88..fadc8f509 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-01-14 Carl Hetherington + + * Try to fix subtitle problems when the video frame rate is being changed + from content to DCP. + 2014-01-13 Carl Hetherington * Change 4:3 and 5:3 ratios to be precise rather than 1.33:1 and 1.66:1, and diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index b672b2c1f..a6f9a17c3 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -556,7 +556,7 @@ FFmpegDecoder::decode_subtitle_packet () source that we may have chopped off for the DCP) */ double const packet_time = (static_cast (sub.pts ) / AV_TIME_BASE) + _video_pts_offset; - + /* hence start time for this sub */ Time const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ; Time const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ; diff --git a/src/lib/player.cc b/src/lib/player.cc index 9f8599693..56145f5bd 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -292,6 +292,7 @@ Player::process_video (weak_ptr weak_piece, shared_ptr image pi->set_subtitle (_out_subtitle.image, _out_subtitle.position + container_offset); } + #ifdef DCPOMATIC_DEBUG _last_video = piece->content; @@ -683,8 +684,18 @@ Player::update_subtitle () _in_subtitle.image->pixel_format (), true ); - _out_subtitle.from = _in_subtitle.from + piece->content->position (); - _out_subtitle.to = _in_subtitle.to + piece->content->position (); + + /* XXX: hack */ + Time from = _in_subtitle.from; + Time to = _in_subtitle.to; + shared_ptr vc = dynamic_pointer_cast (piece->content); + if (vc) { + from = rint (from * vc->video_frame_rate() / _film->video_frame_rate()); + to = rint (to * vc->video_frame_rate() / _film->video_frame_rate()); + } + + _out_subtitle.from = from * piece->content->position (); + _out_subtitle.to = to + piece->content->position (); } /** Re-emit the last frame that was emitted, using current settings for crop, ratio, scaler and subtitles. -- cgit v1.2.3