summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2002-03-23 18:56:55 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2002-03-23 18:56:55 +0000
commitb2dfbe82d7c68198548995aa309a8883ef3da521 (patch)
treedab817ecd8e1a32a9932f89280b865592a888329 /src/xine-engine
parent1886d565632d0cafc381a97e066a122f6a9ccf2c (diff)
downloadxine-lib-b2dfbe82d7c68198548995aa309a8883ef3da521.tar.gz
xine-lib-b2dfbe82d7c68198548995aa309a8883ef3da521.tar.bz2
moved network buffering to a seperate file so all network/stream input plugins
can share that code. added ability to control scr adjustability to metronom (get/set options) so strict_scr is no longer needed. CVS patchset: 1620 CVS date: 2002/03/23 18:56:55
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/metronom.c39
-rw-r--r--src/xine-engine/metronom.h18
-rw-r--r--src/xine-engine/xine.c6
3 files changed, 44 insertions, 19 deletions
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index a3652b02b..416d74467 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.73 2002/03/23 13:28:35 miguelfreitas Exp $
+ * $Id: metronom.c,v 1.74 2002/03/23 18:56:56 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -223,7 +223,8 @@ static void metronom_resume_clock(metronom_t *this) {
static void metronom_adjust_clock(metronom_t *this, int64_t desired_pts) {
- this->scr_master->adjust(this->scr_master, desired_pts);
+ if (this->scr_adjustable)
+ this->scr_master->adjust(this->scr_master, desired_pts);
}
static int metronom_set_speed (metronom_t *this, int speed) {
@@ -503,19 +504,36 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts,
return vpts;
}
-static void metronom_set_av_offset (metronom_t *this, int32_t pts) {
+static void metronom_set_option (metronom_t *this, int option, int64_t value) {
pthread_mutex_lock (&this->lock);
- this->av_offset = pts;
+ switch (option) {
+ case METRONOM_AV_OFFSET:
+ this->av_offset = value;
+ printf ("metronom: av_offset=%lld pts\n", this->av_offset);
+ break;
+ case METRONOM_SCR_ADJUSTABLE:
+ this->scr_adjustable = value;
+ break;
+ default:
+ printf ("metronom: unknown option in set_option: %d\n",
+ option);
+ }
pthread_mutex_unlock (&this->lock);
-
- printf ("metronom: av_offset=%d pts\n", pts);
}
-static int32_t metronom_get_av_offset (metronom_t *this) {
- return this->av_offset;
+static int64_t metronom_get_option (metronom_t *this, int option) {
+ switch (option) {
+ case METRONOM_AV_OFFSET:
+ return this->av_offset;
+ case METRONOM_SCR_ADJUSTABLE:
+ return this->scr_adjustable;
+ }
+ printf ("metronom: unknown option in get_option: %d\n",
+ option);
+ return 0;
}
static scr_plugin_t* get_master_scr(metronom_t *this) {
@@ -628,8 +646,8 @@ metronom_t * metronom_init (int have_audio, void *xine) {
this->got_spu_packet = metronom_got_spu_packet;
this->handle_audio_discontinuity = metronom_handle_audio_discontinuity;
this->handle_video_discontinuity = metronom_handle_video_discontinuity;
- this->set_av_offset = metronom_set_av_offset;
- this->get_av_offset = metronom_get_av_offset;
+ this->set_option = metronom_set_option;
+ this->get_option = metronom_get_option;
this->start_clock = metronom_start_clock;
this->stop_clock = metronom_stop_clock;
this->resume_clock = metronom_resume_clock;
@@ -640,6 +658,7 @@ metronom_t * metronom_init (int have_audio, void *xine) {
this->set_speed = metronom_set_speed;
this->exit = metronom_exit;
+ this->scr_adjustable = 1;
this->scr_list = calloc(MAX_SCR_PROVIDERS, sizeof(void*));
this->register_scr(this, unixscr_init());
diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h
index edddd2061..4f7d9ebb7 100644
--- a/src/xine-engine/metronom.h
+++ b/src/xine-engine/metronom.h
@@ -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.h,v 1.24 2002/03/23 13:28:36 miguelfreitas Exp $
+ * $Id: metronom.h,v 1.25 2002/03/23 18:56:56 guenter Exp $
*
* metronom: general pts => virtual calculation/assoc
*
@@ -144,12 +144,10 @@ struct metronom_s {
void (*handle_video_discontinuity) (metronom_t *this, int type, int64_t disc_off);
/*
- * manually correct audio <-> video sync
- * (this constant value is added to video vpts)
+ * set/get options for metronom, constants see below
*/
- void (*set_av_offset) (metronom_t *this, int32_t pts);
-
- int32_t (*get_av_offset) (metronom_t *this);
+ void (*set_option) (metronom_t *this, int option, int64_t value);
+ int64_t (*get_option) (metronom_t *this, int option);
/*
* system clock reference (SCR) functions
@@ -227,6 +225,7 @@ struct metronom_s {
scr_plugin_t* scr_master;
scr_plugin_t** scr_list;
pthread_t sync_thread;
+ int scr_adjustable;
pthread_mutex_t lock;
@@ -242,6 +241,13 @@ struct metronom_s {
metronom_t *metronom_init (int have_audio, void *xine);
/*
+ * metronom options
+ */
+
+#define METRONOM_SCR_ADJUSTABLE 1
+#define METRONOM_AV_OFFSET 2
+
+/*
* SCR (system clock reference) plugins
*/
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index f69b944e8..2a8b6b071 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.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: xine.c,v 1.111 2002/03/18 19:34:17 guenter Exp $
+ * $Id: xine.c,v 1.112 2002/03/23 18:56:56 guenter Exp $
*
* top-level xine functions
*
@@ -664,11 +664,11 @@ int xine_check_version(int major, int minor, int sub) {
*/
void xine_set_av_offset (xine_t *this, int offset_pts) {
- this->metronom->set_av_offset (this->metronom, offset_pts);
+ this->metronom->set_option (this->metronom, METRONOM_AV_OFFSET, offset_pts);
}
int xine_get_av_offset (xine_t *this) {
- return this->metronom->get_av_offset (this->metronom);
+ return this->metronom->get_option (this->metronom, METRONOM_AV_OFFSET);
}
/*