diff options
Diffstat (limited to 'dxr3interface.c')
-rw-r--r-- | dxr3interface.c | 58 |
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, ®) == -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, ®)); + // 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(); } |