STRUCT MEDIA_ENTITY(9)
π 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 themedia_entity.functionβ the entity's main function, as defined ininclude/uapi/linux/media.h(go seek forMEDIA_ENT_F_*) πflagsβ the entity flags, as defined ininclude/uapi/linux/media.h(go seek forMEDIA_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 bynum_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: π₯ theuse_countreference count must never be negative β but it's a signed integer on purpose, bestie. that way a simpleWARN_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:
enum media_gobj_type(9)struct media_gobj(9)struct media_entity_enum(9)struct media_graph(9)struct media_pipeline(9)struct media_pipeline_pad(9)struct media_pipeline_pad_iter(9)struct media_pipeline_entity_iter(9)struct media_link(9)enum media_pad_signal_type(9)struct media_pad(9)struct media_entity_operations(9)enum media_entity_type(9)media_entity_for_each_pad(9)struct media_interface(9)struct media_intf_devnode(9)media_entity_id(9)media_type(9)media_id(9)media_gobj_gen_id(9)is_media_entity_v4l2_video_device(9)is_media_entity_v4l2_subdev(9)media_entity_enum_init(9)media_entity_enum_cleanup(9)media_entity_enum_zero(9)media_entity_enum_set(9)media_entity_enum_clear(9)media_entity_enum_test(9)media_entity_enum_test_and_set(9)media_entity_enum_empty(9)media_entity_enum_intersects(9)gobj_to_entity(9)gobj_to_pad(9)gobj_to_link(9)gobj_to_intf(9)intf_to_devnode(9)media_gobj_create(9)media_gobj_destroy(9)media_entity_pads_init(9)media_entity_cleanup(9)media_get_pad_index(9)media_create_pad_link(9)media_create_pad_links(9)media_entity_remove_links(9)__media_entity_setup_link(9)media_entity_setup_link(9)media_entity_find_link(9)media_pad_remote_pad_first(9)media_pad_remote_pad_unique(9)media_entity_remote_pad_unique(9)media_entity_remote_source_pad_unique(9)media_pad_is_streaming(9)media_entity_is_streaming(9)media_entity_pipeline(9)media_pad_pipeline(9)media_entity_get_fwnode_pad(9)media_graph_walk_init(9)media_graph_walk_cleanup(9)media_graph_walk_start(9)media_graph_walk_next(9)media_pipeline_start(9)__media_pipeline_start(9)media_pipeline_stop(9)__media_pipeline_stop(9)media_pipeline_for_each_pad(9)media_pipeline_entity_iter_init(9)media_pipeline_entity_iter_cleanup(9)media_pipeline_for_each_entity(9)media_pipeline_alloc_start(9)media_devnode_create(9)media_devnode_remove(9)media_create_intf_link(9)__media_remove_intf_link(9)media_remove_intf_link(9)__media_remove_intf_links(9)media_remove_intf_links(9)media_entity_call(9)media_create_ancillary_link(9)__media_entity_next_link(9)for_each_media_entity_data_link(9)
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
- 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