tweaking
This commit is contained in:
parent
ca4ab01f77
commit
106c8e8403
@ -1,5 +1,4 @@
|
|||||||
#include "./sdl_video_frame_stream2.hpp"
|
#include "./sdl_video_frame_stream2.hpp"
|
||||||
#include "SDL3/SDL_pixels.h"
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -41,9 +40,12 @@ SDLVideoCameraContent::SDLVideoCameraContent(void) {
|
|||||||
{
|
{
|
||||||
SDL_CameraSpec spec {
|
SDL_CameraSpec spec {
|
||||||
// FORCE a diffrent pixel format
|
// FORCE a diffrent pixel format
|
||||||
SDL_PIXELFORMAT_RGBA8888,
|
//SDL_PIXELFORMAT_RGBA8888,
|
||||||
//SDL_COLORSPACE_SRGB,
|
//SDL_PIXELFORMAT_UNKNOWN,
|
||||||
SDL_COLORSPACE_UNKNOWN,
|
SDL_PIXELFORMAT_IYUV,
|
||||||
|
|
||||||
|
SDL_COLORSPACE_SRGB,
|
||||||
|
//SDL_COLORSPACE_UNKNOWN,
|
||||||
|
|
||||||
//1280, 720,
|
//1280, 720,
|
||||||
//640, 360,
|
//640, 360,
|
||||||
|
@ -28,11 +28,12 @@ struct SDLVideoFrame {
|
|||||||
SDLVideoFrame(const SDLVideoFrame& other) {
|
SDLVideoFrame(const SDLVideoFrame& other) {
|
||||||
timestampNS = other.timestampNS;
|
timestampNS = other.timestampNS;
|
||||||
if (static_cast<bool>(other.surface)) {
|
if (static_cast<bool>(other.surface)) {
|
||||||
|
// TODO: use SDL_DuplicateSurface()
|
||||||
surface = {
|
surface = {
|
||||||
SDL_CreateSurface(
|
SDL_CreateSurface(
|
||||||
other.surface->w,
|
other.surface->w,
|
||||||
other.surface->h,
|
other.surface->h,
|
||||||
SDL_PIXELFORMAT_RGBA8888 // meh
|
other.surface->format
|
||||||
),
|
),
|
||||||
&SDL_DestroySurface
|
&SDL_DestroySurface
|
||||||
};
|
};
|
||||||
|
@ -84,7 +84,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
auto writer = SDLAudioOutputDeviceDefaultFactory{}.create();
|
auto writer = SDLAudioOutputDeviceDefaultFactory{}.create();
|
||||||
|
|
||||||
for (size_t i = 0; i < 20; i++) {
|
for (size_t i = 0; i < 100; i++) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
auto new_frame_opt = reader->pop();
|
auto new_frame_opt = reader->pop();
|
||||||
if (new_frame_opt.has_value()) {
|
if (new_frame_opt.has_value()) {
|
||||||
@ -108,7 +108,7 @@ int main(int argc, char** argv) {
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
auto new_frame_opt = reader->pop();
|
auto new_frame_opt = reader->pop();
|
||||||
if (new_frame_opt.has_value()) {
|
if (new_frame_opt.has_value()) {
|
||||||
std::cout << "video frame was " << new_frame_opt.value().surface->w << "x" << new_frame_opt.value().surface->h << " " << new_frame_opt.value().timestampNS << "ns\n";
|
std::cout << "video frame was " << new_frame_opt.value().surface->w << "x" << new_frame_opt.value().surface->h << " " << new_frame_opt.value().timestampNS << "ns " << new_frame_opt.value().surface->format << "sf\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vcc.releaseSubStream(reader);
|
vcc.releaseSubStream(reader);
|
||||||
@ -119,6 +119,7 @@ int main(int argc, char** argv) {
|
|||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
|
|
||||||
// TODO: test android behaviour
|
// TODO: test android behaviour
|
||||||
|
// -> its too big, dpi does not take eye-screen-distance into account
|
||||||
float display_scale = SDL_GetWindowDisplayScale(window.get());
|
float display_scale = SDL_GetWindowDisplayScale(window.get());
|
||||||
if (display_scale < 0.001f) {
|
if (display_scale < 0.001f) {
|
||||||
// error?
|
// error?
|
||||||
|
Loading…
Reference in New Issue
Block a user