]> git.sesse.net Git - casparcg/blobdiff - modules/decklink/producer/decklink_producer.cpp
[ffmpeg] Remove usage of deprecated API usage to easier support a newer version of...
[casparcg] / modules / decklink / producer / decklink_producer.cpp
index e08b3a6d5d52462f1051eabcf75f666dd3ff9780..a6ead70661933b9bf96cc44f518ccd0ff0bc96da 100644 (file)
@@ -113,7 +113,15 @@ class decklink_producer : boost::noncopyable, public IDeckLinkInputCallback
        boost::circular_buffer<size_t>                                  sync_buffer_            { audio_cadence_.size() };
        spl::shared_ptr<core::frame_factory>                    frame_factory_;
        core::audio_channel_layout                                              channel_layout_;
-       ffmpeg::frame_muxer                                                             muxer_                          { in_format_desc_.framerate, frame_factory_, out_format_desc_, channel_layout_, filter_, ffmpeg::filter::is_deinterlacing(filter_) };
+       ffmpeg::frame_muxer                                                             muxer_                          {
+                                                                                                                                                       in_format_desc_.framerate,
+                                                                                                                                                       { ffmpeg::create_input_pad(in_format_desc_, channel_layout_.num_channels) },
+                                                                                                                                                       frame_factory_,
+                                                                                                                                                       out_format_desc_,
+                                                                                                                                                       channel_layout_,
+                                                                                                                                                       filter_,
+                                                                                                                                                       ffmpeg::filter::is_deinterlacing(filter_)
+                                                                                                                                               };
 
        core::constraints                                                               constraints_            { in_format_desc_.width, in_format_desc_.height };
 
@@ -171,6 +179,12 @@ public:
                                                                        << msg_info(print() + L" Failed to start input stream.")
                                                                        << boost::errinfo_api_function("StartStreams"));
 
+               // Wait for first frame until returning or give up after 2 seconds.
+               caspar::timer timeout_timer;
+
+               while (frame_buffer_.size() < 1 && timeout_timer.elapsed() < 2.0)
+                       boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
+
                CASPAR_LOG(info) << print() << L" Initialized";
        }
 
@@ -220,7 +234,7 @@ public:
 
                        video_frame->data[0]                    = reinterpret_cast<uint8_t*>(video_bytes);
                        video_frame->linesize[0]                = video->GetRowBytes();
-                       video_frame->format                             = PIX_FMT_UYVY422;
+                       video_frame->format                             = AVPixelFormat::AV_PIX_FMT_UYVY422;
                        video_frame->width                              = video->GetWidth();
                        video_frame->height                             = video->GetHeight();
                        video_frame->interlaced_frame   = in_format_desc_.field_mode != core::field_mode::progressive;
@@ -269,7 +283,7 @@ public:
 
                        // PUSH
 
-                       muxer_.push(audio_buffer);
+                       muxer_.push({ audio_buffer });
                        muxer_.push(static_cast<std::shared_ptr<AVFrame>>(video_frame));
 
                        // POLL