STRUCT MEDIA_ENTITY(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct media_entity(9) πŸŽ€

okay bestie, so this page is from the Kernel API Manual, and it's literally the whole rundown on struct media_entity β€” the main character of the media entity graph, no cap. Think of it as the group-chat profile for one node in the media graph: who it is, what it does, who it's connected to, and how many people are currently using it πŸ’…. Let's get into it ✨


πŸ’– NAME πŸ’–

struct media_entity β€” a media entity graph object, periodt 🫢


✨ SYNOPSIS ✨

struct media_entity {
    struct media_gobj graph_obj;
    const char *name;
    enum media_entity_type obj_type;
    u32 function;
    unsigned long flags;
    u16 num_pads;
    u16 num_links;
    u16 num_backlinks;
    int internal_idx;
    struct media_pad *pads;
    struct list_head links;
    const struct media_entity_operations *ops;
    int use_count;
    union {
      struct {
        u32 major;
        u32 minor;
      } dev;
    } info;
 };

πŸ¦‹ MEMBERS πŸ¦‹

  • graph_obj β€” the embedded struct holding all the common media object data. it's giving "shared foundation" energy πŸ’…
  • name β€” the entity's name. literally what it's called 🌸
  • obj_type β€” the type of the object that implements the media_entity.
  • function β€” the entity's main function, as defined in include/uapi/linux/media.h (go seek for MEDIA_ENT_F_*) πŸ”
  • flags β€” the entity flags, as defined in include/uapi/linux/media.h (go seek for MEDIA_ENT_FL_*) πŸ”
  • num_pads β€” how many sink and source pads there are.
  • num_links β€” the total number of links β€” forward and back, enabled and disabled. all of them, bestie πŸ’€
  • num_backlinks β€” the number of backlinks.
  • internal_idx β€” a unique internal entity-specific number. and the numbers get re-used if entities are unregistered or registered again πŸ‘€
  • pads β€” the pads array, sized by num_pads.
  • links β€” the list of data links.
  • ops β€” the entity operations.
  • use_count β€” the use count for the entity.
  • info β€” a union with devnode information. it's kept just for backward compatibility, so it's lowkey a legacy icon πŸ™ˆ
  • info.dev β€” contains the device major and minor info.
  • info.dev.major β€” device node major, if the device is a devnode.
  • info.dev.minor β€” device node minor, if the device is a devnode.

🌈 DESCRIPTION 🌈

NOTE: πŸ”₯ the use_count reference count must never be negative β€” but it's a signed integer on purpose, bestie. that way a simple WARN_ON(<0) check can catch reference count bugs that would make it go negative. iconic design choice, honestly πŸ‘‘

🌟 SEE ALSO 🌟

kernel file ./include/media/media-entity.h plus all of these gems:


that's the whole thing, bestie, you ate it up πŸ“ this lil masterpiece lives in ./include/media and was stamped October 2026 β€” go forth and slay your media graph πŸ’œβœ¨

πŸ“¦ where this page comes from