diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 7f3d6d000..349101d52 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -294,7 +294,7 @@ bool CRecordInstance::Update() EPG_AUDIO_PIDS audio_pids; audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; audio_pids.selected = 0; recMovieInfo->audioPids.push_back(audio_pids); @@ -512,7 +512,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis if (tmpstring.empty()) recMovieInfo->epgChannel = "unknown"; else - recMovieInfo->epgChannel = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); + recMovieInfo->epgChannel = tmpstring; tmpstring = "not available"; if (epgid != 0) { @@ -533,10 +533,10 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis } else if (!epgTitle.empty()) { tmpstring = epgTitle; } - recMovieInfo->epgTitle = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); + recMovieInfo->epgTitle = tmpstring; recMovieInfo->epgId = channel->getChannelID(); - recMovieInfo->epgInfo1 = ZapitTools::UTF8_to_UTF8XML(info1.c_str()); - recMovieInfo->epgInfo2 = ZapitTools::UTF8_to_UTF8XML(info2.c_str()); + recMovieInfo->epgInfo1 = info1; + recMovieInfo->epgInfo2 = info2; recMovieInfo->epgEpgId = epgid; recMovieInfo->epgMode = g_Zapit->getMode(); recMovieInfo->epgVideoPid = allpids.PIDs.vpid; @@ -548,7 +548,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis for(it = apid_list.begin(); it != apid_list.end(); it++) { if(allpids.APIDs[i].pid == it->apid) { audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; audio_pids.selected = (audio_pids.epgAudioPid == channel->getAudioPid()) ? 1 : 0; recMovieInfo->audioPids.push_back(audio_pids); @@ -559,7 +559,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis if(recMovieInfo->audioPids.empty() && allpids.APIDs.size()) { int i = 0; audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; audio_pids.selected = 1; recMovieInfo->audioPids.push_back(audio_pids); diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 340a189e2..967469616 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -60,6 +60,7 @@ CVolume::CVolume() MuteIconFrame = false; // For future On/Off switch IconFrame ShadowOffset = 4; mute_ay = 0; + m_mode = CNeutrinoApp::getInstance()->getMode(); Init(); } @@ -115,6 +116,8 @@ void CVolume::Init() mute_dy += mute_icon_dx / 4; mute_ax = sw - mute_dx; mute_ay = y; + + CNeutrinoApp* neutrino = CNeutrinoApp::getInstance(); if ((g_settings.mode_clock) && (g_settings.volume_pos == 0)) { // Clock and MuteIcon in a line. @@ -129,17 +132,20 @@ void CVolume::Init() else mute_ay += (vbar_h - mute_dy) / 2; } - if ((g_settings.mode_clock) && (!CNeutrinoApp::getInstance()->isMuted())) + + if ((g_settings.mode_clock) && (!neutrino->isMuted())) frameBuffer->paintBackgroundBoxRel(sw - clock_width, y, clock_width, clock_height); //printf("\n##### [volume.cpp Zeile %d] mute_ax %d, mute_dx %d\n \n", __LINE__, mute_ax, mute_dx); switch (g_settings.volume_pos) { case 0:// upper right - if (CNeutrinoApp::getInstance()->isMuted()) - x_corr = mute_dx + spacer; + if (( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_audio) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) { + if ((neutrino->isMuted()) && (!g_settings.mode_clock)) + x_corr = mute_dx + spacer; + if (g_settings.mode_clock) + y += clock_height + spacer / 2; + } x = sw - vbar_w - x_corr; - if (g_settings.mode_clock) - y += clock_height + spacer / 2; break; case 1:// upper left break; @@ -181,8 +187,6 @@ CVolume* CVolume::getInstance() void CVolume::AudioMute(int newValue, bool isEvent) { - if((g_settings.current_volume == 0) && (g_settings.show_mute_icon == 1)) - return; CNeutrinoApp* neutrino = CNeutrinoApp::getInstance(); bool doInit = newValue != (int) neutrino->isMuted(); @@ -212,6 +216,17 @@ void CVolume::setvol(int vol) void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowait) { neutrino_msg_t msg = key; + int mode = CNeutrinoApp::getInstance()->getMode(); + + if (msg <= CRCInput::RC_MaxRC) { + if(m_mode != mode) { + m_mode = mode; + Init(); + setVolume(msg); + return; + } + } + int vol = g_settings.current_volume; fb_pixel_t * pixbuf = NULL; @@ -245,11 +260,6 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa sub_chan_keybind = 1; if ((msg == CRCInput::RC_plus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_right))) { - if (g_settings.current_volume < 100 - g_settings.current_volume_step) - g_settings.current_volume += g_settings.current_volume_step; - else - g_settings.current_volume = 100; - if(CNeutrinoApp::getInstance()->isMuted()) { if ((bDoPaint) && (pixbuf!= NULL)) { frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); @@ -260,18 +270,47 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa setVolume(msg); return; } + + if(!CNeutrinoApp::getInstance()->isMuted()) { + if (g_settings.current_volume < 100 - g_settings.current_volume_step) + g_settings.current_volume += g_settings.current_volume_step; + else + g_settings.current_volume = 100; + } } else if ((msg == CRCInput::RC_minus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_left))) { - if (g_settings.current_volume > g_settings.current_volume_step) - g_settings.current_volume -= g_settings.current_volume_step; - else if ((g_settings.show_mute_icon == 1) && (g_settings.current_volume = 1)) { - (g_settings.current_volume = 1); - AudioMute( true, true); - g_settings.current_volume = 0; + if(CNeutrinoApp::getInstance()->isMuted() && g_settings.current_volume > 0) { + if ((bDoPaint) && (pixbuf!= NULL)) { + frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); + delete [] pixbuf; + } + AudioMute(false, true); + Init(); + setVolume(msg); + return; } - else if (g_settings.show_mute_icon == 0) - g_settings.current_volume = 0; + + if(!CNeutrinoApp::getInstance()->isMuted()) { + if (g_settings.current_volume > g_settings.current_volume_step) + g_settings.current_volume -= g_settings.current_volume_step; + + else if (g_settings.show_mute_icon == 1) { + if ((bDoPaint) && (pixbuf!= NULL)) { + frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); + delete [] pixbuf; + } + g_settings.current_volume = 0; + AudioMute( true, true); + Init(); + setVolume(msg); + return; + } + + else if (g_settings.show_mute_icon == 0) + g_settings.current_volume = 0; + } } + else if (msg == CRCInput::RC_home) break; else { diff --git a/src/driver/volume.h b/src/driver/volume.h index 5615eb7df..797d9ccb1 100644 --- a/src/driver/volume.h +++ b/src/driver/volume.h @@ -45,6 +45,7 @@ class CVolume int VolumeFont, colShadow, colBar, colFrame, colContent; int ShadowOffset; int rounded; + int m_mode; bool paintShadow, paintDigits, MuteIconFrame; public: diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 1643869ee..d66a2a424 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1228,8 +1228,13 @@ void CMovieBrowser::refreshMovieInfo(void) int pich = m_cBoxFrameInfo.iHeight; std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name); logo_ok = (fname != ""); + int flogo_w = 0, flogo_h = 0; + if(logo_ok) { + g_PicViewer->getSize(fname.c_str(), &flogo_w, &flogo_h); + g_PicViewer->rescaleImageDimensions(&flogo_w, &flogo_h, picw-2, pich-2); + } + m_pcInfo->setText(&m_movieSelectionHandler->epgInfo2, logo_ok ? m_cBoxFrameInfo.iWidth-flogo_w-20 : 0); - m_pcInfo->setText(&m_movieSelectionHandler->epgInfo2, logo_ok ? m_cBoxFrameInfo.iWidth-picw-20: 0); static int logo_w = 0; static int logo_h = 0; int logo_w_max = m_cBoxFrameTitleRel.iWidth / 4; @@ -1248,9 +1253,6 @@ void CMovieBrowser::refreshMovieInfo(void) g_PicViewer->DisplayImage(lname, lx - pb_hdd_offset, ly, logo_w, logo_h); } if(logo_ok) { - int flogo_w = 0, flogo_h = 0; - g_PicViewer->getSize(fname.c_str(), &flogo_w, &flogo_h); - g_PicViewer->rescaleImageDimensions(&flogo_w, &flogo_h, picw-2, pich-2); lx = m_cBoxFrameInfo.iX+m_cBoxFrameInfo.iWidth - flogo_w -14; ly = m_cBoxFrameInfo.iY - 1 + (m_cBoxFrameInfo.iHeight-flogo_h)/2; g_PicViewer->DisplayImage(fname, lx+2, ly+1, flogo_w, flogo_h, CFrameBuffer::TM_NONE); diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index eda4e0dbd..32d3ae023 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -119,7 +119,7 @@ bool CMovieInfo::convertTs2XmlName(std::string * filename) ************************************************************************/ #define XML_ADD_TAG_STRING(_xml_text_,_tag_name_,_tag_content_){ \ _xml_text_ += "\t\t<"_tag_name_">"; \ - _xml_text_ += _tag_content_; \ + _xml_text_ += ZapitTools::UTF8_to_UTF8XML(_tag_content_.c_str()); \ _xml_text_ += "\n";} #define XML_ADD_TAG_UNSIGNED(_xml_text_,_tag_name_,_tag_content_){\ @@ -141,7 +141,7 @@ bool CMovieInfo::convertTs2XmlName(std::string * filename) {\ if(_node_->GetData() != NULL)\ {\ - _string_dest_ = _node_->GetData();\ + _string_dest_ = decodeXmlSpecialChars(_node_->GetData());\ }\ }} #define XML_GET_DATA_INT(_node_,_tag_,_int_dest_){\ @@ -201,7 +201,7 @@ bool CMovieInfo::encodeMovieInfoXml(std::string * extMessage, MI_MOVIE_INFO * mo sprintf(tmp, "%u", movie_info->audioPids[i].selected); //pids.APIDs[i].pid); *extMessage += tmp; *extMessage += "\" " MI_XML_TAG_NAME "=\""; - *extMessage += movie_info->audioPids[i].epgAudioPidName; // ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + *extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info->audioPids[i].epgAudioPidName.c_str()); *extMessage += "\"/>\n"; } *extMessage += "\t\t\n"; @@ -235,7 +235,7 @@ bool CMovieInfo::encodeMovieInfoXml(std::string * extMessage, MI_MOVIE_INFO * mo sprintf(tmp, "%d", movie_info->bookmarks.user[i].length); //pids.APIDs[i].pid); *extMessage += tmp; *extMessage += "\" " MI_XML_TAG_BOOKMARK_USER_NAME "=\""; - *extMessage += movie_info->bookmarks.user[i].name; + *extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info->bookmarks.user[i].name.c_str()); *extMessage += "\"/>\n"; } } @@ -372,7 +372,7 @@ bool CMovieInfo::parseXmlTree(char */*text*/, MI_MOVIE_INFO * /*movie_info*/) pids.epgAudioPid = atoi(xam2->GetAttributeValue(MI_XML_TAG_PID)); pids.atype = atoi(xam2->GetAttributeValue(MI_XML_TAG_ATYPE)); pids.selected = atoi(xam2->GetAttributeValue(MI_XML_TAG_SELECTED)); - pids.epgAudioPidName = xam2->GetAttributeValue(MI_XML_TAG_NAME); + pids.epgAudioPidName = decodeXmlSpecialChars(xam2->GetAttributeValue(MI_XML_TAG_NAME)); //printf("MOVIE INFO: apid %d type %d name %s selected %d\n", pids.epgAudioPid, pids.atype, pids.epgAudioPidName.c_str(), pids.selected); movie_info->audioPids.push_back(pids); } @@ -405,16 +405,9 @@ bool CMovieInfo::parseXmlTree(char */*text*/, MI_MOVIE_INFO * /*movie_info*/) } delete parser; - strReplace(movie_info->epgTitle, """, "\""); - strReplace(movie_info->epgInfo1, """, "\""); - strReplace(movie_info->epgTitle, "'", "'"); - strReplace(movie_info->epgInfo1, "'", "'"); if (movie_info->epgInfo2 == "") { movie_info->epgInfo2 = movie_info->epgInfo1; //movie_info->epgInfo1 = ""; - } else { - strReplace(movie_info->epgInfo2, """, "\""); - strReplace(movie_info->epgInfo2, "'", "'"); } #endif /* XMLTREE_LIB */ return (true); @@ -590,6 +583,7 @@ int find_next_char(char to_find, char *text, int start_pos, int end_pos) while(_pos_ < bytes && _text_[_pos_] != '<' ) _pos_++;\ _dest_ = "";\ _dest_.append(&_text_[pos_prev],_pos_ - pos_prev );\ + _dest_ = decodeXmlSpecialChars(_dest_);\ _pos_ += sizeof(_tag_);\ continue;\ } @@ -627,6 +621,16 @@ void strReplace(std::string & orig, const char *fstr, const std::string rstr) } } +std::string decodeXmlSpecialChars(std::string s) +{ + strReplace(s,"<","<"); + strReplace(s,">",">"); + strReplace(s,"&","&"); + strReplace(s,""","\""); + strReplace(s,"'","\'"); + return s; +} + /************************************************************************ ************************************************************************/ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) @@ -731,7 +735,10 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/') pos3++; if (text[pos + pos3] == '\"') + { audio_pids.epgAudioPidName.append(&text[pos + pos2 + 1], pos3 - pos2 - 1); + audio_pids.epgAudioPidName = decodeXmlSpecialChars(audio_pids.epgAudioPidName); + } } } printf("MOVIE INFO: apid %d type %d name %s selected %d\n", audio_pids.epgAudioPid, audio_pids.atype, audio_pids.epgAudioPidName.c_str(), audio_pids.selected); @@ -776,7 +783,10 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/') pos3++; if (text[pos + pos3] == '\"') + { movie_info->bookmarks.user[bookmark_nr].name.append(&text[pos + pos2 + 1], pos3 - pos2 - 1); + movie_info->bookmarks.user[bookmark_nr].name = decodeXmlSpecialChars(movie_info->bookmarks.user[bookmark_nr].name); + } } } } @@ -790,16 +800,9 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) } } - strReplace(movie_info->epgTitle, """, "\""); - strReplace(movie_info->epgInfo1, """, "\""); - strReplace(movie_info->epgTitle, "'", "'"); - strReplace(movie_info->epgInfo1, "'", "'"); if (movie_info->epgInfo2 == "") { movie_info->epgInfo2 = movie_info->epgInfo1; //movie_info->epgInfo1 = ""; - } else { - strReplace(movie_info->epgInfo2, """, "\""); - strReplace(movie_info->epgInfo2, "'", "'"); } return (true);