Commit e4da8da1 authored by Stefan Westerfeld's avatar Stefan Westerfeld

SRC: support setting output format to rf64 for huge files

See also:
 - https://github.com/swesterfeld/audiowmark/issues/2
 - https://github.com/swesterfeld/audiowmark/issues/30Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 99ffa6b4
...@@ -87,9 +87,16 @@ AudioOutputStream::create (const string& filename, int n_channels, int sample_ra ...@@ -87,9 +87,16 @@ AudioOutputStream::create (const string& filename, int n_channels, int sample_ra
} }
else else
{ {
SFOutputStream::OutFormat out_format;
if (Params::output_format == Format::RF64)
out_format = SFOutputStream::OutFormat::RF64;
else
out_format = SFOutputStream::OutFormat::WAV;
SFOutputStream *sfostream = new SFOutputStream(); SFOutputStream *sfostream = new SFOutputStream();
out_stream.reset (sfostream); out_stream.reset (sfostream);
err = sfostream->open (filename, n_channels, sample_rate, bit_depth); err = sfostream->open (filename, n_channels, sample_rate, bit_depth, out_format);
if (err) if (err)
return nullptr; return nullptr;
} }
......
...@@ -112,6 +112,9 @@ parse_format (const string& str) ...@@ -112,6 +112,9 @@ parse_format (const string& str)
return Format::RAW; return Format::RAW;
if (str == "auto") if (str == "auto")
return Format::AUTO; return Format::AUTO;
if (str == "rf64")
return Format::RF64;
error ("audiowmark: unsupported format '%s'\n", str.c_str()); error ("audiowmark: unsupported format '%s'\n", str.c_str());
exit (1); exit (1);
} }
...@@ -657,6 +660,11 @@ parse_add_options (ArgParser& ap) ...@@ -657,6 +660,11 @@ parse_add_options (ArgParser& ap)
{ {
Params::test_no_limiter = true; Params::test_no_limiter = true;
} }
if (Params::input_format == Format::RF64)
{
error ("audiowmark: using rf64 as input format has no effect\n");
exit (1);
}
} }
void void
......
...@@ -53,6 +53,8 @@ SFOutputStream::open (std::function<SNDFILE* (SF_INFO *)> open_func, int n_chann ...@@ -53,6 +53,8 @@ SFOutputStream::open (std::function<SNDFILE* (SF_INFO *)> open_func, int n_chann
{ {
case OutFormat::WAV: sfinfo.format = SF_FORMAT_WAV; case OutFormat::WAV: sfinfo.format = SF_FORMAT_WAV;
break; break;
case OutFormat::RF64: sfinfo.format = SF_FORMAT_RF64;
break;
case OutFormat::FLAC: sfinfo.format = SF_FORMAT_FLAC; case OutFormat::FLAC: sfinfo.format = SF_FORMAT_FLAC;
break; break;
default: assert (false); default: assert (false);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
class SFOutputStream : public AudioOutputStream class SFOutputStream : public AudioOutputStream
{ {
public: public:
enum class OutFormat { WAV, FLAC }; enum class OutFormat { WAV, RF64, FLAC };
private: private:
SFVirtualData m_virtual_data; SFVirtualData m_virtual_data;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <assert.h> #include <assert.h>
enum class Format { AUTO = 1, RAW = 2 }; enum class Format { AUTO = 1, RAW = 2, RF64 = 3 };
class Params class Params
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment