1 --- opal-3.16.2/plugins/fax/fax_spandsp/spandsp_fax.cpp 2016-05-12 12:03:01.000000000 +0200
2 +++ opal-3.18.8/plugins/fax/fax_spandsp/spandsp_fax.cpp 2022-03-27 16:06:21.000000000 +0200
9 + #include "spandsp/version.h"
15 #define PTRACE(level, args) \
16 if (LogFunction != NULL && LogFunction(level, NULL, 0, NULL, NULL)) { \
17 - std::ostringstream strm; strm << args; \
18 - LogFunction(level, __FILE__, __LINE__, "FaxCodec", strm.str().c_str()); \
19 + std::ostringstream ptrace_strm; ptrace_strm << args; \
20 + LogFunction(level, __FILE__, __LINE__, "FaxCodec", ptrace_strm.str().c_str()); \
23 +#if SPANDSP_RELEASE_DATE > 20110122
24 +static void SpanDSP_Message(void *, int level, const char *text)
26 static void SpanDSP_Message(int level, const char *text)
29 if (*text != '\0' && LogFunction != NULL) {
30 // Close mapping between spandsp levels and OPAL ones, kust one tweak
32 if (!LogFunction(level, NULL, 0, NULL, NULL))
35 - int last = strlen(text)-1;
36 + size_t last = strlen(text)-1;
37 if (text[last] == '\n')
38 ((char *)text)[last] = '\0';
39 LogFunction(level, __FILE__, __LINE__, "SpanDSP", text);
42 static void InitLogging(logging_state_t * logging, const std::string & tag)
44 +#if SPANDSP_RELEASE_DATE > 20110122
45 + span_log_set_message_handler(logging, SpanDSP_Message, NULL);
47 span_log_set_message_handler(logging, SpanDSP_Message);
50 int level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG;
57 + toLen = (unsigned)size;
59 memcpy(PluginCodec_RTP_GetPayloadPtr(toPtr), &packet[0], packet.size());
62 strm << "-1 (In progress)";
64 "Bit Rate=" << stats.bit_rate << "\n"
65 +#if SPANDSP_RELEASE_DATE > 20110122
66 + "Encoding=" << stats.type << ' ' << CompressionNames[stats.type&3] << "\n"
68 "Encoding=" << stats.encoding << ' ' << CompressionNames[stats.encoding&3] << "\n"
70 "Error Correction=" << stats.error_correcting_mode << "\n"
71 "Tx Pages=" << (stats.m_receiving ? -1 : stats.pages_tx) << "\n"
72 "Rx Pages=" << (stats.m_receiving ? stats.pages_rx : -1) << "\n"
74 int m_supported_resolutions;
75 int m_supported_compressions;
77 + t30_state_t * m_t30state;
82 , m_stationIdentifer("-")
83 - , m_supported_image_sizes(T30_SUPPORT_US_LETTER_LENGTH |
84 - T30_SUPPORT_US_LEGAL_LENGTH |
85 - T30_SUPPORT_UNLIMITED_LENGTH |
86 - T30_SUPPORT_A4_LENGTH |
87 - T30_SUPPORT_B4_LENGTH |
88 - T30_SUPPORT_215MM_WIDTH |
89 - T30_SUPPORT_255MM_WIDTH |
90 - T30_SUPPORT_303MM_WIDTH)
91 - , m_supported_resolutions(T30_SUPPORT_STANDARD_RESOLUTION |
92 - T30_SUPPORT_FINE_RESOLUTION |
93 - T30_SUPPORT_SUPERFINE_RESOLUTION |
94 - T30_SUPPORT_R8_RESOLUTION |
95 - T30_SUPPORT_R16_RESOLUTION)
96 - , m_supported_compressions(T30_SUPPORT_T4_1D_COMPRESSION |
97 - T30_SUPPORT_T4_2D_COMPRESSION |
98 - T30_SUPPORT_T6_COMPRESSION)
99 + , m_supported_image_sizes(INT_MAX)
100 + , m_supported_resolutions(INT_MAX)
101 + , m_supported_compressions(INT_MAX)
109 bool Open(t30_state_t * t30state)
111 + m_t30state = t30state;
113 InitLogging(t30_get_logging_state(t30state), m_tag);
115 if (m_tiffFileName.empty()) {
118 t30_set_supported_modems(t30state, m_supported_modems);
119 t30_set_supported_image_sizes(t30state, m_supported_image_sizes);
120 +#if SPANDSP_RELEASE_DATE > 20110122
121 + t30_set_supported_bilevel_resolutions(t30state, m_supported_resolutions);
123 t30_set_supported_resolutions(t30state, m_supported_resolutions);
125 t30_set_supported_compressions(t30state, m_supported_compressions);
126 t30_set_ecm_capability(t30state, m_useECM);
128 @@ -971,50 +976,62 @@
129 bool IsReceiving() const { return m_receiving; }
132 +#if SPANDSP_RELEASE_DATE > 20110122
133 + static int PhaseB(void * user_data, int result)
135 static int PhaseB(t30_state_t * t30state, void * user_data, int result)
138 if (user_data != NULL)
139 - ((FaxTIFF *)user_data)->PhaseB(t30state, result);
140 + ((FaxTIFF *)user_data)->PhaseB(result);
144 +#if SPANDSP_RELEASE_DATE > 20110122
145 + static int PhaseD(void * user_data, int result)
147 static int PhaseD(t30_state_t * t30state, void * user_data, int result)
150 if (user_data != NULL)
151 - ((FaxTIFF *)user_data)->PhaseD(t30state, result);
152 + ((FaxTIFF *)user_data)->PhaseD(result);
156 +#if SPANDSP_RELEASE_DATE > 20110122
157 + static void PhaseE(void * user_data, int result)
159 static void PhaseE(t30_state_t * t30state, void * user_data, int result)
162 if (user_data != NULL)
163 - ((FaxTIFF *)user_data)->PhaseE(t30state, result);
164 + ((FaxTIFF *)user_data)->PhaseE(result);
169 - void PhaseB(t30_state_t * t30state, int)
173 PTRACE(3, m_tag << " SpanDSP entered Phase B:\n"
174 - << MyStats(t30state, m_completed, m_receiving, m_phase));
175 + << MyStats(m_t30state, m_completed, m_receiving, m_phase));
178 - void PhaseD(t30_state_t * t30state, int)
182 PTRACE(3, m_tag << " SpanDSP entered Phase D:\n"
183 - << MyStats(t30state, m_completed, m_receiving, m_phase));
184 + << MyStats(m_t30state, m_completed, m_receiving, m_phase));
187 - void PhaseE(t30_state_t * t30state, int result)
188 + void PhaseE(int result)
191 m_completed = true; // Finished, exit codec loops
194 PTRACE(3, m_tag << " SpanDSP entered Phase E:\n"
195 - << MyStats(t30state, m_completed, m_receiving, m_phase));
196 + << MyStats(m_t30state, m_completed, m_receiving, m_phase));