roar_str2codec(3)

πŸ“¦ version 1.0~beta12, in ubuntu jammy

πŸ’– roar_str2codec(3) πŸ’–

okay bestie, welcome to the RoarAudio corner of the System Manager's Manual 🌸 today we're doing roar_str2codec(3) β€” the manual page for the two little codec-name-and-ID translator girlies. yes, both functions live in one page, they're roommates, it's giving iconic duo energy πŸ’…


✨ NAME ✨

  • roar_str2codec β€” get a codec ID by its codec name πŸŽ€
  • roar_codec2str β€” get a codec name by its ID πŸ¦‹

✨ SYNOPSIS ✨

#include <roaraudio.h>

int    roar_str2codec (char * codec);
char * roar_codec2str (int    codec);

✨ DESCRIPTION ✨

so roar_str2codec does the thing where you hand it a string and it hands you back a RoarAudio Codec ID. and not just the plain names either β€” it also knows some common aliases, because of course it does, she's well-connected πŸ’…

roar_codec2str is literally just the reverse move of roar_str2codec: you give it the ID and it gives you a name back. no cap. πŸ”

and here's the lil fact that ties it all together: if a codec is valid, then this should be true:

roar_str2codec(roar_codec2str(codec)) == codec
⚠️ but listen, bestie β€” because of aliasing and case insensitivity, the reverse operation does not need to be true. so don't go assuming round-trips are always a thing, okay? that's just how she is πŸ™ˆ

✨ THREAD SAFETY ✨

okay this part ate πŸ”₯ because roar_codec2str returns a static unique pointer for each codec, that means it's fully thread safe. periodt. no locks, no drama, just vibes 🫢


✨ RETURN VALUE ✨

  • On success, roar_str2codec returns a codec ID. πŸŽ‰
  • On error, -1 is returned. πŸ’€
  • roar_codec2str returns the name of the codec, or NULL on error. 😭
🚨 real talk though: you must not free this pointer, and you must not write to it either. hands off, bestie, that pointer is not yours πŸ™…β€β™€οΈ

✨ EXAMPLES ✨

FIXME 😭 yeah... the examples section is literally just sitting there empty. the author said "not me leaving this blank" and then left it blank. we respect the honesty tho πŸ“


✨ SEE ALSO ✨


RoarAudio Β· May 2011 Β· roar_str2codec(3) πŸŽ€

and that's the whole page babes, tysm for reading, go translate some codecs, mwah πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from