xine-lib 1.2.11
Data Structures | Macros | Functions
metronom.c File Reference
#include <time.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#include <sys/time.h>
#include <xine/xine_internal.h>
#include <xine/metronom.h>
#include <xine/xineutils.h>
#include "xine_private.h"

Data Structures

struct  unixscr_values_t
 
struct  unixscr_t
 
struct  metronom_clock_private_t
 
struct  metronom_impl_t
 

Macros

#define LOG_MODULE   "metronom"
 
#define LOG_VERBOSE
 
#define METRONOM_CLOCK_INTERNAL
 
#define AUDIO_SAMPLE_LD   15
 
#define AUDIO_SAMPLE_NUM   (1 << AUDIO_SAMPLE_LD)
 
#define AUDIO_SAMPLE_MASK   (AUDIO_SAMPLE_NUM - 1)
 
#define MAX_SCR_PROVIDERS   10
 
#define MAX_SPEED_CHANGE_CALLBACKS   16
 
#define VIDEO_DRIFT_TOLERANCE   45000
 
#define AUDIO_DRIFT_TOLERANCE   45000
 
#define VIDEO_PREDICTION_MODE   0 /* use pts + frame duration */
 
#define VIDEO_PTS_MODE   1 /* use only pts */
 
#define abs(x)   ( ((x)<0) ? -(x) : (x) )
 
#define START_PTS   0
 
#define STOP_PTS   ~0
 
#define MASK_PTS   (1 << 19) /* 5.825 s */
 
#define BOUNCE_MAX   360000
 

Functions

static int unixscr_get_priority (scr_plugin_t *scr)
 
static void unixscr_set_pivot (unixscr_t *this)
 
static int unixscr_set_speed (scr_plugin_t *scr, int speed)
 
static void unixscr_adjust (scr_plugin_t *scr, int64_t vpts)
 
static void unixscr_start (scr_plugin_t *scr, int64_t start_vpts)
 
static int64_t unixscr_get_current (scr_plugin_t *scr)
 
static void unixscr_exit (scr_plugin_t *scr)
 
static scr_plugin_tunixscr_init (void *this_gen)
 
static void metronom_register_speed_change_callback (metronom_clock_t *this, xine_speed_change_cb_t *callback, void *user_data)
 
static void metronom_unregister_speed_change_callback (metronom_clock_t *this, xine_speed_change_cb_t *callback, void *user_data)
 
static void metronom_start_clock (metronom_clock_t *this, int64_t pts)
 
static int64_t metronom_get_current_time (metronom_clock_t *this)
 
static void metronom_stop_clock (metronom_clock_t *this)
 
static void metronom_resume_clock (metronom_clock_t *this)
 
static void metronom_adjust_clock (metronom_clock_t *this, int64_t desired_pts)
 
static int metronom_set_speed (metronom_clock_t *this, int speed)
 
static void metronom_vdr_hack_disc (metronom_impl_t *this, int64_t pts_offs)
 
static void metronom_vdr_hack_prebuffer (metronom_impl_t *this, int64_t pts)
 
static void metronom_set_audio_rate (metronom_t *this_gen, int64_t pts_per_smpls)
 
static int64_t metronom_got_spu_packet (metronom_t *this_gen, int64_t pts)
 
static int metronom_handle_discontinuity (metronom_impl_t *this, int type, int try, int64_t disc_off)
 
static void metronom_handle_vdr_trick_pts (metronom_impl_t *this, int64_t pts)
 
static void metronom_handle_video_discontinuity (metronom_t *this_gen, int type, int64_t disc_off)
 
static void metronom_got_video_frame (metronom_t *this_gen, vo_frame_t *img)
 
static void metronom_handle_audio_discontinuity (metronom_t *this_gen, int type, int64_t disc_off)
 
static int64_t metronom_got_audio_samples (metronom_t *this_gen, int64_t pts, int nsamples)
 
static void metronom_set_option (metronom_t *this_gen, int option, int64_t value)
 
static void metronom_clock_set_option (metronom_clock_t *this, int option, int64_t value)
 
static int64_t metronom_get_option (metronom_t *this_gen, int option)
 
static int64_t metronom_clock_get_option (metronom_clock_t *this, int option)
 
static void metronom_set_master (metronom_t *this_gen, metronom_t *master)
 
static scr_plugin_tget_master_scr (metronom_clock_t *this)
 
static void * metronom_sync_loop (void *const this_gen)
 
static void metronom_start_sync_thread (metronom_clock_private_t *this_priv)
 
static void metronom_stop_sync_thread (metronom_clock_private_t *this_priv)
 
static int metronom_register_scr (metronom_clock_t *this, scr_plugin_t *scr)
 
static void metronom_unregister_scr (metronom_clock_t *this, scr_plugin_t *scr)
 
static void metronom_exit (metronom_t *this_gen)
 
static void metronom_clock_exit (metronom_clock_t *this)
 
static void metronom_base_av_offs_hook (void *this_gen, xine_cfg_entry_t *entry)
 
metronom_t_x_metronom_init (int have_video, int have_audio, xine_t *xine)
 
static void metronom_sync_hook (void *this_gen, xine_cfg_entry_t *entry)
 
metronom_clock_t_x_metronom_clock_init (xine_t *xine)
 

Macro Definition Documentation

◆ abs

#define abs (   x)    ( ((x)<0) ? -(x) : (x) )

◆ AUDIO_DRIFT_TOLERANCE

#define AUDIO_DRIFT_TOLERANCE   45000

◆ AUDIO_SAMPLE_LD

#define AUDIO_SAMPLE_LD   15

◆ AUDIO_SAMPLE_MASK

#define AUDIO_SAMPLE_MASK   (AUDIO_SAMPLE_NUM - 1)

◆ AUDIO_SAMPLE_NUM

#define AUDIO_SAMPLE_NUM   (1 << AUDIO_SAMPLE_LD)

◆ BOUNCE_MAX

#define BOUNCE_MAX   360000

◆ LOG_MODULE

#define LOG_MODULE   "metronom"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ MASK_PTS

#define MASK_PTS   (1 << 19) /* 5.825 s */

◆ MAX_SCR_PROVIDERS

#define MAX_SCR_PROVIDERS   10

◆ MAX_SPEED_CHANGE_CALLBACKS

#define MAX_SPEED_CHANGE_CALLBACKS   16

◆ METRONOM_CLOCK_INTERNAL

#define METRONOM_CLOCK_INTERNAL

◆ START_PTS

#define START_PTS   0

◆ STOP_PTS

#define STOP_PTS   ~0

◆ VIDEO_DRIFT_TOLERANCE

#define VIDEO_DRIFT_TOLERANCE   45000

◆ VIDEO_PREDICTION_MODE

#define VIDEO_PREDICTION_MODE   0 /* use pts + frame duration */

◆ VIDEO_PTS_MODE

#define VIDEO_PTS_MODE   1 /* use only pts */

Function Documentation

◆ _x_metronom_clock_init()

metronom_clock_t * _x_metronom_clock_init ( xine_t xine)

◆ _x_metronom_init()

metronom_t * _x_metronom_init ( int  have_video,
int  have_audio,
xine_t xine 
)

◆ get_master_scr()

static scr_plugin_t * get_master_scr ( metronom_clock_t this)
static

◆ metronom_adjust_clock()

static void metronom_adjust_clock ( metronom_clock_t this,
int64_t  desired_pts 
)
static

◆ metronom_base_av_offs_hook()

static void metronom_base_av_offs_hook ( void *  this_gen,
xine_cfg_entry_t entry 
)
static

◆ metronom_clock_exit()

static void metronom_clock_exit ( metronom_clock_t this)
static

◆ metronom_clock_get_option()

static int64_t metronom_clock_get_option ( metronom_clock_t this,
int  option 
)
static

◆ metronom_clock_set_option()

static void metronom_clock_set_option ( metronom_clock_t this,
int  option,
int64_t  value 
)
static

◆ metronom_exit()

static void metronom_exit ( metronom_t this_gen)
static

References NULL.

Referenced by _x_metronom_init().

◆ metronom_get_current_time()

static int64_t metronom_get_current_time ( metronom_clock_t this)
static

◆ metronom_get_option()

static int64_t metronom_get_option ( metronom_t this_gen,
int  option 
)
static

◆ metronom_got_audio_samples()

static int64_t metronom_got_audio_samples ( metronom_t this_gen,
int64_t  pts,
int  nsamples 
)
static

◆ metronom_got_spu_packet()

static int64_t metronom_got_spu_packet ( metronom_t this_gen,
int64_t  pts 
)
static

◆ metronom_got_video_frame()

static void metronom_got_video_frame ( metronom_t this_gen,
vo_frame_t img 
)
static

◆ metronom_handle_audio_discontinuity()

static void metronom_handle_audio_discontinuity ( metronom_t this_gen,
int  type,
int64_t  disc_off 
)
static

◆ metronom_handle_discontinuity()

static int metronom_handle_discontinuity ( metronom_impl_t this,
int  type,
int  try,
int64_t  disc_off 
)
static

◆ metronom_handle_vdr_trick_pts()

static void metronom_handle_vdr_trick_pts ( metronom_impl_t this,
int64_t  pts 
)
static

References XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by metronom_set_option().

◆ metronom_handle_video_discontinuity()

static void metronom_handle_video_discontinuity ( metronom_t this_gen,
int  type,
int64_t  disc_off 
)
static

◆ metronom_register_scr()

static int metronom_register_scr ( metronom_clock_t this,
scr_plugin_t scr 
)
static

◆ metronom_register_speed_change_callback()

static void metronom_register_speed_change_callback ( metronom_clock_t this,
xine_speed_change_cb_t callback,
void *  user_data 
)
static

◆ metronom_resume_clock()

static void metronom_resume_clock ( metronom_clock_t this)
static

◆ metronom_set_audio_rate()

static void metronom_set_audio_rate ( metronom_t this_gen,
int64_t  pts_per_smpls 
)
static

References AUDIO_SAMPLE_NUM, and lprintf.

Referenced by _x_metronom_init().

◆ metronom_set_master()

static void metronom_set_master ( metronom_t this_gen,
metronom_t master 
)
static

References METRONOM_LOCK, and metronom_s::set_option.

Referenced by _x_metronom_init().

◆ metronom_set_option()

static void metronom_set_option ( metronom_t this_gen,
int  option,
int64_t  value 
)
static

◆ metronom_set_speed()

static int metronom_set_speed ( metronom_clock_t this,
int  speed 
)
static

◆ metronom_start_clock()

static void metronom_start_clock ( metronom_clock_t this,
int64_t  pts 
)
static

◆ metronom_start_sync_thread()

static void metronom_start_sync_thread ( metronom_clock_private_t this_priv)
static

◆ metronom_stop_clock()

static void metronom_stop_clock ( metronom_clock_t this)
static

◆ metronom_stop_sync_thread()

static void metronom_stop_sync_thread ( metronom_clock_private_t this_priv)
static

◆ metronom_sync_hook()

static void metronom_sync_hook ( void *  this_gen,
xine_cfg_entry_t entry 
)
static

◆ metronom_sync_loop()

static void * metronom_sync_loop ( void *const  this_gen)
static

◆ metronom_unregister_scr()

static void metronom_unregister_scr ( metronom_clock_t this,
scr_plugin_t scr 
)
static

◆ metronom_unregister_speed_change_callback()

static void metronom_unregister_speed_change_callback ( metronom_clock_t this,
xine_speed_change_cb_t callback,
void *  user_data 
)
static

◆ metronom_vdr_hack_disc()

static void metronom_vdr_hack_disc ( metronom_impl_t this,
int64_t  pts_offs 
)
static

◆ metronom_vdr_hack_prebuffer()

static void metronom_vdr_hack_prebuffer ( metronom_impl_t this,
int64_t  pts 
)
static

Referenced by metronom_set_option().

◆ unixscr_adjust()

static void unixscr_adjust ( scr_plugin_t scr,
int64_t  vpts 
)
static

◆ unixscr_exit()

static void unixscr_exit ( scr_plugin_t scr)
static

◆ unixscr_get_current()

static int64_t unixscr_get_current ( scr_plugin_t scr)
static

◆ unixscr_get_priority()

static int unixscr_get_priority ( scr_plugin_t scr)
static

Referenced by unixscr_init().

◆ unixscr_init()

static scr_plugin_t * unixscr_init ( void *  this_gen)
static

◆ unixscr_set_pivot()

static void unixscr_set_pivot ( unixscr_t this)
static

References NULL, and xine_monotonic_clock().

Referenced by unixscr_set_speed().

◆ unixscr_set_speed()

static int unixscr_set_speed ( scr_plugin_t scr,
int  speed 
)
static

◆ unixscr_start()

static void unixscr_start ( scr_plugin_t scr,
int64_t  start_vpts 
)
static