STRUCT VIDTV_ENCODER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct vidtv_encoder(9) πŸ’…

okay bestie, welcome to the Kernel API Manual ✨ β€” this is the page for struct vidtv_encoder(9), and honestly? she's a whole vibe. let's get into it 🫢


✨ NAME ✨

struct vidtv_encoder β€” a generic encoder type. that's it, that's the tweet. a generic. encoder. type. πŸŽ€


🌈 SYNOPSIS 🌈

struct vidtv_encoder {
    enum vidtv_encoder_id id;
    char *name;
    u8 *encoder_buf;
    u32 encoder_buf_sz;
    u32 encoder_buf_offset;
    u64 sample_count;
    struct vidtv_access_unit *access_units;
    void *src_buf;
    u32 src_buf_sz;
    u32 src_buf_offset;
    bool is_video_encoder;
    void *ctx;
    __be16 stream_id;
    __be16 es_pid;
    void *(*encode)(struct vidtv_encoder *e);
    u32 (*clear)(struct vidtv_encoder *e);
    struct vidtv_encoder *sync;
    u32 sampling_rate_hz;
    void (*last_sample_cb)(u32 sample_no);
    void (*destroy)(struct vidtv_encoder *e);
    struct vidtv_encoder *next;
};

look at her. iconic struct definition, no notes πŸ‘‘


πŸ¦‹ Members πŸ¦‹

every single field, bestie, in order, no skipping. iykyk πŸ’–

  • id β€” so we can cast to a concrete implementation when needed. the little type tag that lets us be like "oh she's that kind of encoder" πŸ’…
  • name β€” usually the same as the stream name. literally just the name. lowkey the most normal field here.
  • encoder_buf β€” the encoder's internal buffer for the access units. this is where the AU's live.
  • encoder_buf_sz β€” the encoder buffer size, in bytes.
  • encoder_buf_offset β€” our byte position in the encoder buffer. like a bookmark, but for bytes πŸ“–
  • sample_count β€” how many samples we have encoded in total. the flex counter. she's counting, periodt.
  • access_units β€” encoder payload units, used for clock references. these bad girls keep time ⌚
  • src_buf β€” the source of raw data to be encoded; the encoder might set a default if it's null. so don't panic if she's NULL β€” she may fill herself in πŸ™ˆ
  • src_buf_sz β€” size of src_buf. matching pair, we love a matched set.
  • src_buf_offset β€” our position in the source buffer. another bookmark. we stan a byte-position-keeping duo ✨
  • is_video_encoder β€” whether this is a video encoder (as opposed to audio). the bool that decides her whole personality πŸ”₯
  • ctx β€” encoder-specific state. it's giving "she contains multitudes". every encoder keeps her own little world here πŸ’œ
  • stream_id β€” examples: audio streams (0xc0-0xdf), video streams (0xe0-0xef). remember those ranges, there's no cap.
  • es_pid β€” the TS PID to use for the elementary stream in this encoder. yes, that PID.
  • encode β€” prepare enough AUs for the given amount of time. function pointer, does the actual work. main character energy fr fr.
  • clear β€” clear the encoder output. reset era 🧹
  • sync β€” attempt to synchronize with this encoder. note: attempt. no promises, bestie 😭
  • sampling_rate_hz β€” the sampling rate (or fps, if video) used. numbers! units! hz! (or fps!) πŸ“Š
  • last_sample_cb β€” called when the encoder runs out of data. this is so the source can read data in a piecemeal fashion instead of having to provide it all at once. like texting in little bursts instead of one giant paragraph β€” we respect the pacing πŸŽ€
  • destroy β€” destroy this encoder, freeing allocated resources. the goodbye. the cleanup. do not skip her, or you'll be leaking πŸ’€
  • next β€” next in the chain. linked list behaviour, we love a chain πŸ”—

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./drivers/media/test-drivers/vidtv/vidtv_encoder.h

go read the header, it's right there, she's waiting 🫢


okay that's the whole page, bestie β€” and for the cute sign-off: this little beauty comes from ./drivers/media/test-drivers/v... and is dated October 2026 βœ¨πŸ’–πŸŽ€ slay, go encode something iconic πŸ’…

πŸ“¦ where this page comes from