root/OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegClocks.hpp @ 10851

Revision 10851, 1.6 kB (checked in by robert, 4 years ago)

From Julen Garcia,"I've been lately working also with the ffmpeg plugin and I implemented pause(), seek() and getReferenceTime(). I think that I have solved the internal clock issues (maybe not in the most elegant way :?"

RevLine 
[9816]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
14namespace osgFFmpeg {
15
16
17
18class FFmpegClocks
19{
20public:
21
22    FFmpegClocks();
23
24    void reset(double start_time);
[10851]25    void pause(bool pause);
[9816]26    void rewindAudio();
27    void rewindVideo();
28
29    void audioSetBufferEndPts(double pts);
30    void audioAdjustBufferEndPts(double increment);
31    void audioSetDelay(double delay);
32    void audioDisable();
[10161]33    bool audioDisabled() const { return m_audio_disabled; }
[9816]34
35    double videoSynchClock(const AVFrame * frame, double time_base, double pts);
36    double videoRefreshSchedule(double pts);
37
38    double getStartTime() const;
[10851]39    double getCurrentTime();
40    void setPauseTime(double pause_time);
41    void setSeekTime(double seek_time);
[9816]42
43private:
44
45    double getAudioTime() const;
46
47    typedef osg::Timer Timer;
48    typedef OpenThreads::Mutex Mutex;
49    typedef OpenThreads::ScopedLock<Mutex> ScopedLock;
50
51    mutable Mutex m_mutex;
52
53    double    m_video_clock;
54
55    double    m_start_time;
[10851]56    double    m_pause_time;
57    double    m_seek_time;
[9816]58    double    m_last_frame_delay;
59    double    m_last_frame_pts;
60    double    m_last_actual_delay;
61    double    m_frame_time;
62    double    m_audio_buffer_end_pts;
63    double    m_audio_delay;
[10851]64    Timer     m_audio_timer;
65    bool      m_audio_disabled;
66    bool      m_rewind;
67    bool      m_paused;
68    double    m_last_current_time;
69
[9816]70   
71};
72
73
74
75} // namespace osgFFmpeg
76
77
78
79#endif // HEADER_GUARD_OSGFFMPEG_FFMPEG_CLOCKS_H
Note: See TracBrowser for help on using the browser.