ref: 3ff4284e6549cb5c4587207747ff8079b7d7483d
parent: e305b8ce37e05cc55d66a1c5c742f59e2aa49330
author: rrt <rrt>
date: Mon Dec 11 22:26:52 EST 2006
Remove optimize_trim, which looks like rather too special a special case. Remove st_seek, which was only used by optimize_trim.
--- a/src/misc.c
+++ b/src/misc.c
@@ -599,8 +599,6 @@
* file operations so that they could one day also work on memory
* buffers.
*
- * Offset is in bytes as opposed to st_seek() which is in samples.
- *
* N.B. Can only seek forwards!
*/
int st_seeki(ft_t ft, st_size_t offset, int whence)
--- a/src/sox.c
+++ b/src/sox.c
@@ -551,34 +551,6 @@
return ST_SUCCESS;
}
-static void optimize_trim(void)
-{
- /* Speed hack. If the "trim" effect is the first effect then
- * peak inside its "effect descriptor" and see what the
- * start location is. This has to be done after its start()
- * is called to have the correct location.
- * Also, only do this when only working with one input file.
- * This is because the logic to do it for multiple files is
- * complex and problably never used.
- */
- if (input_count == 1 && neffects > 1 &&
- strcmp(efftab[1].name, "trim") == 0)
- {
- if ((file_desc[0]->h->flags & ST_FILE_SEEK) && file_desc[0]->seekable)
- {
- if (st_seek(file_desc[0], st_trim_get_start(&efftab[1]),
- ST_SEEK_SET) != ST_EOF)
- {
- /* Assuming a failed seek stayed where it was. If the
- * seek worked then reset the start location of
- * trim so that it thinks user didn't request a skip.
- */
- st_trim_clear_start(&efftab[1]);
- }
- }
- }
-}
-
/*
* Process input file -> effect table -> output file
* one buffer at a time
@@ -705,9 +677,6 @@
/* Reserve an output buffer for all effects */
reserve_effect_buf();
-
- /* Try to save some time if first effect is "trim" by seeking */
- optimize_trim();
if (soxmix) {
for (f = 0; f < input_count; f++)
--- a/src/stio.c
+++ b/src/stio.c
@@ -339,18 +339,3 @@
return rc;
}
-
-int st_seek(ft_t ft, st_size_t offset, int whence)
-{
- /* FIXME: Implement ST_SEEK_CUR and ST_SEEK_END. */
- if (whence != ST_SEEK_SET)
- return ST_EOF; /* FIXME: return ST_EINVAL */
-
- /* If file is a seekable file and this handler supports seeking,
- * the invoke handlers function.
- */
- if (ft->seekable && (ft->h->flags & ST_FILE_SEEK))
- return (*ft->h->seek)(ft, offset);
- else
- return ST_EOF; /* FIXME: return ST_EBADF */
-}