00001 #ifndef MNT_RTP_FILE_WRITER_H
00002 #define MNT_RTP_FILE_WRITER_H
00003
00004 #include "mnt_component.h"
00005 #include "mnt_rtp.h"
00006 #include "mnt_rtp_mpeg.h"
00007
00015 class MntRTPFileWriter : public MntComponent {
00016
00017 FILE *f_;
00019 public:
00020
00028 MntRTPFileWriter(const char *name)
00029 {
00030 f_ = fopen(name, "w");
00031 if (f_ == NULL)
00032 {
00033 f_ = fopen("/tmp/DUMP.rtp", "w");
00034 }
00035 }
00036
00040 ~MntRTPFileWriter()
00041 {
00042 fclose(f_);
00043 }
00044
00049 virtual void recv(MntData *p)
00050 {
00051 MntRTPMPEGPacket *pkt = (MntRTPMPEGPacket *)p;
00052 fwrite(&pkt->length_, sizeof(int), 1, f_);
00053 fwrite(pkt->rtp_hdr_, pkt->length_, 1, f_);
00054 push(p);
00055 }
00056 };
00057
00058 #endif