summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dxr3device.c21
-rw-r--r--dxr3device.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/dxr3device.c b/dxr3device.c
index a7d6f2d..1616759 100644
--- a/dxr3device.c
+++ b/dxr3device.c
@@ -43,6 +43,7 @@ static const int TIMESTAMPS_500MS = 45000;
cDxr3Device::cDxr3Device() : spuDecoder(NULL), pluginOn(true), vPts(0), scrSet(false), aspectRatio(EM8300_ASPECTRATIO_4_3)
{
+ lastVideoFrame.data = NULL;
claimDevices();
switch (cSettings::instance()->audioDriver()) {
@@ -75,6 +76,9 @@ cDxr3Device::~cDxr3Device()
if (spuDecoder)
delete spuDecoder;
+
+ if (lastVideoFrame.data)
+ delete[] lastVideoFrame.data;
}
cDxr3Device *cDxr3Device::instance()
@@ -593,6 +597,23 @@ void cDxr3Device::playVideoFrame(cDxr3PesFrame *frame, uint32_t pts)
uint32_t len = frame->payloadSize();
WriteAllOrNothing(fdVideo, data, len, 1000, 10);
+
+ // store last written video frame
+ lastVideoFrameMutex.Lock();
+
+ // make sure that there is space to store video data
+ if (!lastVideoFrame.data) {
+ lastVideoFrame.data = new uint8_t[len];
+ } else if (lastVideoFrame.size < len) {
+ delete[] lastVideoFrame.data;
+ lastVideoFrame.data = new uint8_t[len];
+ }
+
+ // update data
+ memcpy(lastVideoFrame.data, data, sizeof(uint8_t)*len);
+ lastVideoFrame.size = len;
+
+ lastVideoFrameMutex.Unlock();
}
void cDxr3Device::playBlackFrame(uint32_t pts)
diff --git a/dxr3device.h b/dxr3device.h
index f2675f0..9b1af70 100644
--- a/dxr3device.h
+++ b/dxr3device.h
@@ -136,6 +136,9 @@ private:
uint32_t vertical;
uint32_t aspectRatio;
+ cMutex lastVideoFrameMutex;
+ AVPacket lastVideoFrame;
+
static cDxr3Device *inst;
};