summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-11-15 20:43:11 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-11-15 20:43:11 +0000
commit8ba7feda3dbbeb3c48a98ae36e67c8d66d04c3f9 (patch)
tree2c2cbd6d1e55ec2d9dc836bc89b8efe9d0ca315c
parent9271a230caa25831202936e63cce3716ffe2011a (diff)
downloadxine-lib-8ba7feda3dbbeb3c48a98ae36e67c8d66d04c3f9.tar.gz
xine-lib-8ba7feda3dbbeb3c48a98ae36e67c8d66d04c3f9.tar.bz2
* making metronom xine_stream_t independent
* using xprintf() and lprintf() inside metronom * prebuffer is now a metronom option * some small structure cleanup CVS patchset: 5737 CVS date: 2003/11/15 20:43:11
-rw-r--r--src/demuxers/demux_rawdv.c4
-rw-r--r--src/dxr3/dxr3_decode_video.c4
-rw-r--r--src/xine-engine/configfile.h4
-rw-r--r--src/xine-engine/metronom.c198
-rw-r--r--src/xine-engine/metronom.h20
-rw-r--r--src/xine-engine/xine.c7
-rw-r--r--src/xine-engine/xine_interface.c6
-rw-r--r--src/xine-engine/xine_internal.h9
8 files changed, 97 insertions, 155 deletions
diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c
index 737e2d4b0..5203c45ce 100644
--- a/src/demuxers/demux_rawdv.c
+++ b/src/demuxers/demux_rawdv.c
@@ -19,7 +19,7 @@
*/
/*
- * $Id: demux_rawdv.c,v 1.14 2003/11/15 14:01:00 miguelfreitas Exp $
+ * $Id: demux_rawdv.c,v 1.15 2003/11/15 20:43:11 mroi Exp $
*
* demultiplexer for raw dv streams
*/
@@ -376,7 +376,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
if (!INPUT_IS_SEEKABLE(this->input)) {
/* "live" DV streams require more prebuffering */
- this->stream->metronom_prebuffer = 90000;
+ this->stream->metronom->set_option(this->stream->metronom, METRONOM_PREBUFFER, 90000);
}
return &this->demux_plugin;
diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c
index 01a427e83..39d053f6d 100644
--- a/src/dxr3/dxr3_decode_video.c
+++ b/src/dxr3/dxr3_decode_video.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: dxr3_decode_video.c,v 1.43 2003/11/15 13:01:02 miguelfreitas Exp $
+ * $Id: dxr3_decode_video.c,v 1.44 2003/11/15 20:43:11 mroi Exp $
*/
/* dxr3 video decoder plugin.
@@ -259,7 +259,7 @@ static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_
dxr3_update_correct_durations, this);
/* the dxr3 needs a longer prebuffering to have time for its internal decoding */
- this->stream->metronom_prebuffer = 90000;
+ this->stream->metronom->set_option(this->stream->metronom, METRONOM_PREBUFFER, 90000);
stream->video_out->open(stream->video_out, stream);
diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h
index 3ed73e4fb..7f28b0598 100644
--- a/src/xine-engine/configfile.h
+++ b/src/xine-engine/configfile.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: configfile.h,v 1.31 2003/11/11 18:45:00 f1rmb Exp $
+ * $Id: configfile.h,v 1.32 2003/11/15 20:43:12 mroi Exp $
*
* config file management
*
@@ -64,8 +64,6 @@ struct cfg_entry_s {
/* type string */
char *str_value;
char *str_default;
- /* FIXME: remove this member on the next sturcture cleanup */
- void *dummy;
/* common to range, enum, num, bool: */
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index df2c8842c..5137095ff 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.125 2003/11/11 18:45:00 f1rmb Exp $
+ * $Id: metronom.c,v 1.126 2003/11/15 20:43:11 mroi Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -33,6 +33,8 @@
#include <string.h>
#include <errno.h>
+#define LOG_MODULE "metronom"
+
#include "xine_internal.h"
#include "metronom.h"
#include "xineutils.h"
@@ -184,9 +186,7 @@ static scr_plugin_t* unixscr_init () {
pthread_mutex_init (&this->lock, NULL);
unixscr_set_speed (&this->scr, XINE_SPEED_PAUSE);
-#ifdef LOG
- printf("xine-scr_init: complete\n");
-#endif
+ lprintf("xine-scr_init complete\n");
return &this->scr;
}
@@ -202,9 +202,7 @@ static scr_plugin_t* unixscr_init () {
static void metronom_start_clock (metronom_clock_t *this, int64_t pts) {
scr_plugin_t** scr;
-#ifdef LOG
- printf ("metronom: start_clock (at %lld)\n", pts);
-#endif
+ lprintf("start_clock (at %lld)\n", pts);
for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++)
if (*scr) (*scr)->start(*scr, pts);
@@ -260,10 +258,7 @@ static void metronom_set_audio_rate (metronom_t *this, int64_t pts_per_smpls) {
pthread_mutex_unlock (&this->lock);
-#ifdef LOG
- printf ("metronom: %lld pts per %d samples\n", pts_per_smpls, AUDIO_SAMPLE_NUM);
-#endif
-
+ lprintf("%lld pts per %d samples\n", pts_per_smpls, AUDIO_SAMPLE_NUM);
}
static int64_t metronom_got_spu_packet (metronom_t *this, int64_t pts) {
@@ -292,39 +287,33 @@ static void metronom_handle_video_discontinuity (metronom_t *this, int type,
this->video_discontinuity_count++;
pthread_cond_signal (&this->video_discontinuity_reached);
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("metronom: video discontinuity #%d, type is %d, disc_off is %lld\n",
- this->video_discontinuity_count, type, disc_off);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video discontinuity #%d, type is %d, disc_off is %lld\n",
+ this->video_discontinuity_count, type, disc_off);
if (this->have_audio) {
while (this->audio_discontinuity_count <
this->video_discontinuity_count) {
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("metronom: waiting for audio discontinuity #%d\n",
- this->video_discontinuity_count);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for audio discontinuity #%d\n",
+ this->video_discontinuity_count);
pthread_cond_wait (&this->audio_discontinuity_reached, &this->lock);
}
}
/* video_vpts and audio_vpts adjustements */
- cur_time = this->clock->get_current_time(this->clock);
+ cur_time = this->xine->clock->get_current_time(this->xine->clock);
switch (type) {
case DISC_STREAMSTART:
case DISC_STREAMSEEK:
- this->video_vpts = this->stream->metronom_prebuffer + cur_time;
+ this->video_vpts = this->prebuffer + cur_time;
this->audio_vpts = this->video_vpts;
this->force_audio_jump = 1;
this->force_video_jump = 1;
this->video_drift = 0;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) {
- printf ("metronom: video vpts adjusted with prebuffer to %lld\n",
- this->video_vpts);
- printf ("metronom: audio vpts adjusted with prebuffer to %lld\n",
- this->audio_vpts);
- }
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "vpts adjusted with prebuffer to %lld\n",
+ this->video_vpts);
break;
case DISC_ABSOLUTE:
@@ -334,29 +323,23 @@ static void metronom_handle_video_discontinuity (metronom_t *this, int type,
if (this->audio_vpts > cur_time) {
/* still frame with audio */
this->video_vpts = this->audio_vpts;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("metronom: video vpts adjusted to audio vpts\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video vpts adjusted to audio vpts\n");
} else {
/* still frame, no audio */
- this->video_vpts = this->stream->metronom_prebuffer + cur_time;
+ this->video_vpts = this->prebuffer + cur_time;
this->audio_vpts = this->video_vpts;
this->force_video_jump = 1;
this->force_audio_jump = 1;
this->video_drift = 0;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) {
- printf ("metronom: video vpts adjusted with prebuffer to %lld\n",
- this->video_vpts);
- printf ("metronom: audio vpts adjusted with prebuffer to %lld\n",
- this->audio_vpts);
- }
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "vpts adjusted with prebuffer to %lld\n",
+ this->video_vpts);
}
} else {
/* video */
if (this->audio_vpts < cur_time) {
/* video, no sound */
this->audio_vpts = this->video_vpts;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("metronom: audio vpts adjusted to audio vpts\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio vpts adjusted to audio vpts\n");
} else {
/* video + audio */
}
@@ -364,34 +347,24 @@ static void metronom_handle_video_discontinuity (metronom_t *this, int type,
break;
}
-#ifdef LOG
- printf ("metronom: video_vpts: %lld, audio_vpts: %lld\n", this->video_vpts, this->audio_vpts);
-#endif
+ lprintf("video_vpts: %lld, audio_vpts: %lld\n", this->video_vpts, this->audio_vpts);
/* vpts_offset adjustements */
switch (type) {
case DISC_STREAMSTART:
-#ifdef LOG
- printf ("metronom: DISC_STREAMSTART\n");
-#endif
+ lprintf("DISC_STREAMSTART\n");
this->vpts_offset = this->video_vpts;
break;
case DISC_ABSOLUTE:
-#ifdef LOG
- printf ("metronom: DISC_ABSOLUTE\n");
-#endif
+ lprintf("DISC_ABSOLUTE\n");
this->vpts_offset = this->video_vpts - disc_off;
break;
case DISC_RELATIVE:
-#ifdef LOG
- printf ("metronom: DISC_RELATIVE\n");
-#endif
+ lprintf("DISC_RELATIVE\n");
this->vpts_offset = this->vpts_offset - disc_off;
break;
case DISC_STREAMSEEK:
-#ifdef LOG
- printf ("metronom: DISC_STREAMSEEK\n");
-#endif
+ lprintf("DISC_STREAMSEEK\n");
this->vpts_offset = this->video_vpts - disc_off;
break;
}
@@ -412,10 +385,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) {
pthread_mutex_lock (&this->lock);
-#ifdef LOG
- printf("metronom: got_video_frame pts = %lld, duration = %d\n",
- pts, img->duration);
-#endif
+ lprintf("got_video_frame pts = %lld, duration = %d\n", pts, img->duration);
this->img_cpt++;
@@ -428,9 +398,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) {
if (!img->duration) {
if (this->last_video_pts && this->img_cpt) {
this->img_duration = (pts - this->last_video_pts) / this->img_cpt;
-#ifdef LOG
- printf("metronom: computed frame_duration = %lld\n", this->img_duration );
-#endif
+ lprintf("computed frame_duration = %lld\n", this->img_duration );
}
img->duration = this->img_duration;
} else {
@@ -451,18 +419,14 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) {
diff = this->video_vpts - vpts;
-#ifdef LOG
- printf ("metronom: video diff is %lld (predicted %lld, given %lld)\n",
- diff, this->video_vpts, vpts);
-#endif
+ lprintf("video diff is %lld (predicted %lld, given %lld)\n", diff, this->video_vpts, vpts);
if ((abs (diff) > VIDEO_DRIFT_TOLERANCE) || (this->force_video_jump)) {
this->force_video_jump = 0;
this->video_vpts = vpts;
this->video_drift = 0;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("metronom: video jump\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video jump\n");
} else {
@@ -471,10 +435,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) {
/* this will fix video drift with a constant compensation each
frame for about 1 second of video. */
-#ifdef LOG
- if (diff)
- printf ("metronom: video drift, drift is %lld\n", this->video_drift);
-#endif
+ if (diff) lprintf("video drift, drift is %lld\n", this->video_drift);
}
} else {
if (!img->duration) {
@@ -487,10 +448,8 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) {
img->vpts = this->video_vpts + this->av_offset;
-#ifdef LOG
- printf ("metronom: video vpts for %10lld : %10lld (duration:%d drift:%lld step:%lld)\n",
+ lprintf("video vpts for %10lld : %10lld (duration:%d drift:%lld step:%lld)\n",
pts, this->video_vpts, img->duration, this->video_drift, this->video_drift_step );
-#endif
if( this->video_drift * this->video_drift_step > 0 )
{
@@ -512,17 +471,15 @@ static void metronom_handle_audio_discontinuity (metronom_t *this, int type,
this->audio_discontinuity_count++;
pthread_cond_signal (&this->audio_discontinuity_reached);
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("metronom: audio discontinuity #%d, type is %d, disc_off %lld\n",
- this->audio_discontinuity_count, type, disc_off);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio discontinuity #%d, type is %d, disc_off %lld\n",
+ this->audio_discontinuity_count, type, disc_off);
/* next_vpts_offset, in_discontinuity is handled in expect_video_discontinuity */
while ( this->audio_discontinuity_count >
this->discontinuity_handled_count ) {
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("metronom: waiting for in_discontinuity update #%d\n",
- this->audio_discontinuity_count);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for in_discontinuity update #%d\n",
+ this->audio_discontinuity_count);
pthread_cond_wait (&this->video_discontinuity_reached, &this->lock);
}
@@ -539,10 +496,8 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts,
int64_t vpts;
int64_t diff;
-#ifdef LOG_AUDIO
- printf ("metronom: got %d audio samples, pts is %lld, last pts = %lld\n", nsamples, pts, this->last_audio_pts);
- printf ("metronom: AUDIO pts from last= %lld\n", pts-this->last_audio_pts);
-#endif
+ lprintf("got %d audio samples, pts is %lld, last pts = %lld\n", nsamples, pts, this->last_audio_pts);
+ lprintf("AUDIO pts from last= %lld\n", pts-this->last_audio_pts);
pthread_mutex_lock (&this->lock);
@@ -556,14 +511,12 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts,
this->force_audio_jump = 0;
this->audio_vpts = vpts;
this->audio_drift_step = 0;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf("metronom: audio jump, diff=%lld\n", diff);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio jump, diff=%lld\n", diff);
} else {
if( this->audio_samples ) {
/* calculate drift_step to recover vpts errors */
-#ifdef LOG_AUDIO
- printf("metronom: audio diff = %lld \n", diff );
-#endif
+ lprintf("audio diff = %lld \n", diff );
+
diff *= AUDIO_SAMPLE_NUM;
diff /= this->audio_samples * 4;
@@ -575,10 +528,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts,
this->audio_drift_step = diff;
-#ifdef LOG_AUDIO
- printf("metronom: audio_drift = %lld, pts_per_smpls = %lld\n", diff,
- this->pts_per_smpls );
-#endif
+ lprintf("audio_drift = %lld, pts_per_smpls = %lld\n", diff, this->pts_per_smpls);
}
}
this->audio_samples = 0;
@@ -595,9 +545,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts,
this->audio_samples += nsamples;
this->vpts_offset += nsamples * this->audio_drift_step / AUDIO_SAMPLE_NUM;
-#ifdef LOG_AUDIO
- printf ("metronom: audio vpts for %10lld : %10lld\n", pts, vpts);
-#endif
+ lprintf("audio vpts for %10lld : %10lld\n", pts, vpts);
pthread_mutex_unlock (&this->lock);
@@ -611,13 +559,11 @@ static void metronom_set_option (metronom_t *this, int option, int64_t value) {
switch (option) {
case METRONOM_AV_OFFSET:
this->av_offset = value;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("metronom: av_offset=%lld pts\n", this->av_offset);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "av_offset=%lld pts\n", this->av_offset);
break;
case METRONOM_SPU_OFFSET:
this->spu_offset = value;
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("metronom: spu_offset=%lld pts\n", this->spu_offset);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "spu_offset=%lld pts\n", this->spu_offset);
break;
case METRONOM_ADJ_VPTS_OFFSET:
this->audio_vpts += value;
@@ -627,12 +573,14 @@ static void metronom_set_option (metronom_t *this, int option, int64_t value) {
* once in a while means a small sound card drift (or system
* clock drift -- who knows?). nothing to worry about.
*/
- if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("metronom: fixing sound card drift by %lld pts\n", value );
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "fixing sound card drift by %lld pts\n", value);
+ break;
+ case METRONOM_PREBUFFER:
+ this->prebuffer = value;
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "prebuffer=%lld pts\n", this->prebuffer);
break;
default:
- printf ("metronom: unknown option in set_option: %d\n",
- option);
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in set_option: %d\n", option);
}
pthread_mutex_unlock (&this->lock);
@@ -648,8 +596,7 @@ static void metronom_clock_set_option (metronom_clock_t *this,
this->scr_adjustable = value;
break;
default:
- printf ("metronom: unknown option in set_option: %d\n",
- option);
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in set_option: %d\n", option);
}
pthread_mutex_unlock (&this->lock);
@@ -665,9 +612,10 @@ static int64_t metronom_get_option (metronom_t *this, int option) {
return this->img_duration;
case METRONOM_VPTS_OFFSET:
return this->vpts_offset;
+ case METRONOM_PREBUFFER:
+ return this->prebuffer;
}
- printf ("metronom: unknown option in get_option: %d\n",
- option);
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option);
return 0;
}
@@ -676,8 +624,7 @@ static int64_t metronom_clock_get_option (metronom_clock_t *this, int option) {
case CLOCK_SCR_ADJUSTABLE:
return this->scr_adjustable;
}
- printf ("metronom: unknown option in get_option: %d\n",
- option);
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option);
return 0;
}
@@ -694,7 +641,7 @@ static scr_plugin_t* get_master_scr(metronom_clock_t *this) {
}
}
if (select < 0) {
- printf ("metronom: panic - no scr provider found!\n");
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "panic - no scr provider found!\n");
return NULL;
}
return this->scr_list[select];
@@ -796,31 +743,31 @@ static void metronom_clock_exit (metronom_clock_t *this) {
}
-metronom_t * _x_metronom_init (int have_audio, xine_stream_t *stream) {
+metronom_t * _x_metronom_init (int have_audio, xine_t *xine) {
metronom_t *this = xine_xmalloc (sizeof (metronom_t));
- this->stream = stream;
- this->clock = stream->xine->clock;
- this->set_audio_rate = metronom_set_audio_rate;
- this->got_video_frame = metronom_got_video_frame;
- this->got_audio_samples = metronom_got_audio_samples;
- this->got_spu_packet = metronom_got_spu_packet;
+ this->xine = xine;
+ this->set_audio_rate = metronom_set_audio_rate;
+ this->got_video_frame = metronom_got_video_frame;
+ this->got_audio_samples = metronom_got_audio_samples;
+ 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_option = metronom_set_option;
- this->get_option = metronom_get_option;
- this->exit = metronom_exit;
+ this->set_option = metronom_set_option;
+ this->get_option = metronom_get_option;
+ this->exit = metronom_exit;
pthread_mutex_init (&this->lock, NULL);
+ this->prebuffer = PREBUFFER_PTS_OFFSET;
this->av_offset = 0;
this->spu_offset = 0;
this->vpts_offset = 0;
/* initialize video stuff */
-
- this->video_vpts = stream->metronom_prebuffer;
+
+ this->video_vpts = this->prebuffer;
this->video_drift = 0;
this->video_drift_step = 0;
this->video_discontinuity_count = 0;
@@ -835,7 +782,7 @@ metronom_t * _x_metronom_init (int have_audio, xine_stream_t *stream) {
/* initialize audio stuff */
this->have_audio = have_audio;
- this->audio_vpts = this->stream->metronom_prebuffer;
+ this->audio_vpts = this->prebuffer;
this->audio_discontinuity_count = 0;
pthread_cond_init (&this->audio_discontinuity_reached, NULL);
@@ -844,7 +791,7 @@ metronom_t * _x_metronom_init (int have_audio, xine_stream_t *stream) {
}
-metronom_clock_t *_x_metronom_clock_init(void)
+metronom_clock_t *_x_metronom_clock_init(xine_t *xine)
{
metronom_clock_t *this = (metronom_clock_t *)malloc(sizeof(metronom_clock_t));
int err;
@@ -861,8 +808,9 @@ metronom_clock_t *_x_metronom_clock_init(void)
this->unregister_scr = metronom_unregister_scr;
this->exit = metronom_clock_exit;
- this->scr_adjustable = 1;
- this->scr_list = calloc(MAX_SCR_PROVIDERS, sizeof(void*));
+ this->xine = xine;
+ this->scr_adjustable = 1;
+ this->scr_list = calloc(MAX_SCR_PROVIDERS, sizeof(void*));
this->register_scr(this, unixscr_init());
pthread_mutex_init (&this->lock, NULL);
@@ -872,7 +820,7 @@ metronom_clock_t *_x_metronom_clock_init(void)
if ((err = pthread_create(&this->sync_thread, NULL,
(void*(*)(void*)) metronom_sync_loop, this)) != 0)
- printf ("metronom: cannot create sync thread (%s)\n",
+ xprintf(this->xine, XINE_VERBOSITY_NONE, "cannot create sync thread (%s)\n",
strerror(err));
return this;
diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h
index 2858f2586..04304de20 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.52 2003/11/11 18:45:00 f1rmb Exp $
+ * $Id: metronom.h,v 1.53 2003/11/15 20:43:11 mroi Exp $
*
* metronom: general pts => virtual calculation/assoc
*
@@ -169,12 +169,10 @@ struct metronom_s {
void (*exit) (metronom_t *self);
/*
- * pointer to current xine stream object.
+ * pointer to current xine object.
*/
- xine_stream_t *stream;
+ xine_t *xine;
- metronom_clock_t *clock;
-
/*
* metronom internal stuff
*/
@@ -193,6 +191,7 @@ struct metronom_s {
int audio_samples;
int64_t audio_drift_step;
+ int64_t prebuffer;
int64_t av_offset;
int64_t spu_offset;
@@ -225,8 +224,9 @@ struct metronom_s {
#define METRONOM_FRAME_DURATION 4
#define METRONOM_SPU_OFFSET 5
#define METRONOM_VPTS_OFFSET 6
+#define METRONOM_PREBUFFER 7
-metronom_t *_x_metronom_init (int have_audio, xine_stream_t *stream);
+metronom_t *_x_metronom_init (int have_audio, xine_t *xine);
struct metronom_clock_s {
@@ -286,8 +286,10 @@ struct metronom_clock_s {
void (*exit) (metronom_clock_t *self);
- scr_plugin_t* scr_master;
- scr_plugin_t** scr_list;
+ xine_t *xine;
+
+ scr_plugin_t *scr_master;
+ scr_plugin_t **scr_list;
pthread_t sync_thread;
int thread_running;
int scr_adjustable;
@@ -299,7 +301,7 @@ struct metronom_clock_s {
};
-metronom_clock_t *_x_metronom_clock_init(void);
+metronom_clock_t *_x_metronom_clock_init(xine_t *xine);
/*
* clock options
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 2e28fc6fc..0679e4ae2 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.264 2003/11/15 14:00:35 miguelfreitas Exp $
+ * $Id: xine.c,v 1.265 2003/11/15 20:43:11 mroi Exp $
*/
/*
@@ -387,7 +387,6 @@ xine_stream_t *xine_stream_new (xine_t *this,
stream->err = 0;
stream->next_audio_port = NULL;
stream->next_video_port = NULL;
- stream->metronom_prebuffer = PREBUFFER_PTS_OFFSET;
stream->broadcaster = NULL;
/*
@@ -424,7 +423,7 @@ xine_stream_t *xine_stream_new (xine_t *this,
* create a metronom
*/
- stream->metronom = _x_metronom_init ( (ao != NULL), stream);
+ stream->metronom = _x_metronom_init ( (ao != NULL), this);
/*
* alloc fifos, init and start decoder threads
@@ -1305,7 +1304,7 @@ void xine_init (xine_t *this) {
* start metronom clock
*/
- this->clock = _x_metronom_clock_init();
+ this->clock = _x_metronom_clock_init(this);
this->clock->start_clock (this->clock, 0);
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index bec330a2b..3c179b386 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.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_interface.c,v 1.64 2003/11/11 18:45:02 f1rmb Exp $
+ * $Id: xine_interface.c,v 1.65 2003/11/15 20:43:11 mroi Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -423,7 +423,7 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
break;
case XINE_PARAM_METRONOM_PREBUFFER:
- stream->metronom_prebuffer = value;
+ stream->metronom->set_option(stream->metronom, METRONOM_PREBUFFER, value);
break;
case XINE_PARAM_BROADCASTER_PORT:
@@ -523,7 +523,7 @@ int xine_get_param (xine_stream_t *stream, int param) {
return stream->stream_info[XINE_STREAM_INFO_IGNORE_SPU];
case XINE_PARAM_METRONOM_PREBUFFER:
- return stream->metronom_prebuffer;
+ return stream->metronom->get_option(stream->metronom, METRONOM_PREBUFFER);
case XINE_PARAM_BROADCASTER_PORT:
if( stream->broadcaster )
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 0e5327676..800180a17 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.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: xine_internal.h,v 1.147 2003/11/15 15:04:36 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.148 2003/11/15 20:43:12 mroi Exp $
*
*/
@@ -99,6 +99,7 @@ struct xine_s {
plugin_catalog_t *plugin_catalog;
int demux_strategy;
+ char *save_path;
/* log output that may be presented to the user */
scratch_buffer_t *log_buffers[XINE_LOG_NUM];
@@ -109,9 +110,6 @@ struct xine_s {
pthread_mutex_t streams_lock;
metronom_clock_t *clock;
-
- /* FIXME: move this member beneath demux_strategy on the next structure cleanup */
- char *save_path;
};
/*
@@ -171,9 +169,6 @@ struct xine_stream_s {
/* dxr3 use this one, should be possible to fix to use the port instead */
vo_driver_t *video_driver;
- /* michael will move this one to metronom i think */
- int64_t metronom_prebuffer;
-
/* these definitely should be made private! */
int audio_channel_auto;
int spu_decoder_streamtype;