diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp
index 2ecbd5b..bf4ed21 100644
|
a
|
b
|
TVRec::TVRec(int capturecardnum)
|
| 107 | 107 | switchingBuffer(false), |
| 108 | 108 | m_recStatus(rsUnknown), |
| 109 | 109 | // Current recording info |
| 110 | | curRecording(NULL), autoRunJobs(JOB_NONE), |
| | 110 | curRecording(NULL), |
| 111 | 111 | overrecordseconds(0), |
| 112 | 112 | // Pseudo LiveTV recording |
| 113 | 113 | pseudoLiveTVRecording(NULL), |
| … |
… |
void TVRec::FinishedRecording(RecordingInfo *curRec, RecordingQuality *recq)
|
| 916 | 916 | curRec->FinishedRecording(!is_good || (recgrp == "LiveTV")); |
| 917 | 917 | |
| 918 | 918 | // send out REC_FINISHED message |
| 919 | | SendMythSystemRecEvent("REC_FINISHED", curRecording); |
| | 919 | SendMythSystemRecEvent("REC_FINISHED", curRec); |
| 920 | 920 | |
| 921 | 921 | // send out DONE_RECORDING message |
| 922 | 922 | int secsSince = curRec->GetRecordingStartTime() |
| … |
… |
void TVRec::FinishedRecording(RecordingInfo *curRec, RecordingQuality *recq)
|
| 927 | 927 | gCoreContext->dispatch(me); |
| 928 | 928 | |
| 929 | 929 | // Handle JobQueue |
| | 930 | QHash<QString,int>::iterator autoJob = |
| | 931 | autoRunJobs.find(curRec->MakeUniqueKey()); |
| | 932 | if (autoJob == autoRunJobs.end()) |
| | 933 | { |
| | 934 | AutoRunInitType t = |
| | 935 | (recgrp == "LiveTV") ? kAutoRunNone : kAutoRunProfile; |
| | 936 | InitAutoRunJobs(curRec, t, NULL, __LINE__); |
| | 937 | autoJob = autoRunJobs.find(curRec->MakeUniqueKey()); |
| | 938 | } |
| | 939 | LOG(VB_GENERAL, LOG_INFO, QString("AutoRunJobs 0x%1") |
| | 940 | .arg(*autoJob,0,16)); |
| | 941 | |
| 930 | 942 | if ((recgrp == "LiveTV") || (fsize < 1000) || |
| 931 | 943 | (curRec->GetRecordingStatus() != rsRecorded) || |
| 932 | 944 | (curRec->GetRecordingStartTime().secsTo( |
| 933 | 945 | QDateTime::currentDateTime()) < 120)) |
| 934 | 946 | { |
| 935 | | JobQueue::RemoveJobsFromMask(JOB_COMMFLAG, autoRunJobs); |
| 936 | | JobQueue::RemoveJobsFromMask(JOB_TRANSCODE, autoRunJobs); |
| 937 | | } |
| 938 | | if (autoRunJobs) |
| 939 | | { |
| 940 | | JobQueue::QueueRecordingJobs(*curRec, autoRunJobs); |
| | 947 | JobQueue::RemoveJobsFromMask(JOB_COMMFLAG, *autoJob); |
| | 948 | JobQueue::RemoveJobsFromMask(JOB_TRANSCODE, *autoJob); |
| 941 | 949 | } |
| | 950 | if (*autoJob != JOB_NONE) |
| | 951 | JobQueue::QueueRecordingJobs(*curRec, *autoJob); |
| | 952 | autoRunJobs.erase(autoJob); |
| 942 | 953 | } |
| 943 | 954 | |
| 944 | 955 | #define TRANSITION(ASTATE,BSTATE) \ |
| … |
… |
void TVRec::NotifySchedulerOfRecording(RecordingInfo *rec)
|
| 2692 | 2703 | ClearFlags(kFlagCancelNextRecording); |
| 2693 | 2704 | } |
| 2694 | 2705 | |
| | 2706 | void TVRec::InitAutoRunJobs(RecordingInfo *rec, AutoRunInitType t, |
| | 2707 | RecordingProfile *recpro, int line) |
| | 2708 | { |
| | 2709 | if (kAutoRunProfile == t) |
| | 2710 | { |
| | 2711 | RecordingProfile profile; |
| | 2712 | if (!recpro) |
| | 2713 | { |
| | 2714 | load_profile(genOpt.cardtype, NULL, rec, profile); |
| | 2715 | recpro = &profile; |
| | 2716 | } |
| | 2717 | autoRunJobs[rec->MakeUniqueKey()] = |
| | 2718 | init_jobs(rec, *recpro, runJobOnHostOnly, |
| | 2719 | transcodeFirst, earlyCommFlag); |
| | 2720 | } |
| | 2721 | else |
| | 2722 | { |
| | 2723 | autoRunJobs[rec->MakeUniqueKey()] = JOB_NONE; |
| | 2724 | } |
| | 2725 | LOG(VB_GENERAL, LOG_INFO, |
| | 2726 | QString("InitAutoRunJobs for %1, line %2 -> 0x%3") |
| | 2727 | .arg(rec->MakeUniqueKey()).arg(line) |
| | 2728 | .arg(autoRunJobs[rec->MakeUniqueKey()],0,16)); |
| | 2729 | } |
| | 2730 | |
| 2695 | 2731 | /** \fn TVRec::SetLiveRecording(int) |
| 2696 | 2732 | * \brief Tells the Scheduler about changes to the recording status |
| 2697 | 2733 | * of the LiveTV recording. |
| … |
… |
void TVRec::SetLiveRecording(int recording)
|
| 2720 | 2756 | // cancel -- 'recording' should be 0 or -1 |
| 2721 | 2757 | SetFlags(kFlagCancelNextRecording); |
| 2722 | 2758 | curRecording->SetRecordingGroup("LiveTV"); |
| 2723 | | autoRunJobs = JOB_NONE; |
| | 2759 | InitAutoRunJobs(curRecording, kAutoRunNone, NULL, __LINE__); |
| 2724 | 2760 | } |
| 2725 | 2761 | else if (!was_rec && pseudoLiveTVRecording) |
| 2726 | 2762 | { |
| … |
… |
void TVRec::SetLiveRecording(int recording)
|
| 2734 | 2770 | NotifySchedulerOfRecording(curRecording); |
| 2735 | 2771 | recstat = curRecording->GetRecordingStatus(); |
| 2736 | 2772 | curRecording->SetRecordingGroup("Default"); |
| 2737 | | |
| 2738 | | RecordingProfile profile; |
| 2739 | | load_profile(genOpt.cardtype, NULL, curRecording, profile); |
| 2740 | | autoRunJobs = init_jobs(curRecording, profile, runJobOnHostOnly, |
| 2741 | | transcodeFirst, earlyCommFlag); |
| | 2773 | InitAutoRunJobs(curRecording, kAutoRunProfile, NULL, __LINE__); |
| 2742 | 2774 | } |
| 2743 | 2775 | |
| 2744 | 2776 | MythEvent me(QString("UPDATE_RECORDING_STATUS %1 %2 %3 %4 %5") |
| … |
… |
void TVRec::TuningNewRecorder(MPEGStreamData *streamData)
|
| 4073 | 4105 | |
| 4074 | 4106 | SetFlags(kFlagRecorderRunning | kFlagRingBufferReady); |
| 4075 | 4107 | |
| 4076 | | if (!tvchain) |
| 4077 | | autoRunJobs = init_jobs(rec, profile, runJobOnHostOnly, |
| 4078 | | transcodeFirst, earlyCommFlag); |
| | 4108 | InitAutoRunJobs(rec, (tvchain) ? kAutoRunNone : kAutoRunProfile, |
| | 4109 | &profile, __LINE__); |
| 4079 | 4110 | |
| 4080 | 4111 | ClearFlags(kFlagNeedToStartRecorder); |
| 4081 | 4112 | return; |
| … |
… |
void TVRec::TuningRestartRecorder(void)
|
| 4147 | 4178 | curRecording->ApplyRecordRecGroupChange( |
| 4148 | 4179 | curRecording->GetRecordingRule()->m_recGroup); |
| 4149 | 4180 | |
| 4150 | | RecordingProfile profile; |
| 4151 | | QString profileName = load_profile(genOpt.cardtype, NULL, |
| 4152 | | curRecording, profile); |
| 4153 | | autoRunJobs = init_jobs(curRecording, profile, runJobOnHostOnly, |
| 4154 | | transcodeFirst, earlyCommFlag); |
| | 4181 | InitAutoRunJobs(curRecording, kAutoRunProfile, NULL, __LINE__); |
| 4155 | 4182 | } |
| 4156 | 4183 | |
| 4157 | 4184 | ClearFlags(kFlagNeedToStartRecorder); |
diff --git a/mythtv/libs/libmythtv/tv_rec.h b/mythtv/libs/libmythtv/tv_rec.h
index ce54bff..576ed0f 100644
|
a
|
b
|
class MTV_PUBLIC TVRec : public SignalMonitorListener, public QRunnable
|
| 312 | 312 | QDateTime GetRecordEndTime(const ProgramInfo*) const; |
| 313 | 313 | void CheckForRecGroupChange(void); |
| 314 | 314 | void NotifySchedulerOfRecording(RecordingInfo*); |
| | 315 | typedef enum { kAutoRunProfile, kAutoRunNone, } AutoRunInitType; |
| | 316 | void InitAutoRunJobs(RecordingInfo*, AutoRunInitType, |
| | 317 | RecordingProfile *, int line); |
| 315 | 318 | |
| 316 | 319 | void SetRecordingStatus( |
| 317 | 320 | RecStatusType new_status, int line, bool have_lock = false); |
| … |
… |
class MTV_PUBLIC TVRec : public SignalMonitorListener, public QRunnable
|
| 372 | 375 | // Current recording info |
| 373 | 376 | RecordingInfo *curRecording; |
| 374 | 377 | QDateTime recordEndTime; |
| 375 | | int autoRunJobs; |
| | 378 | QHash<QString,int> autoRunJobs; // RecordingInfo->MakeUniqueKey()->autoRun |
| 376 | 379 | int overrecordseconds; |
| 377 | 380 | |
| 378 | 381 | // Pending recording info |