|
Revision 10161, 1.3 kB
(checked in by robert, 4 years ago)
|
|
From Jean-Sebastien Guay, changed the timing control for when no audio layer is supplied.
|
| Line | |
|---|
| 1 | |
|---|
| 2 | #ifndef HEADER_GUARD_OSGFFMPEG_FFMPEG_CLOCKS_H |
|---|
| 3 | #define HEADER_GUARD_OSGFFMPEG_FFMPEG_CLOCKS_H |
|---|
| 4 | |
|---|
| 5 | #include <osg/Timer> |
|---|
| 6 | |
|---|
| 7 | #include <OpenThreads/Mutex> |
|---|
| 8 | #include <OpenThreads/ScopedLock> |
|---|
| 9 | |
|---|
| 10 | #include "FFmpegHeaders.hpp" |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | namespace osgFFmpeg { |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | class FFmpegClocks |
|---|
| 19 | { |
|---|
| 20 | public: |
|---|
| 21 | |
|---|
| 22 | FFmpegClocks(); |
|---|
| 23 | |
|---|
| 24 | void reset(double start_time); |
|---|
| 25 | void rewindAudio(); |
|---|
| 26 | void rewindVideo(); |
|---|
| 27 | |
|---|
| 28 | void audioSetBufferEndPts(double pts); |
|---|
| 29 | void audioAdjustBufferEndPts(double increment); |
|---|
| 30 | void audioSetDelay(double delay); |
|---|
| 31 | void audioDisable(); |
|---|
| 32 | bool audioDisabled() const { return m_audio_disabled; } |
|---|
| 33 | |
|---|
| 34 | double videoSynchClock(const AVFrame * frame, double time_base, double pts); |
|---|
| 35 | double videoRefreshSchedule(double pts); |
|---|
| 36 | |
|---|
| 37 | double getStartTime() const; |
|---|
| 38 | |
|---|
| 39 | private: |
|---|
| 40 | |
|---|
| 41 | double getAudioTime() const; |
|---|
| 42 | |
|---|
| 43 | typedef osg::Timer Timer; |
|---|
| 44 | typedef OpenThreads::Mutex Mutex; |
|---|
| 45 | typedef OpenThreads::ScopedLock<Mutex> ScopedLock; |
|---|
| 46 | |
|---|
| 47 | mutable Mutex m_mutex; |
|---|
| 48 | |
|---|
| 49 | double m_video_clock; |
|---|
| 50 | |
|---|
| 51 | double m_start_time; |
|---|
| 52 | double m_last_frame_delay; |
|---|
| 53 | double m_last_frame_pts; |
|---|
| 54 | double m_last_actual_delay; |
|---|
| 55 | double m_frame_time; |
|---|
| 56 | double m_audio_buffer_end_pts; |
|---|
| 57 | double m_audio_delay; |
|---|
| 58 | Timer m_audio_timer; |
|---|
| 59 | bool m_audio_disabled; |
|---|
| 60 | bool m_rewind; |
|---|
| 61 | |
|---|
| 62 | }; |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | #endif // HEADER_GUARD_OSGFFMPEG_FFMPEG_CLOCKS_H |
|---|