diff options
Diffstat (limited to 'main/codec.c')
-rw-r--r-- | main/codec.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/main/codec.c b/main/codec.c index 1870c393b..7797147a7 100644 --- a/main/codec.c +++ b/main/codec.c @@ -376,6 +376,21 @@ const char *ast_codec_media_type2str(enum ast_media_type type) } } +enum ast_media_type ast_media_type_from_str(const char *media_type_str) +{ + if (!strcasecmp(media_type_str, "audio")) { + return AST_MEDIA_TYPE_AUDIO; + } else if (!strcasecmp(media_type_str, "video")) { + return AST_MEDIA_TYPE_VIDEO; + } else if (!strcasecmp(media_type_str, "image")) { + return AST_MEDIA_TYPE_IMAGE; + } else if (!strcasecmp(media_type_str, "text")) { + return AST_MEDIA_TYPE_TEXT; + } else { + return AST_MEDIA_TYPE_UNKNOWN; + } +} + unsigned int ast_codec_samples_count(struct ast_frame *frame) { struct ast_codec *codec; |