Ticket #4115: 4115-fixes-v1.patch
File 4115-fixes-v1.patch, 6.9 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/tv_play.cpp
53 53 const int TV::kInputModeTimeout=5000; 54 54 55 55 #define DEBUG_CHANNEL_PREFIX 0 /**< set to 1 to channel prefixing */ 56 #define DEBUG_ACTIONS 0/**< set to 1 to debug actions */56 #define DEBUG_ACTIONS 1 /**< set to 1 to debug actions */ 57 57 #define LOC QString("TV: ") 58 #define LOC_WARN QString("TV Warning: ") 58 59 #define LOC_ERR QString("TV Error: ") 59 60 60 61 void TV::InitKeys(void) … … 1480 1481 void TV::RunTV(void) 1481 1482 { 1482 1483 paused = false; 1483 QKeyEvent *keypressed;1484 QString netCmd;1485 1484 1486 1485 doing_ff_rew = 0; 1487 1486 ff_rew_index = kInitFFRWSpeed; … … 1570 1569 getRecorderPlaybackInfo = false; 1571 1570 } 1572 1571 1573 if (nvp && (keyList.count() > 0)) 1574 { 1572 bool had_key = false; 1573 if (nvp) 1574 { 1575 QKeyEvent *keypressed = NULL; 1576 1575 1577 keyListLock.lock(); 1576 keypressed = keyList.first(); 1577 keyList.removeFirst(); 1578 if (keyList.count() > 0) 1579 { 1580 keypressed = keyList.first(); 1581 keyList.removeFirst(); 1582 } 1578 1583 keyListLock.unlock(); 1579 1584 1580 ProcessKeypress(keypressed); 1581 delete keypressed; 1585 if (keypressed) 1586 { 1587 had_key = true; 1588 ProcessKeypress(keypressed); 1589 delete keypressed; 1590 } 1582 1591 } 1583 1592 1584 netCmd = ""; 1585 ncLock.lock(); 1586 if (networkControlCommands.size()) 1593 if (nvp && !had_key && !ignoreKeys) 1587 1594 { 1588 netCmd = networkControlCommands.front(); 1589 networkControlCommands.pop_front(); 1595 QString netCmd = QString::null; 1596 ncLock.lock(); 1597 if (networkControlCommands.size()) 1598 { 1599 netCmd = networkControlCommands.front(); 1600 networkControlCommands.pop_front(); 1601 } 1602 ncLock.unlock(); 1603 1604 if (!netCmd.isEmpty()) 1605 processNetworkControlCommand(netCmd); 1590 1606 } 1591 ncLock.unlock();1592 1607 1593 if (netCmd != "")1594 processNetworkControlCommand(netCmd);1595 1596 1608 if ((recorder && recorder->GetErrorStatus()) || 1597 1609 (nvp && nvp->IsErrored()) || IsErrored()) 1598 1610 { … … 2767 2779 2768 2780 void TV::processNetworkControlCommand(QString command) 2769 2781 { 2782 #ifdef DEBUG_ACTIONS 2783 VERBOSE(VB_IMPORTANT, LOC + "ProcessNetworkControlCommand(" + 2784 QString("%1)").arg(command)); 2785 #endif 2786 2770 2787 QStringList tokens = QStringList::split(" ", command); 2788 if (tokens.size() < 2) 2789 { 2790 VERBOSE(VB_IMPORTANT, LOC_ERR + "Not enough tokens" 2791 "in network control command" + "\n\t\t\t" + 2792 QString("'%1'").arg(command)); 2793 return; 2794 } 2771 2795 2796 if (!dialogname.isEmpty()) 2797 { 2798 VERBOSE(VB_IMPORTANT, LOC_WARN + "Ignoring network " 2799 "control command\n\t\t\t" + 2800 QString("because dialog '%1'").arg(dialogname) + 2801 "is waiting for a response"); 2802 return; 2803 } 2804 2772 2805 if (tokens[1] != "QUERY") 2773 2806 ClearOSD(); 2774 2807 2775 2808 if (tokens.size() == 3 && tokens[1] == "CHANID") 2776 2809 { 2777 ChangeChannel(tokens[2].toUInt(), ""); 2810 queuedChanID = tokens[2].toUInt(); 2811 queuedChanNum = QString::null; 2812 CommitQueuedInput(); 2778 2813 } 2779 2814 else if (tokens.size() == 3 && tokens[1] == "CHANNEL") 2780 2815 { 2781 if (tokens[2] == "UP") 2782 ChangeChannel(CHANNEL_DIRECTION_UP); 2783 else if (tokens[2] == "DOWN") 2784 ChangeChannel(CHANNEL_DIRECTION_DOWN); 2785 else if (tokens[2].contains(QRegExp("^[-\\.\\d_#]+$"))) 2786 ChangeChannel(0, tokens[2]); 2816 uint aindx = (activenvp == nvp) ? 0 : 1; 2817 if (StateIsLiveTV(GetState()) && !pseudoLiveTVState[aindx]) 2818 { 2819 if (tokens[2] == "UP") 2820 ChangeChannel(CHANNEL_DIRECTION_UP); 2821 else if (tokens[2] == "DOWN") 2822 ChangeChannel(CHANNEL_DIRECTION_DOWN); 2823 else if (tokens[2].contains(QRegExp("^[-\\.\\d_#]+$"))) 2824 ChangeChannel(0, tokens[2]); 2825 } 2787 2826 } 2788 2827 else if (tokens.size() == 3 && tokens[1] == "SPEED") 2789 2828 { … … 2865 2904 } 2866 2905 else if (tokens[2].contains(QRegExp("^\\d+\\/\\d+x$"))) 2867 2906 { 2907 if (activerbuffer->InDVDMenuOrStillFrame()) 2908 return; 2909 2868 2910 if (paused) 2869 2911 DoPause(); 2870 2912 … … 2904 2946 } 2905 2947 else if (tokens.size() >= 3 && tokens[1] == "SEEK" && activenvp) 2906 2948 { 2949 if (activerbuffer->InDVDMenuOrStillFrame()) 2950 return; 2951 2907 2952 if (tokens[2] == "BEGINNING") 2908 2953 DoSeek(-activenvp->GetFramesPlayed(), tr("Jump to Beginning")); 2909 2954 else if (tokens[2] == "FORWARD") … … 5198 5243 if ((tokens[1] != "ANSWER") && (tokens[1] != "RESPONSE")) 5199 5244 { 5200 5245 ncLock.lock(); 5201 networkControlCommands.push_back( message);5246 networkControlCommands.push_back(QDeepCopy<QString>(message)); 5202 5247 ncLock.unlock(); 5203 5248 } 5204 5249 } -
programs/mythfrontend/networkcontrol.cpp
192 192 if (result != "") 193 193 { 194 194 nrLock.lock(); 195 networkControlReplies.push_back( result);195 networkControlReplies.push_back(QDeepCopy<QString>(result)); 196 196 nrLock.unlock(); 197 197 198 198 notifyDataAvailable(); … … 227 227 client = s; 228 228 cs = os; 229 229 230 ncLock.lock(); 230 231 networkControlCommands.clear(); 232 ncLock.unlock(); 233 234 nrLock.lock(); 231 235 networkControlReplies.clear(); 236 nrLock.unlock(); 232 237 233 238 welcomeStr = "MythFrontend Network Control\r\n"; 234 239 if (closedOldConn) … … 263 268 lineIn.replace(QRegExp("[\r\n]"), ""); 264 269 lineIn.replace(QRegExp("^\\s"), ""); 265 270 271 if (lineIn.isEmpty()) 272 continue; 273 266 274 tokens = QStringList::split(" ", lineIn); 267 if (tokens [0].lower() != "key")275 if (tokens.size() && (tokens[0].lower() != "key")) 268 276 lineIn = lineIn.lower(); 269 277 270 278 ncLock.lock(); 271 networkControlCommands.push_back( lineIn);279 networkControlCommands.push_back(QDeepCopy<QString>(lineIn)); 272 280 ncLock.unlock(); 273 281 } 274 282 } … … 723 731 for (unsigned int i = 3; i < tokens.size(); i++) 724 732 response += QString(" ") + tokens[i]; 725 733 nrLock.lock(); 726 networkControlReplies.push_back( response);734 networkControlReplies.push_back(QDeepCopy<QString>(response)); 727 735 nrLock.unlock(); 728 736 729 737 notifyDataAvailable();