Mercurial > mplayer.hg
annotate libmpdemux/demux_viv.c @ 3241:71075e783b04
fixed xanim detection (also present on non-x86 too - look at xanim homepage) and added tv into _inputmodules
author | alex |
---|---|
date | Sat, 01 Dec 2001 14:41:54 +0000 |
parents | c0e6a39d2ab7 |
children | 1e2a87b7cae8 |
rev | line source |
---|---|
2687 | 1 // VIVO file parser by A'rpi |
2784 | 2 // VIVO text header parser by alex |
2687 | 3 |
4 #include <stdio.h> | |
5 #include <stdlib.h> | |
6 #include <unistd.h> | |
2928 | 7 #include <string.h> /* strtok */ |
2687 | 8 |
9 #include "config.h" | |
10 #include "mp_msg.h" | |
11 #include "help_mp.h" | |
12 | |
13 #include "stream.h" | |
14 #include "demuxer.h" | |
15 #include "stheader.h" | |
16 | |
17 #include "bswap.h" | |
18 | |
19 typedef struct { | |
2784 | 20 /* generic */ |
3113
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
21 char version; |
2784 | 22 int supported; |
23 /* info */ | |
24 char *title; | |
25 char *author; | |
26 char *copyright; | |
27 char *producer; | |
28 /* video */ | |
29 float fps; | |
30 int width; | |
31 int height; | |
32 int disp_width; | |
33 int disp_height; | |
34 /* audio */ | |
35 int br; | |
36 int samplerate; | |
2687 | 37 } vivo_priv_t; |
38 | |
2784 | 39 /* parse all possible extra headers */ |
40 /* (audio headers are seperate - mostly with recordtype=3) */ | |
41 #define TEXTPARSE_ALL 1 | |
42 | |
43 static void vivo_parse_text_header(demuxer_t *demux, int header_len) | |
44 { | |
45 vivo_priv_t* priv = demux->priv; | |
46 char *buf; | |
47 int i; | |
48 char *token; | |
49 char *opt, *param; | |
50 | |
51 if (!demux->priv) | |
52 { | |
53 priv = malloc(sizeof(vivo_priv_t)); | |
54 memset(priv, 0, sizeof(vivo_priv_t)); | |
55 demux->priv = priv; | |
56 priv->supported = 0; | |
57 } | |
58 | |
59 buf = malloc(header_len); | |
60 opt = malloc(header_len); | |
61 param = malloc(header_len); | |
62 stream_read(demux->stream, buf, header_len); | |
63 i=0; | |
64 while(i<header_len && buf[i]==0x0D && buf[i+1]==0x0A) i+=2; // skip empty lines | |
65 | |
66 token = strtok(buf, (char *)&("\x0d\x0a")); | |
67 while (token && (header_len>2)) | |
68 { | |
69 header_len -= strlen(token)+2; | |
70 if (sscanf(token, "%[^:]:%[^\n]", opt, param) != 2) | |
71 { | |
72 mp_msg(MSGT_DEMUX, MSGL_V, "viv_text_header_parser: bad line: '%s' at ~%p\n", | |
73 token, stream_tell(demux->stream)); | |
74 break; | |
75 } | |
76 mp_msg(MSGT_DEMUX, MSGL_DBG3, "token: '%s' (%d bytes/%d bytes left)\n", | |
77 token, strlen(token), header_len); | |
78 mp_msg(MSGT_DEMUX, MSGL_DBG3, "token => o: '%s', p: '%s'\n", | |
79 opt, param); | |
80 | |
81 /* checking versions: only v1 or v2 is suitable (or known?:) */ | |
82 if (!strcmp(opt, "Version")) | |
83 { | |
84 mp_msg(MSGT_DEMUX, MSGL_DBG2, "Version: %s\n", param); | |
2928 | 85 if (!strncmp(param, "Vivo/1", 6) || !strncmp(param, "Vivo/2", 6)) |
3113
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
86 { |
2928 | 87 // if (atoi(param) == 1 || atoi(param) == 2) |
2784 | 88 priv->supported = 1; |
3113
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
89 /* safe version for fourcc */ |
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
90 priv->version = param[5]; |
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
91 } |
2784 | 92 } |
93 | |
94 /* video specific */ | |
95 if (!strcmp(opt, "FPS")) | |
96 { | |
97 mp_msg(MSGT_DEMUX, MSGL_DBG2, "FPS: %f\n", atof(param)); | |
98 priv->fps = atof(param); | |
99 } | |
100 if (!strcmp(opt, "Width")) | |
101 { | |
102 mp_msg(MSGT_DEMUX, MSGL_DBG2, "Width: %d\n", atoi(param)); | |
103 priv->width = atoi(param); | |
104 } | |
105 if (!strcmp(opt, "Height")) | |
106 { | |
107 mp_msg(MSGT_DEMUX, MSGL_DBG2, "Height: %d\n", atoi(param)); | |
108 priv->height = atoi(param); | |
109 } | |
110 if (!strcmp(opt, "DisplayWidth")) | |
111 { | |
112 mp_msg(MSGT_DEMUX, MSGL_DBG2, "Display Width: %d\n", atoi(param)); | |
113 priv->disp_width = atoi(param); | |
114 } | |
115 if (!strcmp(opt, "DisplayHeight")) | |
116 { | |
117 mp_msg(MSGT_DEMUX, MSGL_DBG2, "Display Height: %d\n", atoi(param)); | |
118 priv->disp_height = atoi(param); | |
119 } | |
120 | |
121 /* audio specific */ | |
122 if (!strcmp(opt, "NominalBitrate")) | |
123 { | |
124 mp_msg(MSGT_DEMUX, MSGL_DBG2, "Bitrate: %d\n", atoi(param)); | |
125 priv->br = atoi(param); | |
126 } | |
127 if (!strcmp(opt, "SamplingFrequency")) | |
128 { | |
129 mp_msg(MSGT_DEMUX, MSGL_DBG2, "Samplerate: %d\n", atoi(param)); | |
130 priv->samplerate = atoi(param); | |
131 } | |
132 | |
133 /* only for displaying some informations about movie*/ | |
134 if (!strcmp(opt, "Title")) | |
135 { | |
136 mp_msg(MSGT_DEMUX, MSGL_INFO, " Title: %s\n", param); | |
3068 | 137 demux_info_add(demux, "name", param); |
2784 | 138 priv->title = malloc(strlen(param)); |
139 strcpy(priv->title, param); | |
140 } | |
141 if (!strcmp(opt, "Author")) | |
142 { | |
143 mp_msg(MSGT_DEMUX, MSGL_INFO, " Author: %s\n", param); | |
3068 | 144 demux_info_add(demux, "author", param); |
2784 | 145 priv->author = malloc(strlen(param)); |
146 strcpy(priv->author, param); | |
147 } | |
148 if (!strcmp(opt, "Copyright")) | |
149 { | |
150 mp_msg(MSGT_DEMUX, MSGL_INFO, " Copyright: %s\n", param); | |
3068 | 151 demux_info_add(demux, "copyright", param); |
2784 | 152 priv->copyright = malloc(strlen(param)); |
153 strcpy(priv->copyright, param); | |
154 } | |
155 if (!strcmp(opt, "Producer")) | |
156 { | |
157 mp_msg(MSGT_DEMUX, MSGL_INFO, " Producer: %s\n", param); | |
3069 | 158 demux_info_add(demux, "encoder", param); |
2784 | 159 priv->producer = malloc(strlen(param)); |
160 strcpy(priv->producer, param); | |
161 } | |
162 | |
163 /* get next token */ | |
164 token = strtok(NULL, (char *)&("\x0d\x0a")); | |
165 } | |
2788 | 166 |
167 if (buf) | |
168 free(buf); | |
169 if (opt) | |
170 free(opt); | |
171 if (param) | |
172 free(param); | |
2784 | 173 } |
174 | |
2687 | 175 int vivo_check_file(demuxer_t* demuxer){ |
176 int flags=0; | |
177 int i=0; | |
178 int len; | |
179 int len2; | |
180 int c; | |
181 unsigned char buf[2048+256]; | |
182 vivo_priv_t* priv; | |
2784 | 183 int orig_pos = stream_tell(demuxer->stream); |
2687 | 184 |
185 mp_msg(MSGT_DEMUX,MSGL_V,"Checking for VIVO\n"); | |
186 | |
187 c=stream_read_char(demuxer->stream); | |
2792 | 188 if(c==-256) return 0; |
2687 | 189 len=0; |
190 while((c=stream_read_char(demuxer->stream))>=0x80){ | |
191 len+=0x80*(c-0x80); | |
192 if(len>1024) return 0; | |
193 } | |
194 len+=c; | |
195 printf("header block 1 size: %d\n",len); | |
196 //stream_skip(demuxer->stream,len); | |
2928 | 197 |
198 priv=malloc(sizeof(vivo_priv_t)); | |
199 memset(priv,0,sizeof(vivo_priv_t)); | |
200 demuxer->priv=priv; | |
2784 | 201 |
2805 | 202 #if 0 |
2785 | 203 vivo_parse_text_header(demuxer, len); |
2784 | 204 if (priv->supported == 0) |
205 return 0; | |
206 #else | |
2928 | 207 /* this is enought for check (for now) */ |
208 stream_read(demuxer->stream,buf,len); | |
209 buf[len]=0; | |
210 // printf("VIVO header: '%s'\n",buf); | |
211 | |
2687 | 212 // parse header: |
213 i=0; | |
214 while(i<len && buf[i]==0x0D && buf[i+1]==0x0A) i+=2; // skip empty lines | |
2695 | 215 if(strncmp(buf+i,"Version:Vivo/",13)) return 0; // bad version/type! |
2784 | 216 #endif |
2687 | 217 |
2695 | 218 #if 0 |
2687 | 219 c=stream_read_char(demuxer->stream); |
220 if(c) return 0; | |
221 len2=0; | |
222 while((c=stream_read_char(demuxer->stream))>=0x80){ | |
223 len2+=0x80*(c-0x80); | |
224 if(len+len2>2048) return 0; | |
225 } | |
226 len2+=c; | |
227 printf("header block 2 size: %d\n",len2); | |
228 stream_skip(demuxer->stream,len2); | |
229 // stream_read(demuxer->stream,buf+len,len2); | |
2695 | 230 #endif |
2687 | 231 |
232 // c=stream_read_char(demuxer->stream); | |
233 // printf("first packet: %02X\n",c); | |
234 | |
2784 | 235 stream_seek(demuxer->stream, orig_pos); |
236 | |
2687 | 237 return 1; |
238 } | |
239 | |
240 // return value: | |
241 // 0 = EOF or no stream found | |
242 // 1 = successfully read a packet | |
243 int demux_vivo_fill_buffer(demuxer_t *demux){ | |
244 demux_stream_t *ds=NULL; | |
245 int c; | |
246 int len=0; | |
247 int seq; | |
248 demux->filepos=stream_tell(demux->stream); | |
249 | |
250 c=stream_read_char(demux->stream); | |
2792 | 251 if (c == -256) /* EOF */ |
252 return 0; | |
2695 | 253 // printf("c=%02X\n",c); |
2687 | 254 switch(c&0xF0){ |
2695 | 255 case 0x00: // header - skip it! |
2784 | 256 { |
2687 | 257 len=stream_read_char(demux->stream); |
2695 | 258 if(len>=0x80) len=0x80*(len-0x80)+stream_read_char(demux->stream); |
259 printf("vivo extra header: %d bytes\n",len); | |
2784 | 260 #ifdef TEXTPARSE_ALL |
261 { | |
262 int pos; | |
263 /* also try to parse all headers */ | |
264 pos = stream_tell(demux->stream); | |
265 vivo_parse_text_header(demux, len); | |
266 stream_seek(demux->stream, pos); | |
267 } | |
268 #endif | |
2687 | 269 break; |
2784 | 270 } |
2687 | 271 case 0x10: // video packet |
272 len=128; | |
273 ds=demux->video; | |
274 break; | |
275 case 0x20: // video packet | |
276 len=stream_read_char(demux->stream); | |
277 ds=demux->video; | |
278 break; | |
3068 | 279 case 0x30: // audio packet |
280 len=40; /* 40kbps */ | |
2695 | 281 ds=demux->audio; |
282 break; | |
2687 | 283 case 0x40: // audio packet |
3068 | 284 len=24; /* 24kbps */ |
2687 | 285 ds=demux->audio; |
286 break; | |
287 default: | |
288 mp_msg(MSGT_DEMUX,MSGL_WARN,"VIVO - unknown ID found: %02X contact author!\n",c); | |
289 } | |
290 | |
2695 | 291 if(!ds || ds->id<-1){ |
2687 | 292 if(len) stream_skip(demux->stream,len); |
293 return 1; | |
294 } | |
295 | |
296 seq=c&0x0F; | |
297 | |
298 if(ds->asf_packet){ | |
299 if(ds->asf_seq!=seq){ | |
300 // closed segment, finalize packet: | |
301 ds_add_packet(ds,ds->asf_packet); | |
302 ds->asf_packet=NULL; | |
2695 | 303 // printf("packet!\n"); |
2687 | 304 } else { |
305 // append data to it! | |
306 demux_packet_t* dp=ds->asf_packet; | |
307 dp->buffer=realloc(dp->buffer,dp->len+len); | |
308 //memcpy(dp->buffer+dp->len,data,len); | |
309 stream_read(demux->stream,dp->buffer+dp->len,len); | |
310 mp_dbg(MSGT_DEMUX,MSGL_DBG4,"data appended! %d+%d\n",dp->len,len); | |
311 dp->len+=len; | |
312 // we are ready now. | |
2695 | 313 if((c&0xF0)==0x20) --ds->asf_seq; // hack! |
2687 | 314 return 1; |
315 } | |
316 } | |
317 // create new packet: | |
318 { demux_packet_t* dp; | |
319 dp=new_demux_packet(len); | |
320 //memcpy(dp->buffer,data,len); | |
321 stream_read(demux->stream,dp->buffer,len); | |
322 // dp->pts=time*0.001f; | |
323 // dp->flags=keyframe; | |
324 // if(ds==demux->video) printf("ASF time: %8d dur: %5d \n",time,dur); | |
325 dp->pos=demux->filepos; | |
326 ds->asf_packet=dp; | |
327 ds->asf_seq=seq; | |
328 // we are ready now. | |
329 return 1; | |
330 } | |
331 | |
332 } | |
333 | |
334 static const short h263_format[8][2] = { | |
335 { 0, 0 }, | |
336 { 128, 96 }, | |
337 { 176, 144 }, | |
338 { 352, 288 }, | |
339 { 704, 576 }, | |
340 { 1408, 1152 }, | |
2784 | 341 { 320, 240 } // ??????? or 240x180 (found in vivo2) ? |
2687 | 342 }; |
343 | |
344 static unsigned char* buffer; | |
345 static int bufptr=0; | |
346 static int bitcnt=0; | |
347 static unsigned char buf=0; | |
348 static int format, width, height; | |
349 | |
350 static unsigned int x_get_bits(int n){ | |
351 unsigned int x=0; | |
352 while(n-->0){ | |
353 if(!bitcnt){ | |
354 // fill buff | |
355 buf=buffer[bufptr++]; | |
356 bitcnt=8; | |
357 } | |
358 //x=(x<<1)|(buf&1);buf>>=1; | |
359 x=(x<<1)|(buf>>7);buf<<=1; | |
360 --bitcnt; | |
361 } | |
362 return x; | |
363 } | |
364 | |
365 #define get_bits(xxx,n) x_get_bits(n) | |
366 #define get_bits1(xxx) x_get_bits(1) | |
367 #define skip_bits(xxx,n) x_get_bits(n) | |
368 #define skip_bits1(xxx) x_get_bits(1) | |
369 | |
370 /* most is hardcoded. should extend to handle all h263 streams */ | |
371 static int h263_decode_picture_header(unsigned char *b_ptr) | |
372 { | |
2928 | 373 // int i; |
2695 | 374 |
375 // for(i=0;i<16;i++) printf(" %02X",b_ptr[i]); printf("\n"); | |
2687 | 376 |
377 buffer=b_ptr; | |
378 bufptr=bitcnt=buf=0; | |
379 | |
380 /* picture header */ | |
2695 | 381 if (get_bits(&s->gb, 22) != 0x20){ |
382 printf("bad picture header\n"); | |
2687 | 383 return -1; |
2695 | 384 } |
2687 | 385 skip_bits(&s->gb, 8); /* picture timestamp */ |
386 | |
2695 | 387 if (get_bits1(&s->gb) != 1){ |
388 printf("bad marker\n"); | |
2687 | 389 return -1; /* marker */ |
2695 | 390 } |
391 if (get_bits1(&s->gb) != 0){ | |
392 printf("bad h263 id\n"); | |
2687 | 393 return -1; /* h263 id */ |
2695 | 394 } |
2687 | 395 skip_bits1(&s->gb); /* split screen off */ |
396 skip_bits1(&s->gb); /* camera off */ | |
397 skip_bits1(&s->gb); /* freeze picture release off */ | |
398 | |
399 format = get_bits(&s->gb, 3); | |
400 | |
401 if (format != 7) { | |
402 printf("h263_plus = 0 format = %d\n",format); | |
403 /* H.263v1 */ | |
404 width = h263_format[format][0]; | |
405 height = h263_format[format][1]; | |
406 printf("%d x %d\n",width,height); | |
2695 | 407 // if (!width) return -1; |
2687 | 408 |
409 printf("pict_type=%d\n",get_bits1(&s->gb)); | |
410 printf("unrestricted_mv=%d\n",get_bits1(&s->gb)); | |
411 #if 1 | |
412 printf("SAC: %d\n",get_bits1(&s->gb)); | |
413 printf("advanced prediction mode: %d\n",get_bits1(&s->gb)); | |
414 printf("PB frame: %d\n",get_bits1(&s->gb)); | |
415 #else | |
416 if (get_bits1(&s->gb) != 0) | |
417 return -1; /* SAC: off */ | |
418 if (get_bits1(&s->gb) != 0) | |
419 return -1; /* advanced prediction mode: off */ | |
420 if (get_bits1(&s->gb) != 0) | |
421 return -1; /* not PB frame */ | |
422 #endif | |
423 printf("qscale=%d\n",get_bits(&s->gb, 5)); | |
424 skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */ | |
425 } else { | |
426 printf("h263_plus = 1\n"); | |
427 /* H.263v2 */ | |
2695 | 428 if (get_bits(&s->gb, 3) != 1){ |
429 printf("H.263v2 A error\n"); | |
2687 | 430 return -1; |
2695 | 431 } |
432 if (get_bits(&s->gb, 3) != 6){ /* custom source format */ | |
433 printf("custom source format\n"); | |
2687 | 434 return -1; |
2695 | 435 } |
2687 | 436 skip_bits(&s->gb, 12); |
437 skip_bits(&s->gb, 3); | |
438 printf("pict_type=%d\n",get_bits(&s->gb, 3) + 1); | |
439 // if (s->pict_type != I_TYPE && | |
440 // s->pict_type != P_TYPE) | |
441 // return -1; | |
442 skip_bits(&s->gb, 7); | |
443 skip_bits(&s->gb, 4); /* aspect ratio */ | |
444 width = (get_bits(&s->gb, 9) + 1) * 4; | |
445 skip_bits1(&s->gb); | |
446 height = get_bits(&s->gb, 9) * 4; | |
447 printf("%d x %d\n",width,height); | |
2695 | 448 //if (height == 0) |
449 // return -1; | |
2687 | 450 printf("qscale=%d\n",get_bits(&s->gb, 5)); |
451 } | |
452 | |
453 /* PEI */ | |
454 while (get_bits1(&s->gb) != 0) { | |
455 skip_bits(&s->gb, 8); | |
456 } | |
457 // s->f_code = 1; | |
458 // s->width = width; | |
459 // s->height = height; | |
460 return 0; | |
461 } | |
462 | |
463 | |
2695 | 464 |
2687 | 465 void demux_open_vivo(demuxer_t* demuxer){ |
466 vivo_priv_t* priv=demuxer->priv; | |
467 | |
468 if(!ds_fill_buffer(demuxer->video)){ | |
469 mp_msg(MSGT_DEMUX,MSGL_ERR,"VIVO: " MSGTR_MissingVideoStreamBug); | |
470 return; | |
471 } | |
472 | |
473 h263_decode_picture_header(demuxer->video->buffer); | |
474 | |
475 | |
476 { sh_video_t* sh=new_sh_video(demuxer,0); | |
3113
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
477 |
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
478 /* viv1, viv2 (for better codecs.conf) */ |
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
479 sh->format = mmioFOURCC('v', 'i', 'v', priv->version); |
c0e6a39d2ab7
changed to generate fourcc's like: viv<version> -> viv1,viv2
alex
parents:
3069
diff
changeset
|
480 // sh->format=0x6f766976; // "vivo" |
2784 | 481 if(!sh->fps) |
2928 | 482 { |
2784 | 483 if (priv->fps) |
484 sh->fps=priv->fps; | |
485 else | |
486 sh->fps=15.0f; | |
2928 | 487 } |
2687 | 488 sh->frametime=1.0f/sh->fps; |
2805 | 489 |
490 #warning "FIXME! we can't scale" | |
491 priv->disp_width = priv->width; | |
492 priv->disp_height = priv->height; | |
493 | |
2784 | 494 if (priv->disp_width) |
495 sh->disp_w = priv->disp_width; | |
496 else | |
497 sh->disp_w = width; | |
498 if (priv->disp_height) | |
499 sh->disp_h = priv->disp_height; | |
500 else | |
501 sh->disp_h = height; | |
2687 | 502 |
503 // emulate BITMAPINFOHEADER: | |
504 sh->bih=malloc(sizeof(BITMAPINFOHEADER)); | |
505 memset(sh->bih,0,sizeof(BITMAPINFOHEADER)); | |
506 sh->bih->biSize=40; | |
2784 | 507 if (priv->width) |
508 sh->bih->biWidth = priv->width; | |
509 else | |
510 sh->bih->biWidth = width; | |
511 if (priv->height) | |
512 sh->bih->biHeight = priv->height; | |
513 else | |
514 sh->bih->biHeight = height; | |
2687 | 515 sh->bih->biPlanes=1; |
516 sh->bih->biBitCount=24; | |
517 sh->bih->biCompression=sh->format; | |
518 sh->bih->biSizeImage=sh->bih->biWidth*sh->bih->biHeight*3; | |
519 demuxer->video->sh=sh; sh->ds=demuxer->video; | |
520 demuxer->video->id=0; | |
2928 | 521 |
522 demuxer->seekable = 0; | |
2788 | 523 |
2928 | 524 printf("VIVO Video stream %d size: display: %dx%d, codec: %lux%lu\n", |
2788 | 525 demuxer->video->id, sh->disp_w, sh->disp_h, sh->bih->biWidth, |
526 sh->bih->biHeight); | |
2687 | 527 } |
528 | |
2695 | 529 if(demuxer->audio->id>=-1){ |
2687 | 530 if(!ds_fill_buffer(demuxer->audio)){ |
531 mp_msg(MSGT_DEMUX,MSGL_ERR,"VIVO: " MSGTR_MissingAudioStream); | |
532 } else | |
533 { sh_audio_t* sh=new_sh_audio(demuxer,1); | |
2788 | 534 |
2687 | 535 sh->format=0x111; // 0x112 |
3068 | 536 // if (sh->format == 0x111) /* G.723 */ |
537 // sh->samplesize = demuxer->audio->buffer_size; | |
538 // printf("samplesize: %d\n", sh->samplesize); | |
2687 | 539 // Emulate WAVEFORMATEX struct: |
540 sh->wf=malloc(sizeof(WAVEFORMATEX)); | |
541 memset(sh->wf,0,sizeof(WAVEFORMATEX)); | |
542 sh->wf->nChannels=1; | |
543 sh->wf->wBitsPerSample=16; | |
2788 | 544 // sh->wf->wBitsPerSample=8; |
2784 | 545 if (priv->samplerate) |
546 sh->wf->nSamplesPerSec=priv->samplerate; | |
547 else | |
548 sh->wf->nSamplesPerSec=22050; | |
2788 | 549 // sh->wf->nSamplesPerSec=8000; |
2687 | 550 sh->wf->nAvgBytesPerSec=sh->wf->nChannels*sh->wf->wBitsPerSample*sh->wf->nSamplesPerSec/8; |
551 demuxer->audio->sh=sh; sh->ds=demuxer->audio; | |
552 demuxer->audio->id=1; | |
553 } | |
2695 | 554 } |
2687 | 555 |
556 } | |
557 | |
2788 | 558 void demux_close_vivo(demuxer_t *demuxer) |
559 { | |
560 vivo_priv_t* priv=demuxer->priv; | |
2809 | 561 |
562 if (priv) { | |
563 if (priv->title) | |
564 free(priv->title); | |
565 if (priv->author) | |
566 free(priv->author); | |
567 if (priv->copyright) | |
568 free(priv->copyright); | |
569 if (priv->producer) | |
570 free(priv->producer); | |
2788 | 571 free(priv); |
2809 | 572 } |
2788 | 573 return; |
574 } |