Ticket #843: pipplayer.8.diff
File pipplayer.8.diff, 15.8 KB (added by , 19 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
502 502 503 503 PIPType piptype = kPIPOff; 504 504 505 if (ispip) 506 { 507 if (m_tv) 508 { 509 VideoOutput *vid = m_tv->GetVideoOutput(); 510 if (vid && !vid->IsResolutionSupported(video_width, video_height)) 511 return false; 512 if (livetv) 513 piptype = kPIPOnLiveTV; 514 else 515 piptype = kPIPOnTV; 516 } 517 else 518 piptype = kPIPOn; 519 } 520 505 521 if (using_null_videoout) 506 522 { 507 523 videoOutput = new VideoOutputNull(); 508 524 if (ispip) 509 {510 if (m_tv)511 {512 if (livetv)513 piptype = kPIPOnLiveTV;514 else515 piptype = kPIPOnTV;516 }517 else518 piptype = kPIPOn;519 520 525 videoOutput->SetAsPIP(piptype); 521 }522 523 526 524 527 if (!videoOutput->Init(video_width, video_height, video_aspect, 525 528 0, 0, 0, 0, 0, 0)) … … 565 568 } 566 569 567 570 if (ispip) 571 videoOutput->SetAsPIP(piptype); 572 573 int xpos = 0; 574 int ypos = 0; 575 int widgetID = widget->winId(); 576 if (piptype >= kPIPOnTV && !softwareScalingPIP) 568 577 { 578 xpos = widget->x(); 579 ypos = widget->y(); 569 580 if (m_tv) 570 piptype = kPIPOnTV; 571 else 572 piptype = kPIPOn; 573 574 videoOutput->SetAsPIP(piptype); 581 widgetID = m_tv->GetWidgetID(); 575 582 } 576 583 577 584 if (!videoOutput->Init(video_width, video_height, video_aspect, 578 widget ->winId(), 0, 0, widget->width(),585 widgetID, xpos, ypos, widget->width(), 579 586 widget->height(), 0)) 580 587 { 581 588 errored = true; -
libs/libmythtv/tv_play.h
34 34 class OSDGenericTree; 35 35 class LiveTVChain; 36 36 class PIPPlayer; 37 class VideoOutput; 37 38 38 39 typedef QValueVector<QString> str_vec_t; 39 40 typedef QMap<QString,QString> InfoMap; … … 172 173 173 174 // Non-const queries 174 175 OSD *GetOSD(void); 176 int GetWidgetID(void); 177 VideoOutput *GetVideoOutput(void); 175 178 176 179 void SetCurrentlyPlaying(ProgramInfo *pginfo); 177 180 -
libs/libmythtv/pipplayer.h
18 18 class PIPPlayer 19 19 { 20 20 public: 21 PIPPlayer( void);21 PIPPlayer(const QRect &rect, int location = -1); 22 22 ~PIPPlayer(void); 23 static PIPPlayer *Create(const QRect &rect);24 static PIPPlayer * Create(NuppelVideoPlayer *parentnvp, int location);25 23 bool StartPlaying(ProgramInfo *rec = NULL, 26 24 bool piptype = false, 27 25 bool nullvideo = false, … … 45 43 void Show(void); 46 44 bool UsingNullVideo(void) { return using_nullvideo; } 47 45 void GetARGBFrame(void); 48 QSize GetVideoDimensions(void)49 { return QSize(video_width, video_height); }50 46 bool IsPaused(void) { return paused; } 51 47 void Pause(void); 52 48 void Play(float speed = 1.0); … … 55 51 private: 56 52 bool StartRecorder(RemoteEncoder *rec, int maxWait); 57 53 void Reinitialize(void); 58 void Init(QRect rect, QString name);59 54 60 55 private: 61 56 RemoteEncoder *piprecorder; … … 69 64 bool islivetv; 70 65 bool reinit; 71 66 bool using_nullvideo; 72 int video_width;73 int video_height;74 67 bool paused; 75 68 }; 76 69 -
libs/libmythtv/tv_play.cpp
3157 3157 3158 3158 void TV::TogglePIPView(void) 3159 3159 { 3160 if (!pipplayer )3160 if (!pipplayer && nvp) 3161 3161 { 3162 3162 int pip_location = gContext->GetNumSetting("PIPLocation", 0); 3163 QRect rect = activenvp->getVideoOutput()->GetPIPRect(pip_location, NULL); 3164 pipplayer = PIPPlayer::Create(rect); 3165 if (!pipplayer) 3166 return; 3163 QRect rect = nvp->getVideoOutput()->GetPIPRect(pip_location, NULL); 3164 pipplayer = new PIPPlayer(rect, pip_location); 3167 3165 pipplayer->StartPlaying(NULL, true, false, this); 3168 3166 if (pipplayer->IsPlaying()) 3169 3167 { … … 3173 3171 } 3174 3172 else 3175 3173 { 3176 QSize pipdim = pipplayer->GetVideoDimensions();3177 VideoOutput *vid = nvp->getVideoOutput();3178 if (vid &&3179 vid->IsResolutionSupported(pipdim.width(), pipdim.height()))3174 if (pipplayer->GetNVP() && 3175 pipplayer->GetNVP()->PIPSoftwareScaling() && 3176 nvp->getVideoOutput() && 3177 nvp->getVideoOutput()->hasXVAcceleration()) 3180 3178 { 3181 if (pipplayer->GetNVP() && 3182 pipplayer->GetNVP()->PIPSoftwareScaling() && 3183 nvp->getVideoOutput() && 3184 nvp->getVideoOutput()->hasXVAcceleration()) 3179 VERBOSE(VB_PLAYBACK, LOC + "Attempting to start Software Scaled PIP"); 3180 pipplayer->StartPlaying(NULL, true, true, this); 3181 if (pipplayer->IsPlaying()) 3185 3182 { 3186 pipplayer->StartPlaying(NULL, true, true, this); 3187 if (pipplayer->IsPlaying()) 3188 { 3189 pipplayer->Hide(); 3190 activenvp->SetPIPPlayer(pipplayer->GetNVP()); 3191 pipplayerCond.wait(); 3192 pipplayer->GetNVP()->DiscardVideoFrames(true); 3193 return; 3194 } 3183 pipplayer->Hide(); 3184 nvp->SetPIPPlayer(pipplayer->GetNVP()); 3185 pipplayerCond.wait(); 3186 pipplayer->GetNVP()->DiscardVideoFrames(true); 3187 return; 3195 3188 } 3196 3189 } 3197 3190 } … … 5905 5898 return NULL; 5906 5899 } 5907 5900 5901 VideoOutput *TV::GetVideoOutput(void) 5902 { 5903 if (nvp) 5904 return nvp->getVideoOutput(); 5905 return NULL; 5906 } 5907 5908 5908 void TV::TreeMenuEntered(OSDListTreeType *tree, OSDGenericTree *item) 5909 5909 { 5910 5910 // show help text somewhere, perhaps? … … 7535 7535 return true; 7536 7536 } 7537 7537 7538 int TV::GetWidgetID(void) 7539 { 7540 if (myWindow) 7541 return myWindow->winId(); 7542 return -1; 7543 } 7538 7544 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
libs/libmythtv/videooutbase.cpp
248 248 .arg(db_move.x()).arg(db_move.y())); 249 249 } 250 250 251 display_visible_rect = QRect( 0, 0, winw, winh);251 display_visible_rect = QRect(winx, winy, winw, winh); 252 252 video_dim = QSize(width, height); 253 253 video_rect = QRect(QPoint(winx, winy), fix_1080i(video_dim)); 254 254 -
libs/libmythtv/pipplayer.cpp
13 13 return NULL; 14 14 } 15 15 16 PIPPlayer::PIPPlayer( void)16 PIPPlayer::PIPPlayer(const QRect &rect, int location) 17 17 : piprecorder(NULL), piprbuffer(NULL), 18 18 piptvchain(NULL), piprecinfo(NULL), 19 19 pipnvp(NULL), pipWindow(NULL), 20 20 islivetv(false), 21 21 reinit(true), using_nullvideo(false), 22 video_width(0), video_height(0),23 22 paused(false) 24 23 { 24 QString name; 25 if (location > -1) 26 name = QString("pip player %1").arg((int)location); 27 else 28 name = "pip player"; 29 30 QRect piprect = QRect(rect); 31 MythMainWindow *mainWindow = gContext->GetMainWindow(); 32 QWidget *parentWidget = mainWindow->currentWidget(); 33 MythDialog *window = new MythDialog(gContext->GetMainWindow(), name); 34 window->setNoErase(); 35 window->setGeometry(piprect); 36 window->setFixedSize(piprect.size()); 37 window->show(); 38 mainWindow->detach(window); 39 pipWindow = window; 40 if (parentWidget && location > -1) 41 pipWindow->stackUnder(parentWidget); 25 42 }; 26 43 27 44 PIPPlayer::~PIPPlayer(void) … … 31 48 pipWindow->deleteLater(); 32 49 }; 33 50 34 PIPPlayer * PIPPlayer::Create(NuppelVideoPlayer *parentnvp, int location)35 {36 PIPPlayer *tmppip = new PIPPlayer();37 if (parentnvp)38 {39 QRect rect = parentnvp->getVideoOutput()->GetPIPRect(location, NULL);40 tmppip->Init(rect, QString("pip player %1").arg((int)location));41 return tmppip;42 }43 delete tmppip;44 return NULL;45 }46 47 PIPPlayer * PIPPlayer::Create(const QRect &rect)48 {49 PIPPlayer *tmppip = new PIPPlayer();50 tmppip->Init(rect, "pip player");51 return tmppip;52 }53 54 void PIPPlayer::Init(QRect rect, QString name)55 {56 QRect piprect = QRect(rect);57 MythDialog *window = new MythDialog(gContext->GetMainWindow(), name);58 window->setNoErase();59 window->setGeometry(piprect);60 window->setFixedSize(piprect.size());61 window->show();62 window->setBackgroundColor(Qt::black);63 gContext->GetMainWindow()->detach(window);64 pipWindow = window;65 }66 67 51 void PIPPlayer::Reinitialize(void) 68 52 { 69 53 if (pipnvp) … … 213 197 usleep(5000); 214 198 } 215 199 216 video_width = pipnvp->GetVideoWidth();217 video_height = pipnvp->GetVideoHeight();218 219 200 if (!pipnvp->IsPlaying()) 220 201 { 221 202 VERBOSE(VB_PLAYBACK, LOC_ERR + "PIP NVP Failed to Start"); -
libs/libmythtv/videoout_xv.h
229 229 230 230 // Chromakey OSD info 231 231 ChromaKeyOSD *chroma_osd; 232 233 //PIP Stuff 234 /// \brief disable X11 setforeground on PIP when ChromakeyOSD is showing. 235 static bool pip_disable_setForeground; 232 236 }; 233 237 234 238 CodecID myth2av_codecid(MythCodecID codec_id, -
libs/libmythtv/videoout_xv.cpp
85 85 "unknown", "xlib", "xshm", "xv-blit", "xvmc", "xvmc", "xvmc", 86 86 }; 87 87 88 bool VideoOutputXv::pip_disable_setForeground = false; 89 88 90 /** \class VideoOutputXv 89 91 * \brief Supports common video output methods used with %X11 Servers. 90 92 * … … 176 178 177 179 if (xvmc_tex) 178 180 delete xvmc_tex; 181 182 if (piptype == kPIPOff) 183 pip_disable_setForeground = false; 179 184 } 180 185 181 186 // this is documented in videooutbase.cpp … … 730 735 if (!done && use_xv) 731 736 done = InitXVideo(); 732 737 738 if (!done && piptype > kPIPOff) 739 return done; 740 733 741 // Fall back to shared memory, if we are allowed to use it 734 742 if (!done && use_shm) 735 743 done = InitXShm(); … … 1098 1106 1099 1107 return ret; 1100 1108 #else // if !USING_XVMC 1109 (void)ispip; 1101 1110 return (MythCodecID)(kCodec_MPEG1 + (stream_type-1)); 1102 1111 #endif // !USING_XVMC 1103 1112 } … … 2575 2584 if (chroma_osd && chroma_osd->GetImage() && xv_need_bobdeint_repaint) 2576 2585 { 2577 2586 X11L; 2587 if (piptype == kPIPOff) 2588 pip_disable_setForeground = true; 2578 2589 XShmPutImage(XJ_disp, XJ_curwin, XJ_gc, chroma_osd->GetImage(), 2579 2590 0, 0, 0, 0, 2580 2591 display_visible_rect.width(), … … 2590 2601 2591 2602 X11L; 2592 2603 2604 if (piptype == kPIPOff) 2605 pip_disable_setForeground = false; 2606 else if (pip_disable_setForeground && piptype >= kPIPOnTV) 2607 { 2608 needrepaint = false; 2609 return; 2610 } 2611 2593 2612 if (xv_draw_colorkey && needrepaint) 2594 2613 { 2595 2614 XSetForeground(XJ_disp, XJ_gc, xv_colorkey); … … 3298 3317 if (width == 0 || height == 0) 3299 3318 return false; 3300 3319 3320 if (!xv_chroma) 3321 { 3322 int ids[] = { GUID_I420_PLANAR, GUID_IYUV_PLANAR, GUID_YV12_PLANAR }; 3323 int format_cnt = 0; 3324 XvImageFormatValues *formats; 3325 X11S(formats = XvListImageFormats(XJ_disp, xv_port, &format_cnt)); 3326 3327 for (int i = 0; i < format_cnt; i++) 3328 { 3329 char *chr = (char*) &(formats[i].id); 3330 VERBOSE(VB_PLAYBACK, LOC + QString("IsResolutionSupported() PIP XVideo Format #%1 is '%2%3%4%5'") 3331 .arg(i).arg(chr[0]).arg(chr[1]).arg(chr[2]).arg(chr[3])); 3332 } 3333 3334 #ifdef USE_HACK_FOR_BROKEN_I420_SUPPORT_IN_DRIVER 3335 swap(ids[0], ids[2]); 3336 #endif // USE_HACK_FOR_BROKEN_I420_SUPPORT_IN_DRIVER 3337 3338 for (uint i = 0; i < sizeof(ids)/sizeof(int); i++) 3339 { 3340 if (has_format(formats, format_cnt, ids[i])) 3341 { 3342 xv_chroma = ids[i]; 3343 break; 3344 } 3345 } 3346 3347 // IYUV is bit identical to I420, just pretend we saw I420 3348 xv_chroma = (GUID_IYUV_PLANAR == xv_chroma) ? GUID_I420_PLANAR : xv_chroma; 3349 if (formats) 3350 X11S(XFree(formats)); 3351 } 3352 3301 3353 if (xv_port >= 0 && xv_chroma) 3302 3354 { 3303 3355 int size = 0; … … 3317 3369 delete info; 3318 3370 return false; 3319 3371 } 3320 3321 3372 return true; 3322 3373 } 3374 3375 VERBOSE(VB_IMPORTANT, LOC_ERR + "IsResolutionSupported(): No free XV Ports or XV Chroma"); 3323 3376 return false; 3324 3377 } 3325 3378 -
programs/mythfrontend/playbackbox.cpp
521 521 522 522 if (previewVideoEnabled) 523 523 { 524 previewPlayer = PIPPlayer::Create(drawVideoBounds);524 previewPlayer = new PIPPlayer(drawVideoBounds); 525 525 if (previewPlayer) 526 526 previewPlayer->Hide(); 527 527 previewPixmapEnabled = true; … … 2162 2162 2163 2163 if (previewVideoEnabled && !previewPlayer) 2164 2164 { 2165 previewPlayer = PIPPlayer::Create(drawVideoBounds);2165 previewPlayer = new PIPPlayer(drawVideoBounds); 2166 2166 if (previewPlayer) 2167 2167 previewPlayer->Hide(); 2168 2168 } -
programs/mythfrontend/globalsettings.cpp
1779 1779 1780 1780 static HostCheckBox *EndOfRecordingExitPrompt() 1781 1781 { 1782 HostCheckBox *gc = new HostCheckBox("End OfRecordingExitPrompt");1782 HostCheckBox *gc = new HostCheckBox("EndofRecordingExitPrompt"); 1783 1783 gc->setLabel(QObject::tr("Prompt at end of recording")); 1784 1784 gc->setValue(false); 1785 1785 gc->setHelpText(QObject::tr("If set, a menu will be displayed allowing " … … 1849 1849 return gc; 1850 1850 } 1851 1851 1852 static HostCheckBox *PlaybackPreviewLowCPU()1853 {1854 HostCheckBox *gc = new HostCheckBox("PlaybackPreviewLowCPU");1855 gc->setLabel(QObject::tr("CPU friendly preview of recordings"));1856 gc->setValue(false);1857 gc->setHelpText(QObject::tr("When enabled, recording previews "1858 "will play with reduced FPS to save CPU."));1859 return gc;1860 }1861 1862 1852 static HostCheckBox *PlayBoxTransparency() 1863 1853 { 1864 1854 HostCheckBox *gc = new HostCheckBox("PlayBoxTransparency"); … … 4160 4150 general->addChild(oscan); 4161 4151 general->addChild(columns2); 4162 4152 general->addChild(PlaybackExitPrompt()); 4153 general->addChild(EndOfRecordingExitPrompt()); 4163 4154 addChild(general); 4164 4155 4165 4156 QString tmp = QString(" (%1/%2)").arg(++i).arg(total);