From f97a29a785cf021e6deaa6382aae8300b646bc01 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 01/26] audioplayer: change scanXmlData() arguments order ... switch url <-> name to get the same order as in other used functions Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f31f8c5bc84c817e3fc955d816bb57cb0dcdfab7 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audioplayer: change scanXmlData() arguments order ... switch url <-> name to get the same order as in other used functions ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 6 +++--- src/gui/audioplayer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 6c3f02371..62c740f4a 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1177,7 +1177,7 @@ void CAudioPlayerGui::readDir_ic(void) { xmlDocPtr answer_parser = parseXml(answer.c_str()); scanBox->hide(); - scanXmlData(answer_parser, "server_name", "listen_url", "bitrate", true); + scanXmlData(answer_parser, "listen_url", "server_name", "bitrate", true); } else scanBox->hide(); @@ -1188,10 +1188,10 @@ void CAudioPlayerGui::readDir_ic(void) void CAudioPlayerGui::scanXmlFile(std::string filename) { xmlDocPtr answer_parser = parseXmlFile(filename.c_str()); - scanXmlData(answer_parser, "name", "url"); + scanXmlData(answer_parser, "url", "name"); } -void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, const char *urltag, const char *bitratetag, bool usechild) +void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *bitratetag, bool usechild) { #define IC_typetag "server_type" diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index c99f6dbc5..3f945c993 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -176,7 +176,7 @@ class CAudioPlayerGui : public CMenuTarget /** * Processes a loaded XML file/data of internet audiostreams or playlists */ - void scanXmlData(xmlDocPtr answer_parser, const char *nametag, const char *urltag, const char *bitratetag = NULL, bool usechild = false); + void scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *bitratetag = NULL, bool usechild = false); /** * Reads the icecast directory (XML file) and calls scanXmlData From c5dbede1d3f23e7c88ea62a188809d65fda9b0ae Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 02/26] audiodec: unify cover handling Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ae0f735d998b8cbc5caf969f342be7af747b05f5 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audiodec: unify cover handling ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/audiodec/ffmpegdec.cpp | 8 +++++--- src/driver/audiodec/mp3dec.cpp | 5 +++-- src/global.h | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 19c48a9eb..ef2583775 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -33,15 +33,19 @@ #include #include #include + +#include #include #include #include // UTF8 #include "ffmpegdec.h" + extern "C" { #include #include #include } + #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1) #define av_frame_alloc avcodec_alloc_frame #define av_frame_unref avcodec_get_frame_defaults @@ -63,8 +67,6 @@ extern cAudio * audioDecoder; #define ProgName "FfmpegDec" -#define COVERDIR "/tmp/cover" - static OpenThreads::Mutex mutex; static int cover_count = 0; @@ -521,7 +523,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) if (save_cover && (avc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)) { mkdir(COVERDIR, 0755); std::string cover(COVERDIR); - cover += "/" + to_string(cover_count++) + ".jpg"; + cover += "/cover_" + to_string(cover_count++) + ".jpg"; FILE *f = fopen(cover.c_str(), "wb"); if (f) { AVPacket *pkt = &avc->streams[i]->attached_pic; diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index 69c11d5b4..c555add3f 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -1388,9 +1388,10 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m) data = id3_field_getbinarydata(field, &size); if ( data ) { + mkdir(COVERDIR, 0755); std::ostringstream cover; - cover.str(""); - cover << "/tmp/cover_" << cover_count++ << ".jpg"; + cover.str(COVERDIR); + cover << "/cover_" << cover_count++ << ".jpg"; FILE * pFile; pFile = fopen ( cover.str().c_str() , "wb" ); if (pFile) diff --git a/src/global.h b/src/global.h index 304ccd195..54ae6d816 100644 --- a/src/global.h +++ b/src/global.h @@ -49,6 +49,8 @@ #define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf" #define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked" +#define COVERDIR "/tmp/cover" + #define LOGODIR ICONSDIR "/logo" #define LOGODIR_VAR ICONSDIR_VAR "/logo" From 519de5279c8065322c46a33b5059adaa49eb84f8 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 03/26] audioplayer: fix coordinates to clear title-box Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0dfe5becbbc832c4379e957abdcea92604eb1caf Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audioplayer: fix coordinates to clear title-box ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 62c740f4a..7c3635b7a 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1733,7 +1733,7 @@ void CAudioPlayerGui::paintTitleBox() return; if (m_state == CAudioPlayerGui::STOP && m_show_playlist) - m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width, m_title_height); + m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width + OFFSET_SHADOW, m_title_height + OFFSET_SHADOW); else { // shadow From 937977f913d10fcaf754ee4c825188244bbf62d3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 04/26] audiometadata: add logo to metadata Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/473dc945c5945a4656ad6646eda149a576d92d9d Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audiometadata: add logo to metadata ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/audiometadata.cpp | 4 +++- src/driver/audiometadata.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/driver/audiometadata.cpp b/src/driver/audiometadata.cpp index 3a47d33d8..ce62d750d 100644 --- a/src/driver/audiometadata.cpp +++ b/src/driver/audiometadata.cpp @@ -64,7 +64,7 @@ CAudioMetaData::CAudioMetaData( const CAudioMetaData& src ) hasInfoOrXingTag( src.hasInfoOrXingTag ), artist( src.artist ), title( src.title ), album( src.album ), sc_station( src.sc_station ), date( src.date ), genre( src.genre ), track( src.track ),cover(src.cover), - url( src.url ), + url( src.url ), logo( src.logo ), cover_temporary( false ), changed( src.changed ) { @@ -98,6 +98,7 @@ void CAudioMetaData::operator=( const CAudioMetaData& src ) genre = src.genre; track = src.track; cover = src.cover; + logo = src.logo; url = src.url; sc_station = src.sc_station; changed = src.changed; @@ -126,6 +127,7 @@ void CAudioMetaData::clear() if (cover_temporary && !cover.empty()) unlink(cover.c_str()); cover.clear(); + logo.clear(); url.clear(); cover_temporary=false; changed=false; diff --git a/src/driver/audiometadata.h b/src/driver/audiometadata.h index be43d5304..5220b0877 100644 --- a/src/driver/audiometadata.h +++ b/src/driver/audiometadata.h @@ -96,6 +96,7 @@ public: std::string genre; std::string track; std::string cover; + std::string logo; std::string url; bool cover_temporary; bool changed; From 9c58e2fc21eb701d44bedfe26b5dfd01fe800ceb Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 05/26] audioplayer: allow logos for internet radio stations ... Syntax in radio-stations.xml or radio-favorites.xml: Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9c115bec035114a4cec33834e0ab3a6385f44711 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audioplayer: allow logos for internet radio stations ... Syntax in radio-stations.xml or radio-favorites.xml: ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 88 ++++++++++++++++++++++++++++++++--------- src/gui/audioplayer.h | 6 +-- 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 7c3635b7a..e3a0e4a9a 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -61,6 +61,7 @@ extern CPictureViewer * g_PicViewer; #include #include #include +#include #include #include @@ -1021,19 +1022,23 @@ bool CAudioPlayerGui::shufflePlaylist(void) return(result); } -void CAudioPlayerGui::addUrl2Playlist(const char *url, const char *name, const time_t bitrate) +void CAudioPlayerGui::addUrl2Playlist(const char *url, const char *name, const char *logo, const time_t bitrate) { CAudiofileExt mp3(url, CFile::STREAM_AUDIO); //printf("[addUrl2Playlist], name = %s, url = %s\n", name, url); if (name != NULL) - { mp3.MetaData.title = name; - } else { - std::string tmp = mp3.Filename.substr(mp3.Filename.rfind('/')+1); - mp3.MetaData.title = tmp; + std::string filename = mp3.Filename.substr(mp3.Filename.rfind('/') + 1); + mp3.MetaData.title = filename; } + + if (logo != NULL) + mp3.MetaData.logo = logo; + else + mp3.MetaData.logo.clear(); + if (bitrate) mp3.MetaData.total_time = bitrate; else @@ -1045,7 +1050,7 @@ void CAudioPlayerGui::addUrl2Playlist(const char *url, const char *name, const t addToPlaylist(mp3); } -void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, const time_t tim) +void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, const char *logo, const time_t tim) { CURL *curl_handle; struct MemoryStruct chunk; @@ -1120,7 +1125,7 @@ void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, cons tmp = strchr(line, '\n'); if (tmp != NULL) *tmp = '\0'; - addUrl2Playlist(ptr, name, tim); + addUrl2Playlist(ptr, name, logo, tim); } } } @@ -1177,7 +1182,7 @@ void CAudioPlayerGui::readDir_ic(void) { xmlDocPtr answer_parser = parseXml(answer.c_str()); scanBox->hide(); - scanXmlData(answer_parser, "listen_url", "server_name", "bitrate", true); + scanXmlData(answer_parser, "listen_url", "server_name", NULL, "bitrate", true); } else scanBox->hide(); @@ -1188,10 +1193,10 @@ void CAudioPlayerGui::readDir_ic(void) void CAudioPlayerGui::scanXmlFile(std::string filename) { xmlDocPtr answer_parser = parseXmlFile(filename.c_str()); - scanXmlData(answer_parser, "url", "name"); + scanXmlData(answer_parser, "url", "name", "logo"); } -void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *bitratetag, bool usechild) +void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *logotag, const char *bitratetag, bool usechild) { #define IC_typetag "server_type" @@ -1224,8 +1229,9 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, c while (element && msg != CRCInput::RC_home) { const char *ptr = NULL; - const char *name = NULL; const char *url = NULL; + const char *name = NULL; + const char *logo = NULL; time_t bitrate = 0; bool skip = true; listPos++; @@ -1243,10 +1249,12 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, c xmlNodePtr child = xmlChildrenNode(element); while (child) { - if (strcmp(xmlGetName(child), nametag) == 0) - name = xmlGetData(child); - else if (strcmp(xmlGetName(child), urltag) == 0) + if (strcmp(xmlGetName(child), urltag) == 0) url = xmlGetData(child); + else if (strcmp(xmlGetName(child), nametag) == 0) + name = xmlGetData(child); + else if (strcmp(xmlGetName(child), logotag) == 0) + logo = xmlGetData(child); else if (strcmp(xmlGetName(child), IC_typetag) == 0) type = xmlGetData(child); else if (bitratetag && strcmp(xmlGetName(child), bitratetag) == 0) @@ -1269,6 +1277,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, c { url = xmlGetAttribute(element, urltag); name = xmlGetAttribute(element, nametag); + logo = xmlGetAttribute(element, logotag); if (bitratetag) { ptr = xmlGetAttribute(element, bitratetag); @@ -1283,13 +1292,12 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, c progress.showStatusMessageUTF(url); //printf("Processing %s, %s\n", url, name); if (strstr(url, ".m3u") || strstr(url, ".pls")) - processPlaylistUrl(url, name); + processPlaylistUrl(url, name, logo); else - addUrl2Playlist(url, name, bitrate); + addUrl2Playlist(url, name, logo, bitrate); } element = xmlNextNode(element); g_RCInput->getMsg(&msg, &data, 0); - } progress.hide(); } @@ -1402,7 +1410,7 @@ bool CAudioPlayerGui::openFilebrowser(void) if (strstr(url, ".m3u") || strstr(url, ".pls")) processPlaylistUrl(url); else - addUrl2Playlist(url, name, duration); + addUrl2Playlist(url, name, NULL, duration); } else if ((url = strstr(cLine, "icy://")) != NULL) { @@ -1545,7 +1553,7 @@ bool CAudioPlayerGui::openSCbrowser(void) #endif // LCD_UPDATE } //printf("processPlaylistUrl(%s, %s)\n", files->Url.c_str(), files->Name.c_str()); - processPlaylistUrl(files->Url.c_str(), files->Name.c_str(), files->Time); + processPlaylistUrl(files->Url.c_str(), files->Name.c_str(), NULL, files->Time); g_RCInput->getMsg(&msg, &data, 0); } if (m_select_title_by_name) @@ -1719,12 +1727,54 @@ void CAudioPlayerGui::paintCover() { const CAudioMetaData meta = CAudioPlayer::getInstance()->getMetaData(); + // try folder.jpg first std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg"; + bool stationlogo = false; + + // try cover from tag if (!meta.cover.empty()) cover = meta.cover; + // try station logo + else if (!meta.logo.empty()) + { + std::size_t found_url = meta.logo.find("://"); + if (found_url != std::string::npos) + { + mkdir(COVERDIR, 0755); + + std::string filename(meta.logo); + const size_t last_slash_idx = filename.find_last_of("/"); + if (last_slash_idx != std::string::npos) + filename.erase(0, last_slash_idx + 1); + + std::string fullname(COVERDIR); + fullname += "/" + filename; + + CHTTPTool httptool; + if (httptool.downloadFile(meta.logo, fullname.c_str())) + { + cover = fullname; + stationlogo = true; + } + else + cover.clear(); + } + } if (access(cover.c_str(), F_OK) == 0) + { g_PicViewer->DisplayImage(cover, m_x + OFFSET_INNER_MID, m_y + OFFSET_INNER_SMALL, m_title_height - 2*OFFSET_INNER_SMALL, m_title_height - 2*OFFSET_INNER_SMALL, m_frameBuffer->TM_NONE); + + /* + Some guys use this covers for the screensaver. + So we need to keep this station-logo until the + stream is stopped. + Until this is coded we delete the station-logo + immediately. + */ + if (stationlogo) + unlink(cover.c_str()); + } } void CAudioPlayerGui::paintTitleBox() diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index 3f945c993..583c97cb3 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -161,12 +161,12 @@ class CAudioPlayerGui : public CMenuTarget /** * Adds an url (shoutcast, ...) to the to the audioplayer playlist */ - void addUrl2Playlist(const char *url, const char *name = NULL, const time_t bitrate = 0); + void addUrl2Playlist(const char *url, const char *name = NULL, const char *logo = NULL, const time_t bitrate = 0); /** * Adds a url which points to an .m3u format (playlist, ...) to the audioplayer playlist */ - void processPlaylistUrl(const char *url, const char *name = NULL, const time_t bitrate = 0); + void processPlaylistUrl(const char *url, const char *name = NULL, const char *logo = NULL, const time_t bitrate = 0); /** * Loads a given XML file of internet audiostreams or playlists and processes them @@ -176,7 +176,7 @@ class CAudioPlayerGui : public CMenuTarget /** * Processes a loaded XML file/data of internet audiostreams or playlists */ - void scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *bitratetag = NULL, bool usechild = false); + void scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *logotag = NULL, const char *bitratetag = NULL, bool usechild = false); /** * Reads the icecast directory (XML file) and calls scanXmlData From b49ce6f0e77f39d7264affceddf10aa7ea46ed24 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 06/26] audioplayer: fix position of meta data in titlebox Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/37c61fa12f6961048f1382ae48873d7c06bd9c64 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audioplayer: fix position of meta data in titlebox ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index e3a0e4a9a..4549fc3ff 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -2190,8 +2190,12 @@ void CAudioPlayerGui::updateMetaData() if (updateMeta || updateScreen) { int cover_width = m_title_height + 2*OFFSET_INNER_MID; - m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - cover_width - OFFSET_INNER_MID, m_meta_height, COL_MENUHEAD_PLUS_0); - int xstart = ((m_width - 2*OFFSET_INNER_MID - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo))/2); + m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - OFFSET_INNER_MID - cover_width, m_meta_height, COL_MENUHEAD_PLUS_0); + + int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo); + int xstart = (m_width - w)/2; + if (xstart < OFFSET_INNER_MID) + xstart = OFFSET_INNER_MID; g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL + m_meta_height, m_width - 2*xstart, m_metainfo, COL_MENUHEAD_TEXT); } } From 2cfee7cc7d78bd39eca87a8c71b8b5b97d41fa5b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 07/26] radio-favorites.xml: add new sample entry Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/113e0e4f3447e81bc72c34f712dbf7c376aaec54 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - radio-favorites.xml: add new sample entry ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/inetradio/radio-favorites.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/inetradio/radio-favorites.xml b/data/inetradio/radio-favorites.xml index 6b6ad38d1..1866a82a0 100644 --- a/data/inetradio/radio-favorites.xml +++ b/data/inetradio/radio-favorites.xml @@ -5,7 +5,8 @@ --> + url="http://streams.80s80s.de/web/mp3-192/streams.80s80s.de/" + name="80s80s - Main stream" + logo="http://media.streamabc.com/80s80s.de/web/600x600_1_80s80s_colored.png" + /> From 3fd16ffbf5a48bb5455c2e226c9b6705f3031dfd Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 08:25:40 +0200 Subject: [PATCH 08/26] audiometadata: fix compile with -Werror; "will be initialized after ..." Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/97837d1513943981b4cb6227e9d6657576e8c4ca Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audiometadata: fix compile with -Werror; "will be initialized after ..." ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/audiometadata.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/audiometadata.cpp b/src/driver/audiometadata.cpp index ce62d750d..8d48a0f10 100644 --- a/src/driver/audiometadata.cpp +++ b/src/driver/audiometadata.cpp @@ -64,7 +64,7 @@ CAudioMetaData::CAudioMetaData( const CAudioMetaData& src ) hasInfoOrXingTag( src.hasInfoOrXingTag ), artist( src.artist ), title( src.title ), album( src.album ), sc_station( src.sc_station ), date( src.date ), genre( src.genre ), track( src.track ),cover(src.cover), - url( src.url ), logo( src.logo ), + logo( src.logo ), url( src.url ), cover_temporary( false ), changed( src.changed ) { From e65e21a0b8af97f8d097c2d436c39cb2d60a1505 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 11:29:03 +0200 Subject: [PATCH 09/26] audioplayer: reset idle time to avoid screensaver ... when returning from filebrowser Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d4f366c0dd9ab7f997a7c4f85948168ccf80f4ad Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: reset idle time to avoid screensaver ... when returning from filebrowser ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 4549fc3ff..df9b4a319 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1495,6 +1495,7 @@ bool CAudioPlayerGui::openFilebrowser(void) result = true; } + m_idletime = time(NULL); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); // if playlist is turned off -> start playing immediately From 102866f71d4f33912727d00f22ba1dde2b21d297 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 11:29:03 +0200 Subject: [PATCH 10/26] audioplayer: fix round borders in footer when playlist is hidden ... and use large roundings as in the other gui-elements Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8a3d8f8b51a8bd97966f8b0708f0a0a631d07bc8 Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: fix round borders in footer when playlist is hidden ... and use large roundings as in the other gui-elements ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 44 ++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index df9b4a319..cb1be808a 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1649,7 +1649,6 @@ void CAudioPlayerGui::paintHead() CComponentsHeader header(m_x, m_y + m_title_height + OFFSET_SHADOW + OFFSET_INTER, m_width, m_header_height, LOCALE_AUDIOPLAYER_HEAD, NEUTRINO_ICON_AUDIO); header.enableShadow( CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); - header.setCorner(RADIUS_MID, CORNER_TOP); if (m_inetmode) header.setCaption(LOCALE_INETRADIO_NAME); @@ -1674,52 +1673,61 @@ void CAudioPlayerGui::paintFoot() { NEUTRINO_ICON_BUTTON_INFO, LOCALE_PICTUREVIEWER_HEAD } }; + int radius = RADIUS_LARGE; int button_y = m_y + m_height - OFFSET_SHADOW - m_info_height - OFFSET_INTER - OFFSET_SHADOW - 2*m_button_height; + int button_x = m_x; + int button_width = m_width; + + // ensure to get round corners in footer + if (!m_show_playlist && radius) + { + button_x += radius; + button_width -= 2*radius; + } // shadow - m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, button_y + OFFSET_SHADOW, m_width, 2*m_button_height, COL_SHADOW_PLUS_0, RADIUS_MID, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); - - m_frameBuffer->paintBoxRel(m_x, button_y, m_width, 2*m_button_height, COL_MENUFOOT_PLUS_0, RADIUS_MID, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); + m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, button_y + OFFSET_SHADOW, m_width, 2*m_button_height, COL_SHADOW_PLUS_0, radius, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); + m_frameBuffer->paintBoxRel(m_x, button_y, m_width, 2*m_button_height, COL_MENUFOOT_PLUS_0, radius, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); if (!m_playlist.empty()) - ::paintButtons(m_x, button_y + m_button_height, m_width, 3, SecondLineButtons, m_width, m_button_height); + ::paintButtons(button_x, button_y + m_button_height, button_width, 3, SecondLineButtons, button_width, m_button_height); if (m_key_level == 0) { if (m_playlist.empty()) { if (m_inetmode) - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[7], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[7], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 1, &(AudioPlayerButtons[7][0]), m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 1, &(AudioPlayerButtons[7][0]), button_width, m_button_height); } else if (m_inetmode) - ::paintButtons(m_x, button_y, m_width, 4, AudioPlayerButtons[8], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 4, AudioPlayerButtons[8], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 4, AudioPlayerButtons[1], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 4, AudioPlayerButtons[1], button_width, m_button_height); } else if (m_key_level == 1) { if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO) - ::paintButtons(m_x, button_y, m_width, 4, AudioPlayerButtons[0], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 4, AudioPlayerButtons[0], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[6], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[6], button_width, m_button_height); } else // key_level == 2 { if (m_state == CAudioPlayerGui::STOP) { if (m_select_title_by_name) - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[5], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[5], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[4], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[4], button_width, m_button_height); } else { if (m_select_title_by_name) - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[3], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[3], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[2], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[2], button_width, m_button_height); } } } @@ -1788,10 +1796,10 @@ void CAudioPlayerGui::paintTitleBox() else { // shadow - m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, m_y + OFFSET_SHADOW, m_width, m_title_height, COL_SHADOW_PLUS_0, RADIUS_MID); + m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, m_y + OFFSET_SHADOW, m_width, m_title_height, COL_SHADOW_PLUS_0, RADIUS_LARGE); - m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height, COL_MENUHEAD_PLUS_0, RADIUS_MID); - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height, 1, COL_FRAME_PLUS_0, RADIUS_MID); //NI + m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height, COL_MENUHEAD_PLUS_0, RADIUS_LARGE); + m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height, 1, COL_FRAME_PLUS_0, RADIUS_LARGE); //NI paintCover(); From e8594b03e24ffe2967c44d5283a543a01586f005 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 15:12:00 +0200 Subject: [PATCH 11/26] audioplayer: fix loading of radio-favorites.xml Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f49a8fe9b9ae04dc1efc9f019fa4f5b6dd43cf0b Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: fix loading of radio-favorites.xml ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index cb1be808a..bae1a1217 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -282,6 +282,13 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) m_select_title_by_name = g_settings.audioplayer_select_title_by_name; } + //NI auto-load favorites + if ((m_inetmode) && (m_playlist.empty())) + { + if (access(RADIO_FAVORITES_XML_FILE, F_OK) == 0) + scanXmlFile(RADIO_FAVORITES_XML_FILE); + } + if (m_playlist.empty()) m_current = -1; else @@ -378,18 +385,15 @@ int CAudioPlayerGui::show() bool clear_before_update = false; m_key_level = 0; - //NI auto-load favorites - if ((m_inetmode) && (m_playlist.empty())) - { - if (access(RADIO_FAVORITES_XML_FILE, F_OK) == 0) - scanXmlFile(RADIO_FAVORITES_XML_FILE); - } - //NI auto-play first entry from favorites if (g_settings.inetradio_autostart) { if ((m_inetmode) && (!m_playlist.empty())) + { + m_current = 0; + m_selected = 0; play(m_selected); + } } while (loop) From a07fbc0cd627e47f0a73f1b09de9e6e0700dbf68 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 15:58:40 +0200 Subject: [PATCH 12/26] audioplayer: reset idle time to avoid screensaver ... when returning from shoutcast-filebrowser Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0a8024cdef84d9e60fa1e64c65e687f16c1d90ce Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: reset idle time to avoid screensaver ... when returning from shoutcast-filebrowser ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index bae1a1217..03f95656b 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1571,6 +1571,7 @@ bool CAudioPlayerGui::openSCbrowser(void) #endif result = true; } + m_idletime = time(NULL); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); // if playlist is turned off -> start playing immediately From 0c585b0d70e29d21397e1442c6c23ae3b42baeda Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 16:26:36 +0200 Subject: [PATCH 13/26] audioplayer: allow to load radio-favorites.xml via menu Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6a3fa8c4e75edf15c40907039b50161c18f433ea Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: allow to load radio-favorites.xml via menu ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/gui/audioplayer.cpp | 15 +++++++++++++-- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 32850895e..aa0c45103 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -155,6 +155,7 @@ audiomenu.volume_adjustment_pcm PCM-Tonspuren audiomenu.volume_start Einschaltlautstärke audiomenu.volume_step Lautstärke Schrittweite audioplayer.add Hinzufügen +audioplayer.add_fav Lokale Radiofavoriten audioplayer.add_ic Icecast audioplayer.add_loc Lokale Radioliste audioplayer.add_sc SHOUTcast diff --git a/data/locale/english.locale b/data/locale/english.locale index 28b74cf62..eefe40372 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -155,6 +155,7 @@ audiomenu.volume_adjustment_pcm PCM streams audiomenu.volume_start Start volume audiomenu.volume_step Volume step audioplayer.add Add +audioplayer.add_fav Local radio favorites audioplayer.add_ic Icecast audioplayer.add_loc Local radio list audioplayer.add_sc SHOUTcast diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 03f95656b..ef0d39ff2 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -708,6 +708,10 @@ int CAudioPlayerGui::show() CMenuSelectorTarget *InetRadioInputChanger = new CMenuSelectorTarget(&select); // -- setup menue for inetradio input sprintf(cnt, "%d", count); + InputSelector.addItem(new CMenuForwarder( + LOCALE_AUDIOPLAYER_ADD_FAV, true, NULL, InetRadioInputChanger, + cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); + sprintf(cnt, "%d", ++count); InputSelector.addItem(new CMenuForwarder( LOCALE_AUDIOPLAYER_ADD_LOC, true, NULL, InetRadioInputChanger, cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); @@ -731,21 +735,28 @@ int CAudioPlayerGui::show() switch (select) { case 0: - scanXmlFile(RADIO_STATION_XML_FILE); + scanXmlFile(RADIO_FAVORITES_XML_FILE); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); break; case 1: - readDir_ic(); + scanXmlFile(RADIO_STATION_XML_FILE); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); break; case 2: + readDir_ic(); + CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); + paintLCD(); + break; + case 3: openSCbrowser(); break; default: break; } + m_current = 0; + m_selected = 0; update=true; } else if (shufflePlaylist()) diff --git a/src/system/locals.h b/src/system/locals.h index 7673ac49d..d335df81a 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -182,6 +182,7 @@ typedef enum LOCALE_AUDIOMENU_VOLUME_START, LOCALE_AUDIOMENU_VOLUME_STEP, LOCALE_AUDIOPLAYER_ADD, + LOCALE_AUDIOPLAYER_ADD_FAV, LOCALE_AUDIOPLAYER_ADD_IC, LOCALE_AUDIOPLAYER_ADD_LOC, LOCALE_AUDIOPLAYER_ADD_SC, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 67055ca4a..3b72a57d1 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -182,6 +182,7 @@ const char * locale_real_names[] = "audiomenu.volume_start", "audiomenu.volume_step", "audioplayer.add", + "audioplayer.add_fav", "audioplayer.add_ic", "audioplayer.add_loc", "audioplayer.add_sc", From 9a98c77126d596ef4ca4f7f63d95e498eb15e682 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 14/26] audioplayer: change scanXmlData() arguments order ... switch url <-> name to get the same order as in other used functions (cherry picked from commit f97a29a785cf021e6deaa6382aae8300b646bc01) Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d75a3b0f58c7f6a2328387d5fc6799a486add595 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audioplayer: change scanXmlData() arguments order ... switch url <-> name to get the same order as in other used functions (cherry picked from commit f97a29a785cf021e6deaa6382aae8300b646bc01) Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 6 +++--- src/gui/audioplayer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 91d0a3085..9ce933e3d 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1141,7 +1141,7 @@ void CAudioPlayerGui::readDir_ic(void) { xmlDocPtr answer_parser = parseXml(answer.c_str()); scanBox->hide(); - scanXmlData(answer_parser, "server_name", "listen_url", "bitrate", true); + scanXmlData(answer_parser, "listen_url", "server_name", "bitrate", true); } else scanBox->hide(); @@ -1152,10 +1152,10 @@ void CAudioPlayerGui::readDir_ic(void) void CAudioPlayerGui::scanXmlFile(std::string filename) { xmlDocPtr answer_parser = parseXmlFile(filename.c_str()); - scanXmlData(answer_parser, "name", "url"); + scanXmlData(answer_parser, "url", "name"); } -void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, const char *urltag, const char *bitratetag, bool usechild) +void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *bitratetag, bool usechild) { #define IC_typetag "server_type" diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index c99f6dbc5..3f945c993 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -176,7 +176,7 @@ class CAudioPlayerGui : public CMenuTarget /** * Processes a loaded XML file/data of internet audiostreams or playlists */ - void scanXmlData(xmlDocPtr answer_parser, const char *nametag, const char *urltag, const char *bitratetag = NULL, bool usechild = false); + void scanXmlData(xmlDocPtr answer_parser, const char *urltag, const char *nametag, const char *bitratetag = NULL, bool usechild = false); /** * Reads the icecast directory (XML file) and calls scanXmlData From 684cf8076b2fb3a9308e688c1fc2075deedf8443 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 15/26] audiodec: unify cover handling (cherry picked from commit c5dbede1d3f23e7c88ea62a188809d65fda9b0ae) Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/99d72a0b8a0f31cc1ad7a85d0f80bcdebb94d681 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audiodec: unify cover handling (cherry picked from commit c5dbede1d3f23e7c88ea62a188809d65fda9b0ae) Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/driver/audiodec/ffmpegdec.cpp | 8 +++++--- src/driver/audiodec/mp3dec.cpp | 5 +++-- src/global.h | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 19c48a9eb..ef2583775 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -33,15 +33,19 @@ #include #include #include + +#include #include #include #include // UTF8 #include "ffmpegdec.h" + extern "C" { #include #include #include } + #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1) #define av_frame_alloc avcodec_alloc_frame #define av_frame_unref avcodec_get_frame_defaults @@ -63,8 +67,6 @@ extern cAudio * audioDecoder; #define ProgName "FfmpegDec" -#define COVERDIR "/tmp/cover" - static OpenThreads::Mutex mutex; static int cover_count = 0; @@ -521,7 +523,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) if (save_cover && (avc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)) { mkdir(COVERDIR, 0755); std::string cover(COVERDIR); - cover += "/" + to_string(cover_count++) + ".jpg"; + cover += "/cover_" + to_string(cover_count++) + ".jpg"; FILE *f = fopen(cover.c_str(), "wb"); if (f) { AVPacket *pkt = &avc->streams[i]->attached_pic; diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index 69c11d5b4..c555add3f 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -1388,9 +1388,10 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m) data = id3_field_getbinarydata(field, &size); if ( data ) { + mkdir(COVERDIR, 0755); std::ostringstream cover; - cover.str(""); - cover << "/tmp/cover_" << cover_count++ << ".jpg"; + cover.str(COVERDIR); + cover << "/cover_" << cover_count++ << ".jpg"; FILE * pFile; pFile = fopen ( cover.str().c_str() , "wb" ); if (pFile) diff --git a/src/global.h b/src/global.h index 7bde595f7..6d3c5497e 100644 --- a/src/global.h +++ b/src/global.h @@ -47,6 +47,8 @@ #define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf" #define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked" +#define COVERDIR "/tmp/cover" + #define LOGODIR ICONSDIR "/logo" #define LOGODIR_VAR ICONSDIR_VAR "/logo" From a82d0e9e58d85713faeb0ae5cc571fdf427083af Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 16/26] audioplayer: fix coordinates to clear title-box (cherry picked from commit 519de5279c8065322c46a33b5059adaa49eb84f8) Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4b4cf14d6ba0e1ae0964a98709213948ef6c9be2 Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audioplayer: fix coordinates to clear title-box (cherry picked from commit 519de5279c8065322c46a33b5059adaa49eb84f8) Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 9ce933e3d..cf33438a4 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1697,7 +1697,7 @@ void CAudioPlayerGui::paintTitleBox() return; if (m_state == CAudioPlayerGui::STOP && m_show_playlist) - m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width, m_title_height); + m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width + OFFSET_SHADOW, m_title_height + OFFSET_SHADOW); else { // shadow From dc545ddf1d3fb191afdbd77267964be8d5bf999c Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 19:53:38 +0200 Subject: [PATCH 17/26] audiometadata: add logo to metadata # Conflicts: # src/driver/audiometadata.cpp # src/driver/audiometadata.h cherry-picked from 9c58e2fc21eb701d44bedfe26b5dfd01fe800ceb Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b66ea2f9cc712b1708daa3e49adb063cd91e0f94 Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audiometadata: add logo to metadata # Conflicts: # src/driver/audiometadata.cpp # src/driver/audiometadata.h cherry-picked from 9c58e2fc21eb701d44bedfe26b5dfd01fe800ceb Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/driver/audiometadata.cpp | 6 +++++- src/driver/audiometadata.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/driver/audiometadata.cpp b/src/driver/audiometadata.cpp index 7dbe1bd08..8d48a0f10 100644 --- a/src/driver/audiometadata.cpp +++ b/src/driver/audiometadata.cpp @@ -64,6 +64,7 @@ CAudioMetaData::CAudioMetaData( const CAudioMetaData& src ) hasInfoOrXingTag( src.hasInfoOrXingTag ), artist( src.artist ), title( src.title ), album( src.album ), sc_station( src.sc_station ), date( src.date ), genre( src.genre ), track( src.track ),cover(src.cover), + logo( src.logo ), url( src.url ), cover_temporary( false ), changed( src.changed ) { @@ -97,9 +98,10 @@ void CAudioMetaData::operator=( const CAudioMetaData& src ) genre = src.genre; track = src.track; cover = src.cover; + logo = src.logo; + url = src.url; sc_station = src.sc_station; changed = src.changed; - changed = src.changed; cover_temporary = false; } @@ -125,6 +127,8 @@ void CAudioMetaData::clear() if (cover_temporary && !cover.empty()) unlink(cover.c_str()); cover.clear(); + logo.clear(); + url.clear(); cover_temporary=false; changed=false; } diff --git a/src/driver/audiometadata.h b/src/driver/audiometadata.h index 3f25fd79e..5220b0877 100644 --- a/src/driver/audiometadata.h +++ b/src/driver/audiometadata.h @@ -96,6 +96,8 @@ public: std::string genre; std::string track; std::string cover; + std::string logo; + std::string url; bool cover_temporary; bool changed; }; From b7f6c11c5939ea3fa8f9d2d1c4f1153a89a06696 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Jun 2017 23:45:57 +0200 Subject: [PATCH 18/26] audioplayer: fix position of meta data in titlebox (cherry picked from commit b49ce6f0e77f39d7264affceddf10aa7ea46ed24) Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f0c70b854cf7ceffe37a852ead9b5bea8b250feb Author: vanhofen Date: 2017-06-27 (Tue, 27 Jun 2017) Origin message was: ------------------ - audioplayer: fix position of meta data in titlebox (cherry picked from commit b49ce6f0e77f39d7264affceddf10aa7ea46ed24) Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index cf33438a4..439856702 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -2093,8 +2093,12 @@ void CAudioPlayerGui::updateMetaData() if (updateMeta || updateScreen) { int cover_width = m_title_height + 2*OFFSET_INNER_MID; - m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - cover_width - OFFSET_INNER_MID, m_meta_height, COL_MENUHEAD_PLUS_0); - int xstart = ((m_width - 2*OFFSET_INNER_MID - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo))/2); + m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - OFFSET_INNER_MID - cover_width, m_meta_height, COL_MENUHEAD_PLUS_0); + + int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo); + int xstart = (m_width - w)/2; + if (xstart < OFFSET_INNER_MID) + xstart = OFFSET_INNER_MID; g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL + m_meta_height, m_width - 2*xstart, m_metainfo, COL_MENUHEAD_TEXT); } } From fd6a3a90671a953218301a78eb50ab648b6f8dad Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 11:29:03 +0200 Subject: [PATCH 19/26] audioplayer: reset idle time to avoid screensaver ... when returning from filebrowser (cherry picked from commit e65e21a0b8af97f8d097c2d436c39cb2d60a1505) Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/bab708281acb3b12d8a8d48d0c5a69f08f482e69 Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: reset idle time to avoid screensaver ... when returning from filebrowser (cherry picked from commit e65e21a0b8af97f8d097c2d436c39cb2d60a1505) Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 439856702..c4ae07f58 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1451,6 +1451,7 @@ bool CAudioPlayerGui::openFilebrowser(void) result = true; } + m_idletime = time(NULL); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); // if playlist is turned off -> start playing immediately From 9ac898c88263c0b9957024115d1e4230c3ecd8e4 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 11:29:03 +0200 Subject: [PATCH 20/26] audioplayer: fix round borders in footer when playlist is hidden ... and use large roundings as in the other gui-elements cherry-picked from 102866f71d4f33912727d00f22ba1dde2b21d297 Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/bb7b9e2207a062e52d3e063c8654c48b59d6c101 Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: fix round borders in footer when playlist is hidden ... and use large roundings as in the other gui-elements cherry-picked from 102866f71d4f33912727d00f22ba1dde2b21d297 Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 44 ++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index c4ae07f58..c360a281f 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1605,7 +1605,6 @@ void CAudioPlayerGui::paintHead() CComponentsHeader header(m_x, m_y + m_title_height + OFFSET_SHADOW + OFFSET_INTER, m_width, m_header_height, LOCALE_AUDIOPLAYER_HEAD, NEUTRINO_ICON_AUDIO); header.enableShadow( CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); - header.setCorner(RADIUS_MID, CORNER_TOP); if (m_inetmode) header.setCaption(LOCALE_INETRADIO_NAME); @@ -1630,52 +1629,61 @@ void CAudioPlayerGui::paintFoot() { NEUTRINO_ICON_BUTTON_INFO, LOCALE_PICTUREVIEWER_HEAD } }; + int radius = RADIUS_LARGE; int button_y = m_y + m_height - OFFSET_SHADOW - m_info_height - OFFSET_INTER - OFFSET_SHADOW - 2*m_button_height; + int button_x = m_x; + int button_width = m_width; + + // ensure to get round corners in footer + if (!m_show_playlist && radius) + { + button_x += radius; + button_width -= 2*radius; + } // shadow - m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, button_y + OFFSET_SHADOW, m_width, 2*m_button_height, COL_SHADOW_PLUS_0, RADIUS_MID, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); - - m_frameBuffer->paintBoxRel(m_x, button_y, m_width, 2*m_button_height, COL_MENUFOOT_PLUS_0, RADIUS_MID, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); + m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, button_y + OFFSET_SHADOW, m_width, 2*m_button_height, COL_SHADOW_PLUS_0, radius, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); + m_frameBuffer->paintBoxRel(m_x, button_y, m_width, 2*m_button_height, COL_MENUFOOT_PLUS_0, radius, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL)); if (!m_playlist.empty()) - ::paintButtons(m_x, button_y + m_button_height, m_width, 3, SecondLineButtons, m_width, m_button_height); + ::paintButtons(button_x, button_y + m_button_height, button_width, 3, SecondLineButtons, button_width, m_button_height); if (m_key_level == 0) { if (m_playlist.empty()) { if (m_inetmode) - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[7], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[7], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 1, &(AudioPlayerButtons[7][0]), m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 1, &(AudioPlayerButtons[7][0]), button_width, m_button_height); } else if (m_inetmode) - ::paintButtons(m_x, button_y, m_width, 4, AudioPlayerButtons[8], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 4, AudioPlayerButtons[8], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 4, AudioPlayerButtons[1], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 4, AudioPlayerButtons[1], button_width, m_button_height); } else if (m_key_level == 1) { if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO) - ::paintButtons(m_x, button_y, m_width, 4, AudioPlayerButtons[0], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 4, AudioPlayerButtons[0], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[6], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[6], button_width, m_button_height); } else // key_level == 2 { if (m_state == CAudioPlayerGui::STOP) { if (m_select_title_by_name) - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[5], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[5], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[4], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[4], button_width, m_button_height); } else { if (m_select_title_by_name) - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[3], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[3], button_width, m_button_height); else - ::paintButtons(m_x, button_y, m_width, 2, AudioPlayerButtons[2], m_width, m_button_height); + ::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[2], button_width, m_button_height); } } } @@ -1702,10 +1710,10 @@ void CAudioPlayerGui::paintTitleBox() else { // shadow - m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, m_y + OFFSET_SHADOW, m_width, m_title_height, COL_SHADOW_PLUS_0, RADIUS_MID); + m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, m_y + OFFSET_SHADOW, m_width, m_title_height, COL_SHADOW_PLUS_0, RADIUS_LARGE); - m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height, COL_MENUHEAD_PLUS_0, RADIUS_MID); - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height, OFFSET_INNER_MIN, COL_FRAME_PLUS_0, RADIUS_MID); + m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height, COL_MENUHEAD_PLUS_0, RADIUS_LARGE); + m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height, 2, COL_FRAME_PLUS_0, RADIUS_LARGE); paintCover(); From ec16de6f289636b12f1ed7e994a67d2550ac41cf Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 15:58:40 +0200 Subject: [PATCH 21/26] audioplayer: reset idle time to avoid screensaver ... when returning from shoutcast-filebrowser (cherry picked from commit a07fbc0cd627e47f0a73f1b09de9e6e0700dbf68) Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b62bb3715f32b62fd6c25d3f7c08ac9760bc5520 Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - audioplayer: reset idle time to avoid screensaver ... when returning from shoutcast-filebrowser (cherry picked from commit a07fbc0cd627e47f0a73f1b09de9e6e0700dbf68) Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index c360a281f..bc18229b3 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1523,6 +1523,7 @@ bool CAudioPlayerGui::openSCbrowser(void) #endif result = true; } + m_idletime = time(NULL); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); // if playlist is turned off -> start playing immediately From 6c9584034575a5f08a38203853fc5aebd5e9122f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 28 Jun 2017 20:36:51 +0200 Subject: [PATCH 22/26] CComponentsFooter: remove FIXME tag fixed since 1b2eea185fc3a50a027d7834c340a184b1eb62e4 Obsolete wrong types caused this. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/47f7426aa727985aa0cdb06cfc77b26ceef698af Author: Thilo Graf Date: 2017-06-28 (Wed, 28 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_footer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 74b48d754..913de581e 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -123,8 +123,8 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con * If already existing some items then subtract those width from footer width. * ...so we have the possible usable size for button container. */ - if(!v_cc_items.empty()){ //FIXME: footer container seems always not empty here, so here j initialized with = 1. I dont't know where it comes from! dbt! - for (size_t j= 1; j< size(); j++) + if(!v_cc_items.empty()){ + for (size_t j= 0; j< size(); j++) w_chain -= getCCItem(j)->getWidth(); } From 9b0650d695426be6c0a606937e021082d5d9ea12 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 28 Jun 2017 21:24:09 +0200 Subject: [PATCH 23/26] settings.h: add define for minimal frame width Mostly we are using a frame width of 2 lines. This should ensure correct scaling with other screen resolution. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6aaa4031972d7a82c3f4c5683122ff819478e4cf Author: Thilo Graf Date: 2017-06-28 (Wed, 28 Jun 2017) ------------------ This commit was generated by Migit --- src/system/settings.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/settings.h b/src/system/settings.h index 34de4f54f..fd72578b2 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -938,6 +938,8 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define SCROLLBAR_WIDTH (OFFSET_INNER_MID + 2*OFFSET_INNER_MIN) +#define FRAME_MIN_WIDTH CFrameBuffer::getInstance()->scale2Res(2) + #define DETAILSLINE_WIDTH CFrameBuffer::getInstance()->scale2Res(16) #define BIGFONT_FACTOR 1.5 From 43d2aeee1c9535d80eb1dd3c76090aac7a579304 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 28 Jun 2017 22:03:12 +0200 Subject: [PATCH 24/26] CAudioPlayerGui: add cc scquare objekt as title box, fix caption bg colors Use of cc square object saves unnecessary paintBoxRel() calls. BgColors of metatdata and time display were different to titlebox body color, but was not to see with all themes. btw: time box was too much on the right side. Frame of titelbox was overpainted but was not very noticeable if frame width < 2. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/86742b1d72a5a306fb5181f1ec418f4c5c4c09c9 Author: Thilo Graf Date: 2017-06-28 (Wed, 28 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 40 +++++++++++++++++++++++++--------------- src/gui/audioplayer.h | 1 + 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index bc18229b3..34e022b86 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -154,6 +154,7 @@ CAudioPlayerGui::CAudioPlayerGui(bool inetmode) m_inetmode = inetmode; m_detailsline = NULL; m_infobox = NULL; + m_titlebox = NULL; Init(); } @@ -209,6 +210,7 @@ CAudioPlayerGui::~CAudioPlayerGui() m_title2Pos.clear(); delete m_detailsline; delete m_infobox; + delete m_titlebox; } const struct button_label AudioPlayerButtons[][4] = @@ -1707,15 +1709,23 @@ void CAudioPlayerGui::paintTitleBox() return; if (m_state == CAudioPlayerGui::STOP && m_show_playlist) - m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width + OFFSET_SHADOW, m_title_height + OFFSET_SHADOW); + { + if (m_titlebox) + { + m_titlebox->kill(); + delete m_titlebox; m_titlebox = NULL; + } + } else { - // shadow - m_frameBuffer->paintBoxRel(m_x + OFFSET_SHADOW, m_y + OFFSET_SHADOW, m_width, m_title_height, COL_SHADOW_PLUS_0, RADIUS_LARGE); - - m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height, COL_MENUHEAD_PLUS_0, RADIUS_LARGE); - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height, 2, COL_FRAME_PLUS_0, RADIUS_LARGE); - + // title box + if (!m_titlebox) + { + m_titlebox = new CComponentsShapeSquare(m_x, m_y, m_width, m_title_height, NULL, CC_SHADOW_ON); + m_titlebox->enableFrame(true, FRAME_MIN_WIDTH); + m_titlebox->setCorner(RADIUS_LARGE); + } + m_titlebox->paint(false); paintCover(); // first line (Track number) @@ -1738,7 +1748,7 @@ void CAudioPlayerGui::paintTitleBox() int xstart = (m_width - w)/2; if (xstart < OFFSET_INNER_MID) xstart = OFFSET_INNER_MID; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 1*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 1*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); //caption "current track" // second line (Artist/Title...) GetMetaData(m_curr_audiofile); @@ -1763,7 +1773,7 @@ void CAudioPlayerGui::paintTitleBox() xstart = (m_width - w)/2; if (xstart < OFFSET_INNER_MID) xstart = OFFSET_INNER_MID; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); //artist - title // reset so fields get painted always m_metainfo.clear(); @@ -2103,7 +2113,7 @@ void CAudioPlayerGui::updateMetaData() if (updateMeta || updateScreen) { int cover_width = m_title_height + 2*OFFSET_INNER_MID; - m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - OFFSET_INNER_MID - cover_width, m_meta_height, COL_MENUHEAD_PLUS_0); + m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - OFFSET_INNER_MID - cover_width, m_meta_height, m_titlebox->getColorBody()); int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo); int xstart = (m_width - w)/2; @@ -2151,7 +2161,7 @@ void CAudioPlayerGui::updateTimes(const bool force) if (m_inetmode) w_total_time = 0; - int x_total_time = m_x + m_width - OFFSET_INNER_MID - w_total_time; + int x_total_time = m_x + m_width - OFFSET_INNER_MID - w_total_time - 2*m_titlebox->getFrameThickness(); // played time offset to align this value on the right side int o_played_time = std::max(w_faked_time - w_played_time, 0); int x_faked_time = m_x + m_width - OFFSET_INNER_MID - w_total_time - w_faked_time; @@ -2160,20 +2170,20 @@ void CAudioPlayerGui::updateTimes(const bool force) if (updateTotal && !m_inetmode) { - m_frameBuffer->paintBoxRel(x_total_time, y_times, w_total_time + OFFSET_INNER_MID, m_item_height, COL_MENUHEAD_PLUS_0); + m_frameBuffer->paintBoxRel(x_total_time, y_times, w_total_time + OFFSET_INNER_MID, m_item_height, m_titlebox->getColorBody()); if (m_time_total > 0) { - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x_total_time, y_times + m_item_height, w_total_time, total_time, COL_MENUHEAD_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x_total_time, y_times + m_item_height, w_total_time, total_time, COL_MENUHEAD_TEXT); //total time } } if (updatePlayed || (m_state == CAudioPlayerGui::PAUSE)) { - m_frameBuffer->paintBoxRel(x_faked_time, y_times, w_faked_time, m_item_height, COL_MENUHEAD_PLUS_0); + m_frameBuffer->paintBoxRel(x_faked_time, y_times, w_faked_time, m_item_height, m_titlebox->getColorBody()); struct timeval tv; gettimeofday(&tv, NULL); if ((m_state != CAudioPlayerGui::PAUSE) || (tv.tv_sec & 1)) { - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x_played_time, y_times + m_item_height, w_played_time, played_time, COL_MENUHEAD_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x_played_time, y_times + m_item_height, w_played_time, played_time, COL_MENUHEAD_TEXT); //elapsed time } } } diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index 3f945c993..8cb914a12 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -128,6 +128,7 @@ class CAudioPlayerGui : public CMenuTarget bool m_inetmode; CComponentsDetailsLine *m_detailsline; CComponentsInfoBox *m_infobox; + CComponentsShapeSquare *m_titlebox; SMSKeyInput m_SMSKeyInput; From 0ddfa9d2046b43dde7410844eb50e90c88e5cf09 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 22:44:08 +0200 Subject: [PATCH 25/26] upnpbrowser: fix some wrong OFFSETs Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/788181bf27db1fefb72641e05917cb9569e1c9ea Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - upnpbrowser: fix some wrong OFFSETs ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/upnpbrowser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index c1eb3e524..a2eb06581 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -126,8 +126,8 @@ void CUpnpBrowserGui::Init() m_header_height = _title_height; m_footer_height = _title_height; - m_topbox_height = _top_height*3 + OFFSET_INNER_MID; // topbox: 3 lines + inner offset - m_infobox_height = _info_height*2 + OFFSET_INNER_LARGE; // infobox/timebox: 2 lines + inner offset + m_topbox_height = 3*_top_height + 2*OFFSET_INNER_SMALL; // topbox: 3 lines + inner offset + m_infobox_height = 2*_info_height + 2*OFFSET_INNER_SMALL; // infobox/timebox: 2 lines + inner offset /* From top to bottom we have: * @@ -1131,7 +1131,7 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry) if(lastname != entry->albumArtURI){ tmpname = lastname = entry->albumArtURI.c_str(); tmpname = g_PicViewer->DownloadImage(tmpname); - int h_image = infobox.getHeight() - OFFSET_INTER - infobox.getCornerRadius(); + int h_image = infobox.getHeight() - 2*OFFSET_INNER_SMALL - infobox.getCornerRadius(); int y_image = infobox.getYPos() + infobox.getHeight()/2 - h_image/2; if (!image){ image = new CComponentsPicture(0, y_image, tmpname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTDARK_PLUS_0); @@ -1140,7 +1140,7 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry) } image->setPicture(tmpname); image->setHeight(h_image, true); - int x_image = infobox.getXPos() + infobox.getWidth() - image->getWidth() - OFFSET_INTER - infobox.getCornerRadius(); + int x_image = infobox.getXPos() + infobox.getWidth() - infobox.getCornerRadius() - OFFSET_INNER_MID - image->getWidth(); image->setXPos(x_image); } }else{ From 2ae4f8a6621824437ec50adf0c5259584cc830cd Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 28 Jun 2017 22:50:47 +0200 Subject: [PATCH 26/26] settings.h: set FRAME_MIN_WIDTH to 1 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/eb6863a3401d03850f20da292280784cbc83dadc Author: vanhofen Date: 2017-06-28 (Wed, 28 Jun 2017) Origin message was: ------------------ - settings.h: set FRAME_MIN_WIDTH to 1 ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/settings.h b/src/system/settings.h index f5f199b39..a0d994ac0 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -1004,7 +1004,7 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define SCROLLBAR_WIDTH (OFFSET_INNER_MID + 2*OFFSET_INNER_MIN) -#define FRAME_MIN_WIDTH CFrameBuffer::getInstance()->scale2Res(2) +#define FRAME_MIN_WIDTH 1 #define DETAILSLINE_WIDTH CFrameBuffer::getInstance()->scale2Res(16)