summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dxr3/dxr3_decoder.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/dxr3/dxr3_decoder.c b/src/dxr3/dxr3_decoder.c
index 023140bfb..f68c1f181 100644
--- a/src/dxr3/dxr3_decoder.c
+++ b/src/dxr3/dxr3_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dxr3_decoder.c,v 1.48 2001/12/23 02:36:54 hrm Exp $
+ * $Id: dxr3_decoder.c,v 1.49 2001/12/23 04:08:25 hrm Exp $
*
* dxr3 video and spu decoder plugin. Accepts the video and spu data
* from XINE and sends it directly to the corresponding dxr3 devices.
@@ -174,6 +174,7 @@ typedef struct dxr3scr_s {
scr_plugin_t scr;
int fd_control;
int priority;
+ int offset; /* a little offset < 7200 */
} dxr3scr_t;
static int dxr3scr_get_priority (scr_plugin_t *scr) {
@@ -246,9 +247,18 @@ static int dxr3scr_set_speed (scr_plugin_t *scr, int speed) {
*/
static void dxr3scr_adjust (scr_plugin_t *scr, uint32_t vpts) {
dxr3scr_t *self = (dxr3scr_t*) scr;
- vpts >>= 1;
- if (ioctl(self->fd_control, EM8300_IOCTL_SCR_SET, &vpts))
- printf("dxr3scr: adjust failed (%s)\n", strerror(errno));
+ uint32_t cpts;
+ if (ioctl(self->fd_control, EM8300_IOCTL_SCR_GET, &cpts))
+ printf("dxr3scr: adjust get failed (%s)\n", strerror(errno));
+ cpts <<= 1;
+ self->offset = (vpts - (cpts + self->offset));
+ /* kernel driver ignores diffs < 7200 */
+ if (self->offset < -7200 || self->offset > 7200) {
+ vpts >>= 1;
+ if (ioctl(self->fd_control, EM8300_IOCTL_SCR_SET, &vpts))
+ printf("dxr3scr: adjust set failed (%s)\n", strerror(errno));
+ self->offset = 0;
+ }
}
/* *** dxr3scr_start ***
@@ -260,6 +270,7 @@ static void dxr3scr_start (scr_plugin_t *scr, uint32_t start_vpts) {
dxr3scr_t *self = (dxr3scr_t*) scr;
start_vpts >>= 1;
+ self->offset = 0;
if (ioctl(self->fd_control, EM8300_IOCTL_SCR_SET, &start_vpts))
printf("dxr3scr: start failed (%s)\n", strerror(errno));
/* mis-use start_vpts */
@@ -280,7 +291,7 @@ static uint32_t dxr3scr_get_current (scr_plugin_t *scr) {
if (ioctl(self->fd_control, EM8300_IOCTL_SCR_GET, &pts))
printf("dxr3scr: get current failed (%s)\n", strerror(errno));
- return pts << 1;
+ return (pts << 1) + self->offset;
}
@@ -300,6 +311,8 @@ static scr_plugin_t* dxr3scr_init (dxr3_decoder_t *dxr3) {
self->scr.start = dxr3scr_start;
self->scr.get_current = dxr3scr_get_current;
+ self->offset = 0;
+
if ((self->fd_control = open (devname, O_WRONLY)) < 0) {
printf("dxr3scr: Failed to open control device %s (%s)\n",
devname, strerror(errno));