Commit 0110bb6a authored by Rafaël Carré's avatar Rafaël Carré
Browse files

replace printf() with logger macros

parent 4a9a2f4f
......@@ -377,7 +377,7 @@ bool AudioRecord::openExistingRawFile()
bool AudioRecord::openExistingWavFile()
{
_info ("AudioRecord: Open existing wave file");
_info ("%s(%s)\n", __PRETTY_FUNCTION__, fileName_);
fp = fopen (fileName_, "rb+");
......@@ -386,8 +386,6 @@ bool AudioRecord::openExistingWavFile()
return false;
}
printf ("AudioRecord::openExistingWavFile()::Tried to open %s ",fileName_);
if (fseek (fp, 40, SEEK_SET) != 0) // jump to data length
_warn ("AudioRecord: Error: Couldn't seek offset 40 in the file ");
......
......@@ -29,6 +29,7 @@
*/
#include "audiocodec.h"
#include "logger.h"
#include <cstdio>
#include <celt/celt.h>
......@@ -52,40 +53,39 @@ class Celt : public sfl::AudioCodec
if (error != CELT_OK) {
switch (error) {
case CELT_BAD_ARG:
printf ("Celt: Error: An (or more) invalid argument (e.g. out of range)\n");
_error ("Celt: An (or more) invalid argument (e.g. out of range)\n");
break;
case CELT_INVALID_MODE:
printf ("Celt: Error: The mode struct passed is invalid\n");
_error("Celt: The mode struct passed is invalid\n");
break;
case CELT_INTERNAL_ERROR:
printf ("Celt: Error: An internal error was detected\n");
_error("Celt: An internal error was detected\n");
break;
case CELT_CORRUPTED_DATA:
printf ("Celt: Error: The data passed (e.g. compressed data to decoder) is corrupted\n");
_error("Celt: The data passed (e.g. compressed data to decoder) is corrupted\n");
break;
case CELT_UNIMPLEMENTED:
printf ("Celt: Error: Invalid/unsupported request numbe\n");
_error("Celt: Invalid/unsupported request numbe\n");
break;
case CELT_INVALID_STATE:
printf ("Celt: Error: An encoder or decoder structure is invalid or already freed\n");
_error("Celt: An encoder or decoder structure is invalid or already freed\n");
break;
case CELT_ALLOC_FAIL:
printf ("Celt: Error: Memory allocation has failed\n");
_error("Celt: Memory allocation has failed\n");
break;
default:
printf ("Celt: Error");
_error("Celt: Unknown error %d\n", error);
}
}
if (_mode == NULL) {
printf ("Celt: Error: Failed to create Celt mode");
}
if (_mode == NULL)
_error("Celt: Failed to create Celt mode");
// bytes_per_packet = 1024;
// if (bytes_per_packet < 0 || bytes_per_packet > MAX_PACKET)
// {
// printf ("bytes per packet must be between 0 and %d");
// _error("bytes per packet must be between 0 and %d");
// }
// celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);
......
......@@ -31,10 +31,11 @@
#include "audiocodec.h"
extern "C" {
#include <gsm/gsm.h>
#include "logger.h"
#include <cassert>
extern "C" {
#include <gsm/gsm.h>
}
/**
......@@ -54,10 +55,10 @@ class Gsm : public sfl::AudioCodec
_hasDynamicPayload = false;
if (! (_decode_gsmhandle = gsm_create()))
printf ("ERROR: decode_gsm_create\n");
_error("ERROR: decode_gsm_create\n");
if (! (_encode_gsmhandle = gsm_create()))
printf ("AudioCodec: ERROR: encode_gsm_create\n");
_error("ERROR: encode_gsm_create\n");
}
Gsm (const Gsm&);
......@@ -74,7 +75,7 @@ class Gsm : public sfl::AudioCodec
(void) buf_size;
if (gsm_decode (_decode_gsmhandle, (gsm_byte*) src, (gsm_signal*) dst) < 0)
printf ("ERROR: gsm_decode\n");
_error("ERROR: gsm_decode\n");
return _frameSize;
}
......
......@@ -94,72 +94,69 @@ static void sink_input_info_callback (pa_context *c UNUSED, const pa_sink_info *
{
char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
if (!eol) {
printf ("Sink %u\n"
" Name: %s\n"
" Driver: %s\n"
" Description: %s\n"
" Sample Specification: %s\n"
" Channel Map: %s\n"
" Owner Module: %u\n"
" Volume: %s\n"
" Monitor Source: %u\n"
" Latency: %0.0f usec\n"
" Flags: %s%s%s\n",
i->index,
i->name,
i->driver,
i->description,
pa_sample_spec_snprint (s, sizeof (s), &i->sample_spec),
pa_channel_map_snprint (cm, sizeof (cm), &i->channel_map),
i->owner_module,
i->mute ? "muted" : pa_cvolume_snprint (cv, sizeof (cv), &i->volume),
i->monitor_source,
(double) i->latency,
i->flags & PA_SINK_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
i->flags & PA_SINK_LATENCY ? "LATENCY " : "",
i->flags & PA_SINK_HARDWARE ? "HARDWARE" : "");
std::string deviceName (i->name);
( (PulseLayer *) userdata)->getSinkList()->push_back (deviceName);
if (eol)
return;
}
_debug ("Sink %u\n"
" Name: %s\n"
" Driver: %s\n"
" Description: %s\n"
" Sample Specification: %s\n"
" Channel Map: %s\n"
" Owner Module: %u\n"
" Volume: %s\n"
" Monitor Source: %u\n"
" Latency: %0.0f usec\n"
" Flags: %s%s%s\n",
i->index,
i->name,
i->driver,
i->description,
pa_sample_spec_snprint (s, sizeof (s), &i->sample_spec),
pa_channel_map_snprint (cm, sizeof (cm), &i->channel_map),
i->owner_module,
i->mute ? "muted" : pa_cvolume_snprint (cv, sizeof (cv), &i->volume),
i->monitor_source,
(double) i->latency,
i->flags & PA_SINK_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
i->flags & PA_SINK_LATENCY ? "LATENCY " : "",
i->flags & PA_SINK_HARDWARE ? "HARDWARE" : "");
((PulseLayer *)userdata)->getSinkList()->push_back (i->name);
}
static void source_input_info_callback (pa_context *c UNUSED, const pa_source_info *i, int eol, void *userdata)
{
char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
if (!eol) {
printf ("Sink %u\n"
" Name: %s\n"
" Driver: %s\n"
" Description: %s\n"
" Sample Specification: %s\n"
" Channel Map: %s\n"
" Owner Module: %u\n"
" Volume: %s\n"
" Monitor if Sink: %u\n"
" Latency: %0.0f usec\n"
" Flags: %s%s%s\n",
i->index,
i->name,
i->driver,
i->description,
pa_sample_spec_snprint (s, sizeof (s), &i->sample_spec),
pa_channel_map_snprint (cm, sizeof (cm), &i->channel_map),
i->owner_module,
i->mute ? "muted" : pa_cvolume_snprint (cv, sizeof (cv), &i->volume),
i->monitor_of_sink,
(double) i->latency,
i->flags & PA_SOURCE_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
i->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
i->flags & PA_SOURCE_HARDWARE ? "HARDWARE" : "");
std::string deviceName (i->name);
( (PulseLayer *) userdata)->getSourceList()->push_back (deviceName);
}
if (!eol)
return;
_debug ("Sink %u\n"
" Name: %s\n"
" Driver: %s\n"
" Description: %s\n"
" Sample Specification: %s\n"
" Channel Map: %s\n"
" Owner Module: %u\n"
" Volume: %s\n"
" Monitor if Sink: %u\n"
" Latency: %0.0f usec\n"
" Flags: %s%s%s\n",
i->index,
i->name,
i->driver,
i->description,
pa_sample_spec_snprint (s, sizeof (s), &i->sample_spec),
pa_channel_map_snprint (cm, sizeof (cm), &i->channel_map),
i->owner_module,
i->mute ? "muted" : pa_cvolume_snprint (cv, sizeof (cv), &i->volume),
i->monitor_of_sink,
(double) i->latency,
i->flags & PA_SOURCE_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
i->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
i->flags & PA_SOURCE_HARDWARE ? "HARDWARE" : "");
((PulseLayer *)userdata)->getSourceList()->push_back (i->name);
}
......
......@@ -746,47 +746,36 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
case IAX_EVENT_ACCEPT:
// Call accepted over there by the computer, not the user yet.
_debug ("IAX_EVENT_ACCEPT: codec format: ");
_debug ("IAX_EVENT_ACCEPT: codec format: %d", event->ies.format);
if (event->ies.format) {
printf ("%i", event->ies.format);
if (event->ies.format)
call->setFormat (event->ies.format);
} else {
printf ("no codec format");
}
break;
case IAX_EVENT_ANSWER:
case IAX_EVENT_TRANSFER:
if (call->getConnectionState() != Call::Connected) {
Manager::instance().addStream (call->getCallId());
if (call->getConnectionState() == Call::Connected)
break;
call->setConnectionState (Call::Connected);
call->setState (Call::Active);
// audiolayer->startStream();
Manager::instance().addStream (call->getCallId());
_debug ("IAX_EVENT_ANSWER: codec format: ");
call->setConnectionState (Call::Connected);
call->setState (Call::Active);
// audiolayer->startStream();
if (event->ies.format) {
// Should not get here, should have been set in EVENT_ACCEPT
printf ("%i", event->ies.format);
call->setFormat (event->ies.format);
}
_debug ("IAX_EVENT_ANSWER: codec format: %d", event->ies.format);
{
printf ("no codec format");
}
// Should not get here, should have been set in EVENT_ACCEPT
if (event->ies.format)
call->setFormat (event->ies.format);
Manager::instance().peerAnsweredCall (id);
Manager::instance().peerAnsweredCall (id);
// start audio here?
audiolayer->startStream();
audiolayer->flushMain();
} else {
// deja connecté ?
}
// start audio here?
audiolayer->startStream();
audiolayer->flushMain();
break;
......@@ -833,40 +822,6 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
case IAX_EVENT_TIMEOUT:
break;
case IAX_EVENT_TRANSFER:
_debug ("IAX_EVENT_TRANSFER");
if (call->getConnectionState() != Call::Connected) {
Manager::instance().addStream (call->getCallId());
call->setConnectionState (Call::Connected);
call->setState (Call::Active);
// audiolayer->startStream();
_debug ("IAX_EVENT_ANSWER: codec format: ");
if (event->ies.format) {
// Should not get here, should have been set in EVENT_ACCEPT
printf ("%i", event->ies.format);
call->setFormat (event->ies.format);
}
{
printf ("no codec format");
}
Manager::instance().peerAnsweredCall (id);
// start audio here?
audiolayer->startStream();
audiolayer->flushMain();
} else {
// deja connecté ?
}
break;
default:
_debug ("iaxHandleCallEvent: Unknown event type (in call event): %d", event->etype);
......
......@@ -217,7 +217,6 @@ pj_status_t InstantMessaging::sip_send (pjsip_inv_session *session, std::string&
// Archive the message
this->saveMessage (text, "Me", id);
printf ("SIPVoIPLink::sendTextMessage %s %s\n", id.c_str(), text.c_str());
return PJ_SUCCESS;
}
......
......@@ -42,8 +42,6 @@ Pattern::Pattern (const std::string& pattern, const std::string& options) :
_count (0),
_options (0)
{
// printf("Pattern constructor called for %s!\n", pattern.c_str());
// Set offsets
_offset[0] = _offset[1] = 0;
......@@ -133,13 +131,9 @@ std::vector<std::string> Pattern::groups (void)
&stringList);
std::vector<std::string> matchedSubstrings;
int i = 1;
while (stringList[i] != NULL) {
for (int i = 1; stringList[i] != NULL; i++)
matchedSubstrings.push_back (stringList[i]);
// printf ("Substr: <start>%s<end>", stringList[i]);
i++;
}
pcre_free_substring_list (stringList);
......@@ -284,7 +278,6 @@ bool Pattern::matches (const std::string& subject) throw (match_error)
// Matching failed.
if (rc < 0) {
_offset[0] = _offset[1] = 0;
// printf(" Matching failed with %d\n", rc);
return false;
}
......@@ -319,8 +312,6 @@ std::vector<std::string> Pattern::split (void)
tokenStart = start();
substringSplitted.push_back (_subject.substr (tokenEnd + 1,
tokenStart - tokenEnd - 1));
// printf("split: %s\n", _subject.substr (tokenEnd + 1,
// tokenStart - tokenEnd - 1).c_str());
tokenEnd = end();
}
......
......@@ -319,7 +319,6 @@ void SIPAccount::unserialize (Conf::MappingNode *map)
map[USERNAME] = user;
map[PASSWORD] = pass;
map[REALM] = realm;
printf("UNSERIALIZED %s %s %s\n", user.c_str(), pass.c_str(), realm.c_str());
creds.push_back(map);
}
}
......
......@@ -4636,7 +4636,7 @@ std::vector<std::string> SIPVoIPLink::getAllIpInterfaceByName (void)
for (int i = 0; i < nifaces; i++) {
_debug (" %s ", ifreqs[i].ifr_name);
ifaceList.push_back (std::string (ifreqs[i].ifr_name));
printf (" %s\n", getInterfaceAddrFromName (std::string (ifreqs[i].ifr_name)).c_str());
_debug (" %s\n", getInterfaceAddrFromName (ifreqs[i].ifr_name).c_str());
}
return ifaceList;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment