1 /*
2  *  vob_pack_unpack.c
3  *
4  *  Copyright (C) Marzio Malanchini - August 2003
5  *
6  *  This file is part of transcode, a video stream processing tool
7  *
8  *  transcode is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2, or (at your option)
11  *  any later version.
12  *
13  *  transcode is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with GNU Make; see the file COPYING.  If not, write to
20  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */
23 
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
27 
28 #include <sys/types.h>
29 #include <sys/stat.h>
30 #include <unistd.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <stdio.h>
34 
35 
36 #include <vob_pack_unpack.h>
37 
38 #define MAX_BUF	102400
39 
f_vob_pack(char * p_option,vob_t * p_vob,int * p_size)40 char *f_vob_pack(char *p_option,vob_t *p_vob,int *p_size)
41 {
42 	static char *p_buffer=NULL;
43 	vob_pack_unpack_t	*p_pup_area;
44 
45 	if(!strcasecmp(p_option,"open"))
46 	{
47 		if (p_buffer==NULL)
48 		{
49 			p_buffer=(char *)calloc(MAX_BUF,1);
50 		}
51 		memset((char *)p_buffer,'\0',MAX_BUF);
52 		memcpy((char *)p_buffer,(char *)p_vob,sizeof(vob_t));
53 		*p_size=sizeof(vob_t);
54 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+sizeof(vob_t));
55 		if (p_vob->vmod_probed!=NULL)
56 		{
57 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
58 			p_pup_area->s_size=strlen(p_vob->vmod_probed);
59 			memcpy(p_pup_area->p_area,p_vob->vmod_probed,p_pup_area->s_size);
60 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
61 		}
62 		else
63 			p_pup_area->s_size=1;	/*only \0*/
64 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
65 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
66 		if (p_vob->amod_probed!=NULL)
67 		{
68 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
69 			p_pup_area->s_size=strlen(p_vob->amod_probed);
70 			memcpy(p_pup_area->p_area,p_vob->amod_probed,p_pup_area->s_size);
71 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
72 		}
73 		else
74 			p_pup_area->s_size=1;	/*only \0*/
75 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
76 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
77 		if (p_vob->vmod_probed_xml!=NULL)
78 		{
79 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
80 			p_pup_area->s_size=strlen(p_vob->vmod_probed_xml);
81 			memcpy(p_pup_area->p_area,p_vob->vmod_probed_xml,p_pup_area->s_size);
82 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
83 		}
84 		else
85 			p_pup_area->s_size=1;	/*only \0*/
86 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
87 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
88 		if (p_vob->amod_probed_xml!=NULL)
89 		{
90 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
91 			p_pup_area->s_size=strlen(p_vob->amod_probed_xml);
92 			memcpy(p_pup_area->p_area,p_vob->amod_probed_xml,p_pup_area->s_size);
93 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
94 		}
95 		else
96 			p_pup_area->s_size=1;	/*only \0*/
97 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
98 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
99 		if (p_vob->video_in_file!=NULL)
100 		{
101 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
102 			p_pup_area->s_size=strlen(p_vob->video_in_file);
103 			memcpy(p_pup_area->p_area,p_vob->video_in_file,p_pup_area->s_size);
104 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
105 		}
106 		else
107 			p_pup_area->s_size=1;	/*only \0*/
108 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
109 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
110 		if (p_vob->audio_in_file!=NULL)
111 		{
112 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
113 			p_pup_area->s_size=strlen(p_vob->audio_in_file);
114 			memcpy(p_pup_area->p_area,p_vob->audio_in_file,p_pup_area->s_size);
115 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
116 		}
117 		else
118 			p_pup_area->s_size=1;	/*only \0*/
119 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
120 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
121 		if (p_vob->nav_seek_file!=NULL)
122 		{
123 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
124 			p_pup_area->s_size=strlen(p_vob->nav_seek_file);
125 			memcpy(p_pup_area->p_area,p_vob->nav_seek_file,p_pup_area->s_size);
126 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
127 		}
128 		else
129 			p_pup_area->s_size=1;	/*only \0*/
130 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
131 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
132 		if (p_vob->vob_info_file!=NULL)
133 		{
134 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
135 			p_pup_area->s_size=strlen(p_vob->vob_info_file);
136 			memcpy(p_pup_area->p_area,p_vob->vob_info_file,p_pup_area->s_size);
137 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
138 		}
139 		else
140 			p_pup_area->s_size=1;	/*only \0*/
141 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
142 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
143 		if (p_vob->video_out_file!=NULL)
144 		{
145 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
146 			p_pup_area->s_size=strlen(p_vob->video_out_file);
147 			memcpy(p_pup_area->p_area,p_vob->video_out_file,p_pup_area->s_size);
148 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
149 		}
150 		else
151 			p_pup_area->s_size=1;	/*only \0*/
152 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
153 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
154 		if (p_vob->audio_out_file!=NULL)
155 		{
156 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
157 			p_pup_area->s_size=strlen(p_vob->audio_out_file);
158 			memcpy(p_pup_area->p_area,p_vob->audio_out_file,p_pup_area->s_size);
159 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
160 		}
161 		else
162 			p_pup_area->s_size=1;	/*only \0*/
163 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
164 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
165 		if (p_vob->divxlogfile!=NULL)
166 		{
167 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
168 			p_pup_area->s_size=strlen(p_vob->divxlogfile);
169 			memcpy(p_pup_area->p_area,p_vob->divxlogfile,p_pup_area->s_size);
170 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
171 		}
172 		else
173 			p_pup_area->s_size=1;	/*only \0*/
174 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
175 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
176 		if (p_vob->lame_preset!=NULL)
177 		{
178 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
179 			p_pup_area->s_size=strlen(p_vob->lame_preset);
180 			memcpy(p_pup_area->p_area,p_vob->lame_preset,p_pup_area->s_size);
181 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
182 		}
183 		else
184 			p_pup_area->s_size=1;	/*only \0*/
185 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
186 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
187 		if (p_vob->audiologfile!=NULL)
188 		{
189 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
190 			p_pup_area->s_size=strlen(p_vob->audiologfile);
191 			memcpy(p_pup_area->p_area,p_vob->audiologfile,p_pup_area->s_size);
192 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
193 		}
194 		else
195 			p_pup_area->s_size=1;	/*only \0*/
196 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
197 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
198 		if (p_vob->ex_v_fcc!=NULL)
199 		{
200 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
201 			p_pup_area->s_size=strlen(p_vob->ex_v_fcc);
202 			memcpy(p_pup_area->p_area,p_vob->ex_v_fcc,p_pup_area->s_size);
203 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
204 		}
205 		else
206 			p_pup_area->s_size=1;	/*only \0*/
207 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
208 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
209 		if (p_vob->ex_a_fcc!=NULL)
210 		{
211 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
212 			p_pup_area->s_size=strlen(p_vob->ex_a_fcc);
213 			memcpy(p_pup_area->p_area,p_vob->ex_a_fcc,p_pup_area->s_size);
214 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
215 		}
216 		else
217 			p_pup_area->s_size=1;	/*only \0*/
218 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
219 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
220 		if (p_vob->ex_profile_name!=NULL)
221 		{
222 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
223 			p_pup_area->s_size=strlen(p_vob->ex_profile_name);
224 			memcpy(p_pup_area->p_area,p_vob->ex_profile_name,p_pup_area->s_size);
225 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
226 		}
227 		else
228 			p_pup_area->s_size=1;	/*only \0*/
229 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
230 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
231 		if (p_vob->mod_path!=NULL)
232 		{
233 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
234 			p_pup_area->s_size=strlen(p_vob->mod_path);
235 			memcpy(p_pup_area->p_area,p_vob->mod_path,p_pup_area->s_size);
236 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
237 		}
238 		else
239 			p_pup_area->s_size=1;	/*only \0*/
240 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
241 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
242 		if (p_vob->im_v_string!=NULL)
243 		{
244 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
245 			p_pup_area->s_size=strlen(p_vob->im_v_string);
246 			memcpy(p_pup_area->p_area,p_vob->im_v_string,p_pup_area->s_size);
247 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
248 		}
249 		else
250 			p_pup_area->s_size=1;	/*only \0*/
251 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
252 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
253 		if (p_vob->im_a_string!=NULL)
254 		{
255 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
256 			p_pup_area->s_size=strlen(p_vob->im_a_string);
257 			memcpy(p_pup_area->p_area,p_vob->im_a_string,p_pup_area->s_size);
258 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
259 		}
260 		else
261 			p_pup_area->s_size=1;	/*only \0*/
262 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
263 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
264 		if (p_vob->ex_v_string!=NULL)
265 		{
266 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
267 			p_pup_area->s_size=strlen(p_vob->ex_v_string);
268 			memcpy(p_pup_area->p_area,p_vob->ex_v_string,p_pup_area->s_size);
269 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
270 		}
271 		else
272 			p_pup_area->s_size=1;	/*only \0*/
273 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
274 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
275 		if (p_vob->ex_a_string!=NULL)
276 		{
277 			p_pup_area->p_area=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
278 			p_pup_area->s_size=strlen(p_vob->ex_a_string);
279 			memcpy(p_pup_area->p_area,p_vob->ex_a_string,p_pup_area->s_size);
280 			p_pup_area->s_size+=1;	/*strlen + \0 so the strings will be terminated*/
281 		}
282 		else
283 			p_pup_area->s_size=1;	/*only \0*/
284 		*p_size=*p_size+p_pup_area->s_size+sizeof(vob_pack_unpack_t);
285 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+*p_size); /*pointer to the next section*/
286 
287 	/* avifile_in and avifile_out are setting by the export_module*/
288 	/* ttime not used in export_module*/
289 
290 		return(p_buffer);
291 	}
292 	else if(!strcasecmp(p_option,"close"))
293 	{
294 		free(p_buffer);
295 		p_buffer=NULL;
296 		return(NULL);
297 	}
298 	return(NULL);
299 }
300 
301 
f_vob_unpack(char * p_option,char * p_area,int s_size)302 vob_t *f_vob_unpack(char *p_option,char *p_area,int s_size)
303 {
304 	static char *p_buffer=NULL,*p_pun_buf;
305 	int s_cont;
306 	vob_pack_unpack_t	*p_pup_area;
307 	vob_t	*p_vob;
308 
309 	if(!strcasecmp(p_option,"open"))
310 	{
311 		if (p_buffer==NULL)
312 		{
313 			p_buffer=(char *)calloc(MAX_BUF,1);
314 		}
315 		memset((char *)p_buffer,'\0',MAX_BUF);
316 		memcpy((char *)p_buffer,p_area,s_size);
317 		p_vob=(vob_t *)p_buffer;
318 		s_cont=sizeof(vob_t);
319 
320 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
321 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
322 		if (p_pup_area->s_size==1)
323 			p_pun_buf=NULL;
324 		p_vob->vmod_probed=p_pun_buf;
325 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
326 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
327 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
328 		if (p_pup_area->s_size==1)
329 			p_pun_buf=NULL;
330 		p_vob->amod_probed=p_pun_buf;
331 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
332 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
333 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
334 		if (p_pup_area->s_size==1)
335 			p_pun_buf=NULL;
336 		p_vob->vmod_probed_xml=p_pun_buf;
337 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
338 
339 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
340 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
341 		if (p_pup_area->s_size==1)
342 			p_pun_buf=NULL;
343 		p_vob->amod_probed_xml=p_pun_buf;
344 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
345 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
346 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
347 		if (p_pup_area->s_size==1)
348 			p_pun_buf=NULL;
349 		p_vob->video_in_file=p_pun_buf;
350 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
351 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
352 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
353 		if (p_pup_area->s_size==1)
354 			p_pun_buf=NULL;
355 		p_vob->audio_in_file=p_pun_buf;
356 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
357 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
358 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
359 		if (p_pup_area->s_size==1)
360 			p_pun_buf=NULL;
361 		p_vob->nav_seek_file=p_pun_buf;
362 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
363 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
364 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
365 		if (p_pup_area->s_size==1)
366 			p_pun_buf=NULL;
367 		p_vob->vob_info_file=p_pun_buf;
368 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
369 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
370 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
371 		if (p_pup_area->s_size==1)
372 			p_pun_buf=NULL;
373 		p_vob->video_out_file=p_pun_buf;
374 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
375 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
376 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
377 		if (p_pup_area->s_size==1)
378 			p_pun_buf=NULL;
379 		p_vob->audio_out_file=p_pun_buf;
380 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
381 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
382 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
383 		if (p_pup_area->s_size==1)
384 			p_pun_buf=NULL;
385 		p_vob->divxlogfile=p_pun_buf;
386 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
387 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
388 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
389 		if (p_pup_area->s_size==1)
390 			p_pun_buf=NULL;
391 		p_vob->lame_preset=p_pun_buf;
392 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
393 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
394 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
395 		if (p_pup_area->s_size==1)
396 			p_pun_buf=NULL;
397 		p_vob->audiologfile=p_pun_buf;
398 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
399 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
400 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
401 		if (p_pup_area->s_size==1)
402 			p_pun_buf=NULL;
403 		p_vob->ex_v_fcc=p_pun_buf;
404 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
405 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
406 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
407 		if (p_pup_area->s_size==1)
408 			p_pun_buf=NULL;
409 		p_vob->ex_a_fcc=p_pun_buf;
410 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
411 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
412 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
413 		if (p_pup_area->s_size==1)
414 			p_pun_buf=NULL;
415 		p_vob->ex_profile_name=p_pun_buf;
416 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
417 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
418 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
419 		if (p_pup_area->s_size==1)
420 			p_pun_buf=NULL;
421 		p_vob->mod_path=p_pun_buf;
422 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
423 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
424 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
425 		if (p_pup_area->s_size==1)
426 			p_pun_buf=NULL;
427 		p_vob->im_v_string=p_pun_buf;
428 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
429 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
430 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
431 		if (p_pup_area->s_size==1)
432 			p_pun_buf=NULL;
433 		p_vob->im_a_string=p_pun_buf;
434 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
435 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
436 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
437 		if (p_pup_area->s_size==1)
438 			p_pun_buf=NULL;
439 		p_vob->ex_v_string=p_pun_buf;
440 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
441 		p_pup_area=(vob_pack_unpack_t *)(p_buffer+s_cont); /*pointer to the next section*/
442 		p_pun_buf=(char *)((char *)p_pup_area+sizeof(vob_pack_unpack_t));
443 		if (p_pup_area->s_size==1)
444 			p_pun_buf=NULL;
445 		p_vob->ex_a_string=p_pun_buf;
446 		s_cont+=p_pup_area->s_size+sizeof(vob_pack_unpack_t);
447 
448 	/* avifile_in and avifile_out are setting by the export_module*/
449 	/* ttime not used in export_module*/
450 
451 		p_vob->avifile_in=(avi_t *)NULL;
452 		p_vob->avifile_out=(avi_t *)NULL;
453 		p_vob->ttime=NULL;
454 
455 		return(p_vob);
456 	}
457 	else if(!strcasecmp(p_option,"close"))
458 	{
459 		free(p_buffer);
460 		p_buffer=NULL;
461 		return(NULL);
462 	}
463 	return(NULL);
464 }
465