comparison mplayer.c @ 20902:bfb6eacd9c4a

Update OSD contents only after the correct values for the frame are known. The most visible inaccuracy caused by the previous update location was that the OSD always showed position 0 after seeking with demux_mkv. Split frame decoding and filtering because with -correct-pts the pts value that should be displayed for the frame is only known after decoding but is needed before filtering (during which the OSD is drawn).
author uau
date Tue, 14 Nov 2006 12:29:20 +0000
parents b0f2e9a16bb1
children b8d8e7ca7410
comparison
equal deleted inserted replaced
20901:b875b84a511e 20902:bfb6eacd9c4a
2760 double pts; 2760 double pts;
2761 2761
2762 while (1) { 2762 while (1) {
2763 current_module = "decode video"; 2763 current_module = "decode video";
2764 // XXX Time used in this call is not counted in any performance 2764 // XXX Time used in this call is not counted in any performance
2765 // timer now 2765 // timer now, OSD is not updated correctly for filter-added frames
2766 if (vf_output_queued_frame(sh_video->vfilter)) 2766 if (vf_output_queued_frame(sh_video->vfilter))
2767 break; 2767 break;
2768 current_module = "video_read_frame"; 2768 current_module = "video_read_frame";
2769 in_size = ds_get_packet_pts(d_video, &start, &pts); 2769 in_size = ds_get_packet_pts(d_video, &start, &pts);
2770 if (in_size < 0) { 2770 if (in_size < 0) {
2775 } 2775 }
2776 if (in_size > max_framesize) 2776 if (in_size > max_framesize)
2777 max_framesize = in_size; 2777 max_framesize = in_size;
2778 if (pts == MP_NOPTS_VALUE) 2778 if (pts == MP_NOPTS_VALUE)
2779 mp_msg(MSGT_CPLAYER, MSGL_ERR, "pts value from demuxer MISSING\n"); 2779 mp_msg(MSGT_CPLAYER, MSGL_ERR, "pts value from demuxer MISSING\n");
2780 if (decode_video(sh_video, start, in_size, 0, pts)) 2780 current_module = "decode video";
2781 break; 2781 void *decoded_frame = decode_video(sh_video, start, in_size, 0, pts);
2782 if (decoded_frame) {
2783 update_osd_msg();
2784 if (filter_video(sh_video, decoded_frame, sh_video->pts))
2785 break;
2786 }
2782 if (hit_eof) 2787 if (hit_eof)
2783 return 0; 2788 return 0;
2784 } 2789 }
2785 return 1; 2790 return 1;
2786 } 2791 }
4322 if(!quiet) 4327 if(!quiet)
4323 print_status(a_pos, 0, 0); 4328 print_status(a_pos, 0, 0);
4324 4329
4325 if(end_at.type == END_AT_TIME && end_at.pos < a_pos) 4330 if(end_at.type == END_AT_TIME && end_at.pos < a_pos)
4326 eof = PT_NEXT_ENTRY; 4331 eof = PT_NEXT_ENTRY;
4332 update_osd_msg();
4327 4333
4328 } else { 4334 } else {
4329 4335
4330 /*========================== PLAY VIDEO ============================*/ 4336 /*========================== PLAY VIDEO ============================*/
4331 4337
4368 ++total_frame_cnt; 4374 ++total_frame_cnt;
4369 } 4375 }
4370 // decode: 4376 // decode:
4371 current_module="decode_video"; 4377 current_module="decode_video";
4372 // printf("Decode! %p %d \n",start,in_size); 4378 // printf("Decode! %p %d \n",start,in_size);
4373 blit_frame=decode_video(sh_video,start,in_size,drop_frame, sh_video->pts); 4379 update_osd_msg();
4380 void *decoded_frame = decode_video(sh_video,start,in_size,drop_frame, sh_video->pts);
4381 blit_frame = (decoded_frame && filter_video(sh_video, decoded_frame,
4382 sh_video->pts));
4374 break; 4383 break;
4375 } 4384 }
4376 else while (1) { 4385 else while (1) {
4377 if (!generate_video_frame(sh_video, d_video)) { 4386 if (!generate_video_frame(sh_video, d_video)) {
4378 eof = 1; 4387 eof = 1;
5407 #endif /* HAVE_NEW_GUI */ 5416 #endif /* HAVE_NEW_GUI */
5408 5417
5409 5418
5410 //================= Update OSD ==================== 5419 //================= Update OSD ====================
5411 5420
5412 update_osd_msg();
5413
5414 #ifdef USE_SUB 5421 #ifdef USE_SUB
5415 // find sub 5422 // find sub
5416 if(subdata && sh_video && sh_video->pts>0){ 5423 if(subdata && sh_video && sh_video->pts>0){
5417 float pts=sh_video->pts; 5424 float pts=sh_video->pts;
5418 if(sub_fps==0) sub_fps=sh_video->fps; 5425 if(sub_fps==0) sub_fps=sh_video->fps;