diff options
Diffstat (limited to 'src/vidcodec.c')
-rw-r--r-- | src/vidcodec.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/vidcodec.c b/src/vidcodec.c new file mode 100644 index 0000000..7624ae7 --- /dev/null +++ b/src/vidcodec.c @@ -0,0 +1,81 @@ +/** + * @file vidcodec.c Video Codec + * + * Copyright (C) 2010 Creytiv.com + */ + +#include <re.h> +#include <baresip.h> + + +static struct list vidcodecl; + + +/** + * Register a Video Codec + * + * @param vc Video Codec + */ +void vidcodec_register(struct vidcodec *vc) +{ + if (!vc) + return; + + list_append(&vidcodecl, &vc->le, vc); + + info("vidcodec: %s\n", vc->name); +} + + +/** + * Unregister a Video Codec + * + * @param vc Video Codec + */ +void vidcodec_unregister(struct vidcodec *vc) +{ + if (!vc) + return; + + list_unlink(&vc->le); +} + + +/** + * Find a Video Codec by name + * + * @param name Name of the Video Codec to find + * @param variant Codec Variant + * + * @return Matching Video Codec if found, otherwise NULL + */ +const struct vidcodec *vidcodec_find(const char *name, const char *variant) +{ + struct le *le; + + for (le=vidcodecl.head; le; le=le->next) { + + struct vidcodec *vc = le->data; + + if (name && 0 != str_casecmp(name, vc->name)) + continue; + + if (variant && 0 != str_casecmp(variant, vc->variant)) + continue; + + return vc; + } + + return NULL; +} + + +/** + * Get the list of Video Codecs + * + * @return List of Video Codecs + */ +struct list *vidcodec_list(void) +{ + return &vidcodecl; +} |