summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-11-18 15:48:15 +0100
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-11-18 15:48:15 +0100
commit4be27b8b4eabd871c7d64f356e710e3cdd7c0330 (patch)
tree076643a9d58a48a0abb6875c88b8071384b37877
parent50d28efba8b6bce3bcf1a48e87b980b03d78fa5a (diff)
downloadvdr-plugin-dxr3-4be27b8b4eabd871c7d64f356e710e3cdd7c0330.tar.gz
vdr-plugin-dxr3-4be27b8b4eabd871c7d64f356e710e3cdd7c0330.tar.bz2
Revert "make it simpler"
This fixes hopefully some problems with playback. This reverts commit 34176db79c1d6bca5d4f76fc34f80e00565091e4.
-rw-r--r--dxr3demuxdevice.c8
-rw-r--r--dxr3device.c3
-rw-r--r--dxr3interface.c58
-rw-r--r--dxr3interface.h3
4 files changed, 47 insertions, 25 deletions
diff --git a/dxr3demuxdevice.c b/dxr3demuxdevice.c
index 8536e8d..f30af8d 100644
--- a/dxr3demuxdevice.c
+++ b/dxr3demuxdevice.c
@@ -120,6 +120,7 @@ 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();
@@ -290,6 +291,7 @@ 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();
@@ -322,6 +324,7 @@ 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();
@@ -339,6 +342,7 @@ 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();
@@ -368,6 +372,7 @@ 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();
@@ -402,6 +407,7 @@ 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();
@@ -442,6 +448,7 @@ 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();
@@ -476,6 +483,7 @@ 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 6dceeaa..e7d469e 100644
--- a/dxr3device.c
+++ b/dxr3device.c
@@ -97,13 +97,14 @@ bool cDxr3Device::SetPlayMode(ePlayMode PlayMode)
break;
case pmNone:
- cDxr3Interface::instance()->flushBuffers();
+ //m_DemuxDevice.Stop();
break;
case pmAudioVideo:
case pmAudioOnly:
case pmAudioOnlyBlack:
case pmVideoOnly:
+
m_PlayMode = PlayMode;
}
diff --git a/dxr3interface.c b/dxr3interface.c
index 981aab0..3bd1bbc 100644
--- a/dxr3interface.c
+++ b/dxr3interface.c
@@ -234,11 +234,38 @@ void cDxr3Interface::dimension(uint32_t &horizontal, uint32_t &vertical)
// play functions
// ==================================
//! set playing mode and start sync engine
-
-void cDxr3Interface::flushBuffers()
+void cDxr3Interface::SetPlayMode()
{
- dsyslog("[dxr3] flushing buffers");
- fsync(m_fdVideo);
+ // 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();
}
// ==================================
@@ -354,16 +381,6 @@ 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)
{
@@ -382,9 +399,6 @@ 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;
}
@@ -560,11 +574,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);
}
// ==================================
@@ -572,8 +586,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 c4db465..060c843 100644
--- a/dxr3interface.h
+++ b/dxr3interface.h
@@ -105,8 +105,7 @@ public:
void dimension(uint32_t &horizontal, uint32_t &vertical);
// play functions
- void flushBuffers();
-
+ void SetPlayMode();
void Pause();
void PlayVideoFrame(cFixedLengthFrame* pFrame);
void PlayVideoFrame(cDxr3PesFrame *frame);