From patchwork Wed Dec 1 15:44:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Matti_Lehtim=C3=A4ki?= X-Patchwork-Id: 12846 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.69) (envelope-from ) id 1PNorJ-0002iS-48 for vdr@linuxtv.org; Wed, 01 Dec 2010 16:44:42 +0100 X-tubIT-Incoming-IP: 209.85.215.182 Received: from mail-ey0-f182.google.com ([209.85.215.182]) by mail.tu-berlin.de (exim-4.69/mailfrontend-c) with esmtp for id 1PNorI-0002cl-5L; Wed, 01 Dec 2010 16:44:40 +0100 Received: by eyb7 with SMTP id 7so3944373eyb.41 for ; Wed, 01 Dec 2010 07:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=2bgsrfQQct+Ik0bhsykQu/O62M6D1ryLChBFudJ7Usk=; b=Y2HAZ8aedME1DiVFeaXq/ymjWSGk5l2Oq8KiK5HFKTDu9ZMnAMwVRn7P3ngwbakUuP 5g1ZMrQZTXY033A2mzZJn55qco2iq+IEeQ+x3u3I9OuUb6YjSDY4MDgX6HeMx++19+9Z 2ZBECVcM04ALATUbblajxpt9PharCrPNvCYdU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=GwdNQ8P6h8yEHQ1erz1Q7iAJkfFWntxjoil5PShSSwkazgGk+lUJWO8XFA64ULhq5s C69VE54nCFAydXT8m7orBzi5gnfx1hXQO+sjnjb5J09jq+6ETlKfbqhdF054SvB90MAd plRM/Tb0SSlTStMznb25pvFNv29T04vIEg1U8= Received: by 10.14.119.200 with SMTP id n48mr4381208eeh.37.1291218279158; Wed, 01 Dec 2010 07:44:39 -0800 (PST) Received: from [192.168.1.100] (dsl-hkibrasgw2-fe28de00-177.dhcp.inet.fi [80.222.40.177]) by mx.google.com with ESMTPS id q58sm91693eeh.15.2010.12.01.07.44.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Dec 2010 07:44:37 -0800 (PST) Message-ID: <4CF66D63.2040600@gmail.com> Date: Wed, 01 Dec 2010 17:44:35 +0200 From: =?ISO-8859-1?Q?Matti_Lehtim=E4ki?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: VDR Mailing List X-PMX-Version: 5.5.4.371499, Antispam-Engine: 2.7.1.369594, Antispam-Data: 2010.12.1.153316 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MIME_TEXT_ONLY_MP_MIXED 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_5000_5999 0, BODY_SIZE_7000_LESS 0, WEBMAIL_SOURCE 0, __BAT_BOUNDARY 0, __CP_MEDIA_BODY 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_MIXED 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_BLIZZARD_RCVD 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __PHISH_SPEAR_STRUCTURE_1 0, __RDNS_GMAIL 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __USER_AGENT 0' X-LSpam-Score: -3.6 (---) X-LSpam-Report: No, score=-3.6 required=5.0 tests=BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1 autolearn=ham Subject: [vdr] [PATCH] Improved pause handling X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Dec 2010 15:44:42 -0000 Status: O X-Status: X-Keywords: X-UID: 23917 Hi, Sometimes when you want to pause live video you are already recording the current channel. In such case it is not practical to start a new instant recording but it would be more practical to start replaying the recording already being made, jump to correct position in the recording and then pause. So I have implemented this for VDR-1.7.16 as a patch which adds two new options to "Pause kay handling" menu item to enable this behavior with or without confirmation. Any improvements or suggestions are welcome. diff -Naur -x PLUGINS -x po vdr-1.7.16_orig/menu.c vdr-1.7.16_pause/menu.c --- vdr-1.7.16_orig/menu.c 2010-06-06 12:56:16.000000000 +0300 +++ vdr-1.7.16_pause/menu.c 2010-11-30 21:09:07.000000000 +0200 @@ -3025,7 +3025,7 @@ class cMenuSetupRecord : public cMenuSetupBase { private: - const char *pauseKeyHandlingTexts[3]; + const char *pauseKeyHandlingTexts[5]; const char *delTimeshiftRecTexts[3]; public: cMenuSetupRecord(void); @@ -3036,6 +3036,8 @@ pauseKeyHandlingTexts[0] = tr("do not pause live video"); pauseKeyHandlingTexts[1] = tr("confirm pause live video"); pauseKeyHandlingTexts[2] = tr("pause live video"); + pauseKeyHandlingTexts[3] = tr("confirm pause and switch to replay mode"); + pauseKeyHandlingTexts[4] = tr("switch to replay mode"); delTimeshiftRecTexts[0] = tr("no"); delTimeshiftRecTexts[1] = tr("confirm"); delTimeshiftRecTexts[2] = tr("yes"); @@ -3045,7 +3047,7 @@ Add(new cMenuEditIntItem( tr("Setup.Recording$Primary limit"), &data.PrimaryLimit, 0, MAXPRIORITY)); Add(new cMenuEditIntItem( tr("Setup.Recording$Default priority"), &data.DefaultPriority, 0, MAXPRIORITY)); Add(new cMenuEditIntItem( tr("Setup.Recording$Default lifetime (d)"), &data.DefaultLifetime, 0, MAXLIFETIME)); - Add(new cMenuEditStraItem(tr("Setup.Recording$Pause key handling"), &data.PauseKeyHandling, 3, pauseKeyHandlingTexts)); + Add(new cMenuEditStraItem(tr("Setup.Recording$Pause key handling"), &data.PauseKeyHandling, 5, pauseKeyHandlingTexts)); Add(new cMenuEditIntItem( tr("Setup.Recording$Pause priority"), &data.PausePriority, 0, MAXPRIORITY)); Add(new cMenuEditIntItem( tr("Setup.Recording$Pause lifetime (d)"), &data.PauseLifetime, 0, MAXLIFETIME)); Add(new cMenuEditBoolItem(tr("Setup.Recording$Use episode name"), &data.UseSubtitle)); @@ -4207,6 +4209,19 @@ AssertFreeDiskSpace(Timer->Priority(), !Timer->Pending()); Timer->SetPending(true); } + else if (Setup.PauseKeyHandling > 2 && Pause) { // PauseLiveVideo & do not start recording + cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); + for (cTimer *t = Timers.First(); t; t = Timers.Next(t)) { + if ((t->Channel() == channel) && t->Recording()) { + for (int i = 0; i < MAXRECORDCONTROLS; i++) { + if (RecordControls[i] && RecordControls[i]->Timer()->Channel() == t->Channel()) { + cReplayControl::SetRecording(RecordControls[i]->FileName(), t->File()); + return true; + } + } + } + } + } VideoDiskSpace(&FreeMB); if (FreeMB < MINFREEDISK) { if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) { @@ -4274,11 +4289,23 @@ { Skins.Message(mtStatus, tr("Pausing live video...")); cReplayControl::SetRecording(NULL, NULL); // make sure the new cRecordControl will set cReplayControl::LastReplayed() + cTimer * timer = NULL; + if (Setup.PauseKeyHandling > 2) { + for (cTimer *t = Timers.First(); t; t = Timers.Next(t)) { // find timer of current recording + if ((t->Channel() == Channels.GetByNumber(cDevice::CurrentChannel())) && t->Recording()) + timer = t; + } + } if (Start(NULL, true)) { sleep(2); // allow recorded file to fill up enough to start replaying cReplayControl *rc = new cReplayControl; cControl::Launch(rc); cControl::Attach(); + if (timer) { // if already recording current channel before pause jump to correct position of recording + int Current, Total; + rc->GetIndex(Current, Total, true); + rc->Goto(SecondsToFrames((Total / rc->FramesPerSecond())-2), false); + } sleep(1); // allow device to replay some frames, so we have a picture Skins.Message(mtStatus, NULL); rc->ProcessKey(kPause); // pause, allowing replay mode display diff -Naur -x PLUGINS -x po vdr-1.7.16_orig/vdr.c vdr-1.7.16_pause/vdr.c --- vdr-1.7.16_orig/vdr.c 2010-04-05 13:06:16.000000000 +0300 +++ vdr-1.7.16_pause/vdr.c 2010-11-30 20:00:48.000000000 +0200 @@ -1074,7 +1074,7 @@ if (!cControl::Control()) { DELETE_MENU; if (Setup.PauseKeyHandling) { - if (Setup.PauseKeyHandling > 1 || Interface->Confirm(tr("Pause live video?"))) { + if ((Setup.PauseKeyHandling == 2 || Setup.PauseKeyHandling == 4) || ((Setup.PauseKeyHandling == 1 || Setup.PauseKeyHandling == 3) && Interface->Confirm(tr("Pause live video?")))) { if (!cRecordControls::PauseLiveVideo()) Skins.Message(mtError, tr("No free DVB device to record!")); }