void* CVFD::TimeThread(void *) { bool RecVisible = true; while(1) { sleep(1); struct stat buf; if (stat("/tmp/vfd.locked", &buf) == -1) { CVFD::getInstance()->showTime(); CVFD::getInstance()->count_down(); } else CVFD::getInstance()->wake_up(); /* hack, just if we missed the blit() somewhere * this will update the framebuffer once per second */ if (getenv("AUTOBLIT") != NULL) { CFrameBuffer *fb = CFrameBuffer::getInstance(); /* plugin start locks the framebuffer... */ if (!fb->Locked()) fb->blit(); } if (g_settings.lcd_vfd_recicon == 1) { if (RecIconID >=0 && CNeutrinoApp::getInstance()->recordingstatus && !CRecordManager::getInstance()->TimeshiftOnly()) { RecVisible = !RecVisible; SetIcon(RecIconID, RecVisible); } } else { if (RecIconID >=0 && CNeutrinoApp::getInstance()->recordingstatus && !CRecordManager::getInstance()->TimeshiftOnly() && CVFD::getInstance()->mode != MODE_STANDBY) { RecVisible = !RecVisible; SetIcon(RecIconID, RecVisible); } } } return NULL; }
bool CVideoSetupNotifier::changeNotify(const neutrino_locale_t OptionName, void *) { dprintf(DEBUG_NORMAL, "CVideoSetupNotifier::changeNotify\n"); CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_ANALOG_MODE)) /* video analoue mode */ { if(videoDecoder) #if defined (PLATFORM_COOLSTREAM) videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode); #else videoDecoder->SetAnalogMode(g_settings.analog_mode); #endif } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEORATIO) || ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOFORMAT )) // format aspect-ratio { if(videoDecoder) videoDecoder->setAspectRatio(g_settings.video_Ratio, g_settings.video_Format); } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOMODE)) // mode { if(videoDecoder) videoDecoder->SetVideoSystem(g_settings.video_Mode); // clear screen frameBuffer->paintBackground(); #ifdef FB_BLIT frameBuffer->blit(); #endif if(prev_video_Mode != g_settings.video_Mode) { if(MessageBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_VIDEOMODE_OK), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_INFO) != CMessageBox::mbrYes) { g_settings.video_Mode = prev_video_Mode; if(videoDecoder) videoDecoder->SetVideoSystem(g_settings.video_Mode); //no-> return to prev mode } else { prev_video_Mode = g_settings.video_Mode; } } } #if !defined (PLATFORM_COOLSTREAM) else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_COLOR_SPACE)) { if(videoDecoder) videoDecoder->SetSpaceColour(g_settings.hdmi_color_space); } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_WSS)) { if(videoDecoder) videoDecoder->SetWideScreen(g_settings.wss_mode); } #endif return true; }
void* CLCD::TimeThread(void *) { while (CLCD::getInstance()->thread_running) { sleep(1); CLCD::getInstance()->showTime(); /* hack, just if we missed the blit() somewhere * this will update the framebuffer once per second */ if (getenv("SPARK_NOBLIT") == NULL) { CFrameBuffer *fb = CFrameBuffer::getInstance(); /* plugin start locks the framebuffer... */ if (!fb->Locked()) fb->blit(); } } return NULL; }
void* CLCD::TimeThread(void *) { while (CLCD::getInstance()->thread_running) { sleep(1); if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT) { struct stat buf; if (stat("/tmp/vfd.locked", &buf) == -1) { CLCD::getInstance()->showTime(); CLCD::getInstance()->count_down(); } else CLCD::getInstance()->wake_up(); } else CLCD::getInstance()->showTime(); /* hack, just if we missed the blit() somewhere * this will update the framebuffer once per second */ if (getenv("SPARK_NOBLIT") == NULL) { CFrameBuffer *fb = CFrameBuffer::getInstance(); /* plugin start locks the framebuffer... */ if (!fb->Locked()) fb->blit(); } } return NULL; }
int CImageInfo::exec(CMenuTarget* parent, const std::string &) { int res = menu_return::RETURN_REPAINT; if (parent) parent->hide(); //clean up before, because we could have a current instance with already initialized contents Clean(); //init window object, add cc-items and paint all ShowWindow(); CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); neutrino_msg_t msg; while (1) { frameBuffer->blit(); neutrino_msg_data_t data; uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS(100); g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); if(msg == CRCInput::RC_setup) { res = menu_return::RETURN_EXIT_ALL; break; } else if (msg == CRCInput::RC_red){ // init temporarly vars neutrino_locale_t info_cap , new_btn_cap; info_cap = new_btn_cap = NONEXISTANT_LOCALE; string info_txt = ""; neutrino_locale_t btn_cap = btn_red->getCaptionLocale(); //toggle caption and info contents if (btn_cap == LOCALE_BUILDINFO_MENU){ info_cap = LOCALE_BUILDINFO_MENU; for (uint i=0; i<CBuildInfo::BI_TYPE_IDS; i++){ info_txt += g_Locale->getText(b_info->getInfo(i).caption); info_txt += "\n"; info_txt += b_info->getInfo(i).info_text + "\n\n"; } new_btn_cap = LOCALE_IMAGEINFO_LICENSE; } if (btn_cap == LOCALE_IMAGEINFO_LICENSE){ info_cap = LOCALE_IMAGEINFO_LICENSE; info_txt = getLicenseText(); new_btn_cap = LOCALE_BUILDINFO_MENU; } //assign new caption and info contents cc_sub_caption->setText(info_cap, CTextBox::AUTO_WIDTH, item_font); InitInfoText(info_txt); btn_red->setCaption(new_btn_cap); //paint items cc_sub_caption->paint(false); cc_lic->paint(false); btn_red->paint(false); } else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) { g_RCInput->postMsg (msg, 0); res = menu_return::RETURN_EXIT_ALL; break; } else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_page_up)) { ScrollLic(false); } else if ((msg == CRCInput::RC_down) || (msg == CRCInput::RC_page_down)) { ScrollLic(true); } else if (msg <= CRCInput::RC_MaxRC){ break; } if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout){ CNeutrinoApp::getInstance()->handleMsg( msg, data ); } } hide(); frameBuffer->blit(); return res; }
void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) { #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE #define DEFAULT_XRES 1280 // backbuffer width #define DEFAULT_YRES 720 // backbuffer height if (!Count()) return; dbgconverter("cDvbSubtitleBitmaps::%s: start\n", __func__); CFrameBuffer* fb = CFrameBuffer::getInstance(); fb_pixel_t *b = fb->getBackBufferPointer(); // HACK. When having just switched channels we may not yet have yet // received valid authoring data. This check triggers for the most // common HD subtitle format and sets our authoring display format // accordingly. Plus, me may not get the authoring data at all, e.g. for // blu-ray playback. if (max_x == 720 && max_y == 576) switch (sub.rects[0]->w) { case 1280: min_x = min_y = 0, max_x = 1280, max_y = 720; break; case 1920: min_x = min_y = 0, max_x = 1920, max_y = 1080; break; } for (int i = 0; i < Count(); i++) { uint32_t * colors = (uint32_t *) sub.rects[i]->pict.data[1]; int width = sub.rects[i]->w; int height = sub.rects[i]->h; uint8_t *origin = sub.rects[i]->pict.data[0]; int nb_colors = sub.rects[i]->nb_colors; size_t bs = width * height; for (unsigned int j = 0; j < bs; j++) if (origin[j] < nb_colors) b[j] = colors[origin[j]]; int width_new = (width * DEFAULT_XRES) / max_x; int height_new = (height * DEFAULT_YRES) / max_y; int x_new = (sub.rects[i]->x * DEFAULT_XRES) / max_x; int y_new = (sub.rects[i]->y * DEFAULT_YRES) / max_y; dbgconverter("cDvbSubtitleBitmaps::Draw: original bitmap=%d x=%d y=%d, w=%d, h=%d col=%d\n", i, sub.rects[i]->x, sub.rects[i]->y, width, height, sub.rects[i]->nb_colors); dbgconverter("cDvbSubtitleBitmaps::Draw: scaled bitmap=%d x_new=%d y_new=%d, w_new=%d, h_new=%d\n", i, x_new, y_new, width_new, height_new); fb->blitArea(width, height, x_new, y_new, width_new, height_new); } if (Count()) fb->blit(); dbgconverter("cDvbSubtitleBitmaps::%s: done\n", __func__); #else int i; int stride = CFrameBuffer::getInstance()->getScreenWidth(true); int wd = CFrameBuffer::getInstance()->getScreenWidth(); int xstart = CFrameBuffer::getInstance()->getScreenX(); int yend = CFrameBuffer::getInstance()->getScreenY() + CFrameBuffer::getInstance()->getScreenHeight(); int ystart = CFrameBuffer::getInstance()->getScreenY(); uint32_t *sublfb = CFrameBuffer::getInstance()->getFrameBufferPointer(); dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride); double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(true)/(double) 720; double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(true)/(double) 576; xc = yc; //FIXME should we scale also to full width ? int xf = int(xc * (double) 720); for (i = 0; i < Count(); i++) { #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) uint32_t * colors = (uint32_t *) sub.rects[i]->pict.data[1]; #else uint32_t * colors = (uint32_t *) sub.rects[i]->data[1]; #endif int width = sub.rects[i]->w; int height = sub.rects[i]->h; int xoff, yoff; int nw = int(width == 1280 ? ((double) width / xc) : ((double) width * xc)); int nh = int((double) height * yc); int xdiff = (wd > xf) ? ((wd - xf) / 2) : 0; xoff = int(sub.rects[i]->x*xc + xstart + xdiff); if(sub.rects[i]->y < 576/2) { yoff = int(ystart + sub.rects[i]->y*yc); } else { yoff = int(yend - ((width == 1280 ? 704:576) - (double) (sub.rects[i]->y + height))*yc - nh); if(yoff < ystart) yoff = ystart; } dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1, sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh); #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->pict.data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh); #else fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh); #endif fb_pixel_t * ptr = newdata; for (int y2 = 0; y2 < nh; y2++) { int y = (yoff + y2) * stride; for (int x2 = 0; x2 < nw; x2++) *(sublfb + xoff + x2 + y) = *ptr++; } free(newdata); if(min_x > xoff) min_x = xoff; if(min_y > yoff) min_y = yoff; if(max_x < (xoff + nw)) max_x = xoff + nw; if(max_y < (yoff + nh)) max_y = yoff + nh; } if(Count()) dbgconverter("cDvbSubtitleBitmaps::Draw: finish, min/max screen: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y); dbgconverter("\n"); #endif }