Avoid to use invalid file descriptor.
[vuplus_dvbapp] / lib / dvb / demux.cpp
1 #include <stdio.h>
2 #include <fcntl.h>
3 #include <sys/ioctl.h>
4 #include <errno.h>
5 #include <unistd.h>
6 #include <signal.h>
7
8 // #define FUZZING 1
9
10 #if FUZZING
11                 /* change every 1:FUZZING_PROPABILITY byte */
12 #define FUZZING_PROPABILITY 100
13 #endif
14
15 #if HAVE_DVB_API_VERSION < 3
16 #include <ost/dmx.h>
17
18 #ifndef DMX_SET_NEGFILTER_MASK
19         #define DMX_SET_NEGFILTER_MASK   _IOW('o',48,uint8_t *)
20 #endif
21
22 #ifndef DMX_GET_STC
23         struct dmx_stc
24         {
25                 unsigned int num;       /* input : which STC? O..N */
26                 unsigned int base;      /* output: divisor for stc to get 90 kHz clock */
27                 unsigned long long stc; /* output: src in 'base'*90 kHz units */
28         };
29         #define DMX_GET_STC             _IOR('o', 50, struct dmx_stc)
30 #endif
31
32 #else
33 #include <linux/dvb/dmx.h>
34
35 #define HAVE_ADD_PID
36
37 #ifdef HAVE_ADD_PID
38
39 #if HAVE_DVB_API_VERSION > 3
40 #ifndef DMX_ADD_PID
41 #define DMX_ADD_PID             _IOW('o', 51, __u16)
42 #define DMX_REMOVE_PID          _IOW('o', 52, __u16)
43 #endif
44 #else
45 #define DMX_ADD_PID              _IO('o', 51)
46 #define DMX_REMOVE_PID           _IO('o', 52)
47
48 typedef enum {
49         DMX_TAP_TS = 0,
50         DMX_TAP_PES = DMX_PES_OTHER, /* for backward binary compat. */
51 } dmx_tap_type_t;
52 #endif
53
54 #endif
55
56 #endif
57
58 #include "crc32.h"
59
60 #include <lib/base/eerror.h>
61 #include <lib/base/filepush.h>
62 #include <lib/dvb/idvb.h>
63 #include <lib/dvb/demux.h>
64 #include <lib/dvb/esection.h>
65 #include <lib/dvb/decoder.h>
66 #include <lib/dvb/pvrparse.h>
67
68 eDVBDemux::eDVBDemux(int adapter, int demux): adapter(adapter), demux(demux)
69 {
70         m_dvr_busy = 0;
71 }
72
73 eDVBDemux::~eDVBDemux()
74 {
75 }
76
77 int eDVBDemux::openDemux(void)
78 {
79         char filename[128];
80 #if HAVE_DVB_API_VERSION < 3
81         snprintf(filename, 128, "/dev/dvb/card%d/demux%d", adapter, demux);
82 #else
83         snprintf(filename, 128, "/dev/dvb/adapter%d/demux%d", adapter, demux);
84 #endif
85         return ::open(filename, O_RDWR);
86 }
87
88 int eDVBDemux::openDVR(int flags)
89 {
90         char filename[128];
91         snprintf(filename, 128, "/dev/dvb/adapter%d/dvr%d", adapter, demux);
92         return ::open(filename, flags);
93 }
94
95 DEFINE_REF(eDVBDemux)
96
97 RESULT eDVBDemux::setSourceFrontend(int fenum)
98 {
99 #if HAVE_DVB_API_VERSION >= 3
100         int fd = openDemux();
101         if (fd < 0) return -1;
102         int n = DMX_SOURCE_FRONT0 + fenum;
103         int res = ::ioctl(fd, DMX_SET_SOURCE, &n);
104         if (res)
105                 eDebug("DMX_SET_SOURCE failed! - %m");
106         else
107                 source = fenum;
108         ::close(fd);
109         return res;
110 #endif
111         return 0;
112 }
113
114 RESULT eDVBDemux::setSourcePVR(int pvrnum)
115 {
116 #if HAVE_DVB_API_VERSION >= 3
117         int fd = openDemux();
118         if (fd < 0) return -1;
119         int n = DMX_SOURCE_DVR0 + pvrnum;
120         int res = ::ioctl(fd, DMX_SET_SOURCE, &n);
121         source = -1;
122         ::close(fd);
123         return res;
124 #endif
125         return 0;
126 }
127
128 RESULT eDVBDemux::createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader)
129 {
130         RESULT res;
131         reader = new eDVBSectionReader(this, context, res);
132         if (res)
133                 reader = 0;
134         return res;
135 }
136
137 RESULT eDVBDemux::createPESReader(eMainloop *context, ePtr<iDVBPESReader> &reader)
138 {
139         RESULT res;
140         reader = new eDVBPESReader(this, context, res);
141         if (res)
142                 reader = 0;
143         return res;
144 }
145
146 RESULT eDVBDemux::createTSRecorder(ePtr<iDVBTSRecorder> &recorder)
147 {
148         if (m_dvr_busy)
149                 return -EBUSY;
150         recorder = new eDVBTSRecorder(this);
151         return 0;
152 }
153
154 RESULT eDVBDemux::getMPEGDecoder(ePtr<iTSMPEGDecoder> &decoder, int primary)
155 {
156         decoder = new eTSMPEGDecoder(this, primary ? 0 : 1);
157         return 0;
158 }
159
160 RESULT eDVBDemux::getSTC(pts_t &pts, int num)
161 {
162         int fd = openDemux();
163         
164         if (fd < 0)
165                 return -ENODEV;
166
167         struct dmx_stc stc;
168         stc.num = num;
169         stc.base = 1;
170         
171         if (ioctl(fd, DMX_GET_STC, &stc) < 0)
172         {
173                 eDebug("DMX_GET_STC failed!");
174                 ::close(fd);
175                 return -1;
176         }
177         
178         pts = stc.stc;
179         
180         eDebug("DMX_GET_STC - %lld", pts);
181         
182         ::close(fd);
183         return 0;
184 }
185
186 RESULT eDVBDemux::flush()
187 {
188         // FIXME: implement flushing the PVR queue here.
189         
190         m_event(evtFlush);
191         return 0;
192 }
193
194 RESULT eDVBDemux::connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn)
195 {
196         conn = new eConnection(this, m_event.connect(event));
197         return 0;
198 }
199
200 void eDVBSectionReader::data(int)
201 {
202         __u8 data[4096]; // max. section size
203         int r;
204         r = ::read(fd, data, 4096);
205 #if FUZZING
206         int j;
207         for (j = 0; j < r; ++j)
208         {
209                 if (!(rand()%FUZZING_PROPABILITY))
210                         data[j] ^= rand();
211         }
212 #endif  
213         if(r < 0)
214         {
215                 eWarning("ERROR reading section - %m\n");
216                 return;
217         }
218         if (checkcrc)
219         {
220                         // this check should never happen unless the driver is crappy!
221                 unsigned int c;
222                 if ((c = crc32((unsigned)-1, data, r)))
223                 {
224                         eDebug("crc32 failed! is %x\n", c);
225                         return;
226                 }
227         }
228         if (active)
229                 read(data);
230         else
231                 eDebug("data.. but not active");
232 }
233
234 eDVBSectionReader::eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res): demux(demux)
235 {
236         char filename[128];
237         fd = demux->openDemux();
238         
239         if (fd >= 0)
240         {
241                 notifier=eSocketNotifier::create(context, fd, eSocketNotifier::Read, false);
242                 CONNECT(notifier->activated, eDVBSectionReader::data);
243                 res = 0;
244         } else
245         {
246                 perror(filename);
247                 res = errno;
248         }
249 }
250
251 DEFINE_REF(eDVBSectionReader)
252
253 eDVBSectionReader::~eDVBSectionReader()
254 {
255         if (fd >= 0)
256                 ::close(fd);
257 }
258
259 RESULT eDVBSectionReader::setBufferSize(int size)
260 {
261         int res=::ioctl(fd, DMX_SET_BUFFER_SIZE, size);
262         if (res < 0)
263                 eDebug("eDVBSectionReader DMX_SET_BUFFER_SIZE failed(%m)");
264         return res;
265 }
266
267 RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
268 {
269         RESULT res;
270         if (fd < 0)
271                 return -ENODEV;
272
273         notifier->start();
274 #if HAVE_DVB_API_VERSION < 3
275         dmxSctFilterParams sct;
276 #else
277         dmx_sct_filter_params sct;
278 #endif
279         sct.pid     = mask.pid;
280         sct.timeout = 0;
281 #if HAVE_DVB_API_VERSION < 3
282         sct.flags   = 0;
283 #else
284         sct.flags   = DMX_IMMEDIATE_START;
285 #endif
286 #if !FUZZING
287         if (mask.flags & eDVBSectionFilterMask::rfCRC)
288         {
289                 sct.flags |= DMX_CHECK_CRC;
290                 checkcrc = 1;
291         } else
292 #endif
293                 checkcrc = 0;
294         
295         memcpy(sct.filter.filter, mask.data, DMX_FILTER_SIZE);
296         memcpy(sct.filter.mask, mask.mask, DMX_FILTER_SIZE);
297 #if HAVE_DVB_API_VERSION >= 3
298         memcpy(sct.filter.mode, mask.mode, DMX_FILTER_SIZE);
299         setBufferSize(8192*8);
300 #endif
301         
302         res = ::ioctl(fd, DMX_SET_FILTER, &sct);
303         if (!res)
304         {
305 #if HAVE_DVB_API_VERSION < 3
306                 res = ::ioctl(fd, DMX_SET_NEGFILTER_MASK, mask.mode);
307                 if (!res)
308                 {
309                         res = ::ioctl(fd, DMX_START, 0);
310                         if (!res)
311                                 active = 1;
312                 }
313 #else
314                 active = 1;
315 #endif
316         }
317         return res;
318 }
319
320 RESULT eDVBSectionReader::stop()
321 {
322         if (!active)
323                 return -1;
324
325         active=0;
326         ::ioctl(fd, DMX_STOP);
327         notifier->stop();
328
329         return 0;
330 }
331
332 RESULT eDVBSectionReader::connectRead(const Slot1<void,const __u8*> &r, ePtr<eConnection> &conn)
333 {
334         conn = new eConnection(this, read.connect(r));
335         return 0;
336 }
337
338 void eDVBPESReader::data(int)
339 {
340         while (1)
341         {
342                 __u8 buffer[16384];
343                 int r;
344                 r = ::read(m_fd, buffer, 16384);
345                 if (!r)
346                         return;
347                 if(r < 0)
348                 {
349                         if (errno == EAGAIN || errno == EINTR) /* ok */
350                                 return;
351                         eWarning("ERROR reading PES (fd=%d) - %m", m_fd);
352                         return;
353                 }
354
355                 if (m_active)
356                         m_read(buffer, r);
357                 else
358                         eWarning("PES reader not active");
359                 if (r != 16384)
360                         break;
361         }
362 }
363
364 eDVBPESReader::eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res): m_demux(demux)
365 {
366         char filename[128];
367         m_fd = m_demux->openDemux();
368         
369         if (m_fd >= 0)
370         {
371                 setBufferSize(64*1024);
372                 ::fcntl(m_fd, F_SETFL, O_NONBLOCK);
373                 m_notifier = eSocketNotifier::create(context, m_fd, eSocketNotifier::Read, false);
374                 CONNECT(m_notifier->activated, eDVBPESReader::data);
375                 res = 0;
376         } else
377         {
378                 perror(filename);
379                 res = errno;
380         }
381 }
382
383 RESULT eDVBPESReader::setBufferSize(int size)
384 {
385         int res = ::ioctl(m_fd, DMX_SET_BUFFER_SIZE, size);
386         if (res < 0)
387                 eDebug("eDVBPESReader DMX_SET_BUFFER_SIZE failed(%m)");
388         return res;
389 }
390
391 DEFINE_REF(eDVBPESReader)
392
393 eDVBPESReader::~eDVBPESReader()
394 {
395         if (m_fd >= 0)
396                 ::close(m_fd);
397 }
398
399 RESULT eDVBPESReader::start(int pid)
400 {
401         RESULT res;
402         if (m_fd < 0)
403                 return -ENODEV;
404
405         m_notifier->start();
406
407 #if HAVE_DVB_API_VERSION < 3
408         dmxPesFilterParams flt;
409         
410         flt.pesType = DMX_PES_OTHER;
411 #else
412         dmx_pes_filter_params flt;
413         
414         flt.pes_type = DMX_PES_OTHER;
415 #endif
416
417         flt.pid     = pid;
418         flt.input   = DMX_IN_FRONTEND;
419         flt.output  = DMX_OUT_TAP;
420         
421         flt.flags   = DMX_IMMEDIATE_START;
422
423         res = ::ioctl(m_fd, DMX_SET_PES_FILTER, &flt);
424         
425         if (res)
426                 eWarning("PES filter: DMX_SET_PES_FILTER - %m");
427         if (!res)
428                 m_active = 1;
429         return res;
430 }
431
432 RESULT eDVBPESReader::stop()
433 {
434         if (!m_active)
435                 return -1;
436
437         m_active=0;
438         ::ioctl(m_fd, DMX_STOP);
439         m_notifier->stop();
440
441         return 0;
442 }
443
444 RESULT eDVBPESReader::connectRead(const Slot2<void,const __u8*,int> &r, ePtr<eConnection> &conn)
445 {
446         conn = new eConnection(this, m_read.connect(r));
447         return 0;
448 }
449
450 class eDVBRecordFileThread: public eFilePushThread
451 {
452 public:
453         eDVBRecordFileThread();
454         void setTimingPID(int pid, int type);
455         
456         void startSaveMetaInformation(const std::string &filename);
457         void stopSaveMetaInformation();
458         void enableAccessPoints(bool enable);
459         int getLastPTS(pts_t &pts);
460 protected:
461         int filterRecordData(const unsigned char *data, int len, size_t &current_span_remaining);
462 private:
463         eMPEGStreamParserTS m_ts_parser;
464         eMPEGStreamInformation m_stream_info;
465         off_t m_current_offset;
466         pts_t m_last_pcr; /* very approximate.. */
467         int m_pid;
468 };
469
470 eDVBRecordFileThread::eDVBRecordFileThread()
471         :eFilePushThread(IOPRIO_CLASS_RT, 7), m_ts_parser(m_stream_info)
472 {
473         m_current_offset = 0;
474 }
475
476 void eDVBRecordFileThread::setTimingPID(int pid, int type)
477 {
478         m_ts_parser.setPid(pid, type);
479 }
480
481 void eDVBRecordFileThread::startSaveMetaInformation(const std::string &filename)
482 {
483         m_stream_info.startSave(filename.c_str());
484 }
485
486 void eDVBRecordFileThread::stopSaveMetaInformation()
487 {
488         m_stream_info.stopSave();
489 }
490
491 void eDVBRecordFileThread::enableAccessPoints(bool enable)
492 {
493         m_ts_parser.enableAccessPoints(enable);
494 }
495
496 int eDVBRecordFileThread::getLastPTS(pts_t &pts)
497 {
498         return m_ts_parser.getLastPTS(pts);
499 }
500
501 int eDVBRecordFileThread::filterRecordData(const unsigned char *data, int len, size_t &current_span_remaining)
502 {
503         m_ts_parser.parseData(m_current_offset, data, len);
504         
505         m_current_offset += len;
506         
507         return len;
508 }
509
510 DEFINE_REF(eDVBTSRecorder);
511
512 eDVBTSRecorder::eDVBTSRecorder(eDVBDemux *demux): m_demux(demux)
513 {
514         m_running = 0;
515         m_target_fd = -1;
516         m_thread = new eDVBRecordFileThread();
517         CONNECT(m_thread->m_event, eDVBTSRecorder::filepushEvent);
518 #ifndef HAVE_ADD_PID
519         m_demux->m_dvr_busy = 1;
520 #endif
521 }
522
523 eDVBTSRecorder::~eDVBTSRecorder()
524 {
525         stop();
526         delete m_thread;
527 #ifndef HAVE_ADD_PID
528         m_demux->m_dvr_busy = 0;
529 #endif
530 }
531
532 RESULT eDVBTSRecorder::start()
533 {
534         std::map<int,int>::iterator i(m_pids.begin());
535
536         if (m_running)
537                 return -1;
538         
539         if (m_target_fd == -1)
540                 return -2;
541
542         if (i == m_pids.end())
543                 return -3;
544
545         char filename[128];
546 #ifndef HAVE_ADD_PID
547 #if HAVE_DVB_API_VERSION < 3
548         snprintf(filename, 128, "/dev/dvb/card%d/dvr%d", m_demux->adapter, m_demux->demux);
549 #else
550         snprintf(filename, 128, "/dev/dvb/adapter%d/dvr%d", m_demux->adapter, m_demux->demux);
551 #endif
552         m_source_fd = ::open(filename, O_RDONLY);
553         
554         if (m_source_fd < 0)
555         {
556                 eDebug("FAILED to open dvr (%s) in ts recoder (%m)", filename);
557                 return -3;
558         }
559 #else
560         snprintf(filename, 128, "/dev/dvb/adapter%d/demux%d", m_demux->adapter, m_demux->demux);
561
562         m_source_fd = ::open(filename, O_RDONLY);
563         
564         if (m_source_fd < 0)
565         {
566                 eDebug("FAILED to open demux (%s) in ts recoder (%m)", filename);
567                 return -3;
568         }
569
570         setBufferSize(1024*1024);
571
572         dmx_pes_filter_params flt;
573 #if HAVE_DVB_API_VERSION > 3
574         flt.pes_type = DMX_PES_OTHER;
575         flt.output  = DMX_OUT_TSDEMUX_TAP;
576 #else
577         flt.pes_type = (dmx_pes_type_t)DMX_TAP_TS;
578         flt.output  = DMX_OUT_TAP;
579 #endif
580         flt.pid     = i->first;
581         ++i;
582         flt.input   = DMX_IN_FRONTEND;
583         flt.flags   = 0;
584         int res = ::ioctl(m_source_fd, DMX_SET_PES_FILTER, &flt);
585         if (res)
586         {
587                 eDebug("DMX_SET_PES_FILTER: %m");
588                 ::close(m_source_fd);
589                 m_source_fd = -1;
590                 return -3;
591         }
592         
593         ::ioctl(m_source_fd, DMX_START);
594         
595 #endif
596
597         if (m_target_filename != "")
598                 m_thread->startSaveMetaInformation(m_target_filename);
599         
600         m_thread->start(m_source_fd, m_target_fd);
601         m_running = 1;
602
603         while (i != m_pids.end()) {
604                 startPID(i->first);
605                 ++i;
606         }
607
608         return 0;
609 }
610
611 RESULT eDVBTSRecorder::setBufferSize(int size)
612 {
613         int res = ::ioctl(m_source_fd, DMX_SET_BUFFER_SIZE, size);
614         if (res < 0)
615                 eDebug("eDVBTSRecorder DMX_SET_BUFFER_SIZE failed(%m)");
616         return res;
617 }
618
619 RESULT eDVBTSRecorder::addPID(int pid)
620 {
621         if (m_pids.find(pid) != m_pids.end())
622                 return -1;
623         
624         m_pids.insert(std::pair<int,int>(pid, -1));
625         if (m_running)
626                 startPID(pid);
627         return 0;
628 }
629
630 RESULT eDVBTSRecorder::removePID(int pid)
631 {
632         if (m_pids.find(pid) == m_pids.end())
633                 return -1;
634                 
635         if (m_running)
636                 stopPID(pid);
637         
638         m_pids.erase(pid);
639         return 0;
640 }
641
642 RESULT eDVBTSRecorder::setTimingPID(int pid, int type)
643 {
644         m_thread->setTimingPID(pid, type);
645         return 0;
646 }
647
648 RESULT eDVBTSRecorder::setTargetFD(int fd)
649 {
650         m_target_fd = fd;
651         return 0;
652 }
653
654 RESULT eDVBTSRecorder::setTargetFilename(const char *filename)
655 {
656         m_target_filename = filename;
657         return 0;
658 }
659
660 RESULT eDVBTSRecorder::enableAccessPoints(bool enable)
661 {
662         m_thread->enableAccessPoints(enable);
663         return 0;
664 }
665
666 RESULT eDVBTSRecorder::setBoundary(off_t max)
667 {
668         return -1; // not yet implemented
669 }
670
671 RESULT eDVBTSRecorder::stop()
672 {
673         int state=3;
674
675         for (std::map<int,int>::iterator i(m_pids.begin()); i != m_pids.end(); ++i)
676                 stopPID(i->first);
677
678         if (!m_running)
679                 return -1;
680
681 #if HAVE_DVB_API_VERSION >= 5
682         /* workaround for record thread stop */
683         if (m_source_fd >= 0)
684         {
685                 if (::ioctl(m_source_fd, DMX_STOP) < 0)
686                         perror("DMX_STOP");
687                 else
688                         state &= ~1;
689
690                 if (::close(m_source_fd) < 0)
691                         perror("close");
692                 else
693                         state &= ~2;
694                 m_source_fd = -1;
695         }
696 #endif
697
698         m_thread->stop();
699
700         if (state & 3)
701         {
702                 if (m_source_fd >= 0)
703                 {
704                         ::close(m_source_fd);
705                         m_source_fd = -1;
706                 }
707         }
708
709         m_running = 0;
710         m_thread->stopSaveMetaInformation();
711         return 0;
712 }
713
714 RESULT eDVBTSRecorder::getCurrentPCR(pts_t &pcr)
715 {
716         if (!m_running)
717                 return 0;
718         if (!m_thread)
719                 return 0;
720                 /* XXX: we need a lock here */
721
722                         /* we don't filter PCR data, so just use the last received PTS, which is not accurate, but better than nothing */
723         return m_thread->getLastPTS(pcr);
724 }
725
726 RESULT eDVBTSRecorder::connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn)
727 {
728         conn = new eConnection(this, m_event.connect(event));
729         return 0;
730 }
731
732 RESULT eDVBTSRecorder::startPID(int pid)
733 {
734 #ifndef HAVE_ADD_PID
735         int fd = m_demux->openDemux();
736         if (fd < 0)
737         {
738                 eDebug("FAILED to open demux in ts recoder (%m)");
739                 return -1;
740         }
741
742 #if HAVE_DVB_API_VERSION < 3
743         dmxPesFilterParams flt;
744         
745         flt.pesType = DMX_PES_OTHER;
746 #else
747         dmx_pes_filter_params flt;
748         
749         flt.pes_type = DMX_PES_OTHER;
750 #endif
751
752         flt.pid     = pid;
753         flt.input   = DMX_IN_FRONTEND;
754         flt.output  = DMX_OUT_TS_TAP;
755         
756         flt.flags   = DMX_IMMEDIATE_START;
757
758         int res = ::ioctl(fd, DMX_SET_PES_FILTER, &flt);
759         if (res < 0)
760         {
761                 eDebug("set pes filter failed!");
762                 ::close(fd);
763                 return -1;
764         }
765         m_pids[pid] = fd;
766 #else
767         while(true) {
768 #if HAVE_DVB_API_VERSION > 3
769                 __u16 p = pid;
770                 if (::ioctl(m_source_fd, DMX_ADD_PID, &p) < 0) {
771 #else
772                 if (::ioctl(m_source_fd, DMX_ADD_PID, pid) < 0) {
773 #endif
774                         perror("DMX_ADD_PID");
775                         if (errno == EAGAIN || errno == EINTR) {
776                                 eDebug("retry!");
777                                 continue;
778                         }
779                 } else
780                         m_pids[pid] = 1;
781                 break;
782         }
783 #endif
784         return 0;
785 }
786
787 void eDVBTSRecorder::stopPID(int pid)
788 {
789 #ifndef HAVE_ADD_PID
790         if (m_pids[pid] != -1)
791                 ::close(m_pids[pid]);
792 #else
793         if (m_pids[pid] != -1)
794         {
795                 while(true) {
796 #if HAVE_DVB_API_VERSION > 3
797                         __u16 p = pid;
798                         if (::ioctl(m_source_fd, DMX_REMOVE_PID, &p) < 0) {
799 #else
800                         if (::ioctl(m_source_fd, DMX_REMOVE_PID, pid) < 0) {
801 #endif
802                                 perror("DMX_REMOVE_PID");
803                                 if (errno == EAGAIN || errno == EINTR) {
804                                         eDebug("retry!");
805                                         continue;
806                                 }
807                         }
808                         break;
809                 }
810         }
811 #endif
812         m_pids[pid] = -1;
813 }
814
815 void eDVBTSRecorder::filepushEvent(int event)
816 {
817         switch (event)
818         {
819         case eFilePushThread::evtWriteError:
820                 m_event(eventWriteError);
821                 break;
822         }
823 }