From ca813634c3aa0505e555c42b4d651b427a80d46a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 1 Jun 2013 17:16:56 +0200 Subject: [PATCH] generic-pc: implement cDemux::getSTC() Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/618e7723bf8d80cc8a8492974b32f023b9575041 Author: Stefan Seyfried Date: 2013-06-01 (Sat, 01 Jun 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- generic-pc/dmx.cpp | 6 ++++++ generic-pc/video.cpp | 10 ++++++++++ generic-pc/video_lib.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/generic-pc/dmx.cpp b/generic-pc/dmx.cpp index b0c0ee2..fe1d161 100644 --- a/generic-pc/dmx.cpp +++ b/generic-pc/dmx.cpp @@ -35,6 +35,10 @@ #include "dmx_lib.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_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, 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) { int64_t pts = 0; + if (videoDecoder) + pts = videoDecoder->GetPTS(); *STC = pts; } diff --git a/generic-pc/video.cpp b/generic-pc/video.cpp index 92ee802..0b39414 100644 --- a/generic-pc/video.cpp +++ b/generic-pc/video.cpp @@ -650,3 +650,13 @@ bool cVideo::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool ge 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; +} diff --git a/generic-pc/video_lib.h b/generic-pc/video_lib.h index 36f9892..69ab36a 100644 --- a/generic-pc/video_lib.h +++ b/generic-pc/video_lib.h @@ -122,6 +122,7 @@ typedef enum class cVideo : public OpenThreads::Thread { friend class GLFramebuffer; + friend class cDemux; private: /* called from GL thread */ class SWFramebuffer : public std::vector @@ -143,6 +144,7 @@ class cVideo : public OpenThreads::Thread AVRational mAR; }; int buf_in, buf_out, buf_num; + int64_t GetPTS(void); public: /* constructor & destructor */ cVideo(int mode, void *, void *);