[Mplayer-cvslog] CVS: main mplayer.c,1.47,1.48
GEREOFFY
arpi_esp at users.sourceforge.net
Thu Apr 12 04:24:44 CEST 2001
Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv30551
Modified Files:
mplayer.c
Log Message:
some cleanup of init_video
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** mplayer.c 2001/04/12 00:52:22 1.47
--- mplayer.c 2001/04/12 02:24:41 1.48
***************
*** 693,711 ****
}
}
-
if(!ds_fill_buffer(d_video)){
printf("AVI: missing video stream!? contact the author, it may be a bug :(\n");
exit(1);
}
- sh_video->format=sh_video->bih.biCompression;
if(has_audio){
! if(verbose) printf("AVI: Searching for audio stream (id:%d)\n",d_audio->id);
if(!ds_fill_buffer(d_audio)){
! printf("AVI: No Audio stream found... ->nosound\n");
has_audio=0;
! }
}
! if(has_audio) sh_audio->format=sh_audio->wf.wFormatTag;
default_fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
break;
}
--- 693,721 ----
}
}
if(!ds_fill_buffer(d_video)){
printf("AVI: missing video stream!? contact the author, it may be a bug :(\n");
exit(1);
}
if(has_audio){
! if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);
if(!ds_fill_buffer(d_audio)){
! printf("ASF: No Audio stream found... ->nosound\n");
has_audio=0;
! } else sh_audio->format=sh_audio->wf.wFormatTag;
}
! // calculating video bitrate:
default_fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
+ avi_header.bitrate=avi_header.movi_end-avi_header.movi_start-avi_header.idx_size*8;
+ if(sh_audio) avi_header.bitrate-=sh_audio->audio.dwLength;
+ if(verbose) printf("AVI video length=%d\n",avi_header.bitrate);
+ avi_header.bitrate=((float)avi_header.bitrate/(float)sh_video->video.dwLength)*default_fps;
+ printf("VIDEO: [%.4s] %dx%d %dbpp %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n",
+ &sh_video->bih.biCompression,
+ sh_video->bih.biWidth,
+ sh_video->bih.biHeight,
+ sh_video->bih.biBitCount,
+ default_fps,
+ avi_header.bitrate*0.008f,
+ avi_header.bitrate/1024.0f );
break;
}
***************
*** 721,725 ****
exit(1);
}
- sh_video->format=sh_video->bih.biCompression;
if(has_audio){
if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);
--- 731,734 ----
***************
*** 727,750 ****
printf("ASF: No Audio stream found... ->nosound\n");
has_audio=0;
! }
}
! if(has_audio) sh_audio->format=sh_audio->wf.wFormatTag;
break;
}
case DEMUXER_TYPE_MPEG_ES: {
demuxer->audio->type=0;
- // Find sequence_header first:
- if(verbose) printf("Searching for sequence header... ");fflush(stdout);
- while(1){
- int i=sync_video_packet(d_video);
- if(i==0x1B3) break; // found it!
- if(!i || !skip_video_packet(d_video)){
- if(verbose) printf("NONE :(\n");
- printf("MPEG: FATAL: EOF while searching for sequence header\n");
- exit(1);
- }
- }
- if(verbose) printf("OK!\n");
- sh_video->format=1; // mpeg video
has_audio=0; // ES streams has no audio channel
break;
--- 736,750 ----
printf("ASF: No Audio stream found... ->nosound\n");
has_audio=0;
! } else sh_audio->format=sh_audio->wf.wFormatTag;
}
! printf("VIDEO: [%.4s] %dx%d %dbpp\n",
! &sh_video->bih.biCompression,
! sh_video->bih.biWidth,
! sh_video->bih.biHeight,
! sh_video->bih.biBitCount);
break;
}
case DEMUXER_TYPE_MPEG_ES: {
demuxer->audio->type=0;
has_audio=0; // ES streams has no audio channel
break;
***************
*** 757,760 ****
--- 757,761 ----
} else {
switch(d_audio->type){
+ if(verbose) printf("detected MPG-PS audio format: %d\n",d_audio->type);
case 1: sh_audio->format=0x50;break; // mpeg
case 2: sh_audio->format=0x2;break; // pcm
***************
*** 763,767 ****
}
}
! if(has_audio) if(verbose) printf("detected MPG-PS audio format: %d\n",sh_audio->format);
// Find sequence_header first:
if(verbose) printf("Searching for sequence header... ");fflush(stdout);
--- 764,783 ----
}
}
! break;
! }
! } // switch(file_format)
!
! // Determine image properties:
! switch(file_format){
! case DEMUXER_TYPE_AVI:
! case DEMUXER_TYPE_ASF: {
! // display info:
! sh_video->format=sh_video->bih.biCompression;
! movie_size_x=sh_video->bih.biWidth;
! movie_size_y=abs(sh_video->bih.biHeight);
! break;
! }
! case DEMUXER_TYPE_MPEG_ES:
! case DEMUXER_TYPE_MPEG_PS: {
// Find sequence_header first:
if(verbose) printf("Searching for sequence header... ");fflush(stdout);
***************
*** 777,780 ****
--- 793,825 ----
if(verbose) printf("OK!\n");
sh_video->format=1; // mpeg video
+ mpeg2_init();
+ // ========= Read & process sequence header & extension ============
+ videobuffer=shmem_alloc(VIDEOBUFFER_SIZE);
+ if(!videobuffer){ printf("Cannot allocate shared memory\n");exit(0);}
+ videobuf_len=0;
+ if(!read_video_packet(d_video)){ printf("FATAL: Cannot read sequence header!\n");exit(1);}
+ if(header_process_sequence_header (picture, &videobuffer[4])) {
+ printf ("bad sequence header!\n"); exit(1);
+ }
+ if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext.
+ videobuf_len=0;
+ if(!read_video_packet(d_video)){ printf("FATAL: Cannot read sequence header extension!\n");exit(1);}
+ if(header_process_extension (picture, &videobuffer[4])) {
+ printf ("bad sequence header extension!\n"); exit(1);
+ }
+ }
+ // display info:
+ default_fps=frameratecode2framerate[picture->frame_rate_code]*0.0001f;
+ movie_size_x=picture->display_picture_width;
+ movie_size_y=picture->display_picture_height;
+ // info:
+ if(verbose) printf("mpeg bitrate: %d (%X)\n",picture->bitrate,picture->bitrate);
+ printf("VIDEO: %s %dx%d (aspect %d) %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n",
+ picture->mpeg1?"MPEG1":"MPEG2",
+ movie_size_x,movie_size_y,
+ picture->aspect_ratio_information,
+ default_fps,
+ picture->bitrate*0.5f,
+ picture->bitrate/16.0f );
break;
}
***************
*** 834,858 ****
if(!init_video_codec(out_fmt)) exit(1);
if(verbose) printf("INFO: Win32 video codec init OK!\n");
- //if(out_fmt==(IMGFMT_BGR|16)) out_fmt=IMGFMT_BGR|15; // fix bpp FIXME!
-
- // calculating video bitrate:
- avi_header.bitrate=avi_header.movi_end-avi_header.movi_start-avi_header.idx_size*8;
- if(sh_audio->audio.fccType) avi_header.bitrate-=sh_audio->audio.dwLength;
- if(verbose) printf("AVI video length=%d\n",avi_header.bitrate);
- avi_header.bitrate=((float)avi_header.bitrate/(float)sh_video->video.dwLength)
- *((float)sh_video->video.dwRate/(float)sh_video->video.dwScale);
- // default_fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
- printf("VIDEO: [%.4s] %dx%d %dbpp %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n",
- &sh_video->bih.biCompression,
- sh_video->bih.biWidth,
- sh_video->bih.biHeight,
- sh_video->bih.biBitCount,
- default_fps,
- avi_header.bitrate*0.008f,
- avi_header.bitrate/1024.0f );
-
- // display info:
- movie_size_x=sh_video->o_bih.biWidth;
- movie_size_y=abs(sh_video->o_bih.biHeight);
break;
}
--- 879,882 ----
***************
*** 883,906 ****
if(verbose) printf("INFO: Win32/DShow video codec init OK!\n");
-
- // calculating video bitrate:
- avi_header.bitrate=avi_header.movi_end-avi_header.movi_start-avi_header.idx_size*8;
- if(sh_audio->audio.fccType) avi_header.bitrate-=sh_audio->audio.dwLength;
- if(verbose) printf("AVI video length=%d\n",avi_header.bitrate);
- avi_header.bitrate=((float)avi_header.bitrate/(float)sh_video->video.dwLength)
- *((float)sh_video->video.dwRate/(float)sh_video->video.dwScale);
- // default_fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
- printf("VIDEO: [%.4s] %dx%d %dbpp %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n",
- &sh_video->bih.biCompression,
- sh_video->bih.biWidth,
- sh_video->bih.biHeight,
- sh_video->bih.biBitCount,
- default_fps,
- avi_header.bitrate*0.008f,
- avi_header.bitrate/1024.0f );
-
- // display info:
- movie_size_x=sh_video->bih.biWidth;
- movie_size_y=abs(sh_video->bih.biHeight);
break;
#endif
--- 907,910 ----
***************
*** 918,949 ****
}
if(verbose) printf("INFO: OpenDivX video codec init OK!\n");
-
- // calculating video bitrate:
- avi_header.bitrate=avi_header.movi_end-avi_header.movi_start-avi_header.idx_size*8;
- if(sh_audio->audio.fccType) avi_header.bitrate-=sh_audio->audio.dwLength;
- if(verbose) printf("AVI video length=%d\n",avi_header.bitrate);
- avi_header.bitrate=((float)avi_header.bitrate/(float)sh_video->video.dwLength)
- *((float)sh_video->video.dwRate/(float)sh_video->video.dwScale);
- // default_fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
- printf("VIDEO: [%.4s] %dx%d %dbpp %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n",
- &sh_video->bih.biCompression,
- sh_video->bih.biWidth,
- sh_video->bih.biHeight,
- sh_video->bih.biBitCount,
- default_fps,
- avi_header.bitrate*0.008f,
- avi_header.bitrate/1024.0f );
-
- // display info:
- movie_size_x=sh_video->bih.biWidth;
- movie_size_y=abs(sh_video->bih.biHeight);
break;
}
case 1: {
- // allocate some shared memory for the video packet buffer:
- videobuffer=shmem_alloc(VIDEOBUFFER_SIZE);
- if(!videobuffer){ printf("Cannot allocate shared memory\n");exit(0);}
// init libmpeg2:
- mpeg2_init();
#ifdef MPEG12_POSTPROC
picture->pp_options=divx_quality;
--- 922,929 ----
***************
*** 955,984 ****
}
#endif
! if(verbose) printf("mpeg2_init() ok\n");
! // ========= Read & process sequence header & extension ============
! videobuf_len=0;
! if(!read_video_packet(d_video)){ printf("FATAL: Cannot read sequence header!\n");return 1;}
! if(header_process_sequence_header (picture, &videobuffer[4])) {
! printf ("bad sequence header!\n"); return 1;
! }
! if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext.
! videobuf_len=0;
! if(!read_video_packet(d_video)){ printf("FATAL: Cannot read sequence header extension!\n");return 1;}
! if(header_process_extension (picture, &videobuffer[4])) {
! printf ("bad sequence header extension!\n"); return 1;
! }
! }
! default_fps=frameratecode2framerate[picture->frame_rate_code]*0.0001f;
! if(verbose) printf("mpeg bitrate: %d (%X)\n",picture->bitrate,picture->bitrate);
! printf("VIDEO: %s %dx%d (aspect %d) %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n",
! picture->mpeg1?"MPEG1":"MPEG2",
! picture->display_picture_width,picture->display_picture_height,
! picture->aspect_ratio_information,
! default_fps,
! picture->bitrate*0.5f,
! picture->bitrate/16.0f );
! // display info:
! movie_size_x=picture->display_picture_width;
! movie_size_y=picture->display_picture_height;
break;
}
--- 935,939 ----
}
#endif
! mpeg2_allocate_image_buffers (picture);
break;
}
***************
*** 1076,1095 ****
fflush(stdout);
-
- if(has_video==1){
- //================== init mpeg codec ===================
- mpeg2_allocate_image_buffers (picture);
- if(verbose) printf("INFO: mpeg2_init_video() OK!\n");
- #ifdef HAVE_CODECCTRL
- // ====== Init MPEG codec process ============
- make_pipe(&control_fifo,&control_fifo2);
- make_pipe(&data_fifo2,&data_fifo);
- // ====== Let's FORK() !!! ===================
- if((child_pid=fork())==0)
- mpeg_codec_controller(video_out); // this one is running in a new process!!!!
- signal(SIGPIPE,SIG_IGN); // Ignore "Broken pipe" signal (codec restarts)
- #endif
- }
-
//================== MAIN: ==========================
{
--- 1031,1034 ----
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list