X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_capture.h;fp=ffmpeg_capture.h;h=e20f24cb5f6fdd965ac19eb5826c8b6085f6f035;hb=8cefe0ef1926be7931d4a9bbfed93ee6e85f3540;hp=82ccfaf5a97aa810cbedab56c4690b2d1ff0f868;hpb=76cd2ae1efce0907f44ddc948391b2cff0ecc0e0;p=nageru diff --git a/ffmpeg_capture.h b/ffmpeg_capture.h index 82ccfaf..e20f24c 100644 --- a/ffmpeg_capture.h +++ b/ffmpeg_capture.h @@ -29,6 +29,8 @@ #include #include +#include + #include "bmusb/bmusb.h" #include "quittable_sleeper.h" @@ -93,6 +95,14 @@ public: frame_callback = callback; } + // Used to get precise information about the Y'CbCr format used + // for a given frame. Only valid to call during the frame callback, + // and only when receiving a frame with pixel format PixelFormat_8BitYCbCrPlanar. + movit::YCbCrFormat get_current_frame_ycbcr_format() const + { + return current_frame_ycbcr_format; + } + void set_dequeue_thread_callbacks(std::function init, std::function cleanup) override { dequeue_init_callback = init; @@ -115,13 +125,13 @@ public: uint32_t get_current_video_mode() const override { return 0; } std::set get_available_pixel_formats() const override { - return std::set{ bmusb::PixelFormat_8BitBGRA }; + return std::set{ bmusb::PixelFormat_8BitBGRA, bmusb::PixelFormat_8BitYCbCrPlanar }; } void set_pixel_format(bmusb::PixelFormat pixel_format) override { - assert(pixel_format == bmusb::PixelFormat_8BitBGRA); + this->pixel_format = pixel_format; } bmusb::PixelFormat get_current_pixel_format() const override { - return bmusb::PixelFormat_8BitBGRA; + return pixel_format; } std::map get_available_video_inputs() const override { @@ -144,6 +154,8 @@ private: std::string description, filename; uint16_t timecode = 0; unsigned width, height; + bmusb::PixelFormat pixel_format = bmusb::PixelFormat_8BitBGRA; + movit::YCbCrFormat current_frame_ycbcr_format; bool running = false; int card_index = -1;