STRUCT SND_COMPR_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct snd_compr_ops(9) β€” compressed path DSP operations πŸŽ€

okay bestie, welcome to the Kernel API Manual ✨ this page is literally all about struct snd_compr_ops, aka the compressed path DSP operations squad. it's giving β€œdriver callback central,” and we are going through every single member with zero skips, fr fr πŸ’…


πŸ’– NAME πŸ’–

struct snd_compr_ops β€” compressed path DSP operations. iconic. no notes. 🌸

✨ SYNOPSIS ✨

here's the whole struct, copied exactly so nobody comes for me:

       struct snd_compr_ops {
           int (*open)(struct snd_compr_stream *stream);
           int (*free)(struct snd_compr_stream *stream);
           int (*set_params)(struct snd_compr_stream *stream, struct
       snd_compr_params *params);
           int (*get_params)(struct snd_compr_stream *stream, struct snd_codec
       *params);
           int (*set_metadata)(struct snd_compr_stream *stream, struct
       snd_compr_metadata *metadata);
           int (*get_metadata)(struct snd_compr_stream *stream, struct
       snd_compr_metadata *metadata);
           int (*trigger)(struct snd_compr_stream *stream, int cmd);
           int (*pointer)(struct snd_compr_stream *stream, struct
       snd_compr_tstamp64 *tstamp);
           int (*copy)(struct snd_compr_stream *stream, char __user *buf,
       size_t count);
           int (*mmap)(struct snd_compr_stream *stream, struct vm_area_struct
       *vma);
           int (*ack)(struct snd_compr_stream *stream, size_t bytes);
           int (*get_caps) (struct snd_compr_stream *stream, struct
       snd_compr_caps *caps);
           int (*get_codec_caps) (struct snd_compr_stream *stream, struct
       snd_compr_codec_caps *codec);
         #if IS_ENABLED(CONFIG_SND_COMPRESS_ACCEL);
           int (*task_create) (struct snd_compr_stream *stream, struct
       snd_compr_task_runtime *task);
           int (*task_start) (struct snd_compr_stream *stream, struct
       snd_compr_task_runtime *task);
           int (*task_stop) (struct snd_compr_stream *stream, struct
       snd_compr_task_runtime *task);
           int (*task_free) (struct snd_compr_stream *stream, struct
       snd_compr_task_runtime *task);
         #endif;
        };

🌸 Members 🌸

member-by-member, no skips, let's go 🫢

  • open β€” Open the compressed stream. This callback is mandatory and shall keep dsp ready to receive the stream parameter πŸ’–
  • free β€” Close the compressed stream. mandatory. yes bestie, it's required πŸŽ€
  • set_params β€” Sets the compressed stream parameters. mandatory. This can be called during stream creation only, to set codec params and the stream properties ✨
  • get_params β€” retrieve the codec parameters. mandatory πŸ”₯
  • set_metadata β€” Set the metadata values for a stream πŸ¦‹
  • get_metadata β€” retrieves the requested metadata values from stream. no cap πŸ‘‘
  • trigger β€” Trigger operations like start, pause, resume, drain, stop. This callback is mandatory ⭐
  • pointer β€” Retrieve current h/w pointer information. Mandatory. periodt πŸ’…
  • copy β€” Copy the compressed data to/from userspace. Optional. Can't be implemented if DSP supports mmap 🫢
  • mmap β€” DSP mmap method to mmap DSP memory 🌈
  • ack β€” Ack for DSP when data is written to audio buffer. Optional. Not valid if copy is implemented πŸ™ˆ
  • get_caps β€” Retrieve DSP capabilities. mandatory πŸ’œ
  • get_codec_caps β€” Retrieve capabilities for a specific codec. mandatory πŸ“
  • task_create β€” Create a set of input/output buffers for accel operations 🧚
  • task_start β€” Start (queue) a task for accel operations πŸ¦‹
  • task_stop β€” Stop (dequeue) a task for accel operations πŸ’€
  • task_free β€” Free a set of input/output buffers for accel operations πŸŽ€

πŸ”Ž SEE ALSO πŸ”Ž

Kernel file ./include/sound/compress_driver.h plus the whole squad: struct snd_compr_task_runtime(9), struct snd_compr_runtime(9), struct snd_compr_stream(9), struct snd_compr(9), snd_compr_use_pause_in_draining(9), snd_compr_set_runtime_buffer(9). go read up, iykyk πŸ’–

xoxo, your kernel bestie πŸ’… β€” source/version: ./include/sound, dated October 2026 πŸŽ€

πŸ“¦ where this page comes from