continue;
}
- shared_ptr<Decoder> decoder = decoder_factory (i, _film->log());
+ shared_ptr<Decoder> decoder = decoder_factory (i, _film->log(), _fast);
FrameRateChange frc (i->active_video_frame_rate(), _film->video_frame_rate());
if (!decoder) {
}
}
+ _stream_states.clear ();
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
if (i->content->audio) {
BOOST_FOREACH (AudioStreamPtr j, i->content->audio->streams()) {
property == DCPContentProperty::NEEDS_ASSETS ||
property == DCPContentProperty::NEEDS_KDM ||
property == SubtitleContentProperty::COLOUR ||
- property == SubtitleContentProperty::OUTLINE ||
- property == SubtitleContentProperty::SHADOW ||
+ property == SubtitleContentProperty::EFFECT ||
property == SubtitleContentProperty::EFFECT_COLOUR ||
property == FFmpegContentProperty::SUBTITLE_STREAM ||
+ property == FFmpegContentProperty::FILTERS ||
property == VideoContentProperty::COLOUR_CONVERSION
) {
Player::content_video_to_dcp (shared_ptr<const Piece> piece, Frame f) const
{
/* See comment in dcp_to_content_video */
- DCPTime const d = DCPTime::from_frames (f * piece->frc.factor(), piece->frc.dcp) - DCPTime (piece->content->trim_start (), piece->frc);
- return max (DCPTime (), d + piece->content->position ());
+ DCPTime const d = DCPTime::from_frames (f * piece->frc.factor(), piece->frc.dcp) - DCPTime(piece->content->trim_start(), piece->frc);
+ return d + piece->content->position();
}
Frame
_always_burn_subtitles = burn;
}
+/** Sets up the player to be faster, possibly at the expense of quality */
void
Player::set_fast ()
{
scoped_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (j, _film->log()));
+ decoder.reset (new DCPDecoder (j, _film->log(), false));
} catch (...) {
return a;
}
optional<DCPTime> earliest_time;
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
- if (!i->done) {
- DCPTime const t = content_time_to_dcp (i, i->decoder->position());
+ if (i->done) {
+ continue;
+ }
+
+ DCPTime const t = content_time_to_dcp (i, i->decoder->position());
+ if (t > i->content->end()) {
+ i->done = true;
+ } else {
/* Given two choices at the same time, pick the one with a subtitle so we see it before
the video.
*/
return merge (subtitles);
}
-bool
+void
Player::video (weak_ptr<Piece> wp, ContentVideo video)
{
shared_ptr<Piece> piece = wp.lock ();
if (!piece) {
- return false;
+ return;
}
FrameRateChange frc(piece->content->active_video_frame_rate(), _film->video_frame_rate());
if (frc.skip && (video.frame % 2) == 1) {
- return false;
+ return;
}
/* Time of the first frame we will emit */
time < piece->content->position() ||
time >= piece->content->end() ||
(_last_video_time && time < *_last_video_time)) {
- return false;
+ return;
}
/* Fill gaps that we discover now that we have some video which needs to be emitted */
emit_video (_last_video[wp], t);
t += one_video_frame ();
}
-
- return true;
}
-Frame
+void
Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_audio)
{
DCPOMATIC_ASSERT (content_audio.audio->frames() > 0);
shared_ptr<Piece> piece = wp.lock ();
if (!piece) {
- return 0;
+ return;
}
shared_ptr<AudioContent> content = piece->content->audio;
pair<shared_ptr<AudioBuffers>, DCPTime> cut = discard_audio (content_audio.audio, time, piece->content->position());
if (!cut.first) {
/* This audio is entirely discarded */
- return 0;
+ return;
}
content_audio.audio = cut.first;
time = cut.second;
} else if (time > piece->content->end()) {
/* Discard it all */
- return 0;
+ return;
} else if (end > piece->content->end()) {
Frame const remaining_frames = DCPTime(piece->content->end() - time).frames_round(_film->audio_frame_rate());
if (remaining_frames == 0) {
- return 0;
+ return;
}
shared_ptr<AudioBuffers> cut (new AudioBuffers (content_audio.audio->channels(), remaining_frames));
cut->copy_from (content_audio.audio.get(), remaining_frames, 0, 0);
_audio_merger.push (content_audio.audio, time);
DCPOMATIC_ASSERT (_stream_states.find (stream) != _stream_states.end ());
_stream_states[stream].last_push_end = time + DCPTime::from_frames (content_audio.audio->frames(), _film->audio_frame_rate());
- return content_audio.audio->frames();
}
void