00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
#ifndef __OPAL_RFC2833_H
00039
#define __OPAL_RFC2833_H
00040
00041
#ifdef P_USE_PRAGMA
00042
#pragma interface
00043
#endif
00044
00045
00046
#include "rtp.h"
00047
00048
00050
00051 class OpalRFC2833Info :
public PObject {
00052 PCLASSINFO(
OpalRFC2833Info, PObject);
00053
public:
00054
OpalRFC2833Info(
00055
char tone,
00056
unsigned duration = 0,
00057
unsigned timestamp = 0
00058 );
00059
00060 char GetTone()
const {
return tone; }
00061 unsigned GetDuration()
const {
return duration; }
00062 unsigned GetTimestamp()
const {
return timestamp; }
00063 BOOL
IsToneStart()
const {
return duration == 0; }
00064
00065
protected:
00066 char tone;
00067 unsigned duration;
00068 unsigned timestamp;
00069 };
00070
00071
00072 class OpalRFC2833 :
public PObject {
00073 PCLASSINFO(
OpalRFC2833, PObject);
00074
public:
00075
OpalRFC2833(
00076
const PNotifier &
receiveNotifier
00077 );
00078
00079
virtual BOOL
SendTone(
00080
char tone,
00081
unsigned duration
00082 );
00083
00084
virtual BOOL
BeginTransmit(
00085
char tone
00086 );
00087
virtual BOOL
EndTransmit();
00088
00089
virtual void OnStartReceive(
00090
char tone
00091 );
00092
virtual void OnEndReceive(
00093
char tone,
00094
unsigned duration,
00095
unsigned timestamp
00096 );
00097
00098 RTP_DataFrame::PayloadTypes
GetPayloadType()
const {
return payloadType; }
00099
00100 void SetPayloadType(
00101 RTP_DataFrame::PayloadTypes type
00102 ) {
payloadType = type; }
00103
00104 const PNotifier &
GetReceiveHandler()
const {
return receiveHandler; }
00105 const PNotifier &
GetTransmitHandler()
const {
return transmitHandler; }
00106
00107
protected:
00108 PDECLARE_NOTIFIER(
RTP_DataFrame,
OpalRFC2833, ReceivedPacket);
00109 PDECLARE_NOTIFIER(
RTP_DataFrame,
OpalRFC2833, TransmitPacket);
00110 PDECLARE_NOTIFIER(PTimer,
OpalRFC2833, ReceiveTimeout);
00111 PDECLARE_NOTIFIER(PTimer,
OpalRFC2833, TransmitEnded);
00112
00113 RTP_DataFrame::PayloadTypes
payloadType;
00114
00115 PMutex
mutex;
00116
00117 PNotifier receiveNotifier;
00118 BOOL
receiveComplete;
00119 BYTE
receivedTone;
00120 unsigned receivedDuration;
00121 unsigned receiveTimestamp;
00122 PTimer
receiveTimer;
00123 PNotifier
receiveHandler;
00124
00125
enum {
00126
TransmitIdle,
00127
TransmitActive,
00128
TransmitEnding
00129 } transmitState;
00130 BYTE
transmitCode;
00131 unsigned transmitTimestamp;
00132 PTimer
transmitTimer;
00133 PNotifier
transmitHandler;
00134 };
00135
00136
00137
#endif // __OPAL_RFC2833_H
00138
00139