diff --git a/src/examples/video-src-alloc.c b/src/examples/video-src-alloc.c index 1165183c4..8348fdf92 100644 --- a/src/examples/video-src-alloc.c +++ b/src/examples/video-src-alloc.c @@ -22,7 +22,7 @@ #include -#define BPP 3 +#define BPP 4 #define CURSOR_WIDTH 64 #define CURSOR_HEIGHT 64 #define CURSOR_BPP 4 @@ -404,7 +404,7 @@ int main(int argc, char *argv[]) SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), - SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_RGB), + SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_RGBA), SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle( &SPA_RECTANGLE(320, 240), &SPA_RECTANGLE(1, 1), diff --git a/src/examples/video-src-fixate.c b/src/examples/video-src-fixate.c index 724974a44..2d77a8887 100644 --- a/src/examples/video-src-fixate.c +++ b/src/examples/video-src-fixate.c @@ -24,7 +24,7 @@ #include -#define BPP 3 +#define BPP 4 #define CURSOR_WIDTH 64 #define CURSOR_HEIGHT 64 #define CURSOR_BPP 4 @@ -414,11 +414,11 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param) modifier = modifiers[rand()%n_modifiers]; } - params[0] = fixate_format(&b, SPA_VIDEO_FORMAT_RGB, &modifier); + params[0] = fixate_format(&b, SPA_VIDEO_FORMAT_RGBA, &modifier); - params[1] = build_format(&b, SPA_VIDEO_FORMAT_RGB, + params[1] = build_format(&b, SPA_VIDEO_FORMAT_RGBA, supported_modifiers, sizeof(supported_modifiers)/sizeof(supported_modifiers[0])); - params[2] = build_format(&b, SPA_VIDEO_FORMAT_RGB, + params[2] = build_format(&b, SPA_VIDEO_FORMAT_RGBA, NULL, 0); printf("announcing fixated EnumFormats\n"); @@ -540,9 +540,9 @@ int main(int argc, char *argv[]) * The server will select a format that matches and informs us about this * in the stream param_changed event. */ - params[0] = build_format(&b, SPA_VIDEO_FORMAT_RGB, + params[0] = build_format(&b, SPA_VIDEO_FORMAT_RGBA, supported_modifiers, sizeof(supported_modifiers)/sizeof(supported_modifiers[0])); - params[1] = build_format(&b, SPA_VIDEO_FORMAT_RGB, NULL, 0); + params[1] = build_format(&b, SPA_VIDEO_FORMAT_RGBA, NULL, 0); printf("announcing starting EnumFormats\n"); for (unsigned int i=0; i < 2; i++) { diff --git a/src/examples/video-src-reneg.c b/src/examples/video-src-reneg.c index d9f6abf8b..9c322d61a 100644 --- a/src/examples/video-src-reneg.c +++ b/src/examples/video-src-reneg.c @@ -22,7 +22,7 @@ #include -#define BPP 3 +#define BPP 4 #define CURSOR_WIDTH 64 #define CURSOR_HEIGHT 64 #define CURSOR_BPP 4 @@ -373,7 +373,7 @@ static void on_reneg_timeout(void *userdata, uint64_t expirations) SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), - SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_RGB), + SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_RGBA), SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&SPA_RECTANGLE(width, height)), SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&SPA_FRACTION(25, 1))); @@ -398,7 +398,7 @@ int main(int argc, char *argv[]) pw_init(&argc, &argv); /* create a thread loop and start it */ - data.loop = pw_thread_loop_new("video-src-alloc", NULL); + data.loop = pw_thread_loop_new("video-src-reneg", NULL); /* take the lock around all PipeWire functions. In callbacks, the lock * is already taken for you but it's ok to lock again because the lock is @@ -449,7 +449,7 @@ int main(int argc, char *argv[]) SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), - SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_RGB), + SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_RGBA), SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle( &SPA_RECTANGLE(320, 240), &SPA_RECTANGLE(1, 1), diff --git a/src/examples/video-src.c b/src/examples/video-src.c index 92db5ff78..cba32c94e 100644 --- a/src/examples/video-src.c +++ b/src/examples/video-src.c @@ -16,10 +16,11 @@ #include #include #include +#include #include -#define BPP 3 +#define BPP 4 #define CURSOR_WIDTH 64 #define CURSOR_HEIGHT 64 #define CURSOR_BPP 4 @@ -224,6 +225,9 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param) if (param == NULL || id != SPA_PARAM_Format) return; + fprintf(stderr, "got format:\n"); + spa_debug_format(2, NULL, param); + spa_format_video_raw_parse(param, &data->format); data->stride = SPA_ROUND_UP_N(data->format.size.width * BPP, 4); @@ -317,7 +321,7 @@ int main(int argc, char *argv[]) SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), - SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_RGB), + SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_BGRA), SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle( &SPA_RECTANGLE(320, 240), &SPA_RECTANGLE(1, 1),