add LCD support
[enigma2.git] / lib / service / servicedvbrecord.cpp
index 880f08d361a10fe954b3e41439d9220bd578eeb7..b34dad10e0ba397a3c7f0446c28b1a8f5021a6fe 100644 (file)
@@ -111,6 +111,7 @@ RESULT eDVBServiceRecord::prepareStreaming()
        m_streaming = 1;
        if (m_state == stateIdle)
                return doPrepare();
+       return -1;
 }
 
 RESULT eDVBServiceRecord::start()
@@ -124,7 +125,7 @@ RESULT eDVBServiceRecord::start()
 
 RESULT eDVBServiceRecord::stop()
 {
-       eDebug("stop recording!!");
+       eDebug("stop recording!");
        if (m_state == stateRecording)
        {
                if (m_record)
@@ -135,7 +136,8 @@ RESULT eDVBServiceRecord::stop()
                        m_target_fd = -1;
                }
                m_state = statePrepared;
-       }
+       } else
+               eDebug("(was not recording)");
        if (m_state == statePrepared)
        {
                m_record = 0;
@@ -205,6 +207,8 @@ int eDVBServiceRecord::doRecord()
                }
                m_record->setTargetFD(fd);
                m_record->setTargetFilename(m_filename.c_str());
+               m_record->connectEvent(slot(*this, &eDVBServiceRecord::recordEvent), m_con_record_event);
+
                m_target_fd = fd;
        }
        
@@ -344,14 +348,6 @@ RESULT eDVBServiceRecord::connectEvent(const Slot2<void,iRecordableService*,int>
        return 0;
 }
 
-static PyObject *createTuple(int pid, const char *type)
-{
-       PyObject *r = PyTuple_New(2);
-       PyTuple_SetItem(r, 0, PyInt_FromLong(pid));
-       PyTuple_SetItem(r, 1, PyString_FromString(type));
-       return r;
-}
-
 RESULT eDVBServiceRecord::stream(ePtr<iStreamableService> &ptr)
 {
        ptr = this;
@@ -380,3 +376,16 @@ PyObject *eDVBServiceRecord::getStreamingData()
        return r;
 }
 
+void eDVBServiceRecord::recordEvent(int event)
+{
+       switch (event)
+       {
+       case iDVBTSRecorder::eventWriteError:
+               eWarning("[eDVBServiceRecord] record write error");
+               stop();
+               m_event((iRecordableService*)this, evRecordWriteError);
+               return;
+       default:
+               eDebug("unhandled record event %d", event);
+       }
+}