1 /*
2 * t38mf.cxx
3 *
4 * T.38 Media Format descriptions
5 *
6 * Open Phone Abstraction Library
7 * Formally known as the Open H323 project.
8 *
9 * Copyright (c) 2008 Vox Lucida
10 *
11 * The contents of this file are subject to the Mozilla Public License
12 * Version 1.0 (the "License"); you may not use this file except in
13 * compliance with the License. You may obtain a copy of the License at
14 * http://www.mozilla.org/MPL/
15 *
16 * Software distributed under the License is distributed on an "AS IS"
17 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18 * the License for the specific language governing rights and limitations
19 * under the License.
20 *
21 * The Original Code is Open Phone Abstraction Library
22 *
23 * The Initial Developer of the Original Code is Vox Lucida
24 *
25 * Contributor(s): ______________________________________.
26 *
27 * $Revision: 26914 $
28 * $Author: rjongbloed $
29 * $Date: 2012-01-31 18:18:04 -0600 (Tue, 31 Jan 2012) $
30 */
31
32 #include <ptlib.h>
33 #include <opal/buildopts.h>
34
35 #include <opal/mediafmt.h>
36 #include <opal/rtpconn.h>
37
38
39 #define new PNEW
40
41
42 #if OPAL_T38_CAPABILITY
43
44 #include <rtp/rtp.h>
45
46 OPAL_INSTANTIATE_MEDIATYPE(fax, OpalFaxMediaType);
47
48
49 /////////////////////////////////////////////////////////////////////////////
50
GetOpalT38()51 const OpalMediaFormat & GetOpalT38()
52 {
53 static class T38MediaFormat : public OpalMediaFormat {
54 public:
55 T38MediaFormat()
56 : OpalMediaFormat(OPAL_T38,
57 "fax",
58 RTP_DataFrame::T38,
59 "t38",
60 false, // No jitter for data
61 1440, // 100's bits/sec
62 528,
63 0,
64 0)
65 {
66 static const char * const RateMan[] = { "localTCF", "transferredTCF" };
67 AddOption(new OpalMediaOptionEnum("T38FaxRateManagement", false, RateMan, PARRAYSIZE(RateMan), OpalMediaOption::EqualMerge, 1));
68 AddOption(new OpalMediaOptionInteger("T38FaxVersion", false, OpalMediaOption::MinMerge, 0, 0, 1));
69 AddOption(new OpalMediaOptionInteger("T38MaxBitRate", false, OpalMediaOption::NoMerge, 14400, 1200, 14400));
70 AddOption(new OpalMediaOptionInteger("T38FaxMaxBuffer", false, OpalMediaOption::NoMerge, 2000, 10, 65535));
71 AddOption(new OpalMediaOptionInteger("T38FaxMaxDatagram", false, OpalMediaOption::NoMerge, 528, 10, 65535));
72 static const char * const UdpEC[] = { "t38UDPFEC", "t38UDPRedundancy" };
73 AddOption(new OpalMediaOptionEnum("T38FaxUdpEC", false, UdpEC, PARRAYSIZE(UdpEC), OpalMediaOption::AlwaysMerge, 1));
74 AddOption(new OpalMediaOptionBoolean("T38FaxFillBitRemoval", false, OpalMediaOption::NoMerge, false));
75 AddOption(new OpalMediaOptionBoolean("T38FaxTranscodingMMR", false, OpalMediaOption::NoMerge, false));
76 AddOption(new OpalMediaOptionBoolean("T38FaxTranscodingJBIG", false, OpalMediaOption::NoMerge, false));
77 AddOption(new OpalMediaOptionBoolean("Use-ECM", false, OpalMediaOption::NoMerge, true));
78 }
79 } const T38;
80 return T38;
81 }
82
83
84
85 /////////////////////////////////////////////////////////////////////////////
86
OpalFaxMediaType()87 OpalFaxMediaType::OpalFaxMediaType()
88 : OpalMediaTypeDefinition("fax", "image", 3) // Must be 3 for H.323 operation
89 {
90 }
91
92
GetRTPEncoding() const93 PString OpalFaxMediaType::GetRTPEncoding() const
94 {
95 return "udptl";
96 }
97
98
CreateRTPSession(OpalRTPConnection &,unsigned sessionID,bool remoteIsNAT)99 RTP_UDP * OpalFaxMediaType::CreateRTPSession(OpalRTPConnection &, unsigned sessionID, bool remoteIsNAT)
100 {
101 RTP_Session::Params params;
102 params.id = sessionID;
103 params.encoding = GetRTPEncoding();
104 params.remoteIsNAT = remoteIsNAT;
105 return new RTP_UDP(params);
106 }
107
108
CreateMediaSession(OpalConnection & conn,unsigned sessionID) const109 OpalMediaSession * OpalFaxMediaType::CreateMediaSession(OpalConnection & conn, unsigned sessionID) const
110 {
111 return new OpalRTPMediaSession(conn, m_mediaType, sessionID);
112 }
113
114
115 #endif // OPAL_T38_CAPABILITY
116
117
118 // End of File ///////////////////////////////////////////////////////////////
119