diff options
author | Stefan Pöschel <github@basicmaster.de> | 2016-04-24 22:18:56 +0200 |
---|---|---|
committer | Stefan Pöschel <github@basicmaster.de> | 2016-04-24 22:18:56 +0200 |
commit | c1599cb19601443c48c45c5ad8d1b0d40a6238bc (patch) | |
tree | a0be96f911a70b3b91654a4b44f998838afb1f22 /src/VLCInput.cpp | |
parent | 42546c26517013fc0df6a47743c7734a1ea9ecf8 (diff) | |
download | fdk-aac-dabplus-c1599cb19601443c48c45c5ad8d1b0d40a6238bc.tar.gz fdk-aac-dabplus-c1599cb19601443c48c45c5ad8d1b0d40a6238bc.tar.bz2 fdk-aac-dabplus-c1599cb19601443c48c45c5ad8d1b0d40a6238bc.zip |
DLS: add DL Plus support
- adds support for Dynamic Label Plus to mot-encoder through a new parameter
block which prepends the DLS text within the regarding file
- adds an option to add DL Plus data to the VLC input ICY text of dabplus-enc
Diffstat (limited to 'src/VLCInput.cpp')
-rw-r--r-- | src/VLCInput.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index 468ef70..fc7e07f 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -337,20 +337,36 @@ ssize_t VLCInputDirect::read(uint8_t* buf, size_t length) return read; } -bool write_icy_to_file(const std::string& text, const std::string& filename) +bool write_icy_to_file(const std::string& text, const std::string& filename, bool dl_plus) { FILE* fd = fopen(filename.c_str(), "wb"); if (fd) { - int ret = fputs(text.c_str(), fd); + bool ret = true; + + // if desired, prepend DL Plus information + if (dl_plus) { + std::stringstream ss; + ss << "##### parameters { #####\n"; + ss << "DL_PLUS=1\n"; + + // if non-empty text, add PROGRAMME.NOW tag + if (!text.empty()) + ss << "DL_PLUS_TAG=33 0 " << (strlen_utf8(text.c_str()) - 1) << "\n"; // -1 ! + + ss << "##### parameters } #####\n"; + ret &= fputs(ss.str().c_str(), fd) >= 0; + } + + ret &= fputs(text.c_str(), fd) >= 0; fclose(fd); - return ret >= 0; + return ret; } return false; } -void VLCInput::write_icy_text(const std::string& filename) +void VLCInput::write_icy_text(const std::string& filename, bool dl_plus) { if (icy_text_written.valid()) { auto status = icy_text_written.wait_for(std::chrono::microseconds(1)); @@ -364,7 +380,7 @@ void VLCInput::write_icy_text(const std::string& filename) else { if (m_nowplaying_previous != m_nowplaying) { icy_text_written = std::async(std::launch::async, - std::bind(write_icy_to_file, m_nowplaying, filename)); + std::bind(write_icy_to_file, m_nowplaying, filename, dl_plus)); } |