add filename to record prepare
authorFelix Domke <tmbinc@elitedvb.net>
Sat, 15 Oct 2005 20:13:05 +0000 (20:13 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sat, 15 Oct 2005 20:13:05 +0000 (20:13 +0000)
lib/service/iservice.h
lib/service/service.h
lib/service/servicedvb.cpp
lib/service/servicedvbrecord.cpp
lib/service/servicedvbrecord.h

index d0dc1e2..abbeb1a 100644 (file)
@@ -233,7 +233,7 @@ TEMPLATE_TYPEDEF(ePtr<iPlayableService>, iPlayableServicePtr);
 class iRecordableService: public iObject
 {
 public:
 class iRecordableService: public iObject
 {
 public:
-       virtual RESULT prepare()=0;
+       virtual RESULT prepare(const char *filename)=0;
        virtual RESULT start()=0;
        virtual RESULT stop()=0;
 };
        virtual RESULT start()=0;
        virtual RESULT stop()=0;
 };
index f98d3e5..17614c2 100644 (file)
@@ -28,7 +28,7 @@ public:
        
                // eServiceCenter
        static RESULT getPrivInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
        
                // eServiceCenter
        static RESULT getPrivInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
-       static RESULT getInstance(iServiceHandlerPtr &SWIG_NAMED_OUTPUT(ptr)) { ptr = instance; return 0; }
+       static SWIG_VOID(RESULT) getInstance(iServiceHandlerPtr &SWIG_NAMED_OUTPUT(ptr)) { ptr = instance; return 0; }
        RESULT addServiceFactory(int id, iServiceHandler *hnd);
        RESULT removeServiceFactory(int id);
 };
        RESULT addServiceFactory(int id, iServiceHandler *hnd);
        RESULT removeServiceFactory(int id);
 };
index a29b77c..86ed83d 100644 (file)
@@ -284,7 +284,7 @@ RESULT eServiceFactoryDVB::lookupService(ePtr<eDVBService> &service, const eServ
 }
 
 eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *service): 
 }
 
 eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *service): 
-       m_reference(ref), m_dvb_service(service)
+       m_reference(ref), m_dvb_service(service), m_service_handler(0)
 {
        m_is_pvr = !ref.path.empty();
        
 {
        m_is_pvr = !ref.path.empty();
        
index 773aeb3..856b8c9 100644 (file)
@@ -5,7 +5,7 @@
 
 DEFINE_REF(eDVBServiceRecord);
 
 
 DEFINE_REF(eDVBServiceRecord);
 
-eDVBServiceRecord::eDVBServiceRecord(const eServiceReferenceDVB &ref): m_ref(ref)
+eDVBServiceRecord::eDVBServiceRecord(const eServiceReferenceDVB &ref): m_ref(ref), m_service_handler(1)
 {
        CONNECT(m_service_handler.serviceEvent, eDVBServiceRecord::serviceEvent);
        m_state = stateIdle;
 {
        CONNECT(m_service_handler.serviceEvent, eDVBServiceRecord::serviceEvent);
        m_state = stateIdle;
@@ -34,8 +34,9 @@ void eDVBServiceRecord::serviceEvent(int event)
 }
 
 
 }
 
 
-RESULT eDVBServiceRecord::prepare()
+RESULT eDVBServiceRecord::prepare(const char *filename)
 {
 {
+       m_filename = filename;
        if (m_state == stateIdle)
                return m_service_handler.tune(m_ref);
        else
        if (m_state == stateIdle)
                return m_service_handler.tune(m_ref);
        else
@@ -73,8 +74,9 @@ int eDVBServiceRecord::doPrepare()
                /* allocate a ts recorder if we don't already have one. */
        if (m_state == stateIdle)
        {
                /* allocate a ts recorder if we don't already have one. */
        if (m_state == stateIdle)
        {
-               ::remove("recordings.ts");
-               int fd = ::open("recording.ts", O_WRONLY|O_CREAT, 0644);
+               eDebug("Recording to %s...", m_filename.c_str());
+               ::remove(m_filename.c_str());
+               int fd = ::open(m_filename.c_str(), O_WRONLY|O_CREAT, 0644);
                if (fd == -1)
                {
                        eDebug("eDVBServiceRecord - can't open hardcoded recording file!");
                if (fd == -1)
                {
                        eDebug("eDVBServiceRecord - can't open hardcoded recording file!");
index c90d0c9..17e3d16 100644 (file)
@@ -14,7 +14,7 @@ class eDVBServiceRecord: public iRecordableService, public Object
 {
 DECLARE_REF(eDVBServiceRecord);
 public:
 {
 DECLARE_REF(eDVBServiceRecord);
 public:
-       RESULT prepare();
+       RESULT prepare(const char *filename);
        RESULT start();
        RESULT stop();
 private:
        RESULT start();
        RESULT stop();
 private:
@@ -31,6 +31,7 @@ private:
        
        int m_recording;
        std::set<int> m_pids_active;
        
        int m_recording;
        std::set<int> m_pids_active;
+       std::string m_filename;
        
        int doPrepare();
        int doRecord();
        
        int doPrepare();
        int doRecord();