summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-11 19:21:45 +0200
committerwm4 <wm4@nowhere>2013-07-11 19:21:45 +0200
commita6706c41d8d89bc1a72dd21e215885e79a766db2 (patch)
tree972ce7787bd5b96c704e89dfe7d8553ad768da2b
parent6f6632b8dd9273a3cbc8e3e0d69e1d3dceed6f45 (diff)
downloadmpv-a6706c41d8d89bc1a72dd21e215885e79a766db2.tar.bz2
mpv-a6706c41d8d89bc1a72dd21e215885e79a766db2.tar.xz
video: eliminate frametime variable
-rw-r--r--core/mplayer.c22
-rw-r--r--demux/demux_lavf.c1
-rw-r--r--demux/demux_mf.c1
-rw-r--r--demux/demux_mkv.c1
-rw-r--r--demux/demux_mng.c1
-rw-r--r--demux/demux_rawvideo.c1
-rw-r--r--demux/stheader.h1
-rw-r--r--stream/tv.c2
8 files changed, 9 insertions, 21 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index f5dbfb4e41..275795defb 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1793,6 +1793,8 @@ static int check_framedrop(struct MPContext *mpctx, double frame_time)
{
float delay = opts->playback_speed * ao_get_delay(mpctx->ao);
float d = delay - mpctx->delay;
+ if (frame_time < 0)
+ frame_time = mpctx->sh_video->fps > 0 ? 1.0 / mpctx->sh_video->fps : 0;
// we should avoid dropping too many frames in sequence unless we
// are too late. and we allow 100ms A-V delay here:
if (d < -mpctx->dropped_frames * frame_time - 0.100 && !mpctx->paused
@@ -2305,14 +2307,12 @@ int reinit_video_chain(struct MPContext *mpctx)
}
mp_tmsg(MSGT_CPLAYER, MSGL_V, "[V] filefmt:%d fourcc:0x%X "
- "size:%dx%d fps:%5.3f ftime:=%6.4f\n",
+ "size:%dx%d fps:%5.3f\n",
mpctx->master_demuxer->file_format, mpctx->sh_video->format,
mpctx->sh_video->disp_w, mpctx->sh_video->disp_h,
- mpctx->sh_video->fps, mpctx->sh_video->frametime);
- if (opts->force_fps) {
+ mpctx->sh_video->fps);
+ if (opts->force_fps)
mpctx->sh_video->fps = opts->force_fps;
- mpctx->sh_video->frametime = 1.0f / mpctx->sh_video->fps;
- }
update_fps(mpctx);
if (!mpctx->sh_video->fps && !opts->force_fps && !opts->correct_pts) {
@@ -2449,7 +2449,7 @@ static struct demux_packet *video_read_frame(struct MPContext *mpctx)
if (pkt->pts != MP_NOPTS_VALUE)
sh_video->last_pts = pkt->pts;
- float frame_time = sh_video->frametime;
+ float frame_time = sh_video->fps > 0 ? 1.0f / sh_video->fps : 0;
// override frame_time for variable/unknown FPS formats:
if (!mpctx->opts.force_fps) {
@@ -2458,10 +2458,8 @@ static struct demux_packet *video_read_frame(struct MPContext *mpctx)
: next_pts - sh_video->last_pts;
if (d >= 0) {
if (demuxer->file_format == DEMUXER_TYPE_TV) {
- if (d > 0) {
- sh_video->frametime = d;
+ if (d > 0)
sh_video->fps = 1.0f / d;
- }
frame_time = d;
} else {
if ((int)sh_video->fps <= 1)
@@ -2574,7 +2572,7 @@ static double update_video(struct MPContext *mpctx, double endpts)
if (pts >= mpctx->hrseek_pts - .005)
mpctx->hrseek_framedrop = false;
int framedrop_type = mpctx->hrseek_active && mpctx->hrseek_framedrop ?
- 1 : check_framedrop(mpctx, sh_video->frametime);
+ 1 : check_framedrop(mpctx, -1);
struct mp_image *decoded_frame =
decode_video(sh_video, pkt, framedrop_type, pts);
talloc_free(pkt);
@@ -4281,10 +4279,8 @@ goto_reopen_demuxer: ;
if (opts->force_fps && mpctx->sh_video) {
mpctx->sh_video->fps = opts->force_fps;
- mpctx->sh_video->frametime = 1.0f / mpctx->sh_video->fps;
mp_tmsg(MSGT_CPLAYER, MSGL_INFO,
- "FPS forced to be %5.3f (ftime: %5.3f).\n",
- mpctx->sh_video->fps, mpctx->sh_video->frametime);
+ "FPS forced to be %5.3f.\n", mpctx->sh_video->fps);
}
//==================== START PLAYING =======================
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index aa3b6c24f2..7f4e3a1b3d 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -402,7 +402,6 @@ static void handle_stream(demuxer_t *demuxer, int i)
av_q2d(st->codec->time_base) *
st->codec->ticks_per_frame);
sh_video->fps = fps;
- sh_video->frametime = 1 / fps;
if (st->sample_aspect_ratio.num)
sh_video->aspect = codec->width * st->sample_aspect_ratio.num
/ (float)(codec->height * st->sample_aspect_ratio.den);
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index 491a91bccf..7465ddeae8 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -219,7 +219,6 @@ static demuxer_t* demux_open_mf(demuxer_t* demuxer){
sh_video->disp_w = 0;
sh_video->disp_h = 0;
sh_video->fps = mf_fps;
- sh_video->frametime = 1 / sh_video->fps;
mf->sh = sh_video;
demuxer->priv=(void*)mf;
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 7b674c9465..c84bdf4392 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -1283,7 +1283,6 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track)
if (track->v_frate == 0.0)
track->v_frate = 25.0;
sh_v->fps = track->v_frate;
- sh_v->frametime = 1 / track->v_frate;
sh_v->aspect = 0;
if (!track->realmedia) {
sh_v->disp_w = track->v_width;
diff --git a/demux/demux_mng.c b/demux/demux_mng.c
index 22299ea17b..34fdf521b5 100644
--- a/demux/demux_mng.c
+++ b/demux/demux_mng.c
@@ -421,7 +421,6 @@ static demuxer_t * demux_mng_open(demuxer_t * demuxer)
// set framerate to some value (MNG does not have a fixed framerate)
sh_video->fps = 5.0f;
- sh_video->frametime = 1.0f / sh_video->fps;
// set video frame parameters
sh_video->bih = calloc(1, sizeof(*sh_video->bih));
diff --git a/demux/demux_rawvideo.c b/demux/demux_rawvideo.c
index 6fc25639ca..4340362192 100644
--- a/demux/demux_rawvideo.c
+++ b/demux/demux_rawvideo.c
@@ -119,7 +119,6 @@ static demuxer_t* demux_rawvideo_open(demuxer_t* demuxer) {
sh_video->gsh->codec=decoder;
sh_video->format=imgfmt;
sh_video->fps=fps;
- sh_video->frametime=1.0/fps;
sh_video->disp_w=width;
sh_video->disp_h=height;
sh_video->i_bps=fps*imgsize;
diff --git a/demux/stheader.h b/demux/stheader.h
index 9898d8be33..0d94607fa2 100644
--- a/demux/stheader.h
+++ b/demux/stheader.h
@@ -124,7 +124,6 @@ typedef struct sh_video {
int pts_assoc_mode;
// output format: (set by demuxer)
float fps; // frames per second (set only if constant fps)
- float frametime; // 1/fps
float aspect; // aspect ratio stored in the file (for prescaling)
float stream_aspect; // aspect ratio in media headers (DVD IFO files)
int i_bps; // == bitrate (compressed bytes/sec)
diff --git a/stream/tv.c b/stream/tv.c
index 93c50fb36a..2c930781bc 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -743,8 +743,6 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
if (tvh->tv_param->fps != -1.0f)
sh_video->fps = tvh->tv_param->fps;
- sh_video->frametime = 1.0f/sh_video->fps;
-
/* If playback only mode, go to immediate mode, fail silently */
if(tvh->tv_param->immediate == 1)
{