summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2001-08-25 21:34:25 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2001-08-25 21:34:25 +0000
commitffbab3d1b4d03085c3ab1d9b4196be238dd2b7b9 (patch)
treed0ac53b4fc427488c4abce6aca4bac2a5aa77f67 /src
parent1669fc9f4496775a73d88b130844ad5a3ff34ee7 (diff)
downloadxine-lib-ffbab3d1b4d03085c3ab1d9b4196be238dd2b7b9.tar.gz
xine-lib-ffbab3d1b4d03085c3ab1d9b4196be238dd2b7b9.tar.bz2
Considerably improved the accuracy of
unixscr_get_current( ... ) Modified behaviour of unixscr_adjust( ... ) this->cur_pts now stays fairly constant and acts more as a pts offset. This could break any plugins which make use of adjust (e.g. dxr3). CVS patchset: 495 CVS date: 2001/08/25 21:34:25
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/metronom.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index 694646bf3..7ed99f96f 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: metronom.c,v 1.19 2001/08/25 07:12:16 guenter Exp $
+ * $Id: metronom.c,v 1.20 2001/08/25 21:34:25 jcdutton Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -88,7 +88,6 @@ static void unixscr_adjust (scr_plugin_t *scr, uint32_t vpts) {
pthread_mutex_lock (&this->lock);
this->cur_pts = vpts;
- gettimeofday(&this->cur_time, NULL);
pthread_mutex_unlock (&this->lock);
}
@@ -109,16 +108,15 @@ static uint32_t unixscr_get_current (scr_plugin_t *scr) {
struct timeval tv;
uint32_t pts;
-
+ double pts_calc;
pthread_mutex_lock (&this->lock);
gettimeofday(&tv, NULL);
+
+ pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor;
+ pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6;
- this->cur_pts += (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor;
- this->cur_pts += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6;
-
- pts = this->cur_pts;
- memcpy (&this->cur_time, &tv, sizeof (tv));
+ pts = this->cur_pts + pts_calc;
pthread_mutex_unlock (&this->lock);