From 5637664fcbe18b05a773d6db621a94de76e07817 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 12 Apr 2015 08:46:12 +0200 Subject: VLC can write ICY Text into a file for mot-encoder --- src/VLCInput.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/VLCInput.cpp') diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index 687e144..82d1d14 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -216,6 +216,12 @@ ssize_t VLCInput::m_read(uint8_t* buf, size_t length) err = -1; break; } + + char* nowplaying_sz = libvlc_media_get_meta(media, libvlc_meta_NowPlaying); + if (nowplaying_sz) { + m_nowplaying = nowplaying_sz; + free(nowplaying_sz); + } } return err; } @@ -230,5 +236,12 @@ ssize_t VLCInput::read(uint8_t* buf, size_t length) return read; } +void VLCInput::write_icy_text(const std::string& filename) const +{ + FILE* fd = fopen(filename.c_str(), "wb"); + fprintf(fd, "%s", m_nowplaying.c_str()); + fclose(fd); +} + #endif // HAVE_VLC -- cgit v1.2.3