mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-02 01:25:11 +00:00
update to snapshot spandsp-20090220
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12190 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
65181f78ff
commit
da557fd631
19 files changed
+695
-527
No files matched your search
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t4.h,v 1.3 2009/02/16 09:57:22 steveu Exp $
|
||||
* $Id: t4.h,v 1.4 2009/02/20 12:34:20 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_SPANDSP_PRIVATE_T4_H_)
|
||||
@@ -107,7 +107,7 @@ struct t4_state_s
|
||||
int stop_page;
|
||||
|
||||
/*! \brief The number of pages transferred to date. */
|
||||
int pages_transferred;
|
||||
int current_page;
|
||||
/*! \brief The number of pages in the current image file. */
|
||||
int pages_in_file;
|
||||
/*! \brief Column-to-column (X) resolution in pixels per metre. */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t30.h,v 1.123 2009/02/04 13:18:53 steveu Exp $
|
||||
* $Id: t30.h,v 1.124 2009/02/20 12:34:20 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -515,8 +515,10 @@ typedef struct
|
||||
int bit_rate;
|
||||
/*! \brief TRUE if error correcting mode is used. */
|
||||
int error_correcting_mode;
|
||||
/*! \brief The number of pages transferred so far. */
|
||||
int pages_transferred;
|
||||
/*! \brief The number of pages sent so far. */
|
||||
int pages_tx;
|
||||
/*! \brief The number of pages received so far. */
|
||||
int pages_rx;
|
||||
/*! \brief The number of pages in the file (<0 if not known). */
|
||||
int pages_in_file;
|
||||
/*! \brief The horizontal column-to-column resolution of the page, in pixels per metre */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t4.h,v 1.57 2009/02/10 13:06:47 steveu Exp $
|
||||
* $Id: t4.h,v 1.58 2009/02/20 12:34:20 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -323,11 +323,14 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s);
|
||||
\return zero for success, -1 for failure. */
|
||||
SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s);
|
||||
|
||||
/*! \brief Check for the existance of the next page. This information can
|
||||
be needed before it is determined that the current page is finished with.
|
||||
/*! \brief Check for the existance of the next page, and whether its format is like the
|
||||
current one. This information can be needed before it is determined that the current
|
||||
page is finished with.
|
||||
\param s The T.4 context.
|
||||
\return zero for next page found, -1 for failure. */
|
||||
SPAN_DECLARE(int) t4_tx_more_pages(t4_state_t *s);
|
||||
\return 0 for next page found with the same format as the current page.
|
||||
1 for next page found with different format from the current page.
|
||||
-1 for no page found, or file failure. */
|
||||
SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s);
|
||||
|
||||
/*! \brief Complete the sending of a page.
|
||||
\param s The T.4 context.
|
||||
@@ -435,6 +438,11 @@ SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s);
|
||||
\return The number of pages, or -1 if there is an error. */
|
||||
SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s);
|
||||
|
||||
/*! \brief Get the currnet page number in the file.
|
||||
\param s The T.4 context.
|
||||
\return The page number, or -1 if there is an error. */
|
||||
SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s);
|
||||
|
||||
/*! Get the current image transfer statistics.
|
||||
\brief Get the current transfer statistics.
|
||||
\param s The T.4 context.
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
/* The date and time of the version are in UTC form. */
|
||||
|
||||
#define SPANDSP_RELEASE_DATE 20090216
|
||||
#define SPANDSP_RELEASE_TIME 100031
|
||||
#define SPANDSP_RELEASE_DATE 20090220
|
||||
#define SPANDSP_RELEASE_TIME 124309
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
+19
-4
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t30.c,v 1.285 2009/02/10 13:06:46 steveu Exp $
|
||||
* $Id: t30.c,v 1.286 2009/02/20 12:34:20 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -469,7 +469,9 @@ static int copy_quality(t30_state_t *s)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Bad rows = %d\n", stats.bad_rows);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Longest bad row run = %d\n", stats.longest_bad_row_run);
|
||||
if (stats.bad_rows == 0)
|
||||
/* Don't treat a page as perfect because it has zero bad rows out of zero total rows. A zero row
|
||||
page has got to be some kind of total page failure. */
|
||||
if (stats.bad_rows == 0 && stats.length != 0)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is perfect\n");
|
||||
quality = T30_COPY_QUALITY_PERFECT;
|
||||
@@ -587,10 +589,21 @@ static void release_resources(t30_state_t *s)
|
||||
|
||||
static uint8_t check_next_tx_step(t30_state_t *s)
|
||||
{
|
||||
int res;
|
||||
int more;
|
||||
|
||||
if (t4_tx_more_pages(&(s->t4)) == 0)
|
||||
res = t4_tx_next_page_has_different_format(&(s->t4));
|
||||
if (res == 0)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with the same format\n");
|
||||
return (s->local_interrupt_pending) ? T30_PRI_MPS : T30_MPS;
|
||||
}
|
||||
if (res > 0)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with a different format\n");
|
||||
s->tx_start_page = t4_tx_get_current_page_in_file(&(s->t4)) + 1;
|
||||
return (s->local_interrupt_pending) ? T30_PRI_EOM : T30_EOM;
|
||||
}
|
||||
/* Call a user handler, if one is set, to check if another document is to be sent.
|
||||
If so, we send an EOM, rather than an EOP. Then we will renegotiate, and the new
|
||||
document will begin. */
|
||||
@@ -5778,7 +5791,8 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
|
||||
t->error_correcting_mode = s->error_correcting_mode;
|
||||
t->error_correcting_mode_retries = s->error_correcting_mode_retries;
|
||||
t4_get_transfer_statistics(&s->t4, &stats);
|
||||
t->pages_transferred = stats.pages_transferred;
|
||||
t->pages_tx = s->ecm_tx_page;
|
||||
t->pages_rx = s->ecm_rx_page;
|
||||
t->pages_in_file = stats.pages_in_file;
|
||||
t->width = stats.width;
|
||||
t->length = stats.length;
|
||||
@@ -5833,6 +5847,7 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s)
|
||||
s->far_end_detected = FALSE;
|
||||
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0);
|
||||
release_resources(s);
|
||||
/* The ECM page number is only reset at call establishment */
|
||||
s->ecm_rx_page = 0;
|
||||
s->ecm_tx_page = 0;
|
||||
return 0;
|
||||
|
||||
+138
-50
@@ -24,7 +24,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t4.c,v 1.125 2009/02/16 09:57:22 steveu Exp $
|
||||
* $Id: t4.c,v 1.126 2009/02/20 12:34:20 steveu Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -239,8 +239,8 @@ static int set_tiff_directory_info(t4_state_t *s)
|
||||
/* Set the total pages to 1. For any one page document we will get this
|
||||
right. For multi-page documents we will need to come back and fill in
|
||||
the right answer when we know it. */
|
||||
TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, s->pages_transferred++, 1);
|
||||
s->pages_in_file = s->pages_transferred;
|
||||
TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, s->current_page++, 1);
|
||||
s->pages_in_file = s->current_page;
|
||||
if (t->output_compression == COMPRESSION_CCITT_T4)
|
||||
{
|
||||
if (s->bad_rows)
|
||||
@@ -301,8 +301,6 @@ static int get_tiff_directory_info(t4_state_t *s)
|
||||
{ -1.00f, -1, -1}
|
||||
};
|
||||
uint16_t res_unit;
|
||||
uint16_t photo_metric;
|
||||
uint16_t fill_order;
|
||||
uint32_t parm;
|
||||
float x_resolution;
|
||||
float y_resolution;
|
||||
@@ -327,16 +325,14 @@ static int get_tiff_directory_info(t4_state_t *s)
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution);
|
||||
res_unit = RESUNIT_INCH;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit);
|
||||
photo_metric = PHOTOMETRIC_MINISWHITE;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &photo_metric);
|
||||
if (photo_metric != PHOTOMETRIC_MINISWHITE)
|
||||
t->photo_metric = PHOTOMETRIC_MINISWHITE;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &t->photo_metric);
|
||||
if (t->photo_metric != PHOTOMETRIC_MINISWHITE)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", s->file);
|
||||
t->photo_metric = photo_metric;
|
||||
fill_order = FILLORDER_LSB2MSB;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_FILLORDER, &fill_order);
|
||||
if (fill_order != FILLORDER_LSB2MSB)
|
||||
t->fill_order = FILLORDER_LSB2MSB;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_FILLORDER, &t->fill_order);
|
||||
if (t->fill_order != FILLORDER_LSB2MSB)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "%s: Fill order needs swapping.\n", s->file);
|
||||
t->fill_order = fill_order;
|
||||
|
||||
/* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the
|
||||
precise value. The other value should be exact. */
|
||||
@@ -367,6 +363,92 @@ static int get_tiff_directory_info(t4_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int test_tiff_directory_info(t4_state_t *s)
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
float resolution;
|
||||
int code;
|
||||
} x_res_table[] =
|
||||
{
|
||||
{ 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4},
|
||||
{ 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8},
|
||||
{ 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300},
|
||||
{ 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16},
|
||||
{ 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600},
|
||||
{ 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800},
|
||||
{1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200},
|
||||
{ -1.00f, -1}
|
||||
};
|
||||
static const struct
|
||||
{
|
||||
float resolution;
|
||||
int code;
|
||||
int max_rows_to_next_1d_row;
|
||||
} y_res_table[] =
|
||||
{
|
||||
{ 38.50f, T4_Y_RESOLUTION_STANDARD, 2},
|
||||
{ 77.00f, T4_Y_RESOLUTION_FINE, 4},
|
||||
{ 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6},
|
||||
{ 154.00f, T4_Y_RESOLUTION_SUPERFINE, 8},
|
||||
{ 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12},
|
||||
{ 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16},
|
||||
{1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24},
|
||||
{ -1.00f, -1, -1}
|
||||
};
|
||||
uint16_t res_unit;
|
||||
uint32_t parm;
|
||||
float x_resolution;
|
||||
float y_resolution;
|
||||
int i;
|
||||
t4_tiff_state_t *t;
|
||||
|
||||
t = &s->tiff;
|
||||
parm = 0;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm);
|
||||
if (parm != 1)
|
||||
return -1;
|
||||
parm = 0;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm);
|
||||
if (s->image_width != parm)
|
||||
{
|
||||
printf("Width changed\n");
|
||||
return 1;
|
||||
}
|
||||
x_resolution = 0.0f;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution);
|
||||
y_resolution = 0.0f;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution);
|
||||
res_unit = RESUNIT_INCH;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit);
|
||||
|
||||
/* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the
|
||||
precise value. The other value should be exact. */
|
||||
/* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */
|
||||
for (i = 0; x_res_table[i].code > 0; i++)
|
||||
{
|
||||
if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution))
|
||||
break;
|
||||
}
|
||||
if (s->x_resolution != x_res_table[i].code)
|
||||
{
|
||||
printf("X-res changed\n");
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; y_res_table[i].code > 0; i++)
|
||||
{
|
||||
if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution))
|
||||
break;
|
||||
}
|
||||
if (s->y_resolution != y_res_table[i].code)
|
||||
{
|
||||
printf("Y-res changed\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int get_tiff_total_pages(t4_state_t *s)
|
||||
{
|
||||
int max;
|
||||
@@ -378,7 +460,7 @@ static int get_tiff_total_pages(t4_state_t *s)
|
||||
while (TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) max))
|
||||
max++;
|
||||
/* Back to the previous page */
|
||||
if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->pages_transferred))
|
||||
if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
|
||||
return -1;
|
||||
return max;
|
||||
}
|
||||
@@ -460,15 +542,15 @@ static int close_tiff_output_file(t4_state_t *s)
|
||||
t = &s->tiff;
|
||||
/* Perform any operations needed to tidy up a written TIFF file before
|
||||
closure. */
|
||||
if (s->pages_transferred > 1)
|
||||
if (s->current_page > 1)
|
||||
{
|
||||
/* We need to edit the TIFF directories. Until now we did not know
|
||||
the total page count, so the TIFF file currently says one. Now we
|
||||
need to set the correct total page count associated with each page. */
|
||||
for (i = 0; i < s->pages_transferred; i++)
|
||||
for (i = 0; i < s->current_page; i++)
|
||||
{
|
||||
TIFFSetDirectory(t->tiff_file, (tdir_t) i);
|
||||
TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, i, s->pages_transferred);
|
||||
TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, i, s->current_page);
|
||||
TIFFWriteDirectory(t->tiff_file);
|
||||
}
|
||||
}
|
||||
@@ -478,7 +560,7 @@ static int close_tiff_output_file(t4_state_t *s)
|
||||
{
|
||||
/* Try not to leave a file behind, if we didn't receive any pages to
|
||||
put in it. */
|
||||
if (s->pages_transferred == 0)
|
||||
if (s->current_page == 0)
|
||||
remove(s->file);
|
||||
free((char *) s->file);
|
||||
}
|
||||
@@ -501,6 +583,12 @@ static int get_tiff_directory_info(t4_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int test_tiff_directory_info(t4_state_t *s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static int open_tiff_input_file(t4_state_t *s, const char *file)
|
||||
{
|
||||
return 0;
|
||||
@@ -1326,7 +1414,7 @@ SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int outpu
|
||||
value to ensure it will be seen as changing when the real value is used. */
|
||||
s->bytes_per_row = 0;
|
||||
|
||||
s->pages_transferred = 0;
|
||||
s->current_page = 0;
|
||||
s->pages_in_file = 0;
|
||||
s->start_page = 0;
|
||||
s->stop_page = INT_MAX;
|
||||
@@ -1866,9 +1954,12 @@ SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start
|
||||
if (open_tiff_input_file(s, file) < 0)
|
||||
return NULL;
|
||||
s->file = strdup(file);
|
||||
s->current_page =
|
||||
s->start_page = (start_page >= 0) ? start_page : 0;
|
||||
s->stop_page = (stop_page >= 0) ? stop_page : INT_MAX;
|
||||
|
||||
if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
|
||||
return -1;
|
||||
if (get_tiff_directory_info(s))
|
||||
{
|
||||
close_tiff_input_file(s);
|
||||
@@ -1877,7 +1968,6 @@ SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start
|
||||
|
||||
s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1;
|
||||
|
||||
s->pages_transferred = s->start_page;
|
||||
s->pages_in_file = -1;
|
||||
|
||||
run_space = (s->image_width + 4)*sizeof(uint32_t);
|
||||
@@ -1937,7 +2027,7 @@ static void make_header(t4_state_t *s, char *header)
|
||||
tm.tm_min,
|
||||
s->header_info,
|
||||
s->tiff.local_ident,
|
||||
s->pages_transferred + 1);
|
||||
s->current_page + 1);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -1950,24 +2040,24 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
|
||||
int row_bufptr;
|
||||
int run_space;
|
||||
int len;
|
||||
int this_image_width;
|
||||
int old_image_width;
|
||||
char *t;
|
||||
char header[132 + 1];
|
||||
uint8_t *bufptr8;
|
||||
uint32_t *bufptr;
|
||||
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d\n", s->pages_transferred);
|
||||
if (s->pages_transferred > s->stop_page)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d\n", s->current_page);
|
||||
if (s->current_page > s->stop_page)
|
||||
return -1;
|
||||
if (s->tiff.tiff_file == NULL)
|
||||
return -1;
|
||||
this_image_width = 0;
|
||||
old_image_width = s->image_width;
|
||||
if (s->row_read_handler == NULL)
|
||||
{
|
||||
#if defined(HAVE_LIBTIFF)
|
||||
if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->pages_transferred))
|
||||
if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
|
||||
return -1;
|
||||
TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGEWIDTH, &this_image_width);
|
||||
get_tiff_directory_info(s);
|
||||
#endif
|
||||
}
|
||||
s->image_size = 0;
|
||||
@@ -1977,10 +2067,9 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
|
||||
s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1;
|
||||
|
||||
/* Allow for pages being of different width. */
|
||||
run_space = (this_image_width + 4)*sizeof(uint32_t);
|
||||
if (this_image_width != s->image_width)
|
||||
run_space = (s->image_width + 4)*sizeof(uint32_t);
|
||||
if (old_image_width != s->image_width)
|
||||
{
|
||||
s->image_width = this_image_width;
|
||||
s->bytes_per_row = (s->image_width + 7)/8;
|
||||
|
||||
if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL)
|
||||
@@ -2073,13 +2162,13 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
|
||||
}
|
||||
if (s->line_encoding == T4_COMPRESSION_ITU_T6)
|
||||
{
|
||||
/* Attach an EOFB (end of facsimile block) to the end of the page */
|
||||
/* Attach an EOFB (end of facsimile block == 2 x EOLs) to the end of the page */
|
||||
for (i = 0; i < EOLS_TO_END_T6_TX_PAGE; i++)
|
||||
encode_eol(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Attach a return to control (RTC == 6 x EOLs) to the end of the page */
|
||||
/* Attach an RTC (return to control == 6 x EOLs) to the end of the page */
|
||||
s->row_is_2d = FALSE;
|
||||
for (i = 0; i < EOLS_TO_END_T4_TX_PAGE; i++)
|
||||
encode_eol(s);
|
||||
@@ -2095,27 +2184,20 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t4_tx_more_pages(t4_state_t *s)
|
||||
SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existance of page %d\n", s->pages_transferred + 1);
|
||||
if (s->pages_transferred >= s->stop_page)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existance of page %d\n", s->current_page + 1);
|
||||
if (s->current_page >= s->stop_page)
|
||||
return -1;
|
||||
if (s->tiff.tiff_file == NULL)
|
||||
return -1;
|
||||
if (s->pages_in_file >= 0)
|
||||
if (s->row_read_handler == NULL)
|
||||
{
|
||||
if (s->pages_transferred + 1 >= s->pages_in_file)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s->row_read_handler == NULL)
|
||||
{
|
||||
#if defined(HAVE_LIBTIFF)
|
||||
if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->pages_transferred + 1))
|
||||
return -1;
|
||||
if (s->tiff.tiff_file == NULL)
|
||||
return -1;
|
||||
if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page + 1))
|
||||
return -1;
|
||||
return test_tiff_directory_info(s);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2131,7 +2213,7 @@ SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s)
|
||||
|
||||
SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s)
|
||||
{
|
||||
s->pages_transferred++;
|
||||
s->current_page++;
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@@ -2261,9 +2343,15 @@ SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s)
|
||||
{
|
||||
return s->current_page;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t)
|
||||
{
|
||||
t->pages_transferred = s->pages_transferred - s->start_page;
|
||||
t->pages_transferred = s->current_page - s->start_page;
|
||||
t->pages_in_file = s->pages_in_file;
|
||||
t->width = s->image_width;
|
||||
t->length = s->image_length;
|
||||
|
||||
Reference in new issue
Block a user