]> git.sesse.net Git - nageru/blobdiff - mixer.h
Release Nageru 1.7.2.
[nageru] / mixer.h
diff --git a/mixer.h b/mixer.h
index adfb7cf361f24ea22554c3deab545cbd9de87ad5..d1bf79519452113a49183e7539596f6c96600010 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -288,8 +288,8 @@ public:
        }
 
        // Note: You can also get this through the global variable global_audio_mixer.
-       AudioMixer *get_audio_mixer() { return &audio_mixer; }
-       const AudioMixer *get_audio_mixer() const { return &audio_mixer; }
+       AudioMixer *get_audio_mixer() { return audio_mixer.get(); }
+       const AudioMixer *get_audio_mixer() const { return audio_mixer.get(); }
 
        void schedule_cut()
        {
@@ -322,6 +322,11 @@ public:
                return cards[card_index].output != nullptr;
        }
 
+       bool card_is_ffmpeg(unsigned card_index) const {
+               assert(card_index < num_cards + num_video_inputs);
+               return cards[card_index].type == CardType::FFMPEG_INPUT;
+       }
+
        std::map<uint32_t, bmusb::VideoMode> get_available_video_modes(unsigned card_index) const {
                assert(card_index < num_cards);
                return cards[card_index].capture->get_available_video_modes();
@@ -369,6 +374,10 @@ public:
                cards[card_index].capture->set_audio_input(input);
        }
 
+       std::string get_ffmpeg_filename(unsigned card_index) const;
+
+       void set_ffmpeg_filename(unsigned card_index, const std::string &filename);
+
        void change_x264_bitrate(unsigned rate_kbit) {
                video_encoder->change_x264_bitrate(rate_kbit);
        }
@@ -412,6 +421,8 @@ public:
                theme->set_theme_menu_callback(callback);
        }
 
+       void wait_for_next_frame();
+
 private:
        struct CaptureCard;
 
@@ -473,7 +484,10 @@ private:
        movit::YCbCrInput *display_input;
 
        int64_t pts_int = 0;  // In TIMEBASE units.
-       unsigned frame_num = 0;
+
+       mutable std::mutex frame_num_mutex;
+       std::condition_variable frame_num_updated;
+       unsigned frame_num = 0;  // Under <frame_num_mutex>.
 
        // Accumulated errors in number of 1/TIMEBASE audio samples. If OUTPUT_FREQUENCY divided by
        // frame rate is integer, will always stay zero.
@@ -548,7 +562,7 @@ private:
        JitterHistory output_jitter_history;
        CaptureCard cards[MAX_VIDEO_CARDS];  // Protected by <card_mutex>.
        YCbCrInterpretation ycbcr_interpretation[MAX_VIDEO_CARDS];  // Protected by <card_mutex>.
-       AudioMixer audio_mixer;  // Same as global_audio_mixer (see audio_mixer.h).
+       std::unique_ptr<AudioMixer> audio_mixer;  // Same as global_audio_mixer (see audio_mixer.h).
        bool input_card_is_master_clock(unsigned card_index, unsigned master_card_index) const;
        struct OutputFrameInfo {
                int dropped_frames;  // Since last frame.