diff options
Diffstat (limited to 'src/xine-engine/metronom.h')
-rw-r--r-- | src/xine-engine/metronom.h | 108 |
1 files changed, 32 insertions, 76 deletions
diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h index 18dd2ca8e..1b6a841cc 100644 --- a/src/xine-engine/metronom.h +++ b/src/xine-engine/metronom.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * * This file is part of xine, a unix video player. * @@ -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.16 2001/12/27 14:30:30 f1rmb Exp $ + * $Id: metronom.h,v 1.17 2002/02/09 07:13:24 guenter Exp $ * * metronom: general pts => virtual calculation/assoc * @@ -50,6 +50,7 @@ extern "C" { #include <inttypes.h> #include <sys/time.h> #include <pthread.h> +#include "video_out.h" typedef struct metronom_s metronom_t ; typedef struct scr_plugin_s scr_plugin_t; @@ -63,58 +64,26 @@ struct metronom_s { void *xine; /* - * this is called to tell metronom to prepare for a new video stream - * (video and audio decoder threads may be blocked at these functions - * to synchronize starting and stopping) - */ - - void (*video_stream_start) (metronom_t *this); - void (*video_stream_end) (metronom_t *this); - - /* - * this is called to tell metronom to prepare for a new audio stream - * (video and audio decoder threads may be blocked at these functions - * to synchronize starting and stopping) - */ - - void (*audio_stream_start) (metronom_t *this); - void (*audio_stream_end) (metronom_t *this); - - /* - * called by video output driver to inform metronom about current framerate - * - * parameter pts_per_frame : frame display duration in 1/90000 sec - */ - void (*set_video_rate) (metronom_t *this, uint32_t pts_per_frame); - - /* - * return current video rate (including delta corrections) - */ - - uint32_t (*get_video_rate) (metronom_t *this); - - /* * called by audio output driver to inform metronom about current audio - * bitrate + * samplerate * * parameter pts_per_smpls : 1/90000 sec per 65536 samples */ - void (*set_audio_rate) (metronom_t *this, uint32_t pts_per_smpls); + void (*set_audio_rate) (metronom_t *this, int64_t pts_per_smpls); /* * called by video output driver for *every* frame * - * parameter pts: pts for frame if known, 0 otherwise - * scr: system clock reference, may be 0 or == pts if unknown + * parameter frame containing pts, scr, ... information * - * return value: virtual pts for frame (interpolated if pts == 0) + * will set vpts field in frame * * this function will also update video_wrap_offset if a discontinuity * is detected (read the comentaries below about discontinuities). * */ - uint32_t (*got_video_frame) (metronom_t *this, uint32_t pts, uint32_t scr); + void (*got_video_frame) (metronom_t *this, vo_frame_t *frame); /* * called by audio output driver whenever audio samples are delivered to it @@ -130,7 +99,8 @@ struct metronom_s { * */ - uint32_t (*got_audio_samples) (metronom_t *this, uint32_t pts, uint32_t nsamples, uint32_t scr); + int64_t (*got_audio_samples) (metronom_t *this, int64_t pts, + int nsamples, int64_t scr); /* * called by SPU decoder whenever a packet is delivered to it @@ -143,17 +113,17 @@ struct metronom_s { * due to the lack of regularity on spu packets) */ - uint32_t (*got_spu_packet) (metronom_t *this, uint32_t pts, uint32_t duration, - uint32_t scr); + int64_t (*got_spu_packet) (metronom_t *this, int64_t pts, int64_t duration, + int64_t scr); /* - * Tell metronom about discontinuities. + * tell metronom about discontinuities. * - * These functions are called due to a discontinuity detected at + * these functions are called due to a discontinuity detected at * demux stage from SCR values. As SCR are not guarateed to happen with * any regularity, we can not correct the xxx_wrap_offset right now. * - * We will instead prepare both audio and video to correct the + * we will instead prepare both audio and video to correct the * discontinuity at the first new PTS value (got_video_frame or * got_audio_samples). As we can predict with reasonably accuracy what * the old PTS would have being the calculated wrap_offset should be @@ -185,7 +155,7 @@ struct metronom_s { * start metronom clock (no clock reset) * at given pts */ - void (*start_clock) (metronom_t *this, uint32_t pts); + void (*start_clock) (metronom_t *this, int64_t pts); /* @@ -203,13 +173,13 @@ struct metronom_s { /* * get current clock value in vpts */ - uint32_t (*get_current_time) (metronom_t *this); + int64_t (*get_current_time) (metronom_t *this); /* * adjust master clock to external timer (e.g. audio hardware) */ - void (*adjust_clock) (metronom_t *this, uint32_t desired_pts); + void (*adjust_clock) (metronom_t *this, int64_t desired_pts); /* @@ -229,28 +199,24 @@ struct metronom_s { * metronom internal stuff */ - uint32_t pts_per_frame; - uint32_t pts_per_smpls; + int64_t pts_per_smpls; - int32_t audio_pts_delta; + int64_t audio_pts_delta; - uint32_t video_vpts; - uint32_t spu_vpts; - uint32_t audio_vpts; + int64_t video_vpts; + int64_t spu_vpts; + int64_t audio_vpts; - int32_t video_wrap_offset; - int32_t audio_wrap_offset; + int64_t video_wrap_offset; + int64_t audio_wrap_offset; int wrap_diff_counter; - uint32_t last_video_pts; - uint32_t last_video_scr; - int num_video_vpts_guessed; + int64_t last_video_pts; - uint32_t last_audio_pts; - uint32_t last_audio_scr; + int64_t last_audio_pts; int num_audio_samples_guessed; - int32_t av_offset; + int64_t av_offset; scr_plugin_t* scr_master; scr_plugin_t** scr_list; @@ -259,29 +225,19 @@ struct metronom_s { pthread_mutex_t lock; int have_audio; - int video_stream_starting; - int video_stream_running; - int audio_stream_starting; - int audio_stream_running; int video_discontinuity; int video_discontinuity_count; int audio_discontinuity; int audio_discontinuity_count; pthread_cond_t video_discontinuity_reached; pthread_cond_t audio_discontinuity_reached; - pthread_cond_t video_started; - pthread_cond_t audio_started; - pthread_cond_t video_ended; - pthread_cond_t audio_ended; - int frames_since_start; - int avg_frame_duration; }; metronom_t *metronom_init (int have_audio, void *xine); /* - * SCR plugins + * SCR (system clock reference) plugins */ struct scr_plugin_s @@ -299,11 +255,11 @@ struct scr_plugin_s int (*set_speed) (scr_plugin_t *this, int speed); - void (*adjust) (scr_plugin_t *this, uint32_t vpts); + void (*adjust) (scr_plugin_t *this, int64_t vpts); - void (*start) (scr_plugin_t *this, uint32_t start_vpts); + void (*start) (scr_plugin_t *this, int64_t start_vpts); - uint32_t (*get_current) (scr_plugin_t *this); + int64_t (*get_current) (scr_plugin_t *this); metronom_t *metronom; }; |