STRUCT VIDTV_ENCODER(9)
π 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'sNULLβ she may fill herself in πsrc_buf_szβ size ofsrc_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). theboolthat 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms