[svn-commits] ivaxer: branch ivaxer/ast_storage r267541 - in /team/ivaxer/ast_storage: incl...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 3 12:46:57 CDT 2010


Author: ivaxer
Date: Thu Jun  3 12:46:54 2010
New Revision: 267541

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=267541
Log:
implemented ast_getformatbyextension() in file.c

Modified:
    team/ivaxer/ast_storage/include/asterisk/file.h
    team/ivaxer/ast_storage/main/file.c

Modified: team/ivaxer/ast_storage/include/asterisk/file.h
URL: http://svnview.digium.com/svn/asterisk/team/ivaxer/ast_storage/include/asterisk/file.h?view=diff&rev=267541&r1=267540&r2=267541
==============================================================================
--- team/ivaxer/ast_storage/include/asterisk/file.h (original)
+++ team/ivaxer/ast_storage/include/asterisk/file.h Thu Jun  3 12:46:54 2010
@@ -32,6 +32,8 @@
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
 #endif
+
+#include "asterisk/frame_defs.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
@@ -345,6 +347,14 @@
  */
 int ast_exts_compare(const char *exts, const char *type);
 
+/* Get format number for a given extension */
+/*!
+ * \param ext a extension name
+ * \return a format number
+ * \retval 0 if format not found
+ */
+format_t ast_getformatbyextension(const char *ext);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/ivaxer/ast_storage/main/file.c
URL: http://svnview.digium.com/svn/asterisk/team/ivaxer/ast_storage/main/file.c?view=diff&rev=267541&r1=267540&r2=267541
==============================================================================
--- team/ivaxer/ast_storage/main/file.c (original)
+++ team/ivaxer/ast_storage/main/file.c Thu Jun  3 12:46:54 2010
@@ -221,6 +221,23 @@
 	}
 
 	return 0;
+}
+
+format_t ast_getformatbyextension(const char *ext)
+{
+	struct ast_format *fmt;
+
+	AST_RWLIST_RDLOCK(&formats);
+
+	AST_RWLIST_TRAVERSE(&formats, fmt, list) {
+		if (ast_exts_compare(fmt->exts, ext)) {
+			break;
+		}
+	}
+
+	AST_RWLIST_UNLOCK(&formats);
+
+	return fmt ? fmt->format : 0;
 }
 
 static int copy(const char *infile, const char *outfile)




More information about the svn-commits mailing list