comparison mplayer.c @ 33495:52a393df8df8

Put code checking if at the EOS in a function.
author cboesch
date Sat, 11 Jun 2011 15:39:00 +0000
parents fd4a27bd4ed4
children d54614382edc
comparison
equal deleted inserted replaced
33494:86a93b00b52c 33495:52a393df8df8
1799 { 1799 {
1800 return written_audio_pts(sh_audio, d_audio) - playback_speed * 1800 return written_audio_pts(sh_audio, d_audio) - playback_speed *
1801 audio_out->get_delay(); 1801 audio_out->get_delay();
1802 } 1802 }
1803 1803
1804 static int is_at_end(MPContext *mpctx, m_time_size_t *end_at, double pts)
1805 {
1806 switch (end_at->type) {
1807 case END_AT_TIME: return end_at->pos <= pts;
1808 case END_AT_SIZE: return end_at->pos <= stream_tell(mpctx->stream);
1809 }
1810 return 0;
1811 }
1812
1804 static int check_framedrop(double frame_time) 1813 static int check_framedrop(double frame_time)
1805 { 1814 {
1806 // check for frame-drop: 1815 // check for frame-drop:
1807 current_module = "check_framedrop"; 1816 current_module = "check_framedrop";
1808 if (mpctx->sh_audio && !mpctx->d_audio->eof) { 1817 if (mpctx->sh_audio && !mpctx->d_audio->eof) {
3800 a_pos = playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out); 3809 a_pos = playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out);
3801 3810
3802 if (!quiet) 3811 if (!quiet)
3803 print_status(a_pos, 0, 0); 3812 print_status(a_pos, 0, 0);
3804 3813
3805 if (end_at.type == END_AT_TIME && end_at.pos < a_pos || 3814 if (is_at_end(mpctx, &end_at, a_pos))
3806 end_at.type == END_AT_SIZE && end_at.pos < stream_tell(mpctx->stream))
3807 mpctx->eof = PT_NEXT_ENTRY; 3815 mpctx->eof = PT_NEXT_ENTRY;
3808 update_subtitles(NULL, a_pos, mpctx->d_sub, 0); 3816 update_subtitles(NULL, a_pos, mpctx->d_sub, 0);
3809 update_osd_msg(); 3817 update_osd_msg();
3810 } else { 3818 } else {
3811 int frame_time_remaining = 0; 3819 int frame_time_remaining = 0;
3921 --play_n_frames; 3929 --play_n_frames;
3922 if (play_n_frames <= 0) 3930 if (play_n_frames <= 0)
3923 mpctx->eof = PT_NEXT_ENTRY; 3931 mpctx->eof = PT_NEXT_ENTRY;
3924 } 3932 }
3925 3933
3926 if (!frame_time_remaining && 3934 if (!frame_time_remaining && is_at_end(mpctx, &end_at,
3927 ((end_at.type == END_AT_TIME && mpctx->sh_video->pts >= end_at.pos) || 3935 mpctx->sh_video->pts))
3928 (end_at.type == END_AT_SIZE && stream_tell(mpctx->stream) >= end_at.pos)))
3929 mpctx->eof = PT_NEXT_ENTRY; 3936 mpctx->eof = PT_NEXT_ENTRY;
3930 } // end if(mpctx->sh_video) 3937 } // end if(mpctx->sh_video)
3931 3938
3932 #ifdef CONFIG_DVDNAV 3939 #ifdef CONFIG_DVDNAV
3933 if (mpctx->stream->type == STREAMTYPE_DVDNAV) { 3940 if (mpctx->stream->type == STREAMTYPE_DVDNAV) {