Ticket #5956: 5956-v1.patch
File 5956-v1.patch, 4.7 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/videoout_xv.cpp
86 86 87 87 #define NUM_VDPAU_BUFFERS 17 88 88 89 static QStringList allowed_video_renderers( MythCodecID codec_id,90 Display *XJ_disp);89 static QStringList allowed_video_renderers( 90 MythCodecID codec_id, Display *display, Screen *screen, Window curwin); 91 91 92 92 static void SetFromEnv(bool &useXvVLD, bool &useXvIDCT, bool &useXvMC, 93 93 bool &useXV, bool &useShm, bool &useOpenGL, 94 94 bool &useVDPAU); 95 static void SetFromHW(Display *d, bool &useXvMC, bool &useXV, 95 static void SetFromHW(Display *d, Screen *screen, Window curwin, 96 bool &useXvMC, bool &useXV, 96 97 bool &useShm, bool &useXvMCOpenGL, 97 98 bool &useOpenGL, bool &useVDPAU, 98 99 MythCodecID myth_codec_id); … … 1556 1557 if ((dec == "libmpeg2") || (dec == "ffmpeg")) 1557 1558 return (MythCodecID)(kCodec_MPEG1 + (stream_type-1)); 1558 1559 1559 Display *disp = MythXOpenDisplay();1560 1561 1560 // Disable features based on environment and DB values. 1562 1561 bool use_xvmc_vld = false, use_xvmc_idct = false, use_xvmc = false; 1563 1562 bool use_xv = true, use_shm = true, use_opengl = true; … … 1575 1574 1576 1575 // Disable features based on hardware capabilities. 1577 1576 bool use_xvmc_opengl = use_xvmc; 1578 SetFromHW(disp, use_xvmc, use_xv, use_shm, 1577 Display *disp = MythXOpenDisplay(); 1578 X11L; 1579 Screen *screen = DefaultScreenOfDisplay(disp); 1580 Window root = DefaultRootWindow(disp); 1581 X11U; 1582 SetFromHW(disp, screen, root, use_xvmc, use_xv, use_shm, 1579 1583 use_xvmc_opengl, use_opengl, use_vdpau, 1580 (MythCodecID)(kCodec_MPEG1_VDPAU + (stream_type-1)));1584 (MythCodecID)(kCodec_MPEG1_VDPAU + (stream_type-1))); 1581 1585 1582 1586 MythCodecID ret = (MythCodecID)(kCodec_MPEG1 + (stream_type-1)); 1583 1587 #ifdef USING_XVMC … … 1603 1607 bool ok = true; 1604 1608 if (test_surface && ret > kCodec_NORMAL_END) 1605 1609 { 1606 Window root;1607 1610 XvMCSurfaceInfo info; 1608 1611 1609 1612 ok = false; 1610 X11S(root = DefaultRootWindow(disp));1611 1613 int port = GrabSuitableXvPort(disp, root, ret, width, height, 1612 1614 xvmc_chroma, &info); 1613 1615 if (port >= 0) … … 1799 1801 { 1800 1802 // Figure out what video renderer to use 1801 1803 db_vdisp_profile->SetInput(windows[0].GetVideoDim()); 1802 QStringList renderers = allowed_video_renderers(myth_codec_id, XJ_disp); 1804 QStringList renderers = allowed_video_renderers( 1805 myth_codec_id, XJ_disp, XJ_screen, XJ_curwin); 1803 1806 QString renderer = QString::null; 1804 1807 1805 1808 QString tmp = db_vdisp_profile->GetVideoRenderer(); … … 4953 4956 if (!disp) 4954 4957 return list; 4955 4958 4956 list = allowed_video_renderers(myth_codec_id, disp); 4959 X11L; 4960 Screen *screen = DefaultScreenOfDisplay(disp); 4961 Window window = DefaultRootWindow(disp); 4962 X11U; 4957 4963 4964 list = allowed_video_renderers(myth_codec_id, disp, screen, window); 4965 4958 4966 XCloseDisplay(disp); 4959 4967 4960 4968 return list; … … 4982 4990 } 4983 4991 4984 4992 static void SetFromHW(Display *d, 4985 bool &useXvMC, bool &useXVideo, 4986 bool &useShm, bool &useXvMCOpenGL, 4987 bool &useOpenGL, bool &useVDPAU, 4993 Screen *screen, Window curwin, 4994 bool &useXvMC, bool &useXVideo, 4995 bool &useShm, bool &useXvMCOpenGL, 4996 bool &useOpenGL, bool &useVDPAU, 4988 4997 MythCodecID vdpau_codec_id) 4989 4998 { 4990 4999 (void) vdpau_codec_id; … … 5056 5065 useVDPAU = false; 5057 5066 #ifdef USING_VDPAU 5058 5067 useVDPAU = VDPAUContext::CheckCodecSupported(vdpau_codec_id); 5068 if (useVDPAU) 5069 { 5070 VDPAUContext *c = new VDPAUContext(); 5071 useVDPAU = c->Init(d, screen, curwin, QSize(1920,1200), false); 5072 c->Deinit(); 5073 delete c; 5074 } 5059 5075 #endif // USING_VDPAU 5060 5076 } 5061 5077 } 5062 5078 5063 static QStringList allowed_video_renderers( MythCodecID myth_codec_id,5064 Display *XJ_disp)5079 static QStringList allowed_video_renderers( 5080 MythCodecID myth_codec_id, Display *display, Screen *screen, Window curwin) 5065 5081 { 5066 5082 bool vld, idct, mc, xv, shm, xvmc_opengl, opengl, vdpau; 5067 5083 … … 5071 5087 xvmc_opengl = vld || idct || mc; 5072 5088 5073 5089 SetFromEnv(vld, idct, mc, xv, shm, opengl, vdpau); 5074 SetFromHW( XJ_disp, mc, xv, shm, xvmc_opengl,5090 SetFromHW(display, screen, curwin, mc, xv, shm, xvmc_opengl, 5075 5091 opengl, vdpau, myth_codec_id); 5076 5092 idct &= mc; 5077 5093