From 8ee91bd73802b0e56a01956be5c797c7ce6236ef Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 18 Jun 2020 11:43:34 +0200 Subject: [PATCH] examples: don't hardcode dimensions for crop info --- src/examples/video-src-alloc.c | 9 +++------ src/examples/video-src.c | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/examples/video-src-alloc.c b/src/examples/video-src-alloc.c index fc594267c..2635e34d3 100644 --- a/src/examples/video-src-alloc.c +++ b/src/examples/video-src-alloc.c @@ -34,10 +34,7 @@ #include -#define BPP 3 -#define WIDTH 320 -#define HEIGHT 200 -#define CROP 8 +#define BPP 3 #define CURSOR_WIDTH 64 #define CURSOR_HEIGHT 64 #define CURSOR_BPP 4 @@ -132,8 +129,8 @@ static void on_timeout(void *userdata, uint64_t expirations) data->crop = (sin(data->accumulator) + 1.0) * 32.0; mc->region.position.x = data->crop; mc->region.position.y = data->crop; - mc->region.size.width = WIDTH - data->crop*2; - mc->region.size.height = HEIGHT - data->crop*2; + mc->region.size.width = data->format.size.width - data->crop*2; + mc->region.size.height = data->format.size.height - data->crop*2; } if ((mcs = spa_buffer_find_meta_data(buf, SPA_META_Cursor, sizeof(*mcs)))) { struct spa_meta_bitmap *mb; diff --git a/src/examples/video-src.c b/src/examples/video-src.c index f9aa2fe6a..b9459ddc1 100644 --- a/src/examples/video-src.c +++ b/src/examples/video-src.c @@ -31,10 +31,7 @@ #include -#define BPP 3 -#define WIDTH 320 -#define HEIGHT 200 -#define CROP 8 +#define BPP 3 #define CURSOR_WIDTH 64 #define CURSOR_HEIGHT 64 #define CURSOR_BPP 4 @@ -132,8 +129,8 @@ static void on_timeout(void *userdata, uint64_t expirations) data->crop = (sin(data->accumulator) + 1.0) * 32.0; mc->region.position.x = data->crop; mc->region.position.y = data->crop; - mc->region.size.width = WIDTH - data->crop*2; - mc->region.size.height = HEIGHT - data->crop*2; + mc->region.size.width = data->format.size.width - data->crop*2; + mc->region.size.height = data->format.size.height - data->crop*2; } if ((mcs = spa_buffer_find_meta_data(buf, SPA_META_Cursor, sizeof(*mcs)))) { struct spa_meta_bitmap *mb;