Mercurial > mplayer.hg
comparison libmpdemux/demux_ogg.c @ 5429:e9e2dc1306b1
BITMAPINFOHEADER fixed to be accepted by win32 decoders (divx,divxds)
author | arpi |
---|---|
date | Sun, 31 Mar 2002 20:17:27 +0000 |
parents | a43b00b28081 |
children | 779ebb242aec |
comparison
equal
deleted
inserted
replaced
5428:a43b00b28081 | 5429:e9e2dc1306b1 |
---|---|
284 | 284 |
285 // Old video header | 285 // Old video header |
286 if(*(int32_t*)(pack.packet+96) == 0x05589f80 && pack.bytes >= 184) { | 286 if(*(int32_t*)(pack.packet+96) == 0x05589f80 && pack.bytes >= 184) { |
287 sh_v = new_sh_video(demuxer,ogg_d->num_sub); | 287 sh_v = new_sh_video(demuxer,ogg_d->num_sub); |
288 sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); | 288 sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); |
289 sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); | |
290 sh_v->bih->biCompression= | |
289 sh_v->format = mmioFOURCC(pack.packet[68],pack.packet[69], | 291 sh_v->format = mmioFOURCC(pack.packet[68],pack.packet[69], |
290 pack.packet[70],pack.packet[71]); | 292 pack.packet[70],pack.packet[71]); |
291 sh_v->frametime = (*(int64_t*)(pack.packet+164))*0.0000001; | 293 sh_v->frametime = (*(int64_t*)(pack.packet+164))*0.0000001; |
292 sh_v->fps = 1/sh_v->frametime; | 294 sh_v->fps = 1/sh_v->frametime; |
293 sh_v->disp_w = sh_v->bih->biWidth = *(int32_t*)(pack.packet+176); | 295 sh_v->disp_w = sh_v->bih->biWidth = *(int32_t*)(pack.packet+176); |
294 sh_v->disp_h = sh_v->bih->biHeight = *(int32_t*)(pack.packet+180); | 296 sh_v->disp_h = sh_v->bih->biHeight = *(int32_t*)(pack.packet+180); |
295 sh_v->bih->biBitCount = *(int16_t*)(pack.packet+182); | 297 sh_v->bih->biBitCount = *(int16_t*)(pack.packet+182); |
298 if(!sh_v->bih->biBitCount) sh_v->bih->biBitCount=24; // hack, FIXME | |
299 sh_v->bih->biPlanes=1; | |
300 sh_v->bih->biSizeImage=(sh_v->bih->biBitCount>>3)*sh_v->bih->biWidth*sh_v->bih->biHeight; | |
296 | 301 |
297 ogg_d->subs[ogg_d->num_sub].samplerate = sh_v->fps; | 302 ogg_d->subs[ogg_d->num_sub].samplerate = sh_v->fps; |
298 n_video++; | 303 n_video++; |
299 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is video\n",ogg_d->num_sub); | 304 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is video (old hdr)\n",ogg_d->num_sub); |
300 if(verbose) print_video_header(sh_v->bih); | 305 if(verbose) print_video_header(sh_v->bih); |
301 // Old audio header | 306 // Old audio header |
302 } else if(*(int32_t*)pack.packet+96 == 0x05589F81) { | 307 } else if(*(int32_t*)pack.packet+96 == 0x05589F81) { |
303 unsigned int extra_size; | 308 unsigned int extra_size; |
304 sh_a = new_sh_audio(demuxer,ogg_d->num_sub); | 309 sh_a = new_sh_audio(demuxer,ogg_d->num_sub); |
315 if(extra_size > 0) | 320 if(extra_size > 0) |
316 memcpy(sh_a->wf+sizeof(WAVEFORMATEX),pack.packet+142,extra_size); | 321 memcpy(sh_a->wf+sizeof(WAVEFORMATEX),pack.packet+142,extra_size); |
317 | 322 |
318 ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate * sh_a->channels; | 323 ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate * sh_a->channels; |
319 n_audio++; | 324 n_audio++; |
320 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is audio\n",ogg_d->num_sub); | 325 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is audio (old hdr)\n",ogg_d->num_sub); |
321 if(verbose) print_wave_header(sh_a->wf); | 326 if(verbose) print_wave_header(sh_a->wf); |
322 } else | 327 } else |
323 mp_msg(MSGT_DEMUX,MSGL_WARN,"OGG stream %d contain an old header but the header type is unknow\n",ogg_d->num_sub); | 328 mp_msg(MSGT_DEMUX,MSGL_WARN,"OGG stream %d contain an old header but the header type is unknow\n",ogg_d->num_sub); |
324 | 329 |
325 // Check new header | 330 // Check new header |
339 sh_v->disp_w = sh_v->bih->biWidth = st->sh.video.width; | 344 sh_v->disp_w = sh_v->bih->biWidth = st->sh.video.width; |
340 sh_v->disp_h = sh_v->bih->biHeight = st->sh.video.height; | 345 sh_v->disp_h = sh_v->bih->biHeight = st->sh.video.height; |
341 | 346 |
342 ogg_d->subs[ogg_d->num_sub].samplerate= sh_v->fps; | 347 ogg_d->subs[ogg_d->num_sub].samplerate= sh_v->fps; |
343 n_video++; | 348 n_video++; |
344 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is video\n",ogg_d->num_sub); | 349 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is video (new hdr)\n",ogg_d->num_sub); |
345 if(verbose) print_video_header(sh_v->bih); | 350 if(verbose) print_video_header(sh_v->bih); |
346 /// New audio header | 351 /// New audio header |
347 } else if(strncmp(st->streamtype,"audio",5) == 0) { | 352 } else if(strncmp(st->streamtype,"audio",5) == 0) { |
348 char buffer[5]; | 353 char buffer[5]; |
349 unsigned int extra_size = st->size - sizeof(stream_header); | 354 unsigned int extra_size = st->size - sizeof(stream_header); |
362 if(extra_size) | 367 if(extra_size) |
363 memcpy(sh_a->wf+sizeof(WAVEFORMATEX),st+1,extra_size); | 368 memcpy(sh_a->wf+sizeof(WAVEFORMATEX),st+1,extra_size); |
364 | 369 |
365 ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate * sh_a->channels; | 370 ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate * sh_a->channels; |
366 n_audio++; | 371 n_audio++; |
367 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is audio\n",ogg_d->num_sub); | 372 mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is audio (new hdr)\n",ogg_d->num_sub); |
368 if(verbose) print_wave_header(sh_a->wf); | 373 if(verbose) print_wave_header(sh_a->wf); |
369 | 374 |
370 /// Check for text (subtitles) header | 375 /// Check for text (subtitles) header |
371 } else if(strncmp(st->streamtype,"text",4) == 0) { | 376 } else if(strncmp(st->streamtype,"text",4) == 0) { |
372 mp_msg(MSGT_DEMUX,MSGL_WARN,"OGG text stream are not supported\n"); | 377 mp_msg(MSGT_DEMUX,MSGL_WARN,"OGG text stream are not supported\n"); |