summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dxr3demuxdevice.c8
-rw-r--r--dxr3device.c3
-rw-r--r--dxr3interface.c58
-rw-r--r--dxr3interface.h3
-rw-r--r--dxr3interface_spu_encoder.c4
5 files changed, 27 insertions, 49 deletions
diff --git a/dxr3demuxdevice.c b/dxr3demuxdevice.c
index 407cde2..a6d833d 100644
--- a/dxr3demuxdevice.c
+++ b/dxr3demuxdevice.c
@@ -121,7 +121,6 @@ void cDxr3DemuxDevice::SetReplayMode()
if (m_demuxMode == DXR3_DEMUX_TRICK_MODE &&
m_trickState == DXR3_FREEZE)
{
- m_dxr3Device->SetPlayMode();
m_dxr3Device->SetSysClock(m_stopScr);
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
@@ -302,7 +301,6 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts)
m_synchState = DXR3_DEMUX_SYNCHED;
pcr = vPts - PRE_BUFFER_LENGTH;
m_dxr3Device->SetSysClock(pcr);
- m_dxr3Device->SetPlayMode();
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
m_vBuf.Start();
@@ -335,7 +333,6 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts)
pcr = vPts - PRE_BUFFER_LENGTH;
}
m_dxr3Device->SetSysClock(pcr);
- m_dxr3Device->SetPlayMode();
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
m_vBuf.Start();
@@ -353,7 +350,6 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts)
m_synchState = DXR3_DEMUX_SYNCHED;
pcr = aPts - PRE_BUFFER_LENGTH;
m_dxr3Device->SetSysClock(pcr);
- m_dxr3Device->SetPlayMode();
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
m_vBuf.Start();
@@ -383,7 +379,6 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts)
pcr = vPts - PRE_BUFFER_LENGTH;
}
m_dxr3Device->SetSysClock(pcr);
- m_dxr3Device->SetPlayMode();
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
m_vBuf.Start();
@@ -418,7 +413,6 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts)
pcr = vPts - PRE_BUFFER_LENGTH;
}
m_dxr3Device->SetSysClock(pcr);
- m_dxr3Device->SetPlayMode();
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
m_vBuf.Start();
@@ -459,7 +453,6 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts)
pcr = vPts - PRE_BUFFER_LENGTH;
}
m_dxr3Device->SetSysClock(pcr);
- m_dxr3Device->SetPlayMode();
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
m_vBuf.Start();
@@ -494,7 +487,6 @@ int cDxr3DemuxDevice::DemuxAudioPes(const uint8_t* buf, int length)
if (m_synchState != DXR3_DEMUX_AUDIO_SYNCHED &&
syncCounter > 2) {
m_synchState = DXR3_DEMUX_AUDIO_SYNCHED;
- m_dxr3Device->SetPlayMode();
m_dxr3Device->EnableVideo();
m_dxr3Device->EnableAudio();
m_vBuf.Start();
diff --git a/dxr3device.c b/dxr3device.c
index 5490a72..7ab2e18 100644
--- a/dxr3device.c
+++ b/dxr3device.c
@@ -99,14 +99,13 @@ bool cDxr3Device::SetPlayMode(ePlayMode PlayMode)
break;
case pmNone:
- //m_DemuxDevice.Stop();
+ cDxr3Interface::instance()->flushBuffers();
break;
case pmAudioVideo:
case pmAudioOnly:
case pmAudioOnlyBlack:
case pmVideoOnly:
-
m_PlayMode = PlayMode;
}
diff --git a/dxr3interface.c b/dxr3interface.c
index 2115112..7305aea 100644
--- a/dxr3interface.c
+++ b/dxr3interface.c
@@ -274,38 +274,11 @@ void cDxr3Interface::setDimension(uint32_t horizontal, uint32_t vertical)
// play functions
// ==================================
//! set playing mode and start sync engine
-void cDxr3Interface::SetPlayMode()
-{
- // this is the case, when SVDRP command DOF was used and
- // should be ignored.
- if (m_fdControl == -1) {
- return;
- }
-
- em8300_register_t reg;
- int ioval;
-
- Lock();
-
- ioval = EM8300_SUBDEVICE_AUDIO;
- ioctl(m_fdControl, EM8300_IOCTL_FLUSH, &ioval);
- fsync(m_fdVideo);
-
- ioval = EM8300_PLAYMODE_PLAY;
- if (ioctl(m_fdControl, EM8300_IOCTL_SET_PLAYMODE, &ioval) == -1)
- {
- esyslog("dxr3: unable to set play mode: %m");
- }
- reg.microcode_register = 1;
- reg.reg = 0;
- reg.val = MVCOMMAND_SYNC;
- if (ioctl(m_fdControl, EM8300_IOCTL_WRITEREG, &reg) == -1)
- {
- esyslog("dxr3: unable to start em8300 sync engine: %m");
- }
-
- Unlock();
+void cDxr3Interface::flushBuffers()
+{
+ dsyslog("[dxr3] flushing buffers");
+ fsync(m_fdVideo);
}
// ==================================
@@ -463,6 +436,16 @@ void cDxr3Interface::ClaimDevices()
// configure device based on settings
ConfigureDevice();
+ uint32_t ioval = EM8300_PLAYMODE_PLAY;
+ CHECK(ioctl(m_fdControl, EM8300_IOCTL_SET_PLAYMODE, &ioval));
+
+ em8300_register_t reg;
+ reg.microcode_register = 1;
+ reg.reg = 0;
+ reg.val = MVCOMMAND_SYNC;
+
+ CHECK(ioctl(m_fdControl, EM8300_IOCTL_WRITEREG, &reg));
+
// get bcs values from driver
if (ioctl(m_fdControl, EM8300_IOCTL_GETBCS, &m_bcs) == -1)
{
@@ -481,6 +464,9 @@ void cDxr3Interface::ClaimDevices()
void cDxr3Interface::ReleaseDevices()
{
if (m_fdControl > -1) {
+ uint32_t ioval = EM8300_PLAYMODE_STOPPED;
+ CHECK(ioctl(m_fdControl, EM8300_IOCTL_SET_PLAYMODE, &ioval));
+
close(m_fdControl);
m_fdControl = -1;
}
@@ -656,11 +642,11 @@ void cDxr3Interface::Resuscitation()
endt = time(&endt);
if (endt - startt > 4)
{
- esyslog("dxr3: fatal: reopening devices took too long");
- exit(1);
+ esyslog("dxr3: fatal: reopening devices took too long");
+ exit(1);
}
dsyslog("dxr3: resuscitation: reopening devices took %ld seconds",
- endt - startt);
+ endt - startt);
}
// ==================================
@@ -707,8 +693,8 @@ void cDxr3Interface::WriteSpu(const uint8_t* pBuf, int length)
{
Lock();
- if (write(m_fdSpu, pBuf, length) == -1)
- Resuscitation();
+ if (write(m_fdSpu, pBuf, length) == -1)
+ Resuscitation();
Unlock();
}
diff --git a/dxr3interface.h b/dxr3interface.h
index c1a3548..8e53781 100644
--- a/dxr3interface.h
+++ b/dxr3interface.h
@@ -106,7 +106,8 @@ public:
void setDimension(uint32_t horizontal, uint32_t vertical);
// play functions
- void SetPlayMode();
+ void flushBuffers();
+
void Pause();
void SingleStep();
void PlayVideoFrame(cFixedLengthFrame* pFrame, int times = 1);
diff --git a/dxr3interface_spu_encoder.c b/dxr3interface_spu_encoder.c
index 6b0f081..d99d4b5 100644
--- a/dxr3interface_spu_encoder.c
+++ b/dxr3interface_spu_encoder.c
@@ -273,8 +273,8 @@ int cSPUEncoder::Flush(cPalette *Palette)
EncodePixelbufRle(0, 0, OSDWIDTH, OSDHEIGHT-1, OSD_Screen, 0,
&m_encodeddata);
- dsyslog("dxr3: cSPUEncoder::Flush: OSD data size: %d",
- m_encodeddata.count);
+// dsyslog("dxr3: cSPUEncoder::Flush: OSD data size: %d",
+// m_encodeddata.count);
if (m_encodeddata.count <= DATASIZE)
{