X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_capture.h;h=05e92e21fec5bfecd75fdcfddeee1ea7365a7c86;hb=14dc6f7ef9dd76cba75ffe7499d9a81d66c7b152;hp=24e6b5b40d3f9b780e71facdb7fb0dc347e5723c;hpb=f07adb19f0e2571bf4894ec57e6fcfe4a3e5fd95;p=nageru diff --git a/ffmpeg_capture.h b/ffmpeg_capture.h index 24e6b5b..05e92e2 100644 --- a/ffmpeg_capture.h +++ b/ffmpeg_capture.h @@ -17,8 +17,7 @@ // CPU conversion), but it would require some more plumbing, and it would also // fail if the file changes parameters midway, which is allowed in some formats. // -// There is currently no audio support. There is also no support for changing -// the video underway (unlike images), although there really should be. +// There is currently no audio support. #include #include @@ -109,22 +108,20 @@ public: void configure_card() override; void start_bm_capture() override; void stop_dequeue_thread() override; - - // TODO: Specify error status through this. - bool get_disconnected() const override { return false; } + bool get_disconnected() const override { return false; } // We never unplug. std::map get_available_video_modes() const; void set_video_mode(uint32_t video_mode_id) override {} // Ignore. uint32_t get_current_video_mode() const override { return 0; } std::set get_available_pixel_formats() const override { - return std::set{ bmusb::PixelFormat_8BitRGBA }; + return std::set{ bmusb::PixelFormat_8BitBGRA }; } void set_pixel_format(bmusb::PixelFormat pixel_format) override { - assert(pixel_format == bmusb::PixelFormat_8BitRGBA); + assert(pixel_format == bmusb::PixelFormat_8BitBGRA); } bmusb::PixelFormat get_current_pixel_format() const override { - return bmusb::PixelFormat_8BitRGBA; + return bmusb::PixelFormat_8BitBGRA; } std::map get_available_video_inputs() const override { @@ -140,7 +137,9 @@ public: private: void producer_thread_func(); + void send_disconnected_frame(); bool play_video(const std::string &pathname); + void internal_rewind(); std::string description, filename; uint16_t timecode = 0; @@ -161,6 +160,9 @@ private: QuittableSleeper producer_thread_should_quit; std::thread producer_thread; + int64_t pts_origin, last_pts; + std::chrono::steady_clock::time_point start, next_frame_start; + std::mutex queue_mu; struct QueuedCommand { enum Command { REWIND, CHANGE_RATE } command;