generic-pc: implement cDemux::getSTC()

This commit is contained in:
Stefan Seyfried
2013-06-01 17:16:56 +02:00
parent 7e9d0f49a9
commit 618e7723bf
3 changed files with 18 additions and 0 deletions

View File

@@ -35,6 +35,10 @@
#include "dmx_lib.h" #include "dmx_lib.h"
#include "lt_debug.h" #include "lt_debug.h"
/* needed for getSTC :-( */
#include "video_lib.h"
extern cVideo *videoDecoder;
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args)
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args)
#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) #define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args)
@@ -474,6 +478,8 @@ void cDemux::removePid(unsigned short Pid)
void cDemux::getSTC(int64_t * STC) void cDemux::getSTC(int64_t * STC)
{ {
int64_t pts = 0; int64_t pts = 0;
if (videoDecoder)
pts = videoDecoder->GetPTS();
*STC = pts; *STC = pts;
} }

View File

@@ -650,3 +650,13 @@ bool cVideo::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool ge
return true; return true;
} }
int64_t cVideo::GetPTS(void)
{
int64_t pts = 0;
buf_m.lock();
if (buf_num != 0)
pts = buffers[buf_out].pts();
buf_m.unlock();
return pts;
}

View File

@@ -122,6 +122,7 @@ typedef enum
class cVideo : public OpenThreads::Thread class cVideo : public OpenThreads::Thread
{ {
friend class GLFramebuffer; friend class GLFramebuffer;
friend class cDemux;
private: private:
/* called from GL thread */ /* called from GL thread */
class SWFramebuffer : public std::vector<unsigned char> class SWFramebuffer : public std::vector<unsigned char>
@@ -143,6 +144,7 @@ class cVideo : public OpenThreads::Thread
AVRational mAR; AVRational mAR;
}; };
int buf_in, buf_out, buf_num; int buf_in, buf_out, buf_num;
int64_t GetPTS(void);
public: public:
/* constructor & destructor */ /* constructor & destructor */
cVideo(int mode, void *, void *); cVideo(int mode, void *, void *);