Modifying open source code to overcome inbuilt limits

This article applies to not just this particular piece of code but rather any open source tool you use. It may be possible for you to simply edit the source code and use it modified. Thats the beauty of open source!

I downloaded this tool SHNTool to use to try to split some lossless audio files that we are publishing on flawlessquran.com. The sad thing is, it has a file limit of 256 files, however I needed 286 files to be split at once.

Believe it or not, all I had to do is download the source for for SHNTool and then edit src/mode_split.c and change the definition of SPLIT_MAX_PIECES from
#define SPLIT_MAX_PIECES 256
to
#define SPLIT_MAX_PIECES 300

Then obviously I rebuilt it (using ./configure followed by make followed by make install)
and it worked!!

Splitting [002.flac] (198:33.36) –> [vbv/002248.flac] (1:20.18) : 100% OK
Splitting [002.flac] (198:33.36) –> [vbv/002249.flac] (1:03.49) : 100% OK
Splitting [002.flac] (198:33.36) –> [vbv/002250.flac] (2:20.72) : 100% OK
Splitting [002.flac] (198:33.36) –> [vbv/002251.flac] (0:31.64) : 100% OK
Splitting [002.flac] (198:33.36) –> [vbv/002252.flac] (0:53.67) : 100% OK
Splitting [002.flac] (198:33.36) –> [vbv/002253.flac] (0:20.66) : 100% OK
Splitting [002.flac] (198:33.36) –> [vbv/002254.flac] (1:42.21) : 100% OK
Splitting [002.flac] (198:33.36) –> [vbv/002255.flac] (0:28.39) : 100% OK

No more “shnsplit: error: too many split files would be created — maximum is 256″

I posted this incase someone else is running into the same problem the solution is quite easy!

and this worked!
It seems that the developers simply put an arbitrary limit of 256.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>