Test task for Cinemo
- application is called with pathname as argument, all WAV-files contained directly in that folder are to be encoded to MP3
- use all available CPU cores for the encoding process in an efficient way by utilizing multi-threading
- statically link to lame encoder library
- application should be compilable and runnable on Windows and Linux
- the resulting MP3 files are to be placed within the same directory as the source WAV files, the filename extension should be changed appropriately to .MP3
- non-WAV files in the given folder shall be ignored
- multithreading shall be implemented by means of using Posix Threads
- the Boost library shall not be used
- the LAME encoder should be used with reasonable standard settings
Buildable on any more-or-less modern distribution (gcc 4.8+) as easy as "cmake . && make". Static libmp3lame library must be installed to /usr/local/lib prior to building ctt.
In addition to standard mingw32-base, following packages must be installed:
- mingw32-gcc-g++
- mingw32-pthreads-w32
Afterwards, generate MinGW makefile with cmake and build using mingw32-make. Prebuilt static libmp3lame is available in lib directory.
Latest cmake does not properly work with latest Visual Studio. Project must be built manually:
- Create WIN32 console project from existing source
- Add include directory to compiler configuration
- Add lib directory to linker configuration
- Additionally link with pthreadVSE1.lib, libmp3lame-static.lib, libmpghip-static.lib
- Code is little-endian and will not work on big-endian architectures
- Proper support for wav format is too big, so I ignore many chunk types (i.e. wavl, slnt)
- I've implemented support for 16 and 8 bit wavs, 24 and 32 bit wavs would not be encoded
- Only mono and stereo wavs are supported, no multichannel support
- C++11 standard implementation is broken in VS2015, this is sad
- I'd prefer to use C++11 threads and mutexes instead of pthreads