Skip to main content

MediaCodecRegistry

Struct MediaCodecRegistry 

Source
pub struct MediaCodecRegistry;
Expand description

Stateless cross-platform media codec registry providing magic-byte detection and native pure-Rust decoders.

Implementations§

Source§

impl MediaCodecRegistry

Magic-byte detection, MIME classification, and pure-Rust decoders for all cross-platform media formats.

Source

pub fn detect_media_kind(uri: &str, bytes: &[u8]) -> MediaKind

Sniffs MediaKind from raw payload magic bytes first, falling back to uri extension without heap allocations.

§Arguments
  • &str - Source URI or filename.
  • &[u8] - Optional leading raw bytes.
§Returns
  • MediaKind - Detected high-level media type.
Source

pub fn detect_image_format(uri: &str, bytes: &[u8]) -> ImageFormat

Detects the encoded ImageFormat from leading magic bytes or filename extension without heap allocations.

§Arguments
  • &str - Source URI or filename.
  • &[u8] - Optional leading bytes.
§Returns
  • ImageFormat - Resolved image format.
Source

pub fn decode_bmp(bytes: &[u8], alt_text: &str) -> Result<ImageAsset, String>

Decodes an uncompressed 24-bit or 32-bit Windows BMP byte slice into an ImageAsset.

§Arguments
  • &[u8] - Raw .bmp file bytes.
  • &str - Accessibility alt text.
§Returns
  • Result<ImageAsset, String> - Decoded ImageAsset or format error message.
Source

pub fn decode_gif(bytes: &[u8], title: &str) -> Result<GifAnimation, String>

Parses a GIF87a/GIF89a byte stream header, global color table, and Graphics Control frame timings.

§Arguments
  • &[u8] - Raw .gif file bytes.
  • &str - Asset title.
§Returns
  • Result<GifAnimation, String> - Decoded multi-frame GifAnimation or parse error.
Source

pub fn decode_wav(bytes: &[u8], title: &str) -> Result<AudioTrack, String>

Decodes a RIFF PCM WAV audio byte slice (8-bit or 16-bit) into a normalized AudioTrack with waveform peaks.

§Arguments
  • &[u8] - Raw .wav bytes.
  • &str - Track title.
§Returns
  • Result<AudioTrack, String> - Decoded AudioTrack or format error.
Source

pub fn parse_pdf(bytes: &[u8]) -> Result<PdfDocument, String>

Parses a %PDF-1.x byte stream extracting version, info dictionary metadata, page count, and Tj/TJ text runs.

§Arguments
  • &[u8] - Raw .pdf document bytes.
§Returns
  • Result<PdfDocument, String> - Structured multi-page PdfDocument or format error.
Source

pub fn parse_html(raw: &str) -> HtmlDocument

Parses raw HTML5 markup into a sanitized, zero-JS HtmlDocument ready for native euv rendering.

§Arguments
  • &str - Raw HTML markup string.
§Returns
  • HtmlDocument - Parsed document title, links count, and ordered HtmlBlock items.
Source

pub fn parse_and_rasterize_svg( raw_svg: &str, out_w: u32, out_h: u32, ) -> Result<SvgDocument, String>

Parses an SVG document (<svg>, <rect>, <circle>, <line>) and rasterizes it into an ImageBuffer.

§Arguments
  • &str - Raw SVG XML source.
  • u32 - Target rasterization width in pixels.
  • u32 - Target rasterization height in pixels.
§Returns
  • Result<SvgDocument, String> - Parsed and rasterized SvgDocument or error.
Source

pub fn compute_waveform_peaks(samples: &[f32], bars: usize) -> Vec<f32>

Computes normalized RMS waveform bar peaks (0.08..=1.0) from PCM samples.

§Arguments
  • &[f32] - Input PCM samples.
  • usize - Number of output bars.
§Returns
  • Vec<f32> - Normalized bar peak heights.
Source

pub fn synthesize_frame( width: u32, height: u32, bg: Color, accent: Color, frame_idx: usize, ) -> ImageBuffer

Synthesizes a clean multi-band gradient + orbiting geometric emblem frame for sample GIF/Video/LIVE buffers.

§Arguments
  • u32 - Frame width in pixels.
  • u32 - Frame height in pixels.
  • Color - Base background tone.
  • Color - Primary accent tone.
  • usize - Animation frame index.
§Returns
  • ImageBuffer - Rendered RGBA8 bitmap frame.

Trait Implementations§

Source§

impl Clone for MediaCodecRegistry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MediaCodecRegistry

Source§

impl Debug for MediaCodecRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MediaCodecRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.