Ticket #1122: 1122-fix-v3.patch
File 1122-fix-v3.patch, 7.6 KB (added by , 20 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
367 367 368 368 bool NuppelVideoPlayer::InitVideo(void) 369 369 { 370 VERBOSE(VB_RECORD, "InitVideo()"); 370 371 InitFilters(); 371 372 if (using_null_videoout) 372 373 { … … 447 448 448 449 void NuppelVideoPlayer::ReinitVideo(void) 449 450 { 451 VERBOSE(VB_RECORD, "ReinitVideo()"); 450 452 InitFilters(); 451 453 452 454 vidExitLock.lock(); -
libs/libmythtv/videoout_xv.cpp
27 27 #include "XvMCSurfaceTypes.h" 28 28 #include "util-x11.h" 29 29 #include "config.h" 30 #include "exitcodes.h" 30 31 31 32 #define LOC QString("VideoOutputXv: ") 32 33 #define LOC_ERR QString("VideoOutputXv Error: ") … … 48 49 #define round(x) ((int) ((x) + 0.5)) 49 50 #endif 50 51 52 class port_info { public: Display *disp; int port; }; 53 static QMap<int,port_info> open_xv_ports; 51 54 55 static void close_all_xv_ports_signal_handler(int sig) 56 { 57 cerr<<"Signal: "<<sys_siglist[sig]<<endl; 58 QMap<int,port_info>::iterator it; 59 for (it = open_xv_ports.begin(); it != open_xv_ports.end(); ++it) 60 { 61 cerr<<"Ungrabbing XVideo port: "<<(*it).port<<endl; 62 XvUngrabPort((*it).disp, (*it).port, CurrentTime); 63 } 64 exit(GENERIC_EXIT_NOT_OK); 65 } 66 static void add_open_xv_port(Display *disp, int port) 67 { 68 if (port >= 0) 69 { 70 open_xv_ports[port].disp = disp; 71 open_xv_ports[port].port = port; 72 //signal(SIGSTOP, close_all_xv_ports_signal_handler); 73 //signal(SIGABRT, close_all_xv_ports_signal_handler); 74 signal(SIGINT, close_all_xv_ports_signal_handler); 75 } 76 } 77 static void del_open_xv_port(int port) 78 { 79 if (port >= 0) 80 { 81 open_xv_ports.remove(port); 82 83 if (!open_xv_ports.count()) 84 { 85 //signal(SIGSTOP, SIG_DFL); 86 //signal(SIGABRT, SIG_DFL); 87 signal(SIGHUP, SIG_DFL); 88 } 89 } 90 } 91 static bool has_open_xv_port(int port) 92 { 93 return open_xv_ports.find(port) != open_xv_ports.end(); 94 } 95 static uint cnt_open_xv_port(void) 96 { 97 return open_xv_ports.count(); 98 } 99 52 100 //#define DEBUG_PAUSE /* enable to debug XvMC pause frame */ 53 101 54 102 #ifdef USING_XVMC … … 245 293 // ungrab port... 246 294 if (xv_port >= 0) 247 295 { 248 X11S(XvUngrabPort(XJ_disp, xv_port, CurrentTime)); 296 VERBOSE(VB_PLAYBACK, LOC + "Closing XVideo port " << xv_port); 297 X11L; 298 XvUngrabPort(XJ_disp, xv_port, CurrentTime); 299 del_open_xv_port(xv_port); 300 X11U; 249 301 xv_port = -1; 250 302 } 251 303 … … 631 683 if (!surf.size()) 632 684 continue; 633 685 634 X11S(ret = XvGrabPort(disp, p, CurrentTime)); 686 X11L; 687 ret = XvGrabPort(disp, p, CurrentTime); 688 if (Success == ret) 689 { 690 VERBOSE(VB_PLAYBACK, "Grabbed xv port "<<p); 691 port = p; 692 add_open_xv_port(disp, p); 693 } 694 X11U; 635 695 if (Success != ret) 696 { 697 VERBOSE(VB_PLAYBACK, "Failed to grab xv port "<<p); 636 698 continue; 699 } 637 700 638 701 if (xvmc_surf_info) 639 702 surf.set(surfNum, xvmc_surf_info); 640 port = p;641 703 #endif // USING_XVMC 642 704 } 643 705 else 644 706 { 645 707 for (p = firstPort; (p <= lastPort) && (port == -1); ++p) 646 708 { 647 X11S(ret = XvGrabPort(disp, p, CurrentTime)); 709 X11L; 710 ret = XvGrabPort(disp, p, CurrentTime); 648 711 if (Success == ret) 712 { 713 VERBOSE(VB_PLAYBACK, "Grabbed xv port "<<p); 649 714 port = p; 715 add_open_xv_port(disp, p); 716 } 717 X11U; 650 718 } 651 719 } 652 720 } … … 785 853 */ 786 854 bool VideoOutputXv::InitXvMC(MythCodecID mcodecid) 787 855 { 856 VERBOSE(VB_IMPORTANT, "InitXvMC() -- begin"); 788 857 (void)mcodecid; 789 858 #ifdef USING_XVMC 790 859 xv_port = GrabSuitableXvPort(XJ_disp, XJ_root, mcodecid, … … 826 895 delete xvmc_osd_available[i]; 827 896 xvmc_osd_available.clear(); 828 897 xvmc_osd_lock.unlock(); 829 X11S(XvUngrabPort(XJ_disp, xv_port, CurrentTime)); 898 VERBOSE(VB_PLAYBACK, LOC + "Closing XVideo port " << xv_port); 899 X11L; 900 XvUngrabPort(XJ_disp, xv_port, CurrentTime); 901 del_open_xv_port(xv_port); 902 X11U; 830 903 xv_port = -1; 831 904 } 832 905 906 VERBOSE(VB_IMPORTANT, "InitXvMC() -- end ok("<<ok<<")"); 833 907 return ok; 834 908 #else // USING_XVMC 835 909 return false; … … 846 920 */ 847 921 bool VideoOutputXv::InitXVideo() 848 922 { 923 VERBOSE(VB_IMPORTANT, "InitXVideo() -- begin"); 849 924 xv_port = GrabSuitableXvPort(XJ_disp, XJ_root, kCodec_MPEG2, 850 925 XJ_width, XJ_height); 851 926 if (xv_port == -1) … … 903 978 { 904 979 VERBOSE(VB_IMPORTANT, LOC_ERR + 905 980 "Couldn't find the proper XVideo image format."); 906 X11S(XvUngrabPort(XJ_disp, xv_port, CurrentTime)); 981 VERBOSE(VB_PLAYBACK, LOC + "Closing XVideo port " << xv_port); 982 X11L; 983 XvUngrabPort(XJ_disp, xv_port, CurrentTime); 984 del_open_xv_port(xv_port); 985 X11U; 907 986 xv_port = -1; 908 987 } 909 988 … … 916 995 { 917 996 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to create XVideo Buffers."); 918 997 DeleteBuffers(XVideo, false); 919 X11S(XvUngrabPort(XJ_disp, xv_port, CurrentTime)); 998 VERBOSE(VB_PLAYBACK, LOC + "Closing XVideo port " << xv_port); 999 X11L; 1000 XvUngrabPort(XJ_disp, xv_port, CurrentTime); 1001 del_open_xv_port(xv_port); 1002 X11U; 920 1003 xv_port = -1; 921 1004 ok = false; 922 1005 } 923 1006 else 924 1007 video_output_subtype = XVideo; 925 1008 1009 VERBOSE(VB_IMPORTANT, "InitXVideo() -- end ok("<<ok<<")"); 926 1010 return ok; 927 1011 } 928 1012 … … 1003 1087 (void)stream_type, (void)xvmc_chroma, (void)test_surface; 1004 1088 1005 1089 #ifdef USING_XVMC 1090 VERBOSE(VB_IMPORTANT, "GetBestSupportedCodec() -- begin"); 1006 1091 Display *disp; 1007 1092 X11S(disp = XOpenDisplay(NULL)); 1008 1093 … … 1056 1141 width, height); 1057 1142 ok = NULL != ctx; 1058 1143 DeleteXvMCContext(disp, ctx); 1059 X11S(XvUngrabPort(disp, port, CurrentTime)); 1144 VERBOSE(VB_PLAYBACK, LOC + "Closing XVideo port " << port); 1145 X11L; 1146 XvUngrabPort(disp, port, CurrentTime); 1147 del_open_xv_port(port); 1148 X11U; 1060 1149 } 1061 1150 } 1062 1151 X11S(XCloseDisplay(disp)); 1152 X11S(ok |= cnt_open_xv_port() > 0); // also ok if we already opened port.. 1063 1153 1064 1154 if (!ok) 1065 1155 { … … 1078 1168 ret = (MythCodecID)(kCodec_MPEG1 + (stream_type-1)); 1079 1169 } 1080 1170 1171 VERBOSE(VB_IMPORTANT, "GetBestSupportedCodec() -- end"); 1081 1172 return ret; 1082 1173 #else // if !USING_XVMC 1083 1174 return (MythCodecID)(kCodec_MPEG1 + (stream_type-1)); … … 1182 1273 DeleteBuffers(VideoOutputSubType(), true); 1183 1274 if (xv_port >= 0) 1184 1275 { 1185 X11S(XvUngrabPort(XJ_disp, xv_port, CurrentTime)); 1276 VERBOSE(VB_PLAYBACK, LOC + "Closing XVideo port " << xv_port); 1277 X11L; 1278 XvUngrabPort(XJ_disp, xv_port, CurrentTime); 1279 del_open_xv_port(xv_port); 1280 X11U; 1186 1281 xv_port = -1; 1187 1282 } 1188 1283 #endif // USING_XVMC