25
25
#include " common/os/thread.h"
26
26
#include " config.h"
27
27
#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"
30
30
#include " monitor.h"
31
31
32
32
#include " ../decklink.h"
@@ -194,10 +194,10 @@ core::video_format_desc get_decklink_format(const port_configuration& confi
194
194
return fallback_format_desc;
195
195
}
196
196
197
- spl::shared_ptr<frame_factory> create_frame_factory (bool hdr)
197
+ spl::shared_ptr<format_strategy> create_format_strategy (bool hdr)
198
198
{
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 >();
201
201
}
202
202
203
203
enum EOTF
@@ -437,7 +437,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
437
437
{
438
438
const configuration config_;
439
439
const port_configuration output_config_;
440
- spl::shared_ptr<frame_factory > frame_factory_ ;
440
+ spl::shared_ptr<format_strategy > format_strategy_ ;
441
441
com_ptr<IDeckLink> decklink_ = get_device(output_config_.device_index);
442
442
com_iface_ptr<IDeckLinkOutput> output_ = iface_cast<IDeckLinkOutput>(decklink_);
443
443
com_iface_ptr<IDeckLinkKeyer> keyer_ = iface_cast<IDeckLinkKeyer>(decklink_, true );
@@ -454,7 +454,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
454
454
const core::video_format_desc decklink_format_desc_;
455
455
com_ptr<IDeckLinkDisplayMode> mode_ = get_display_mode(output_,
456
456
decklink_format_desc_.format,
457
- frame_factory_ ->get_pixel_format (),
457
+ format_strategy_ ->get_pixel_format (),
458
458
bmdSupportedVideoModeDefault);
459
459
460
460
decklink_secondary_port (const configuration& config,
@@ -465,7 +465,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
465
465
int device_sync_group)
466
466
: config_(config)
467
467
, output_config_(std::move(output_config))
468
- , frame_factory_ (new frame_factory_sdr_bgra ())
468
+ , format_strategy_ (new sdr_bgra_strategy ())
469
469
, device_sync_group_(device_sync_group)
470
470
, channel_format_desc_(std::move(channel_format_desc))
471
471
, decklink_format_desc_(get_decklink_format(output_config_, main_decklink_format_desc))
@@ -557,7 +557,7 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
557
557
frame1 = frame;
558
558
}
559
559
560
- auto image_data = frame_factory_ ->convert_frame_for_port (
560
+ auto image_data = format_strategy_ ->convert_frame_for_port (
561
561
channel_format_desc_, decklink_format_desc_, output_config_, frame1, frame2, mode_->GetFieldDominance ());
562
562
563
563
schedule_next_video (image_data, 0 , display_time);
@@ -569,8 +569,8 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
569
569
decklink_format_desc_,
570
570
nb_samples,
571
571
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 ),
574
574
core::color_space::bt709,
575
575
config_.hdr_meta ));
576
576
if (FAILED (output_->ScheduleVideoFrame (get_raw (packed_frame),
@@ -600,9 +600,9 @@ struct decklink_secondary_port final : public IDeckLinkVideoOutputCallback
600
600
601
601
struct decklink_consumer final : public IDeckLinkVideoOutputCallback
602
602
{
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_ ;
606
606
607
607
com_ptr<IDeckLink> decklink_ = get_device(config_.primary.device_index);
608
608
com_iface_ptr<IDeckLinkOutput> output_ = iface_cast<IDeckLinkOutput>(decklink_);
@@ -638,7 +638,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
638
638
639
639
com_ptr<IDeckLinkDisplayMode> mode_ = get_display_mode(output_,
640
640
decklink_format_desc_.format,
641
- frame_factory_ ->get_pixel_format (),
641
+ format_strategy_ ->get_pixel_format (),
642
642
bmdSupportedVideoModeDefault);
643
643
644
644
std::atomic<bool > abort_request_{false };
@@ -647,7 +647,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
647
647
decklink_consumer (const configuration& config, core::video_format_desc channel_format_desc, int channel_index)
648
648
: channel_index_(channel_index)
649
649
, config_(config)
650
- , frame_factory_(create_frame_factory (config.hdr))
650
+ , format_strategy_(create_format_strategy (config.hdr))
651
651
, channel_format_desc_(std::move(channel_format_desc))
652
652
, decklink_format_desc_(get_decklink_format(config.primary, channel_format_desc_))
653
653
{
@@ -726,7 +726,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
726
726
nb_samples);
727
727
}
728
728
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_);
730
730
731
731
schedule_next_video (image_data, nb_samples, video_scheduled_, config_.hdr_meta .default_color_space );
732
732
for (auto & context : secondary_port_contexts_) {
@@ -943,7 +943,7 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
943
943
if (i == -1 ) {
944
944
// Primary port
945
945
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_,
947
947
decklink_format_desc_,
948
948
config_.primary ,
949
949
frame1,
@@ -1016,8 +1016,8 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
1016
1016
BMDTimeValue display_time,
1017
1017
core::color_space color_space)
1018
1018
{
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 );
1021
1021
auto fill_frame = wrap_raw<com_ptr, IDeckLinkVideoFrame>(new decklink_frame (
1022
1022
std::move (image_data), decklink_format_desc_, nb_samples, config_.hdr , fmt, row_bytes, color_space, config_.hdr_meta ));
1023
1023
if (FAILED (output_->ScheduleVideoFrame (
0 commit comments