2
synchronisation of audio/video (PTS) against system clock stamps (SCR)
3
Copyright (C) 2000 Martin Vogt
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation.
9
For more information look at the file COPYRIGHT in this package
14
#ifndef __SYNCCLOCKMPEG_H
15
#define __SYNCCLOCKMPEG_H
18
#include "syncClock.h"
21
The idea is similar to this:
22
We start a clock and selext a synchronisation mode.
23
(AUDIO,VIDEO,BOTH,NONE)
24
Assume we select AUDIO. When the audio thread delivers an SCR
25
and an PTS, we set the SCR from this set, as the new
26
time reference fo rthis clock.
27
If a video thread enters the class, with an SCR,PTS we wait,
28
or directly return if the PTS is in time or out of time,
29
but we never set the SCR.
32
class SyncClockMPEG : public SyncClock {
39
timeval_t lastSCR_time;
40
timeval_t lastPTS_time;
48
void setSyncMode(int syncMode);
51
int syncAudio(double pts,double scr);
52
int syncVideo(double pts,double scr,
53
class TimeStamp* earlyTime,class TimeStamp* waitTime);
55
void print(char* text);
57
double getPTSTime(double* window);
60
void printTime(timeval_t* a,char* text);
61
void markLastPTSTime(double scr,double pts);
62
int gowait(double scr,double pts,
63
class TimeStamp* earlyTime,class TimeStamp* waitTime);
64
int a_Minus_b_Is_C(timeval_t* a,timeval_t* b,timeval_t* c);
65
double timeval2Double(timeval_t* a);
66
void double2Timeval(double a,timeval_t* dest);
69
void unlockSyncClock();
71
abs_thread_mutex_t scrMut;
72
abs_thread_mutex_t changeMut;