@@ -98,6 +98,29 @@ const Data = struct {
9898
9999var data : Data = .{};
100100
101+ const formats : []const pw.c.spa_video_format = &.{
102+ // XXX: ... this vs xrgb??
103+ pw .c .SPA_VIDEO_FORMAT_RGBx ,
104+ // XXX: ...
105+ pw .c .SPA_VIDEO_FORMAT_BGR ,
106+ pw .c .SPA_VIDEO_FORMAT_BGR ,
107+ pw .c .SPA_VIDEO_FORMAT_xBGR ,
108+ pw .c .SPA_VIDEO_FORMAT_RGB ,
109+ pw .c .SPA_VIDEO_FORMAT_RGB ,
110+ pw .c .SPA_VIDEO_FORMAT_xRGB ,
111+ pw .c .SPA_VIDEO_FORMAT_ABGR ,
112+ pw .c .SPA_VIDEO_FORMAT_BGRA ,
113+ pw .c .SPA_VIDEO_FORMAT_ARGB ,
114+ pw .c .SPA_VIDEO_FORMAT_RGBA ,
115+ pw .c .SPA_VIDEO_FORMAT_YV12 ,
116+ pw .c .SPA_VIDEO_FORMAT_I420 ,
117+ pw .c .SPA_VIDEO_FORMAT_YUY2 ,
118+ pw .c .SPA_VIDEO_FORMAT_UYVY ,
119+ pw .c .SPA_VIDEO_FORMAT_YVYU ,
120+ pw .c .SPA_VIDEO_FORMAT_NV12 ,
121+ pw .c .SPA_VIDEO_FORMAT_NV21 ,
122+ };
123+
101124pub fn main () ! void {
102125 // If we're linking with the Zig module, set up logging.
103126 var logger = if (example_options .use_zig_module ) pw .Logger .init () else {};
@@ -178,18 +201,22 @@ pub fn main() !void {
178201 check (pw .c .spa_pod_builder_prop (& b , pw .c .SPA_FORMAT_mediaSubtype , 0 ));
179202 check (pw .c .spa_pod_builder_id (& b , pw .c .SPA_MEDIA_SUBTYPE_raw ));
180203
204+ // XXX: ... oh, we actually need to do all the conversions ourselves? that's really annoying.
205+ // there's supposed to be a way to get it to convert for us i think? maybe we need more modules
206+ // for video conversion or something. or is it doing it? idk
181207 // build an enumeration of formats
182208 {
183209 var choice_frame : pw.c.spa_pod_frame = undefined ;
184210 check (pw .c .spa_pod_builder_prop (& b , pw .c .SPA_FORMAT_VIDEO_format , 0 ));
185211 check (pw .c .spa_pod_builder_push_choice (& b , & choice_frame , pw .c .SPA_CHOICE_Enum , 0 ));
186212 // We only support one format
187213 check (pw .c .spa_pod_builder_id (& b , pw .c .SPA_VIDEO_FORMAT_UNKNOWN ));
188- check (pw .c .spa_pod_builder_id (& b , pw .c .SPA_VIDEO_FORMAT_RGBx ));
189- // XXX: ... oh, we actually need to do all the conversions ourselves? that's really annoying.
190- // there's supposed to be a way to get it to convert for us i think? maybe we need more modules
191- // for video conversion or something. or is it doing it? idk
192- check (pw .c .spa_pod_builder_id (& b , pw .c .SPA_VIDEO_FORMAT_YUY2 ));
214+ for (formats ) | format | {
215+ check (pw .c .spa_pod_builder_id (& b , format ));
216+ }
217+ // check(pw.c.spa_pod_builder_id(&b, pw.c.SPA_VIDEO_FORMAT_RGBx));
218+ // check(pw.c.spa_pod_builder_id(&b, pw.c.SPA_VIDEO_FORMAT_YUY2));
219+
193220 assert (pw .c .spa_pod_builder_pop (& b , & choice_frame ) != null );
194221 }
195222
0 commit comments