From d0468cf1c2e24be3287f4766a49a9bc6a8dc9c18 Mon Sep 17 00:00:00 2001 From: Harm van der Heijden Date: Sun, 23 Dec 2001 04:08:25 +0000 Subject: Did some digging in the dxr3 em8300 kernel sources; turnes out that the kernel driver ignores SETSCR commands when the difference is smaller than 7200 (a very arbitrary value of 2 frames). Since my favourite oss audio driver has a GAP_TOLERANCE of 5000, this resulted in about a gazillion 'audio out: adjusting master clock' messages. Now added an offset to simulate adjustments < 7200; as soon as the offset goes over 7200 SETSCR is called and offset set to 0. CVS patchset: 1288 CVS date: 2001/12/23 04:08:25 --- src/dxr3/dxr3_decoder.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src') 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)); -- cgit v1.2.3