@@ -572,7 +572,7 @@ std::shared_ptr<Frame> Timeline::apply_effects(std::shared_ptr<Frame> frame, int
572572}
573573
574574// Get or generate a blank frame
575- std::shared_ptr<Frame> Timeline::GetOrCreateFrame (std::shared_ptr<Frame> background_frame, Clip* clip, int64_t number)
575+ std::shared_ptr<Frame> Timeline::GetOrCreateFrame (std::shared_ptr<Frame> background_frame, Clip* clip, int64_t number, openshot::TimelineInfoStruct* options )
576576{
577577 std::shared_ptr<Frame> new_frame;
578578
@@ -584,7 +584,7 @@ std::shared_ptr<Frame> Timeline::GetOrCreateFrame(std::shared_ptr<Frame> backgro
584584 ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::GetOrCreateFrame (from reader)" , " number" , number, " samples_in_frame" , samples_in_frame);
585585
586586 // Attempt to get a frame (but this could fail if a reader has just been closed)
587- new_frame = std::shared_ptr<Frame>(clip->GetFrame (background_frame, number));
587+ new_frame = std::shared_ptr<Frame>(clip->GetFrame (background_frame, number, options ));
588588
589589 // Return real frame
590590 return new_frame;
@@ -603,29 +603,28 @@ std::shared_ptr<Frame> Timeline::GetOrCreateFrame(std::shared_ptr<Frame> backgro
603603}
604604
605605// Process a new layer of video or audio
606- void Timeline::add_layer (std::shared_ptr<Frame> new_frame, Clip* source_clip, int64_t clip_frame_number, int64_t timeline_frame_number, bool is_top_clip, float max_volume)
606+ void Timeline::add_layer (std::shared_ptr<Frame> new_frame, Clip* source_clip, int64_t clip_frame_number, bool is_top_clip, float max_volume)
607607{
608- // Get the clip's frame, composited on top of the current timeline frame
608+ // Create timeline options (with details about this current frame request)
609+ TimelineInfoStruct* options = new TimelineInfoStruct ();
610+ options->is_top_clip = is_top_clip;
611+
612+ // Get the clip's frame, composited on top of the current timeline frame
609613 std::shared_ptr<Frame> source_frame;
610- source_frame = GetOrCreateFrame (new_frame, source_clip, clip_frame_number);
614+ source_frame = GetOrCreateFrame (new_frame, source_clip, clip_frame_number, options);
615+ delete options;
611616
612617 // No frame found... so bail
613618 if (!source_frame)
614619 return ;
615620
616621 // Debug output
617- ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::add_layer" , " new_frame->number" , new_frame->number , " clip_frame_number" , clip_frame_number, " timeline_frame_number" , timeline_frame_number);
618-
619- /* Apply effects to the source frame (if any). If multiple clips are overlapping, only process the
620- * effects on the top clip. */
621- if (is_top_clip) {
622- source_frame = apply_effects (source_frame, timeline_frame_number, source_clip->Layer ());
623- }
622+ ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::add_layer" , " new_frame->number" , new_frame->number , " clip_frame_number" , clip_frame_number);
624623
625624 /* COPY AUDIO - with correct volume */
626625 if (source_clip->Reader ()->info .has_audio ) {
627626 // Debug output
628- ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::add_layer (Copy Audio)" , " source_clip->Reader()->info.has_audio" , source_clip->Reader ()->info .has_audio , " source_frame->GetAudioChannelsCount()" , source_frame->GetAudioChannelsCount (), " info.channels" , info.channels , " clip_frame_number" , clip_frame_number, " timeline_frame_number " , timeline_frame_number );
627+ ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::add_layer (Copy Audio)" , " source_clip->Reader()->info.has_audio" , source_clip->Reader ()->info .has_audio , " source_frame->GetAudioChannelsCount()" , source_frame->GetAudioChannelsCount (), " info.channels" , info.channels , " clip_frame_number" , clip_frame_number);
629628
630629 if (source_frame->GetAudioChannelsCount () == info.channels && source_clip->has_audio .GetInt (clip_frame_number) != 0 )
631630 for (int channel = 0 ; channel < source_frame->GetAudioChannelsCount (); channel++)
@@ -678,7 +677,7 @@ void Timeline::add_layer(std::shared_ptr<Frame> new_frame, Clip* source_clip, in
678677 }
679678 else
680679 // Debug output
681- ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::add_layer (No Audio Copied - Wrong # of Channels)" , " source_clip->Reader()->info.has_audio" , source_clip->Reader ()->info .has_audio , " source_frame->GetAudioChannelsCount()" , source_frame->GetAudioChannelsCount (), " info.channels" , info.channels , " clip_frame_number" , clip_frame_number, " timeline_frame_number " , timeline_frame_number );
680+ ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::add_layer (No Audio Copied - Wrong # of Channels)" , " source_clip->Reader()->info.has_audio" , source_clip->Reader ()->info .has_audio , " source_frame->GetAudioChannelsCount()" , source_frame->GetAudioChannelsCount (), " info.channels" , info.channels , " clip_frame_number" , clip_frame_number);
682681 }
683682
684683 // Debug output
@@ -893,7 +892,7 @@ std::shared_ptr<Frame> Timeline::GetFrame(int64_t requested_frame)
893892 ZmqLogger::Instance ()->AppendDebugMethod (" Timeline::GetFrame (Calculate clip's frame #)" , " clip->Position()" , clip->Position (), " clip->Start()" , clip->Start (), " info.fps.ToFloat()" , info.fps .ToFloat (), " clip_frame_number" , clip_frame_number);
894893
895894 // Add clip's frame as layer
896- add_layer (new_frame, clip, clip_frame_number, requested_frame, is_top_clip, max_volume);
895+ add_layer (new_frame, clip, clip_frame_number, is_top_clip, max_volume);
897896
898897 } else {
899898 // Debug output
0 commit comments