本文整理汇总了C++中span_log函数的典型用法代码示例。如果您正苦于以下问题:C++ span_log函数的具体用法?C++ span_log怎么用?C++ span_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了span_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fax_set_rx_type
static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc)
{
fax_state_t *s;
fax_modems_state_t *t;
s = (fax_state_t *) user_data;
t = &s->modems;
span_log(&s->logging, SPAN_LOG_FLOW, "Set rx type %d\n", type);
if (t->current_rx_type == type)
return;
t->current_rx_type = type;
t->rx_bit_rate = bit_rate;
hdlc_rx_init(&t->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, t);
switch (type)
{
case T30_MODEM_V21:
fax_modems_start_slow_modem(t, FAX_MODEM_V21_RX);
break;
case T30_MODEM_V17:
fax_modems_start_fast_modem(t, FAX_MODEM_V17_RX, bit_rate, short_train, use_hdlc);
break;
case T30_MODEM_V27TER:
fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_RX, bit_rate, short_train, use_hdlc);
break;
case T30_MODEM_V29:
fax_modems_start_fast_modem(t, FAX_MODEM_V29_RX, bit_rate, short_train, use_hdlc);
break;
case T30_MODEM_DONE:
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
default:
fax_modems_set_rx_handler(t, (span_rx_handler_t) &span_dummy_rx, s, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, s);
break;
}
}
示例2: tx_packet_handler
static int tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
{
int i;
int chan;
/* This routine queues messages between two instances of T.38 processing */
chan = (intptr_t) user_data;
if (t38_simulate_incrementing_repeats)
{
for (i = 0; i < count; i++)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", t38_subst_seq[chan], len);
if (g1050_put(g1050_path[chan], buf, len, t38_subst_seq[chan], when) < 0)
printf("Lost packet %d\n", t38_subst_seq[chan]);
t38_subst_seq[chan] = (t38_subst_seq[chan] + 1) & 0xFFFF;
}
}
else
{
span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count);
for (i = 0; i < count; i++)
{
if (g1050_put(g1050_path[chan], buf, len, s->tx_seq_no, when) < 0)
printf("Lost packet %d\n", s->tx_seq_no);
}
}
return 0;
}
示例3: v29_v21_rx
static int v29_v21_rx(void *user_data, const int16_t amp[], int len)
{
fax_state_t *t;
fax_modems_state_t *s;
t = (fax_state_t *) user_data;
s = &t->modems;
v29_rx(&s->v29_rx, amp, len);
if (t->t30.rx_trained)
{
/* The fast modem has trained, so we no longer need to run the slow
one in parallel. */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx));
set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->v29_rx);
}
else
{
fsk_rx(&s->v21_rx, amp, len);
if (t->t30.rx_frame_received)
{
/* We have received something, and the fast modem has not trained. We must
be receiving valid V.21 */
span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx);
}
}
return 0;
}
示例4: tx_packet_handler_a
static int tx_packet_handler_a(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
{
int i;
static int subst_seq = 0;
/* This routine queues messages between two instances of T.38 processing */
if (simulate_incrementing_repeats)
{
for (i = 0; i < count; i++)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len);
g1050_put(path_a_to_b, buf, len, subst_seq, when);
subst_seq = (subst_seq + 1) & 0xFFFF;
}
}
else
{
span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count);
for (i = 0; i < count; i++)
g1050_put(path_a_to_b, buf, len, s->tx_seq_no, when);
}
return 0;
}
示例5: fax_set_rx_type
static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc)
{
fax_state_t *s;
put_bit_func_t put_bit_func;
void *put_bit_user_data;
fax_modems_state_t *t;
s = (fax_state_t *) user_data;
t = &s->modems;
span_log(&s->logging, SPAN_LOG_FLOW, "Set rx type %d\n", type);
if (t->current_rx_type == type)
return;
/*endif*/
t->current_rx_type = type;
t->rx_bit_rate = bit_rate;
if (use_hdlc)
{
put_bit_func = (put_bit_func_t) hdlc_rx_put_bit;
put_bit_user_data = (void *) &t->hdlc_rx;
hdlc_rx_init(&t->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
}
else
{
put_bit_func = t30_non_ecm_put_bit;
put_bit_user_data = (void *) &s->t30;
}
/*endif*/
switch (type)
{
case T30_MODEM_V21:
fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data);
fsk_rx_signal_cutoff(&t->v21_rx, -45.5f);
set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx);
break;
case T30_MODEM_V17:
v17_rx_restart(&t->fast_modems.v17_rx, bit_rate, short_train);
v17_rx_set_put_bit(&t->fast_modems.v17_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s);
break;
case T30_MODEM_V27TER:
v27ter_rx_restart(&t->fast_modems.v27ter_rx, bit_rate, false);
v27ter_rx_set_put_bit(&t->fast_modems.v27ter_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v27ter_v21_rx, &v27ter_v21_rx_fillin, s);
break;
case T30_MODEM_V29:
v29_rx_restart(&t->fast_modems.v29_rx, bit_rate, false);
v29_rx_set_put_bit(&t->fast_modems.v29_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v29_v21_rx, &v29_v21_rx_fillin, s);
break;
case T30_MODEM_DONE:
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
default:
set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s);
break;
}
/*endswitch*/
}
示例6: tone_detected
static void tone_detected(void *user_data, int tone, int level, int delay)
{
t30_state_t *s;
s = (t30_state_t *) user_data;
span_log(&s->logging, SPAN_LOG_FLOW, "%s detected (%ddBm0)\n", modem_connect_tone_to_str(tone), level);
}
示例7: v8_handler
static void v8_handler(void *user_data, v8_parms_t *result)
{
fax_state_t *s;
s = (fax_state_t *) user_data;
span_log(&s->logging, SPAN_LOG_FLOW, "V.8 report received\n");
}
示例8: tone_detected
static void tone_detected(void *user_data, int on, int level, int delay)
{
t30_state_t *s;
s = (t30_state_t *) user_data;
span_log(&s->logging, SPAN_LOG_FLOW, "FAX tone declared %s (%ddBm0)\n", (on) ? "on" : "off", level);
}
示例9: SPAN_DECLARE
SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s)
{
int row;
int i;
if (s->line_encoding == T4_COMPRESSION_ITU_T6)
{
/* Push enough zeros through the decoder to flush out any remaining codes */
for (i = 0; i < 13; i++)
t4_rx_put_bit(s, 0);
}
if (s->t4_t6_rx.curr_bad_row_run)
{
if (s->t4_t6_rx.curr_bad_row_run > s->t4_t6_rx.longest_bad_row_run)
s->t4_t6_rx.longest_bad_row_run = s->t4_t6_rx.curr_bad_row_run;
s->t4_t6_rx.curr_bad_row_run = 0;
}
if (s->image_size == 0)
return -1;
if (s->t4_t6_rx.row_write_handler)
{
for (row = 0; row < s->image_length; row++)
{
if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, s->image_buffer + row*s->bytes_per_row, s->bytes_per_row) < 0)
{
span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row);
break;
}
}
/* Write a blank row to indicate the end of the image. */
if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, NULL, 0) < 0)
span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row);
}
else
{
write_tiff_image(s);
}
s->t4_t6_rx.rx_bits = 0;
s->t4_t6_rx.rx_skip_bits = 0;
s->t4_t6_rx.rx_bitstream = 0;
s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
s->image_size = 0;
return 0;
}
示例10: write_tiff_image
static int write_tiff_image(t4_rx_state_t *s)
{
t4_rx_tiff_state_t *t;
#if defined(SPANDSP_SUPPORT_TIFF_FX)
uint64_t offset;
#endif
t = &s->tiff;
if (t->image_buffer == NULL || t->image_size <= 0)
return -1;
/* Set up the TIFF directory info... */
set_tiff_directory_info(s);
/* ...Put the directory in the file before the image data, to get them in the order specified
for TIFF/F files... */
if (!TIFFCheckpointDirectory(t->tiff_file))
span_log(&s->logging, SPAN_LOG_WARNING, "%s: Failed to checkpoint directory for page %d.\n", t->file, s->current_page);
/* ...and write out the image... */
if (TIFFWriteEncodedStrip(t->tiff_file, 0, t->image_buffer, t->image_size) < 0)
span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", t->file);
/* ...then finalise the directory entry, and libtiff is happy. */
if (!TIFFWriteDirectory(t->tiff_file))
span_log(&s->logging, SPAN_LOG_WARNING, "%s: Failed to write directory for page %d.\n", t->file, s->current_page);
#if defined(SPANDSP_SUPPORT_TIFF_FX)
if (s->current_page == 0)
{
if (!TIFFCreateCustomDirectory(t->tiff_file, &tiff_fx_field_array))
{
TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, PROFILETYPE_G3_FAX);
TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, FAXPROFILE_F);
TIFFSetField(t->tiff_file, TIFFTAG_VERSIONYEAR, "1998");
offset = 0;
if (!TIFFWriteCustomDirectory(t->tiff_file, &offset))
printf("Failed to write custom directory.\n");
/* Now go back and patch in the pointer to the new IFD */
if (!TIFFSetDirectory(t->tiff_file, s->current_page))
printf("Failed to set directory.\n");
if (!TIFFSetField(t->tiff_file, TIFFTAG_GLOBALPARAMETERSIFD, offset))
printf("Failed to set field.\n");
if (!TIFFWriteDirectory(t->tiff_file))
span_log(&s->logging, SPAN_LOG_WARNING, "%s: Failed to write directory for page %d.\n", t->file, s->current_page);
}
}
#endif
return 0;
}
示例11: SPAN_DECLARE
SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_schemes)
{
const char *comma;
int i;
comma = "";
span_log(&s->logging, SPAN_LOG_FLOW, "");
for (i = 0; i < 32; i++)
{
if ((modulation_schemes & (1 << i)))
{
span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s%s", comma, v8_modulation_to_str(modulation_schemes & (1 << i)));
comma = ", ";
}
}
span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, " supported\n");
}
示例12: SPAN_DECLARE
SPAN_DECLARE(void) t30_set_status(t30_state_t *s, int status)
{
if (s->current_status != status)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Status changing to '%s'\n", t30_completion_code_to_str(status));
s->current_status = status;
}
}
示例13: SPAN_DECLARE
SPAN_DECLARE(int) ademco_contactid_receiver_log_msg(ademco_contactid_receiver_state_t *s, const ademco_contactid_report_t *report)
{
const char *t;
span_log(&s->logging, SPAN_LOG_FLOW, "Ademco Contact ID message:\n");
span_log(&s->logging, SPAN_LOG_FLOW, " Account %X\n", report->acct);
switch (report->mt)
{
case ADEMCO_CONTACTID_MESSAGE_TYPE_18:
case ADEMCO_CONTACTID_MESSAGE_TYPE_98:
t = "Contact ID";
break;
default:
t = "???";
break;
}
span_log(&s->logging, SPAN_LOG_FLOW, " Message type %s (%X)\n", t, report->mt);
t = ademco_contactid_msg_qualifier_to_str(report->q);
span_log(&s->logging, SPAN_LOG_FLOW, " Qualifier %s (%X)\n", t, report->q);
t = ademco_contactid_event_to_str(report->xyz);
span_log(&s->logging, SPAN_LOG_FLOW, " Event %s (%X)\n", t, report->xyz);
span_log(&s->logging, SPAN_LOG_FLOW, " Group/partition %X\n", report->gg);
span_log(&s->logging, SPAN_LOG_FLOW, " User/Zone information %X\n", report->ccc);
return 0;
}
示例14: SPAN_DECLARE
SPAN_DECLARE(t4_rx_state_t *) t4_rx_init(t4_rx_state_t *s, const char *file, int supported_output_compressions)
{
bool alloced;
alloced = false;
if (s == NULL)
{
if ((s = (t4_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
alloced = true;
}
#if defined(SPANDSP_SUPPORT_TIFF_FX)
TIFF_FX_init();
#endif
memset(s, 0, sizeof(*s));
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "T.4");
span_log(&s->logging, SPAN_LOG_FLOW, "Start rx document\n");
s->supported_tiff_compressions = supported_output_compressions;
#if !defined(SPANDSP_SUPPORT_T88)
s->supported_tiff_compressions &= ~T4_COMPRESSION_T88;
#endif
#if !defined(SPANDSP_SUPPORT_T43)
s->supported_tiff_compressions &= ~T4_COMPRESSION_T43;
#endif
#if !defined(SPANDSP_SUPPORT_T45)
s->supported_tiff_compressions &= ~T4_COMPRESSION_T45;
#endif
/* Set some default values */
s->metadata.x_resolution = T4_X_RESOLUTION_R8;
s->metadata.y_resolution = T4_Y_RESOLUTION_FINE;
s->current_page = 0;
s->current_decoder = 0;
/* Default handler */
s->row_handler = tiff_row_write_handler;
s->row_handler_user_data = s;
if (file)
{
s->tiff.pages_in_file = 0;
if (open_tiff_output_file(s, file) < 0)
{
if (alloced)
span_free(s);
return NULL;
}
/* Save the file name for logging reports. */
s->tiff.file = strdup(file);
}
return s;
}
示例15: write_tiff_image
static void write_tiff_image(t4_state_t *s)
{
/* Set up the TIFF directory info... */
set_tiff_directory_info(s);
/* ..and then write the image... */
if (TIFFWriteEncodedStrip(s->tiff.tiff_file, 0, s->image_buffer, s->image_length*s->bytes_per_row) < 0)
span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", s->tiff.file);
/* ...then the directory entry, and libtiff is happy. */
TIFFWriteDirectory(s->tiff.tiff_file);
}