comparison mencoder.c @ 8030:2b39ff3860b7

cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed, instead doing it in demux_avi.c, storing private data in priv insteda of demuxer structs)
author arpi
date Sat, 02 Nov 2002 00:45:12 +0000
parents b9da278e4c92
children 136e7e515764
comparison
equal deleted inserted replaced
8029:6ccd72982b88 8030:2b39ff3860b7
645 force_fourcc[2], force_fourcc[3]); 645 force_fourcc[2], force_fourcc[3]);
646 printf(MSGTR_ForcingOutputFourcc, 646 printf(MSGTR_ForcingOutputFourcc,
647 mux_v->bih->biCompression, (char *)&mux_v->bih->biCompression); 647 mux_v->bih->biCompression, (char *)&mux_v->bih->biCompression);
648 } 648 }
649 649
650 if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! 650 //if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf!
651 651
652 // ============= AUDIO =============== 652 // ============= AUDIO ===============
653 if(sh_audio){ 653 if(sh_audio){
654 654
655 mux_a=aviwrite_new_stream(muxer,AVIWRITE_TYPE_AUDIO); 655 mux_a=aviwrite_new_stream(muxer,AVIWRITE_TYPE_AUDIO);
1051 } 1051 }
1052 1052
1053 if(sh_audio && !demuxer2){ 1053 if(sh_audio && !demuxer2){
1054 float AV_delay,x; 1054 float AV_delay,x;
1055 // A-V sync! 1055 // A-V sync!
1056 #if 0
1056 if(pts_from_bps){ 1057 if(pts_from_bps){
1057 unsigned int samples=(sh_audio->audio.dwSampleSize)? 1058 unsigned int samples=(sh_audio->audio.dwSampleSize)?
1058 ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) : 1059 ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) :
1059 (d_audio->block_no); // <- used for VBR audio 1060 (d_audio->block_no); // <- used for VBR audio
1060 // printf("samples=%d \n",samples); 1061 // printf("samples=%d \n",samples);
1061 a_pts=samples*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate; 1062 a_pts=samples*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate;
1062 delay_corrected=1; 1063 delay_corrected=1;
1063 } else { 1064 } else
1065 #endif
1066 {
1064 // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec) 1067 // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec)
1065 a_pts=d_audio->pts; 1068 a_pts=d_audio->pts;
1066 if(!delay_corrected) if(a_pts) delay_corrected=1; 1069 if(!delay_corrected) if(a_pts) delay_corrected=1;
1067 //printf("*** %5.3f ***\n",a_pts); 1070 //printf("*** %5.3f ***\n",a_pts);
1068 a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; 1071 a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
1101 #endif 1104 #endif
1102 1105
1103 { float t=(GetTimerMS()-timer_start)*0.001f; 1106 { float t=(GetTimerMS()-timer_start)*0.001f;
1104 float len=(demuxer->movi_end-demuxer->movi_start); 1107 float len=(demuxer->movi_end-demuxer->movi_start);
1105 float p=len>1000 ? (float)(demuxer->filepos-demuxer->movi_start) / len : 0; 1108 float p=len>1000 ? (float)(demuxer->filepos-demuxer->movi_start) / len : 0;
1109 #if 0
1106 if(!len && sh_audio && sh_audio->audio.dwLength>100){ 1110 if(!len && sh_audio && sh_audio->audio.dwLength>100){
1107 p=(sh_audio->audio.dwSampleSize? ds_tell(sh_audio->ds)/sh_audio->audio.dwSampleSize : sh_audio->ds->block_no) 1111 p=(sh_audio->audio.dwSampleSize? ds_tell(sh_audio->ds)/sh_audio->audio.dwSampleSize : sh_audio->ds->block_no)
1108 / (float)(sh_audio->audio.dwLength); 1112 / (float)(sh_audio->audio.dwLength);
1109 } 1113 }
1114 #endif
1110 #if 0 1115 #if 0
1111 mp_msg(MSGT_AVSYNC,MSGL_STATUS,"%d < %d < %d \r", 1116 mp_msg(MSGT_AVSYNC,MSGL_STATUS,"%d < %d < %d \r",
1112 (int)demuxer->movi_start, 1117 (int)demuxer->movi_start,
1113 (int)demuxer->filepos, 1118 (int)demuxer->filepos,
1114 (int)demuxer->movi_end); 1119 (int)demuxer->movi_end);