using boost::weak_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
+using boost::scoped_ptr;
Player::Player (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist)
: _film (film)
property == ContentProperty::TRIM_END ||
property == ContentProperty::PATH ||
property == VideoContentProperty::VIDEO_FRAME_TYPE ||
- property == DCPContentProperty::CAN_BE_PLAYED
+ property == DCPContentProperty::CAN_BE_PLAYED ||
+ property == SubRipContentProperty::SUBTITLE_COLOUR ||
+ property == SubRipContentProperty::SUBTITLE_OUTLINE ||
+ property == SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR
) {
_have_valid_pieces = false;
/* Find subtitles for possible burn-in */
- PlayerSubtitles ps = get_subtitles (time, DCPTime::from_frames (1, _film->video_frame_rate ()), false, true);
+ PlayerSubtitles ps = get_subtitles (time, DCPTime::from_frames (1, _film->video_frame_rate ()), false, true, accurate);
list<PositionImage> sub_images;
list<shared_ptr<Piece> > ov = overlaps<VideoContent> (
time,
- time + DCPTime::from_frames (1, _film->video_frame_rate ()) - DCPTime::delta()
+ time + DCPTime::from_frames (1, _film->video_frame_rate ())
);
list<shared_ptr<PlayerVideo> > pvf;
* _always_burn_subtitles is true; in this case, all subtitles will be returned.
*/
PlayerSubtitles
-Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt)
+Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, bool accurate)
{
list<shared_ptr<Piece> > subs = overlaps<SubtitleContent> (time, time + length);
/* XXX: this video_frame_rate() should be the rate that the subtitle content has been prepared for */
ContentTime const to = from + ContentTime::from_frames (1, _film->video_frame_rate ());
- list<ContentImageSubtitle> image = subtitle_decoder->get_image_subtitles (ContentTimePeriod (from, to), starting);
+ list<ContentImageSubtitle> image = subtitle_decoder->get_image_subtitles (ContentTimePeriod (from, to), starting, accurate);
for (list<ContentImageSubtitle>::iterator i = image.begin(); i != image.end(); ++i) {
/* Apply content's subtitle offsets */
ps.image.push_back (i->sub);
}
- list<ContentTextSubtitle> text = subtitle_decoder->get_text_subtitles (ContentTimePeriod (from, to), starting);
+ list<ContentTextSubtitle> text = subtitle_decoder->get_text_subtitles (ContentTimePeriod (from, to), starting, accurate);
BOOST_FOREACH (ContentTextSubtitle& ts, text) {
BOOST_FOREACH (dcp::SubtitleString s, ts.subs) {
s.set_h_position (s.h_position() + subtitle_content->subtitle_x_offset ());
if (!j) {
continue;
}
- DCPDecoder decoder (j, false);
+
+ scoped_ptr<DCPDecoder> decoder;
+ try {
+ decoder.reset (new DCPDecoder (j, false));
+ } catch (...) {
+ return a;
+ }
+
int64_t offset = 0;
- BOOST_FOREACH (shared_ptr<dcp::Reel> k, decoder.reels()) {
+ BOOST_FOREACH (shared_ptr<dcp::Reel> k, decoder->reels()) {
DCPTime const from = i->position() + DCPTime::from_frames (offset, _film->video_frame_rate());
if (j->reference_video ()) {
a.push_back (
}
if (j->reference_subtitle ()) {
+ DCPOMATIC_ASSERT (k->main_subtitle ());
a.push_back (
ReferencedReelAsset (
k->main_subtitle (),