X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fmixer.cpp;h=b3e60feba560a261d25e63b2fc2fc42c99505bc3;hb=HEAD;hp=736ceb22f6f98713a76e90361f9f0e4abeaeb178;hpb=9400e0e0e057e5dd2165401d729a500ef476f356;p=nageru diff --git a/nageru/mixer.cpp b/nageru/mixer.cpp index 736ceb2..b986ed5 100644 --- a/nageru/mixer.cpp +++ b/nageru/mixer.cpp @@ -1,9 +1,16 @@ -#undef Success - #include "mixer.h" +#include +#include #include +#include +#include #include +#include +#include +#include +#include +#include #include #include #include @@ -11,19 +18,21 @@ #include #include #include +#include +#include +#include +#include +#include #include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include #include #include #include @@ -31,6 +40,7 @@ #include "DeckLinkAPI.h" #include "LinuxCOM.h" #include "alsa_output.h" +#include "audio_mixer.h" #include "basic_stats.h" #include "bmusb/bmusb.h" #include "bmusb/fake_capture.h" @@ -39,27 +49,33 @@ #undef LOG_WARNING #include "cef_capture.h" #endif +#include "card_type.h" #include "chroma_subsampler.h" -#include "shared/context.h" #include "decklink_capture.h" #include "decklink_output.h" #include "decklink_util.h" #include "defs.h" -#include "shared/disk_space_estimator.h" #include "ffmpeg_capture.h" #include "flags.h" #include "image_input.h" #include "input_mapping.h" -#include "shared/metrics.h" -#include "shared/va_display.h" +#include "input_state.h" +#include "libusb.h" #include "mjpeg_encoder.h" #include "pbo_frame_allocator.h" -#include "shared/ref_counted_gl_sync.h" +#include "queue_length_policy.h" #include "resampling_queue.h" +#include "shared/context.h" +#include "shared/disk_space_estimator.h" +#include "shared/metrics.h" +#include "shared/ref_counted_gl_sync.h" +#include "shared/shared_defs.h" #include "shared/timebase.h" +#include "theme.h" #include "timecode_renderer.h" #include "v210_converter.h" #include "video_encoder.h" +#include "ycbcr_interpretation.h" #undef Status #include @@ -393,7 +409,7 @@ Mixer::Mixer(const QSurfaceFormat &format) } // Must be instantiated after VideoEncoder has initialized global_flags.use_zerocopy. - theme.reset(new Theme(global_flags.theme_filename, global_flags.theme_dirs, resource_pool.get())); + theme.reset(new Theme(global_flags.theme_filename, global_flags.theme_dirs, resource_pool.get(), create_surface(format))); // Must be instantiated after the theme, as the theme decides the number of FFmpeg inputs. std::vector video_inputs = theme->get_video_inputs(); @@ -630,9 +646,6 @@ void Mixer::configure_card(unsigned card_index, CaptureInterface *capture, CardT card->frame_allocator->reconfigure(pixel_format, FRAME_SIZE, global_flags.width, global_flags.height, card_index, mjpeg_encoder.get()); } card->capture->set_video_frame_allocator(card->frame_allocator.get()); - if (card->surface == nullptr) { - card->surface = create_surface_with_same_format(mixer_surface); - } while (!card->new_frames.empty()) card->new_frames.pop_front(); card->last_timecode = -1; card->capture->set_pixel_format(pixel_format); @@ -796,7 +809,7 @@ int unwrap_timecode(uint16_t current_wrapped, int last) void Mixer::bm_frame(unsigned card_index, uint16_t timecode, FrameAllocator::Frame video_frame, size_t video_offset, VideoFormat video_format, - FrameAllocator::Frame audio_frame, size_t audio_offset, AudioFormat audio_format) + FrameAllocator::Frame audio_frame, size_t audio_offset, AudioFormat audio_format) { DeviceSpec device{InputSourceType::CAPTURE_CARD, card_index}; CaptureCard *card = &cards[card_index]; @@ -1597,7 +1610,7 @@ void Mixer::handle_hotplugged_cards() fprintf(stderr, "New SRT stream connected (%s), choosing slot %d.\n", stream_id.c_str(), free_card_index); } CaptureCard *card = &cards[free_card_index]; - FFmpegCapture *capture = new FFmpegCapture(sock, stream_id); + FFmpegCapture *capture = new FFmpegCapture(sock, stream_id, create_surface_with_same_format(mixer_surface)); capture->set_card_index(free_card_index); configure_card(free_card_index, capture, CardType::FFMPEG_INPUT, /*output=*/nullptr, /*is_srt_card=*/true); card->srt_metrics.update_srt_stats(sock); // Initial zero stats.