2525#include " common/os/thread.h"
2626#include " config.h"
2727#include " decklink_consumer.h"
28- #include " frame_factory_hdr_v210 .h"
29- #include " frame_factory_sdr_bgra .h"
28+ #include " hdr_v210_strategy .h"
29+ #include " sdr_bgra_strategy .h"
3030#include " monitor.h"
3131
3232#include " ../decklink.h"
@@ -194,10 +194,10 @@ core::video_format_desc get_decklink_format(const port_configuration& confi
194194 return fallback_format_desc;
195195}
196196
197- spl::shared_ptr<frame_factory> create_frame_factory (bool hdr)
197+ spl::shared_ptr<format_strategy> create_format_strategy (bool hdr)
198198{
199- return hdr ? spl::make_shared<frame_factory, frame_factory_hdr_v210 >()
200- : spl::make_shared<frame_factory, frame_factory_sdr_bgra >();
199+ return hdr ? spl::make_shared<format_strategy, hdr_v210_strategy >()
200+ : spl::make_shared<format_strategy, sdr_bgra_strategy >();
201201}
202202
203203enum EOTF
@@ -437,7 +437,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
437437{
438438 const configuration config_;
439439 const port_configuration output_config_;
440- spl::shared_ptr<frame_factory > frame_factory_ ;
440+ spl::shared_ptr<format_strategy > format_strategy_ ;
441441 com_ptr<IDeckLink> decklink_ = get_device(output_config_.device_index);
442442 com_iface_ptr<IDeckLinkOutput> output_ = iface_cast<IDeckLinkOutput>(decklink_);
443443 com_iface_ptr<IDeckLinkKeyer> keyer_ = iface_cast<IDeckLinkKeyer>(decklink_, true );
@@ -454,7 +454,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
454454 const core::video_format_desc decklink_format_desc_;
455455 com_ptr<IDeckLinkDisplayMode> mode_ = get_display_mode(output_,
456456 decklink_format_desc_.format,
457- frame_factory_ ->get_pixel_format (),
457+ format_strategy_ ->get_pixel_format (),
458458 bmdSupportedVideoModeDefault);
459459
460460 decklink_secondary_port (const configuration& config,
@@ -465,7 +465,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
465465 int device_sync_group)
466466 : config_(config)
467467 , output_config_(std::move(output_config))
468- , frame_factory_ (new frame_factory_sdr_bgra ())
468+ , format_strategy_ (new sdr_bgra_strategy ())
469469 , device_sync_group_(device_sync_group)
470470 , channel_format_desc_(std::move(channel_format_desc))
471471 , decklink_format_desc_(get_decklink_format(output_config_, main_decklink_format_desc))
@@ -557,7 +557,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
557557 frame1 = frame;
558558 }
559559
560- auto image_data = frame_factory_ ->convert_frame_for_port (
560+ auto image_data = format_strategy_ ->convert_frame_for_port (
561561 channel_format_desc_, decklink_format_desc_, output_config_, frame1, frame2, mode_->GetFieldDominance ());
562562
563563 schedule_next_video (image_data, 0 , display_time);
@@ -569,8 +569,8 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
569569 decklink_format_desc_,
570570 nb_samples,
571571 config_.hdr ,
572- frame_factory_ ->get_pixel_format (),
573- frame_factory_ ->get_row_bytes (decklink_format_desc_.width ),
572+ format_strategy_ ->get_pixel_format (),
573+ format_strategy_ ->get_row_bytes (decklink_format_desc_.width ),
574574 core::color_space::bt709,
575575 config_.hdr_meta ));
576576 if (FAILED (output_->ScheduleVideoFrame (get_raw (packed_frame),
@@ -600,9 +600,9 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
600600
601601struct decklink_consumer final : public IDeckLinkVideoOutputCallback
602602{
603- const int channel_index_;
604- const configuration config_;
605- spl::shared_ptr<frame_factory> frame_factory_ ;
603+ const int channel_index_;
604+ const configuration config_;
605+ spl::shared_ptr<format_strategy> format_strategy_ ;
606606
607607 com_ptr<IDeckLink> decklink_ = get_device(config_.primary.device_index);
608608 com_iface_ptr<IDeckLinkOutput> output_ = iface_cast<IDeckLinkOutput>(decklink_);
@@ -638,7 +638,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
638638
639639 com_ptr<IDeckLinkDisplayMode> mode_ = get_display_mode(output_,
640640 decklink_format_desc_.format,
641- frame_factory_ ->get_pixel_format (),
641+ format_strategy_ ->get_pixel_format (),
642642 bmdSupportedVideoModeDefault);
643643
644644 std::atomic<bool > abort_request_{false };
@@ -647,7 +647,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
647647 decklink_consumer (const configuration& config, core::video_format_desc channel_format_desc, int channel_index)
648648 : channel_index_(channel_index)
649649 , config_(config)
650- , frame_factory_(create_frame_factory (config.hdr))
650+ , format_strategy_(create_format_strategy (config.hdr))
651651 , channel_format_desc_(std::move(channel_format_desc))
652652 , decklink_format_desc_(get_decklink_format(config.primary, channel_format_desc_))
653653 {
@@ -726,7 +726,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
726726 nb_samples);
727727 }
728728
729- std::shared_ptr<void > image_data = frame_factory_ ->allocate_frame_data (decklink_format_desc_);
729+ std::shared_ptr<void > image_data = format_strategy_ ->allocate_frame_data (decklink_format_desc_);
730730
731731 schedule_next_video (image_data, nb_samples, video_scheduled_, config_.hdr_meta .default_color_space );
732732 for (auto & context : secondary_port_contexts_) {
@@ -943,7 +943,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
943943 if (i == -1 ) {
944944 // Primary port
945945 std::shared_ptr<void > image_data =
946- frame_factory_ ->convert_frame_for_port (channel_format_desc_,
946+ format_strategy_ ->convert_frame_for_port (channel_format_desc_,
947947 decklink_format_desc_,
948948 config_.primary ,
949949 frame1,
@@ -1016,8 +1016,8 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
10161016 BMDTimeValue display_time,
10171017 core::color_space color_space)
10181018 {
1019- auto fmt = frame_factory_ ->get_pixel_format ();
1020- auto row_bytes = frame_factory_ ->get_row_bytes (decklink_format_desc_.width );
1019+ auto fmt = format_strategy_ ->get_pixel_format ();
1020+ auto row_bytes = format_strategy_ ->get_row_bytes (decklink_format_desc_.width );
10211021 auto fill_frame = wrap_raw<com_ptr, IDeckLinkVideoFrame>(new decklink_frame (
10221022 std::move (image_data), decklink_format_desc_, nb_samples, config_.hdr , fmt, row_bytes, color_space, config_.hdr_meta ));
10231023 if (FAILED (output_->ScheduleVideoFrame (
0 commit comments