1 /*
2  * g7222mf.cxx
3  *
4  * GSM-AMR 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: 24049 $
28  * $Author: rjongbloed $
29  * $Date: 2010-02-10 17:51:53 -0600 (Wed, 10 Feb 2010) $
30  */
31 
32 #include <ptlib.h>
33 #include <opal/buildopts.h>
34 
35 #include <opal/mediafmt.h>
36 #include <codec/opalplugin.h>
37 #include <h323/h323caps.h>
38 
39 
40 #define new PNEW
41 
42 
43 /////////////////////////////////////////////////////////////////////////////
44 
45 class OpalG7222Format : public OpalAudioFormatInternal
46 {
47   public:
OpalG7222Format()48     OpalG7222Format()
49       : OpalAudioFormatInternal(OPAL_G7222, RTP_DataFrame::DynamicBase, "AMR-WB",  33, 160, 1, 1, 1, 8000, 0)
50     {
51       OpalMediaOption * option = new OpalMediaOptionInteger("Initial Mode", false, OpalMediaOption::MinMerge, 7);
52 #if OPAL_SIP
53       option->SetFMTPName("mode");
54       option->SetFMTPDefault("0");
55 #endif
56 #if OPAL_H323
57       OpalMediaOption::H245GenericInfo info;
58       info.ordinal = 1;
59       info.mode = OpalMediaOption::H245GenericInfo::NonCollapsing;
60       info.excludeTCS = info.excludeOLC = true;
61       option->SetH245Generic(info);
62 #endif
63       AddOption(option);
64 
65 #if OPAL_H323
66       option = FindOption(OpalAudioFormat::RxFramesPerPacketOption());
67       if (option != NULL) {
68         info.ordinal = 0; // All other fields the same as for the mode
69         info.excludeTCS = false;
70         info.excludeReqMode = true;
71         option->SetH245Generic(info);
72       }
73 #endif
74 
75       AddOption(new OpalMediaOptionString(PLUGINCODEC_MEDIA_PACKETIZATIONS, true, "RFC3267,RFC4867"));
76     }
77 };
78 
79 
80 #if OPAL_H323
81 class H323_G7222Capability : public H323GenericAudioCapability
82 {
83   public:
H323_G7222Capability()84     H323_G7222Capability()
85       : H323GenericAudioCapability(OpalPluginCodec_Identifer_G7222)
86     {
87     }
88 
Clone() const89     virtual PObject * Clone() const
90     {
91       return new H323_G7222Capability(*this);
92     }
93 
GetFormatName() const94     virtual PString GetFormatName() const
95     {
96       return OpalG7222;
97     }
98 };
99 #endif // OPAL_H323
100 
101 
102 
GetOpalG7222()103 const OpalAudioFormat & GetOpalG7222()
104 {
105   static OpalAudioFormat const G7222_Format(new OpalG7222Format);
106 
107 #if OPAL_H323
108   static H323CapabilityFactory::Worker<H323_G7222Capability> G7222_Factory(OPAL_G7222, true);
109 #endif // OPAL_H323
110 
111   return G7222_Format;
112 }
113 
114 
115 
116 // End of File ///////////////////////////////////////////////////////////////
117