diff options
author | phintuka <phintuka> | 2007-09-30 16:52:18 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2007-09-30 16:52:18 +0000 |
commit | a87ba55fe98134122926f12e25654b4ee0d25bd1 (patch) | |
tree | 29633e5aae0200e8883744b274637edb74f1c86c | |
parent | 15e70fb28e0964a5c55a27b6f989997da8e282ef (diff) | |
download | xineliboutput-a87ba55fe98134122926f12e25654b4ee0d25bd1.tar.gz xineliboutput-a87ba55fe98134122926f12e25654b4ee0d25bd1.tar.bz2 |
Setup option to limit trick speed
-rw-r--r-- | config.c | 4 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | device.c | 25 | ||||
-rw-r--r-- | setup_menu.c | 5 |
4 files changed, 25 insertions, 12 deletions
@@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: config.c,v 1.46 2007-09-17 17:56:26 phelin Exp $ + * $Id: config.c,v 1.47 2007-09-30 16:52:18 phintuka Exp $ * */ @@ -489,6 +489,7 @@ config_t::config_t() { #else ibp_trickspeed = 0; #endif + max_trickspeed = 12; overscan = 0; hue = -1; saturation = -1; @@ -712,6 +713,7 @@ bool config_t::SetupParse(const char *Name, const char *Value) else if (!strcasecmp(Name, "Video.Brightness")) brightness = atoi(Value); else if (!strcasecmp(Name, "Video.Overscan")) overscan = atoi(Value); else if (!strcasecmp(Name, "Video.IBPTrickSpeed")) ibp_trickspeed = atoi(Value); + else if (!strcasecmp(Name, "Video.MaxTrickSpeed")) max_trickspeed = atoi(Value); else if (!strcasecmp(Name, "Post.pp.Enable")) ffmpeg_pp = atoi(Value); else if (!strcasecmp(Name, "Post.pp.Quality")) ffmpeg_pp_quality = atoi(Value); @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: config.h,v 1.30 2007-09-12 13:49:37 phintuka Exp $ + * $Id: config.h,v 1.31 2007-09-30 16:52:18 phintuka Exp $ * */ @@ -201,6 +201,7 @@ class config_t { // Video settings int ibp_trickspeed; + int max_trickspeed; int overscan; // % int hue; // 0...0xffff, -1 == off int saturation; // 0...0xffff, -1 == off @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: device.c,v 1.42 2007-09-30 16:10:20 phintuka Exp $ + * $Id: device.c,v 1.43 2007-09-30 16:52:18 phintuka Exp $ * */ @@ -776,6 +776,11 @@ void cXinelibDevice::TrickSpeed(int Speed) RealSpeed = 12/Speed; LOGTRICKSPEED(" Fast (%dx speed), direction unknown", RealSpeed); + if(RealSpeed > xc.max_trickspeed) { + RealSpeed = xc.max_trickspeed; + LOGTRICKSPEED(" Trick speed limited to %dx speed", RealSpeed); + } + /* only I-frames, backwards, pts must be re-generated if playing backwards */ m_TrickSpeedMode |= trs_PTS_check; @@ -966,14 +971,16 @@ int cXinelibDevice::PlayTrickSpeed(const uchar *buf, int length) static int64_t t0 = 0; int64_t t1 = cTimeMs::Now(); if((t1 - t0) < 1000) { - int fdelay = 40*12; - if(m_TrickSpeed==6) fdelay /= 2; - if(m_TrickSpeed==3) fdelay /= 4; - if(m_TrickSpeed==1) fdelay /= 12; - if(m_TrickSpeed==63) fdelay *= 6; - if(m_TrickSpeed==48) fdelay *= 4; - if(m_TrickSpeed==24) fdelay *= 2; - + int fdelay = 40*12; // = 480 ms, time of one GOP in normal speed + switch(m_TrickSpeed) { + case 6: /* 2x ff */ fdelay /= min( 2, xc.max_trickspeed); break; + case 3: /* 4x ff */ fdelay /= min( 4, xc.max_trickspeed); break; + case 1: /* 12x ff */ fdelay /= min(12, xc.max_trickspeed); break; + case 63: /* 1/6x rew */ fdelay *= 6; break; + case 48: /* 1/4x rew */ fdelay *= 4; break; + case 24: /* 1/2x rew */ fdelay *= 2; break; + default: break; + } /* wait if data is coming in too fast */ if(fdelay - (t1-t0) >= 40) { m_TrickSpeedDelay = 40; diff --git a/setup_menu.c b/setup_menu.c index e7460dc5..5c3d9510 100644 --- a/setup_menu.c +++ b/setup_menu.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: setup_menu.c,v 1.39 2007-09-18 14:02:38 phintuka Exp $ + * $Id: setup_menu.c,v 1.40 2007-09-30 16:52:18 phintuka Exp $ * */ @@ -657,6 +657,8 @@ void cMenuSetupVideo::Set(void) Add(new cMenuEditBoolItem(tr("Smooth fast forward"), &newconfig.ibp_trickspeed)); #endif + Add(new cMenuEditIntItem(tr("Fastest trick speed"), + &newconfig.max_trickspeed, 1, 12)); if(current<1) current=1; /* first item is not selectable */ SetCurrent(Get(current)); @@ -755,6 +757,7 @@ void cMenuSetupVideo::Store(void) SetupStore("Video.Brightness", xc.brightness); SetupStore("Video.Overscan", xc.overscan); SetupStore("Video.IBPTrickSpeed", xc.ibp_trickspeed); + SetupStore("Video.MaxTrickSpeed", xc.max_trickspeed); SetupStore("Post.pp.Enable", xc.ffmpeg_pp); SetupStore("Post.pp.Quality", xc.ffmpeg_pp_quality); SetupStore("Post.pp.Mode", xc.ffmpeg_pp_mode); |