mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
cellCamera: fix qt camera handler format
This commit is contained in:
parent
9a6285942b
commit
67ba381dfe
@ -1692,6 +1692,7 @@ error_code camera_context::start_camera()
|
|||||||
handler->set_mirrored(!!attr[CELL_CAMERA_MIRRORFLAG].v1);
|
handler->set_mirrored(!!attr[CELL_CAMERA_MIRRORFLAG].v1);
|
||||||
handler->set_frame_rate(info.framerate);
|
handler->set_frame_rate(info.framerate);
|
||||||
handler->set_resolution(info.width, info.height);
|
handler->set_resolution(info.width, info.height);
|
||||||
|
handler->set_format(info.format, info.bytesize);
|
||||||
|
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ public:
|
|||||||
void start_camera() override { m_state = camera_handler_state::running; };
|
void start_camera() override { m_state = camera_handler_state::running; };
|
||||||
void stop_camera() override { m_state = camera_handler_state::open; };
|
void stop_camera() override { m_state = camera_handler_state::open; };
|
||||||
|
|
||||||
void set_format(s32 format, u32 bytes_per_pixel) override
|
void set_format(s32 format, u32 bytesize) override
|
||||||
{
|
{
|
||||||
m_format = format;
|
m_format = format;
|
||||||
m_bytes_per_pixel = bytes_per_pixel;
|
m_bytesize = bytesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_frame_rate(u32 frame_rate) override
|
void set_frame_rate(u32 frame_rate) override
|
||||||
|
@ -36,7 +36,7 @@ protected:
|
|||||||
atomic_t<camera_handler_state> m_state = camera_handler_state::not_available;
|
atomic_t<camera_handler_state> m_state = camera_handler_state::not_available;
|
||||||
bool m_mirrored = false;
|
bool m_mirrored = false;
|
||||||
s32 m_format = 2; // CELL_CAMERA_RAW8
|
s32 m_format = 2; // CELL_CAMERA_RAW8
|
||||||
u32 m_bytes_per_pixel = 1;
|
u32 m_bytesize = 0;
|
||||||
u32 m_width = 640;
|
u32 m_width = 640;
|
||||||
u32 m_height = 480;
|
u32 m_height = 480;
|
||||||
u32 m_frame_rate = 30;
|
u32 m_frame_rate = 30;
|
||||||
|
@ -181,10 +181,10 @@ void qt_camera_handler::stop_camera()
|
|||||||
m_camera->stop();
|
m_camera->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qt_camera_handler::set_format(s32 format, u32 bytes_per_pixel)
|
void qt_camera_handler::set_format(s32 format, u32 bytesize)
|
||||||
{
|
{
|
||||||
m_format = format;
|
m_format = format;
|
||||||
m_bytes_per_pixel = bytes_per_pixel;
|
m_bytesize = bytesize;
|
||||||
|
|
||||||
update_camera_settings();
|
update_camera_settings();
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ void qt_camera_handler::update_camera_settings()
|
|||||||
if (m_surface)
|
if (m_surface)
|
||||||
{
|
{
|
||||||
m_surface->set_resolution(m_width, m_height);
|
m_surface->set_resolution(m_width, m_height);
|
||||||
m_surface->set_format(m_format, m_bytes_per_pixel);
|
m_surface->set_format(m_format, m_bytesize);
|
||||||
m_surface->set_mirrored(m_mirrored);
|
m_surface->set_mirrored(m_mirrored);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public:
|
|||||||
void close_camera() override;
|
void close_camera() override;
|
||||||
void start_camera() override;
|
void start_camera() override;
|
||||||
void stop_camera() override;
|
void stop_camera() override;
|
||||||
void set_format(s32 format, u32 bytes_per_pixel) override;
|
void set_format(s32 format, u32 bytesize) override;
|
||||||
void set_frame_rate(u32 frame_rate) override;
|
void set_frame_rate(u32 frame_rate) override;
|
||||||
void set_resolution(u32 width, u32 height) override;
|
void set_resolution(u32 width, u32 height) override;
|
||||||
void set_mirrored(bool mirrored) override;
|
void set_mirrored(bool mirrored) override;
|
||||||
|
@ -93,7 +93,7 @@ bool qt_camera_video_surface::present(const QVideoFrame& frame)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const u64 new_size = m_width * m_height * m_bytes_per_pixel;
|
const u64 new_size = m_bytesize;
|
||||||
image_buffer& image_buffer = m_image_buffer[m_write_index];
|
image_buffer& image_buffer = m_image_buffer[m_write_index];
|
||||||
|
|
||||||
// Reset buffer if necessary
|
// Reset buffer if necessary
|
||||||
@ -226,8 +226,8 @@ bool qt_camera_video_surface::present(const QVideoFrame& frame)
|
|||||||
// Unmap frame memory
|
// Unmap frame memory
|
||||||
tmp.unmap();
|
tmp.unmap();
|
||||||
|
|
||||||
camera_log.trace("Wrote image to video surface. index=%d, m_frame_number=%d, width=%d, height=%d, bytes_per_pixel=%d",
|
camera_log.trace("Wrote image to video surface. index=%d, m_frame_number=%d, width=%d, height=%d, bytesize=%d",
|
||||||
m_write_index, m_frame_number.load(), m_width, m_height, m_bytes_per_pixel);
|
m_write_index, m_frame_number.load(), m_width, m_height, m_bytesize);
|
||||||
|
|
||||||
// Toggle write/read index
|
// Toggle write/read index
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
@ -237,12 +237,12 @@ bool qt_camera_video_surface::present(const QVideoFrame& frame)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qt_camera_video_surface::set_format(s32 format, u32 bytes_per_pixel)
|
void qt_camera_video_surface::set_format(s32 format, u32 bytesize)
|
||||||
{
|
{
|
||||||
camera_log.notice("Setting format: format=%d, bytes_per_pixel=%d", format, bytes_per_pixel);
|
camera_log.notice("Setting format: format=%d, bytesize=%d", format, bytesize);
|
||||||
|
|
||||||
m_format = format;
|
m_format = format;
|
||||||
m_bytes_per_pixel = bytes_per_pixel;
|
m_bytesize = bytesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qt_camera_video_surface::set_resolution(u32 width, u32 height)
|
void qt_camera_video_surface::set_resolution(u32 width, u32 height)
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const override;
|
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const override;
|
||||||
bool present(const QVideoFrame& frame) override;
|
bool present(const QVideoFrame& frame) override;
|
||||||
|
|
||||||
void set_format(s32 format, u32 bytes_per_pixel);
|
void set_format(s32 format, u32 bytesize);
|
||||||
void set_resolution(u32 width, u32 height);
|
void set_resolution(u32 width, u32 height);
|
||||||
void set_mirrored(bool mirrored);
|
void set_mirrored(bool mirrored);
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ private:
|
|||||||
bool m_front_facing = false;
|
bool m_front_facing = false;
|
||||||
bool m_mirrored = false; // Set by cellCamera
|
bool m_mirrored = false; // Set by cellCamera
|
||||||
s32 m_format = 2; // CELL_CAMERA_RAW8, set by cellCamera
|
s32 m_format = 2; // CELL_CAMERA_RAW8, set by cellCamera
|
||||||
u32 m_bytes_per_pixel = 1;
|
u32 m_bytesize = 0;
|
||||||
u32 m_width = 640;
|
u32 m_width = 640;
|
||||||
u32 m_height = 480;
|
u32 m_height = 480;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user