1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18 // ============================================================(Auto)=
19 // FILE: h245_copier.c
20 //
21 // DESC: PER Copy routines for H.245
22 // -------------------------------------------------------------------
23 // Copyright (c) 1998- 2000, PacketVideo Corporation.
24 // All Rights Reserved.
25 // ===================================================================
26
27 // ========================================================
28 // D E E P C O P Y R O U T I N E S
29 // ========================================================
30 // ****************************************************
31 // ** NOTE: This file is not auto-generated. **
32 // ** Add copy routines as needed in the application **
33 // ****************************************************
34
35 #include "oscl_base.h"
36 #include "oscl_mem.h"
37 #include "per_headers.h"
38 #include "h245def.h"
39 #include "h245_encoder.h"
40 #include "h245_decoder.h"
41 #include "h245_copier.h"
42
43 //-------------------------------------------------------------
44 // Copy_DataType()
45 //
46 // Generic copy routine for an H.245 DataType.
47 //-------------------------------------------------------------
48 OSCL_EXPORT_REF PS_DataType
Copy_DataType(PS_DataType x)49 Copy_DataType(PS_DataType x)
50 {
51 PS_OutStream outstream;
52 PS_InStream instream;
53 PS_DataType y;
54 uint8 *data_origin;
55
56 /* Encode original (x) to Outstream */
57 outstream = NewOutStream();
58 Encode_DataType(x, outstream);
59
60 /* Decode copy (y) from Instream */
61 instream = ConvertOutstreamToInstream(outstream);
62 data_origin = instream->data; // Save the origin for later OSCL_DEFAULT_FREE
63 y = (PS_DataType) OSCL_DEFAULT_MALLOC(sizeof(S_DataType));
64 Decode_DataType(y, instream);
65
66 /* Free the bitstream */
67 OSCL_DEFAULT_FREE(data_origin);
68 OSCL_DEFAULT_FREE(instream);
69
70 /* Return copy */
71 return(y);
72 }
73
74 //-------------------------------------------------------------
75 // Copy_H223LogicalChannelParameters()
76 //
77 // Generic copy routine for an H.245 H223LogicalChannelParameters.
78 //-------------------------------------------------------------
79 OSCL_EXPORT_REF PS_H223LogicalChannelParameters
Copy_H223LogicalChannelParameters(PS_H223LogicalChannelParameters x)80 Copy_H223LogicalChannelParameters(PS_H223LogicalChannelParameters x)
81 {
82 PS_OutStream outstream;
83 PS_InStream instream;
84 PS_H223LogicalChannelParameters y;
85 uint8 *data_origin;
86
87 /* Encode original (x) to Outstream */
88 outstream = NewOutStream();
89 Encode_H223LogicalChannelParameters(x, outstream);
90
91 /* Decode copy (y) from Instream */
92 instream = ConvertOutstreamToInstream(outstream);
93 data_origin = instream->data; // Save the origin for later OSCL_DEFAULT_FREE
94 y = (PS_H223LogicalChannelParameters) OSCL_DEFAULT_MALLOC(sizeof(S_H223LogicalChannelParameters));
95 Decode_H223LogicalChannelParameters(y, instream);
96
97 /* Free the bitstream */
98 OSCL_DEFAULT_FREE(data_origin);
99 OSCL_DEFAULT_FREE(instream);
100
101 /* Return copy */
102 return(y);
103 }
104
105 //-------------------------------------------------------------
106 // Copy_MultiplexEntryDescriptor()
107 //
108 // Generic copy routine for an H.245 MultiplexEntryDescriptor.
109 //-------------------------------------------------------------
110 PS_MultiplexEntryDescriptor
Copy_MultiplexEntryDescriptor(PS_MultiplexEntryDescriptor x)111 Copy_MultiplexEntryDescriptor(PS_MultiplexEntryDescriptor x)
112 {
113 PS_OutStream outstream;
114 PS_InStream instream;
115 PS_MultiplexEntryDescriptor y;
116 uint8 *data_origin;
117
118 /* Encode original (x) to Outstream */
119 outstream = NewOutStream();
120 Encode_MultiplexEntryDescriptor(x, outstream);
121
122 /* Decode copy (y) from Instream */
123 instream = ConvertOutstreamToInstream(outstream);
124 data_origin = instream->data; // Save the origin for later OSCL_DEFAULT_FREE
125 y = (PS_MultiplexEntryDescriptor) OSCL_DEFAULT_MALLOC(sizeof(S_MultiplexEntryDescriptor));
126 Decode_MultiplexEntryDescriptor(y, instream);
127
128 /* Free the bitstream */
129 OSCL_DEFAULT_FREE(data_origin);
130 OSCL_DEFAULT_FREE(instream);
131
132 /* Return copy */
133 return(y);
134 }
135
136 //-------------------------------------------------------------
137 // Copy_ForwardLogicalChannelParameters()
138 //
139 // Generic copy routine for an H.245 ForwardLogicalChannelParameters.
140 //-------------------------------------------------------------
141 PS_ForwardLogicalChannelParameters
Copy_ForwardLogicalChannelParameters(PS_ForwardLogicalChannelParameters x)142 Copy_ForwardLogicalChannelParameters(PS_ForwardLogicalChannelParameters x)
143 {
144 PS_OutStream outstream;
145 PS_InStream instream;
146 PS_ForwardLogicalChannelParameters y;
147 uint8 *data_origin;
148
149 /* Encode original (x) to Outstream */
150 outstream = NewOutStream();
151 Encode_ForwardLogicalChannelParameters(x, outstream);
152
153 /* Decode copy (y) from Instream */
154 instream = ConvertOutstreamToInstream(outstream);
155 data_origin = instream->data; // Save the origin for later OSCL_DEFAULT_FREE
156 y = (PS_ForwardLogicalChannelParameters) OSCL_DEFAULT_MALLOC(sizeof(S_ForwardLogicalChannelParameters));
157 Decode_ForwardLogicalChannelParameters(y, instream);
158
159 /* Free the bitstream */
160 OSCL_DEFAULT_FREE(data_origin);
161 OSCL_DEFAULT_FREE(instream);
162
163 /* Return copy */
164 return(y);
165 }
166
167 //-------------------------------------------------------------
168 // Copy_ReverseLogicalChannelParameters()
169 //
170 // Generic copy routine for an H.245 ReverseLogicalChannelParameters.
171 //-------------------------------------------------------------
172 PS_ReverseLogicalChannelParameters
Copy_ReverseLogicalChannelParameters(PS_ReverseLogicalChannelParameters x)173 Copy_ReverseLogicalChannelParameters(PS_ReverseLogicalChannelParameters x)
174 {
175 PS_OutStream outstream;
176 PS_InStream instream;
177 PS_ReverseLogicalChannelParameters y;
178 uint8 *data_origin;
179
180 /* Encode original (x) to Outstream */
181 outstream = NewOutStream();
182 Encode_ReverseLogicalChannelParameters(x, outstream);
183
184 /* Decode copy (y) from Instream */
185 instream = ConvertOutstreamToInstream(outstream);
186 data_origin = instream->data; // Save the origin for later OSCL_DEFAULT_FREE
187 y = (PS_ReverseLogicalChannelParameters) OSCL_DEFAULT_MALLOC(sizeof(S_ReverseLogicalChannelParameters));
188 Decode_ReverseLogicalChannelParameters(y, instream);
189
190 /* Free the bitstream */
191 OSCL_DEFAULT_FREE(data_origin);
192 OSCL_DEFAULT_FREE(instream);
193
194 /* Return copy */
195 return(y);
196 }
197
Copy_TerminalCapabilitySet(PS_TerminalCapabilitySet x)198 PS_TerminalCapabilitySet Copy_TerminalCapabilitySet(PS_TerminalCapabilitySet x)
199 {
200 PS_OutStream outstream;
201 PS_InStream instream;
202 PS_TerminalCapabilitySet y;
203 uint8 *data_origin;
204
205 /* Encode original (x) to Outstream */
206 outstream = NewOutStream();
207 Encode_TerminalCapabilitySet(x, outstream);
208
209 /* Decode copy (y) from Instream */
210 instream = ConvertOutstreamToInstream(outstream);
211 data_origin = instream->data; // Save the origin for later OSCL_DEFAULT_FREE
212 y = (PS_TerminalCapabilitySet) OSCL_DEFAULT_MALLOC(sizeof(S_TerminalCapabilitySet));
213 Decode_TerminalCapabilitySet(y, instream);
214
215 /* Free the bitstream */
216 OSCL_DEFAULT_FREE(data_origin);
217 OSCL_DEFAULT_FREE(instream);
218
219 /* Return copy */
220 return(y);
221 }
222