[Freeswitch-svn] [commit] r13971 - freeswitch/trunk/contrib/jmesquita/mod_khomp

FreeSWITCH SVN raulfragoso at freeswitch.org
Thu Jun 25 20:28:47 PDT 2009


Author: raulfragoso
Date: Thu Jun 25 22:28:46 2009
New Revision: 13971

Log:
Initial implementation for audio buffers


Modified:
   freeswitch/trunk/contrib/jmesquita/mod_khomp/mod_khomp.cpp

Modified: freeswitch/trunk/contrib/jmesquita/mod_khomp/mod_khomp.cpp
==============================================================================
--- freeswitch/trunk/contrib/jmesquita/mod_khomp/mod_khomp.cpp	(original)
+++ freeswitch/trunk/contrib/jmesquita/mod_khomp/mod_khomp.cpp	Thu Jun 25 22:28:46 2009
@@ -131,9 +131,10 @@
 static void printLinks(switch_stream_handle_t* stream, unsigned int device, unsigned int link);
 static void printChannels(switch_stream_handle_t* stream, unsigned int device, unsigned int link);
 /* Handles callbacks and events from the boards */
-static int32 Kstdcall EventCallBack(int32 obj, K3L_EVENT * e);
+static int32 Kstdcall khomp_event_callback(int32 obj, K3L_EVENT * e);
 KLibraryStatus khomp_channel_from_event(unsigned int KDeviceId, unsigned int KChannel, K3L_EVENT * event);
-
+/* Callback for receiving audio buffers from the boards */
+static void Kstdcall khomp_audio_listener (int32 deviceid, int32 mixer, byte * read_buffer, int32 read_size);
 
 
 /* Will init part of our private structure and setup all the read/write buffers */
@@ -658,6 +659,9 @@
        Spawn our k3l global var that will be used along the module
        for sending info to the boards
     */
+    k3lSetGlobalParam (klpResetFwOnStartup, 1);
+    k3lSetGlobalParam (klpDisableInternalVoIP, 1);
+	
     k3l = new K3LAPI();
 
     /* Start the API and connect to KServer */
@@ -670,7 +674,8 @@
     }
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "K3L started.\n");
 
-    k3lRegisterEventHandler( EventCallBack );
+    k3lRegisterEventHandler( khomp_event_callback );
+	k3lRegisterAudioListener (NULL, khomp_audio_listener);
 
     /* Add all the specific API functions */
     SWITCH_ADD_API(api_interface, "khomp", "Khomp Menu", khomp, KHOMP_SYNTAX);
@@ -1104,7 +1109,7 @@
 }
 
 
-static int32 Kstdcall EventCallBack(int32 obj, K3L_EVENT * e)
+static int32 Kstdcall khomp_event_callback(int32 obj, K3L_EVENT * e)
 {				
     /* TODO: How do we make sure channels inside FreeSWITCH only change to valid states on K3L? */
     switch(e->Code)
@@ -1272,6 +1277,11 @@
 }
 
 
+static void Kstdcall khomp_audio_listener (int32 deviceid, int32 mixer, byte * read_buffer, int32 read_size)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New audio buffer for deviceid %d, mixer %d, with size %d\n", deviceid, mixer, read_size);
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c



More information about the Freeswitch-svn mailing list