Skip to main content

Module formats

Module formats 

Source
Expand description

Handles conversions, e.g., between RGB and YUV.

In particular when encoding frames your source data might be a YUV buffer, or one of multiple RGB formats. The structs and traits in here can help you with that format conversion.

§Examples

Load a vanilla 3x8 bit-per-pixel RGB slice into a YUVBuffer:

use openh264::formats::{RgbSliceU8, YUVBuffer};

// Assume this is a 2x2 pixel RGB buffer you got from somewhere.
let raw_rgb = &[ 10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40 ];
let rgb_source = RgbSliceU8::new(raw_rgb, (2, 2));

// Now you have a YUV which you can feed into the encoder.
let yuv = YUVBuffer::from_rgb_source(rgb_source);

Structs§

AbgrSliceU8
Container for a slice of contiguous [A B G R A B G R ...] data.
AbgrSliceU32
Container for a slice of contiguous [ABGR ABGR ...] data.
ArgbSliceU8
Container for a slice of contiguous [A R G B A R G B ...] data.
ArgbSliceU32
Container for a slice of contiguous [ARGB ARGB ...] data.
BgrSliceU8
Container for a slice of contiguous [B G R B G R ...] data.
BgraSliceU8
Container for a slice of contiguous [B G R A B G R A ...] data.
BgraSliceU32
Container for a slice of contiguous [BGRA BGRA ...] data.
RgbSliceU8
Container for a slice of contiguous [R G B R G B ...] data.
RgbaSliceU8
Container for a slice of contiguous [R G B A R G B A ...] data.
RgbaSliceU32
Container for a slice of contiguous [RGBA RGBA ...] data.
YUVBuffer
Converts RGB to YUV data.
YUVSlices
Convenience wrapper if you already have YUV-sliced data from some other place.

Traits§

RGB8Source
Source of RGB8 data for fast pixel access.
RGBSource
Source of arbitrarily formatted RGB data.
YUVSource
Allows the Encoder to be generic over a YUV source.