00001 #ifndef MNT_RTP_PAYLOAD_DUMPER_H 00002 #define MNT_RTP_PAYLOAD_DUMPER_H 00003 00004 #include "mnt_component.h" 00005 #include "mnt_rtp.h" 00006 #include "mnt_rtp_mpeg.h" 00007 00012 class MntRTPPayloadDumper : public MntComponent { 00013 00014 FILE *f_; 00016 public: 00017 00025 MntRTPPayloadDumper(const char *name) 00026 { 00027 f_ = fopen(name, "w"); 00028 if (f_ == NULL) 00029 { 00030 f_ = fopen("/tmp/rtp.dump", "w"); 00031 } 00032 } 00033 00037 ~MntRTPPayloadDumper() 00038 { 00039 fclose(f_); 00040 } 00041 00046 virtual void recv(MntData *p) 00047 { 00048 MntRTPMPEGPacket *pkt = (MntRTPMPEGPacket *)p; 00049 fwrite(pkt->pl_data_, pkt->length_ - sizeof(MntRTPHdr) - sizeof(MntRTPMPEGHdr), 1, f_); 00050 push(p); 00051 } 00052 }; 00053 00054 #endif