Skip to main content

moq_encode_video

Function moq_encode_video 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn moq_encode_video( broadcast: u32, input: *const moq_video_encoder_input, output: *const moq_video_encoder_output, bandwidth: u32, ) -> i32
Expand description

Open a video track on a broadcast, encoding the raw frames you publish to it.

The encoder is opened here, so an unsupported codec, resolution, or backend fails now rather than on the first frame. The track is named after the codec (.avc3 / .hev1) and its catalog rendition is published immediately, read out of the encoder rather than guessed, so a subscriber can find the track before a frame is written to it.

Returns a non-zero handle on success or a negative error code.

ยงSafety

  • input / output must point to fully populated structs.
  • output->encoder must point to output->encoder_len bytes of UTF-8 when output->kind is MOQ_VIDEO_ENCODER_KIND_NAMED.
  • bandwidth is a handle from crate::moq_session_bandwidth, or 0 to hold the configured bitrate regardless of congestion.