[asterisk-commits] file: branch group/media_formats r406149 - in /team/group/media_formats: incl...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 21 16:33:37 CST 2014
Author: file
Date: Tue Jan 21 16:33:34 2014
New Revision: 406149
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406149
Log:
Allow unknown to be used as a media type when searching for a codec.
Modified:
team/group/media_formats/include/asterisk/codec.h
team/group/media_formats/main/codec.c
Modified: team/group/media_formats/include/asterisk/codec.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/include/asterisk/codec.h?view=diff&rev=406149&r1=406148&r2=406149
==============================================================================
--- team/group/media_formats/include/asterisk/codec.h (original)
+++ team/group/media_formats/include/asterisk/codec.h Tue Jan 21 16:33:34 2014
@@ -28,7 +28,8 @@
/*! \brief Types of media */
enum ast_media_type {
- AST_MEDIA_TYPE_AUDIO = 0,
+ AST_MEDIA_TYPE_UNKNOWN = 0,
+ AST_MEDIA_TYPE_AUDIO,
AST_MEDIA_TYPE_VIDEO,
AST_MEDIA_TYPE_IMAGE,
AST_MEDIA_TYPE_TEXT,
Modified: team/group/media_formats/main/codec.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/main/codec.c?view=diff&rev=406149&r1=406148&r2=406149
==============================================================================
--- team/group/media_formats/main/codec.c (original)
+++ team/group/media_formats/main/codec.c Tue Jan 21 16:33:34 2014
@@ -77,7 +77,11 @@
case OBJ_SEARCH_OBJECT:
right_key = right->name;
cmp = strcmp(left->name, right_key);
- cmp |= (right->type != left->type);
+
+ if (right->type != AST_MEDIA_TYPE_UNKNOWN) {
+ cmp |= (right->type != left->type);
+ }
+
cmp |= (right->sample_rate != left->sample_rate);
break;
case OBJ_SEARCH_KEY:
@@ -243,7 +247,10 @@
struct ast_codec *codec_new;
/* Some types have specific requirements */
- if (codec->type == AST_MEDIA_TYPE_AUDIO) {
+ if (codec->type == AST_MEDIA_TYPE_UNKNOWN) {
+ ast_log(LOG_ERROR, "A media type must be specified for codec '%s'\n", codec->name);
+ return -1;
+ } else if (codec->type == AST_MEDIA_TYPE_AUDIO) {
if (!codec->sample_rate) {
ast_log(LOG_ERROR, "A sample rate must be specified for codec '%s' of type '%s'\n",
codec->name, ast_codec_media_type2str(codec->type));
More information about the asterisk-commits
mailing list