void CTestMenu::testShowPictureURL() { neutrino_msg_t msg; neutrino_msg_data_t data; CFileBrowser * fileBrowser; fileBrowser = new CFileBrowser(); CFileFilter fileFilter; fileFilter.addFilter("png"); fileFilter.addFilter("bmp"); fileFilter.addFilter("jpg"); fileFilter.addFilter("jpeg"); fileBrowser->Multi_Select = false; fileBrowser->Dirs_Selectable = false; fileBrowser->Filter = &fileFilter; std::string Path_local = g_settings.network_nfs_audioplayerdir; BROWSER: if (fileBrowser->exec(Path_local.c_str())) { Path_local = fileBrowser->getCurrentDir(); CFile * file; if ((file = fileBrowser->getSelectedFile()) != NULL) { CPictureViewerGui tmpPictureViewerGui; CPicture pic; struct stat statbuf; pic.Filename = file->Name; std::string tmp = file->Name.substr(file->Name.rfind('/') + 1); pic.Name = tmp.substr(0, tmp.rfind('.')); pic.Type = tmp.substr(tmp.rfind('.') + 1); if(stat(pic.Filename.c_str(), &statbuf) != 0) printf("stat error"); pic.Date = statbuf.st_mtime; tmpPictureViewerGui.addToPlaylist(pic); tmpPictureViewerGui.exec(NULL, "urlplayback"); } g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec if (msg != CRCInput::RC_home) { goto BROWSER; } } delete fileBrowser; }
void* CPictureViewerGui::decodeThread(void *arg) { CPictureViewerGui *PictureViewerGui = (CPictureViewerGui*) arg; pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); PictureViewerGui->thrView(); PictureViewerGui->decodeTflag=false; pthread_exit(NULL); }
bool CUpnpBrowserGui::selectItem(std::string id) { bool loop = true; bool endall = false; bool changed = true; bool rchanged = true; neutrino_msg_t msg; neutrino_msg_data_t data; std::vector<UPnPEntry> *entries; unsigned int index, selected, dirnum; index = 0; selected = 0; dirnum = 0; entries = NULL; while (loop) { updateTimes(); if (rchanged) { if (entries) delete entries; entries = NULL; std::list<UPnPAttribute>attribs; std::list<UPnPAttribute>results; std::list<UPnPAttribute>::iterator i; std::stringstream sindex; std::stringstream scount; unsigned int returned = 0; bool rfound = false; bool nfound = false; bool tfound = false; sindex << index; scount << m_listmaxshow; attribs.push_back(UPnPAttribute("ObjectID", id)); attribs.push_back(UPnPAttribute("BrowseFlag", "BrowseDirectChildren")); attribs.push_back(UPnPAttribute("Filter", "*")); attribs.push_back(UPnPAttribute("StartingIndex", sindex.str())); attribs.push_back(UPnPAttribute("RequestedCount", scount.str())); attribs.push_back(UPnPAttribute("SortCriteria", "")); results = m_devices[m_selecteddevice].SendSOAP("urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", attribs); for (i = results.begin(); i != results.end(); i++) { if (i->first == "NumberReturned") { returned = atoi(i->second.c_str()); nfound = true; } if (i->first == "TotalMatches") { dirnum = atoi(i->second.c_str()); tfound = true; } if (i->first == "Result") { entries = decodeResult(i->second); rfound = true; } } if (!entries) return endall; if (!nfound || !tfound || !rfound) { delete entries; return endall; } if (returned != entries->size()) { delete entries; return endall; } if (returned == 0) { delete entries; return endall; } rchanged=false; changed=true; } if (changed) { paintItem(entries, selected - index, dirnum - index, index); changed = false; } m_frameBuffer->blit(); g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; if( msg == CRCInput::RC_timeout) { // nothing } else if(msg == CRCInput::RC_home) { loop = false; endall = true; } else if(msg == CRCInput::RC_left) { loop = false; } else if (msg_repeatok == CRCInput::RC_up && selected > 0) { selected--; if (selected < index) { index -= m_listmaxshow; rchanged = true; } changed = true; } else if( (msg == CRCInput::RC_yellow || (int) msg == g_settings.key_channelList_pageup) && selected > 0) { if (index > 0) { index-=m_listmaxshow; selected-=m_listmaxshow; rchanged=true; } else selected=0; changed = true; } else if (msg_repeatok == CRCInput::RC_down && selected + 1 < dirnum) { selected++; if (selected + 1 > index + m_listmaxshow) { index += m_listmaxshow; rchanged = true; } changed=true; } else if( (msg == CRCInput::RC_green || (int) msg == g_settings.key_channelList_pagedown)&& selected + 1 < dirnum) { if (index < ((dirnum - 1) / m_listmaxshow) * m_listmaxshow) { index += m_listmaxshow; selected += m_listmaxshow; if (selected + 1 >= dirnum) selected = dirnum - 1; rchanged = true; } else selected = dirnum - 1; changed = true; } else if(msg == CRCInput::RC_right) { if ((*entries)[selected - index].isdir) { endall = selectItem((*entries)[selected - index].id); if (endall) loop = false; } changed = true; } else if(msg == CRCInput::RC_ok) { if (!(*entries)[selected - index].isdir) { m_folderplay = false; int preferred = (*entries)[selected - index].preferred; if (preferred != -1) { std::string protocol, prot, network, mime, additional; protocol=(*entries)[selected - index].resources[preferred].protocol; splitProtocol(protocol, prot, network, mime, additional); if (mime == "audio/mpeg") { CAudioPlayerGui tmpAudioPlayerGui; CAudiofileExt audiofile((*entries)[selected - index].resources[preferred].url, CFile::EXTENSION_MP3); tmpAudioPlayerGui.addToPlaylist(audiofile); tmpAudioPlayerGui.exec(NULL, "urlplayback"); } else if ((mime == "image/gif") || (mime == "image/jpeg")) { CPictureViewerGui tmpPictureViewerGui; CPicture pic; struct stat statbuf; pic.Filename = (*entries)[selected - index].resources[preferred].url; std::string tmp = (*entries)[selected - index].resources[preferred].url.substr((*entries)[selected - index].resources[preferred].url.rfind('/') + 1); pic.Name = tmp.substr(0, tmp.rfind('.')); pic.Type = tmp.substr(tmp.rfind('.') + 1); if(stat(pic.Filename.c_str(), &statbuf) != 0) printf("stat error"); pic.Date = statbuf.st_mtime; tmpPictureViewerGui.addToPlaylist(pic); tmpPictureViewerGui.exec(NULL, "urlplayback"); changed = true; } else if (mime.substr(0,6) == "video/") { m_frameBuffer->ClearFrameBuffer(); m_frameBuffer->blit(); CFile file; file.Name = (*entries)[selected - index].resources[preferred].url.c_str(); //FIXME CMoviePlayerGui tmpMoviePlayerGui; tmpMoviePlayerGui.addToPlaylist(file); tmpMoviePlayerGui.exec(NULL, "urlplayback"); changed = true; } m_playing_entry = (*entries)[selected - index]; } } else { m_folderplay = true; m_playfolder = (*entries)[selected - index].id; m_playid = 0; playnext(); } changed = true; } else if( msg == CRCInput::RC_red) { if(CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) CAudioPlayer::getInstance()->stop(); m_folderplay = false; } else if(msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::SHUTDOWN || msg == NeutrinoMessages::SLEEPTIMER) { loop = false; g_RCInput->postMsg(msg, data); } else if(msg == NeutrinoMessages::EVT_TIMER) { CNeutrinoApp::getInstance()->handleMsg( msg, data ); } else { if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) loop = false; changed = true; } if (m_folderplay && (CAudioPlayer::getInstance()->getState() == CBaseDec::STOP)) playnext(); m_frameBuffer->blit(); } if (entries) delete entries; m_frameBuffer->ClearFrameBuffer(); m_frameBuffer->blit(); return endall; }
void CUpnpBrowserGui::playnext(void) { while (true) { std::list<UPnPAttribute>attribs; std::list<UPnPAttribute>results; std::list<UPnPAttribute>::iterator i; std::stringstream sindex; std::vector<UPnPEntry> *entries = NULL; bool rfound = false; bool nfound = false; bool tfound = false; sindex << m_playid; attribs.push_back(UPnPAttribute("ObjectID", m_playfolder)); attribs.push_back(UPnPAttribute("BrowseFlag", "BrowseDirectChildren")); attribs.push_back(UPnPAttribute("Filter", "*")); attribs.push_back(UPnPAttribute("StartingIndex", sindex.str())); attribs.push_back(UPnPAttribute("RequestedCount", "1")); attribs.push_back(UPnPAttribute("SortCriteria", "")); results = m_devices[m_selecteddevice].SendSOAP("urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", attribs); for (i = results.begin(); i!=results.end(); i++) { if (i->first=="NumberReturned") { if (atoi(i->second.c_str()) != 1) { m_folderplay = false; return; } nfound=true; } if (i->first=="TotalMatches") { tfound=true; } if (i->first=="Result") { entries=decodeResult(i->second); rfound=true; } } m_playid++; if ((entries != NULL) && (!(*entries)[0].isdir)) { int preferred=(*entries)[0].preferred; if (preferred != -1) { std::string protocol, prot, network, mime, additional; protocol=(*entries)[0].resources[preferred].protocol; splitProtocol(protocol, prot, network, mime, additional); if (mime == "audio/mpeg") { m_playing_entry = (*entries)[0]; m_playing_entry_is_shown = false; CAudioPlayerGui tmpAudioPlayerGui; CAudiofileExt audiofile((*entries)[0].resources[preferred].url, CFile::EXTENSION_MP3); tmpAudioPlayerGui.addToPlaylist(audiofile); tmpAudioPlayerGui.exec(NULL, "urlplayback"); return; } else if (mime.substr(0,6) == "video/") { m_frameBuffer->ClearFrameBuffer(); m_frameBuffer->blit(); CFile mfile; mfile.Name = (*entries)[0].resources[preferred].url.c_str(); //FIXME CMoviePlayerGui tmpMoviePlayerGui; tmpMoviePlayerGui.addToPlaylist(mfile); tmpMoviePlayerGui.exec(NULL, "urlplayback"); return; } else if (mime.substr(0,6) == "image/") { CPictureViewerGui tmpPictureViewerGui; CPicture pic; struct stat statbuf; pic.Filename = (*entries)[0].resources[preferred].url; std::string tmp = (*entries)[0].resources[preferred].url.substr((*entries)[0].resources[preferred].url.rfind('/') + 1); pic.Name = tmp.substr(0, tmp.rfind('.')); pic.Type = tmp.substr(tmp.rfind('.') + 1); if(stat(pic.Filename.c_str(), &statbuf) != 0) printf("stat error"); pic.Date = statbuf.st_mtime; tmpPictureViewerGui.addToPlaylist(pic); tmpPictureViewerGui.exec(NULL, "urlplayback"); return; } } } else { neutrino_msg_t msg; neutrino_msg_data_t data; g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display if( msg == CRCInput::RC_home) { m_folderplay = false; break; } } } // m_frameBuffer->ClearFrameBuffer(); m_frameBuffer->blit(); }
void plugin_exec(void) { neutrino_msg_t msg; neutrino_msg_data_t data; CFileBrowser filebrowser; std::string Path_local = "/media/hdd"; BROWSER: if (filebrowser.exec(Path_local.c_str())) { Path_local = filebrowser.getCurrentDir(); // remark path // get the current file name CFile * file; if ((file = filebrowser.getSelectedFile()) != NULL) { // parse file extension if(file->getType() == CFile::FILE_PICTURE) { CPictureViewerGui tmpPictureViewerGui; CPicture pic; struct stat statbuf; pic.Filename = file->Name; std::string tmp = file->Name.substr(file->Name.rfind('/') + 1); pic.Name = tmp.substr(0, tmp.rfind('.')); pic.Type = tmp.substr(tmp.rfind('.') + 1); if(stat(pic.Filename.c_str(), &statbuf) != 0) printf("stat error"); pic.Date = statbuf.st_mtime; tmpPictureViewerGui.addToPlaylist(pic); tmpPictureViewerGui.exec(NULL, "urlplayback"); } else if(file->getType() == CFile::FILE_TEXT || file->getType() == CFile::FILE_XML) { std::string buffer; buffer.clear(); char buf[256]; FILE* pFile; pFile = fopen(file->Name.c_str(), "r"); if(pFile != NULL) { fgets(buf, sizeof(buf), pFile); } fclose(pFile); buffer = buf; int mode = CInfoBox::SCROLL | CInfoBox::TITLE | CInfoBox::FOOT | CInfoBox::BORDER;// | //CInfoBox::NO_AUTO_LINEBREAK | //CInfoBox::CENTER | //CInfoBox::AUTO_WIDTH | //CInfoBox::AUTO_HIGH; CBox position(g_settings.screen_StartX + 50, g_settings.screen_StartY + 50, g_settings.screen_EndX - g_settings.screen_StartX - 100, g_settings.screen_EndY - g_settings.screen_StartY - 100); CInfoBox * infoBox = new CInfoBox(file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU], mode, &position, file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], NULL); infoBox->setText(&buffer); infoBox->exec(); delete infoBox; } else if(file->getType() == CFile::FILE_VIDEO) { moviePlayerGui->filename = file->Name.c_str(); moviePlayerGui->Title = file->Title; moviePlayerGui->Info1 = file->Info1; moviePlayerGui->Info2 = file->Info2; // play moviePlayerGui->exec(NULL, "urlplayback"); } else if(file->getType() == CFile::FILE_AUDIO) { CAudioPlayerGui tmpAudioPlayerGui; CAudiofileExt audiofile(file->Name, file->getExtension()); tmpAudioPlayerGui.addToPlaylist(audiofile); tmpAudioPlayerGui.exec(NULL, "urlplayback"); } } g_RCInput->getMsg_ms(&msg, &data, 10); if (msg != CRCInput::RC_home) { goto BROWSER; } } }
void CImageInfo::paintRevisionInfos(int y_startposition) { struct utsname u; clearContentBox(); paintContent(font_small, xpos, y_startposition, "Kernel:", COL_MENUCONTENTINACTIVE ); if (!uname(&u)) // no idea what could go wrong here, but u would be uninitialized. paintContent(font_small, xpos+x_offset_large, y_startposition, u.release); y_startposition += sheight; paintContent(font_small, xpos, y_startposition, "BusyBox:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, getSysInfo("BusyBox v", false).c_str()); y_startposition += sheight; paintContent(font_small, xpos, y_startposition, "JFFS2:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, getSysInfo("JFFS2 version ", false).c_str()); y_startposition += sheight; paintContent(font_small, xpos, y_startposition, "Squashfs:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, getSysInfo("squashfs: version ", false).c_str()); y_startposition += sheight; paintContent(font_small, xpos, y_startposition, "Imageinfo:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, getModulVersion("","$Revision: 1.37 $").c_str()); #ifdef ENABLE_MOVIEBROWSER y_startposition += sheight; static CMovieBrowser mb; paintContent(font_small, xpos, y_startposition, "Moviebrowser:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, mb.getMovieBrowserVersion().c_str()); #endif /* ENABLE_MOVIEBROWSER */ #ifdef ENABLE_MOVIEPLAYER y_startposition += sheight; static CMoviePlayerGui mp; paintContent(font_small, xpos, y_startposition, "Movieplayer:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, mp.getMoviePlayerVersion().c_str()); #endif #ifdef ENABLE_PICTUREVIEWER y_startposition += sheight; static CPictureViewerGui pv; paintContent(font_small, xpos, y_startposition, "Pictureviewer:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, pv.getPictureViewerVersion().c_str()); #endif #ifndef ENABLE_KERNEL26 //TODO: k26 support #ifdef ENABLE_DRIVE_GUI y_startposition += sheight; static CDriveSetup ide; paintContent(font_small, xpos, y_startposition, "IDE/MMC:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, ide.getDriveSetupVersion().c_str()); #endif /*ENABLE_DRIVE_GUI*/ #endif /*ENABLE_KERNEL26*/ y_startposition += sheight; static CStreamInfo2Misc si; paintContent(font_small, xpos, y_startposition, "Streaminfo:", COL_MENUCONTENTINACTIVE ); paintContent(font_small, xpos+x_offset_large, y_startposition, si.getStreamInfoVersion().c_str()); }
void CTestMenu::testShowPictureFolder() { neutrino_msg_t msg; neutrino_msg_data_t data; CFileBrowser * fileBrowser; CFileFilter fileFilter; CFileList filelist; int selected = 0; fileFilter.addFilter("png"); fileFilter.addFilter("bmp"); fileFilter.addFilter("jpg"); fileFilter.addFilter("jpeg"); fileBrowser = new CFileBrowser(); fileBrowser->Multi_Select = true; fileBrowser->Dirs_Selectable = true; fileBrowser->Filter = &fileFilter; std::string Path_local = g_settings.network_nfs_audioplayerdir; BROWSER: if (fileBrowser->exec(Path_local.c_str())) { Path_local = fileBrowser->getCurrentDir(); CPictureViewerGui tmpPictureViewerGui; CPicture pic; struct stat statbuf; CFileList::const_iterator files = fileBrowser->getSelectedFiles().begin(); for(; files != fileBrowser->getSelectedFiles().end(); files++) { if (files->getType() == CFile::FILE_PICTURE) { pic.Filename = files->Name; std::string tmp = files->Name.substr(files->Name.rfind('/') + 1); pic.Name = tmp.substr(0, tmp.rfind('.')); pic.Type = tmp.substr(tmp.rfind('.') + 1); if(stat(pic.Filename.c_str(), &statbuf) != 0) printf("stat error"); pic.Date = statbuf.st_mtime; tmpPictureViewerGui.addToPlaylist(pic); } } tmpPictureViewerGui.exec(NULL, "urlplayback"); g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec if (msg != CRCInput::RC_home) { goto BROWSER; } } delete fileBrowser; }
void CTestMenu::testCallPictureViewer() { CPictureViewerGui tmpPictureViewerGui; tmpPictureViewerGui.exec(NULL, ""); }