Function gstreamer_gl::functions::gl_video_format_swizzle

source ·
pub fn gl_video_format_swizzle(video_format: VideoFormat) -> Option<[i32; 4]>
Expand description

Calculates the swizzle indices for video_format and gl_format in order to access a texture such that accessing a texel from a texture through the swizzle index produces values in the order (R, G, B, A) or (Y, U, V, A).

For multi-planer formats, the swizzle index uses the same component order (RGBA/YUVA) and should be applied after combining multiple planes into a single rgba/yuva value. e.g. sampling from a NV12 format would have Y from one texture and UV from another texture into a (Y, U, V) value. Add an Aplha component and then perform swizzling. Sampling from NV21 would produce (Y, V, U) which is then swizzled to (Y, U, V).

§video_format

the GstVideoFormat in use

§Returns

whether valid swizzle indices could be found

§swizzle

the returned swizzle indices