Fix MEDIA_LNK_FL_* and MEDIA_PAD_FL_* visibility in CLI translation unit

The CLI is a separate translation unit that doesn't include <linux/media.h>,
so the kernel flag constants were undefined there. Fix by defining our own
public constants in media_ctrl.h:
- MEDIA_LINK_FL_{ENABLED,IMMUTABLE,DYNAMIC} for link flags
- MEDIA_PAD_FLAG_{SINK,SOURCE} for pad flags (distinct names avoid
  redefinition conflict with kernel's MEDIA_PAD_FL_* in media_ctrl.c)

media_ctrl.c now translates kernel flags to our constants on the way out.
Added fallback #defines for kernel constants that were missing them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 21:51:49 +00:00
parent a29c556851
commit 4ba2a8118d
3 changed files with 33 additions and 10 deletions

View File

@@ -91,8 +91,8 @@ static void on_pad(const struct Media_Pad *pad, void *userdata) {
static void on_link(const struct Media_Link *link, void *userdata) {
(void)userdata;
const char *enabled = (link->flags & MEDIA_LNK_FL_ENABLED) ? "enabled" : "disabled";
const char *mutable = (link->flags & MEDIA_LNK_FL_IMMUTABLE) ? ", immutable" : "";
const char *enabled = (link->flags & MEDIA_LINK_FL_ENABLED) ? "enabled" : "disabled";
const char *mutable = (link->flags & MEDIA_LINK_FL_IMMUTABLE) ? ", immutable" : "";
printf(" link: entity %u pad %u -> entity %u pad %u [%s%s]\n",
link->source.entity_id, link->source.index,
link->sink.entity_id, link->sink.index,