]> git.sesse.net Git - nageru/blobdiff - nageru/ffmpeg_capture.h
When hot-unplugging capture cards, actually allow making them inactive.
[nageru] / nageru / ffmpeg_capture.h
index 685191a1f28bf9f463773fccb9abe3858c46b86d..1fc8f7128f516d6b4d06431b3049256f7bbdf7f7 100644 (file)
@@ -213,6 +213,7 @@ public:
        void start_bm_capture() override;
        void stop_dequeue_thread() override;
        bool get_disconnected() const override { return disconnected; }  // Only if play_once == true.
+       int get_srt_sock() const { return srt_sock; }
 
        std::map<uint32_t, bmusb::VideoMode> get_available_video_modes() const override;
        void set_video_mode(uint32_t video_mode_id) override {}  // Ignore.
@@ -266,11 +267,14 @@ private:
        int read_srt(uint8_t *buf, int buf_size);
 #endif
 
+       inline unsigned frame_width(const AVFrame *frame) const;
+       inline unsigned frame_height(const AVFrame *frame) const;
+
        mutable std::mutex filename_mu;
        std::string description, filename;
        int srt_sock = -1;
        uint16_t timecode = 0;
-       unsigned width, height;
+       unsigned width, height;  // 0 means keep input size.
        bmusb::PixelFormat pixel_format = bmusb::PixelFormat_8BitBGRA;
        movit::YCbCrFormat current_frame_ycbcr_format;
        bool running = false;
@@ -325,6 +329,11 @@ private:
        std::string last_subtitle;
 
        movit::RGBTriplet last_neutral_color{1.0f, 1.0f, 1.0f};
+
+       // Used for suppressing repeated warnings. Reset when a video starts playing.
+       // -1 is strictly speaking outside the range of the enum, but hopefully, it will be alright.
+       AVColorSpace last_colorspace = static_cast<AVColorSpace>(-1);
+       AVChromaLocation last_chroma_location = static_cast<AVChromaLocation>(-1);
 };
 
 #endif  // !defined(_FFMPEG_CAPTURE_H)