summaryrefslogtreecommitdiff
path: root/dxr3interface.c
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-08-28 22:54:49 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-08-28 22:54:49 +0200
commit34176db79c1d6bca5d4f76fc34f80e00565091e4 (patch)
treeda73ca31bcf445bb973cfc6fa139d393292edd95 /dxr3interface.c
parentef399b1a8b6a8e9b495ebddb03db242f6225cee9 (diff)
downloadvdr-plugin-dxr3-34176db79c1d6bca5d4f76fc34f80e00565091e4.tar.gz
vdr-plugin-dxr3-34176db79c1d6bca5d4f76fc34f80e00565091e4.tar.bz2
make it simpler
- get rid of SetPlayMode() - add method to do flushing of video buffer - dont spam log with spu buffer sizes
Diffstat (limited to 'dxr3interface.c')
-rw-r--r--dxr3interface.c58
1 files changed, 22 insertions, 36 deletions
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();
}