summaryrefslogtreecommitdiff
path: root/src/dxr3
diff options
context:
space:
mode:
Diffstat (limited to 'src/dxr3')
-rw-r--r--src/dxr3/dxr3_decode_video.c34
-rw-r--r--src/dxr3/dxr3_mpeg_encoders.c20
-rw-r--r--src/dxr3/dxr3_scr.c29
-rw-r--r--src/dxr3/dxr3_scr.h6
-rw-r--r--src/dxr3/em8300.h19
-rw-r--r--src/dxr3/video_out_dxr3.c20
-rw-r--r--src/dxr3/video_out_dxr3.h5
7 files changed, 79 insertions, 54 deletions
diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c
index 4b6c2f339..2f1f4c2ae 100644
--- a/src/dxr3/dxr3_decode_video.c
+++ b/src/dxr3/dxr3_decode_video.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_decode_video.c,v 1.49 2003/12/14 22:13:22 siggi Exp $
+ * $Id: dxr3_decode_video.c,v 1.50 2004/01/04 22:26:28 mroi Exp $
*/
/* dxr3 video decoder plugin.
@@ -136,10 +136,10 @@ typedef struct dxr3_decoder_s {
} dxr3_decoder_t;
/* helper functions */
-static int dxr3_present(xine_stream_t *stream);
-static int dxr3_mvcommand(int fd_control, int command);
-static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t *buffer);
-static int get_duration(dxr3_decoder_t *this);
+static inline int dxr3_present(xine_stream_t *stream);
+static inline int dxr3_mvcommand(int fd_control, int command);
+static inline void parse_mpeg_header(dxr3_decoder_t *this, uint8_t *buffer);
+static inline int get_duration(dxr3_decoder_t *this);
/* config callbacks */
static void dxr3_update_sync_mode(void *this_gen, xine_cfg_entry_t *entry);
@@ -428,6 +428,9 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf)
#endif
dxr3_mvcommand(this->fd_control, MVCOMMAND_SYNC);
this->resync_window = -RESYNC_WINDOW_SIZE;
+ pthread_mutex_lock(&this->scr->mutex);
+ this->scr->sync = 1;
+ pthread_mutex_unlock(&this->scr->mutex);
}
if (this->resync_window != 0 && this->resync_window > -RESYNC_WINDOW_SIZE)
this->resync_window--;
@@ -459,6 +462,9 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf)
#endif
dxr3_mvcommand(this->fd_control, MVCOMMAND_START);
this->resync_window = RESYNC_WINDOW_SIZE;
+ pthread_mutex_lock(&this->scr->mutex);
+ this->scr->sync = 0;
+ pthread_mutex_unlock(&this->scr->mutex);
}
if (this->resync_window != 0 && this->resync_window < RESYNC_WINDOW_SIZE)
this->resync_window++;
@@ -638,7 +644,7 @@ static void dxr3_dispose(video_decoder_t *this_gen)
}
-static int dxr3_present(xine_stream_t *stream)
+static inline int dxr3_present(xine_stream_t *stream)
{
plugin_node_t *node;
video_driver_class_t *vo_class;
@@ -658,18 +664,18 @@ static int dxr3_present(xine_stream_t *stream)
return present;
}
-static int dxr3_mvcommand(int fd_control, int command)
+static inline int dxr3_mvcommand(int fd_control, int command)
{
- em8300_register_t regs;
+ em8300_register_t reg;
- regs.microcode_register = 1;
- regs.reg = 0;
- regs.val = command;
+ reg.microcode_register = 1;
+ reg.reg = 0;
+ reg.val = command;
- return ioctl(fd_control, EM8300_IOCTL_WRITEREG, &regs);
+ return ioctl(fd_control, EM8300_IOCTL_WRITEREG, &reg);
}
-static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer)
+static inline void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer)
{
this->frame_rate_code = buffer[3] & 15;
this->height = (buffer[0] << 16) |
@@ -727,7 +733,7 @@ static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer)
}
}
-static int get_duration(dxr3_decoder_t *this)
+static inline int get_duration(dxr3_decoder_t *this)
{
int duration;
diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c
index c478079a2..7ec432eeb 100644
--- a/src/dxr3/dxr3_mpeg_encoders.c
+++ b/src/dxr3/dxr3_mpeg_encoders.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_mpeg_encoders.c,v 1.16 2003/12/06 13:26:36 f1rmb Exp $
+ * $Id: dxr3_mpeg_encoders.c,v 1.17 2004/01/04 22:26:29 mroi Exp $
*/
/* mpeg encoders for the dxr3 video out plugin.
@@ -251,15 +251,6 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame)
return 0;
}
- /* set the dxr3 playmode */
- if (drv->enhanced_mode) {
- em8300_register_t regs;
- regs.microcode_register = 1;
- regs.reg = 0;
- regs.val = MVCOMMAND_SYNC;
- ioctl(drv->fd_control, EM8300_IOCTL_WRITEREG, &regs);
- }
-
return 1;
}
@@ -447,15 +438,6 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame)
fame_init (this->context, &this->fp, this->buffer, DEFAULT_BUFFER_SIZE);
- /* set the dxr3 playmode */
- if (drv->enhanced_mode) {
- em8300_register_t regs;
- regs.microcode_register = 1;
- regs.reg = 0;
- regs.val = MVCOMMAND_SYNC;
- ioctl(drv->fd_control, EM8300_IOCTL_WRITEREG, &regs);
- }
-
return 1;
}
diff --git a/src/dxr3/dxr3_scr.c b/src/dxr3/dxr3_scr.c
index ac632874e..2be48c3d8 100644
--- a/src/dxr3/dxr3_scr.c
+++ b/src/dxr3/dxr3_scr.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_scr.c,v 1.12 2003/12/09 00:02:29 f1rmb Exp $
+ * $Id: dxr3_scr.c,v 1.13 2004/01/04 22:26:29 mroi Exp $
*/
/* dxr3 scr plugin.
@@ -49,7 +49,7 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed);
static void dxr3_scr_exit(scr_plugin_t *scr);
/* helper function */
-static int dxr3_mvcommand(int fd_control, int command);
+static inline int dxr3_mvcommand(int fd_control, int command);
/* config callback */
static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry);
@@ -62,7 +62,6 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine)
this = (dxr3_scr_t *)xine_xmalloc(sizeof(dxr3_scr_t));
- this->xine = xine;
confstr = xine->config->register_string(xine->config,
CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL);
if ((this->fd_control = open(confstr, O_WRONLY)) < 0) {
@@ -72,6 +71,8 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine)
return NULL;
}
+ this->xine = xine;
+
this->scr_plugin.interface_version = 2;
this->scr_plugin.get_priority = dxr3_scr_get_priority;
this->scr_plugin.start = dxr3_scr_start;
@@ -87,6 +88,7 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine)
this->offset = 0;
this->last_pts = 0;
this->scanning = 0;
+ this->sync = 0;
pthread_mutex_init(&this->mutex, NULL);
@@ -120,6 +122,7 @@ static void dxr3_scr_start(scr_plugin_t *scr, int64_t vpts)
vpts32 = 0x900;
ioctl(this->fd_control, EM8300_IOCTL_SCR_SETSPEED, &vpts32);
this->scanning = 0;
+ this->sync = 0;
pthread_mutex_unlock(&this->mutex);
}
@@ -176,6 +179,7 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed)
uint32_t em_speed;
int playmode;
+ pthread_mutex_lock(&this->mutex);
switch (speed) {
case XINE_SPEED_PAUSE:
em_speed = 0;
@@ -191,7 +195,10 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed)
break;
case XINE_SPEED_NORMAL:
em_speed = 0x900;
- playmode = MVCOMMAND_SYNC;
+ if (this->sync)
+ playmode = MVCOMMAND_SYNC;
+ else
+ playmode = MVCOMMAND_START;
break;
case XINE_SPEED_FAST_2:
em_speed = 0x900 * 2;
@@ -217,6 +224,8 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed)
if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SETSPEED, &em_speed))
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: failed to set speed (%s)\n", strerror(errno));
+ pthread_mutex_unlock(&this->mutex);
+
#if LOG_SCR
printf("dxr3_scr: speed set to mode %d\n", speed);
#endif
@@ -233,15 +242,15 @@ static void dxr3_scr_exit(scr_plugin_t *scr)
}
-static int dxr3_mvcommand(int fd_control, int command)
+static inline int dxr3_mvcommand(int fd_control, int command)
{
- em8300_register_t regs;
+ em8300_register_t reg;
- regs.microcode_register = 1;
- regs.reg = 0;
- regs.val = command;
+ reg.microcode_register = 1;
+ reg.reg = 0;
+ reg.val = command;
- return ioctl(fd_control, EM8300_IOCTL_WRITEREG, &regs);
+ return ioctl(fd_control, EM8300_IOCTL_WRITEREG, &reg);
}
static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry)
diff --git a/src/dxr3/dxr3_scr.h b/src/dxr3/dxr3_scr.h
index d14840d41..fe4f1ccbe 100644
--- a/src/dxr3/dxr3_scr.h
+++ b/src/dxr3/dxr3_scr.h
@@ -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_scr.h,v 1.6 2003/12/09 00:02:29 f1rmb Exp $
+ * $Id: dxr3_scr.h,v 1.7 2004/01/04 22:26:29 mroi Exp $
*/
#include "xine_internal.h"
@@ -28,13 +28,15 @@ typedef struct dxr3_scr_s {
scr_plugin_t scr_plugin;
pthread_mutex_t mutex;
+ xine_t *xine;
+
int fd_control; /* to access the dxr3 control device */
int priority;
int64_t offset; /* difference between real scr and internal dxr3 clock */
uint32_t last_pts; /* last known value of internal dxr3 clock to detect wrap around */
int scanning; /* are we in a scanning mode */
- xine_t *xine;
+ int sync; /* are we in sync mode */
} dxr3_scr_t;
/* plugin initialization function */
diff --git a/src/dxr3/em8300.h b/src/dxr3/em8300.h
index 425bb92a4..411694646 100644
--- a/src/dxr3/em8300.h
+++ b/src/dxr3/em8300.h
@@ -79,6 +79,7 @@ typedef struct {
#define EM8300_IOCTL_SCR_GETSPEED _IOR('C',17,unsigned)
#define EM8300_IOCTL_SCR_SETSPEED _IOW('C',17,unsigned)
#define EM8300_IOCTL_FLUSH _IOW('C',18,int)
+#define EM8300_IOCTL_VBI _IOW('C',19,struct timeval)
#define EM8300_OVERLAY_SIGNAL_ONLY 1
#define EM8300_OVERLAY_SIGNAL_WITH_VGA 2
@@ -323,8 +324,10 @@ struct em8300_s
int video_ptsfifo_ptr;
#if LINUX_VERSION_CODE < 0x020314
struct wait_queue *video_ptsfifo_wait;
+ struct wait_queue *vbi_wait;
#else
wait_queue_head_t video_ptsfifo_wait;
+ wait_queue_head_t vbi_wait;
#endif
int video_ptsfifo_waiting;
int video_first;
@@ -358,6 +361,14 @@ struct em8300_s
int overlay_xcorr_default;
int overlay_70;
int overlay_dword_24bb8;
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
+ /* Memory exported via mmap() */
+ struct list_head memory;
+#endif
+
+ /* To support different options for different cards */
+ unsigned int card_nr;
};
#define TIMEDIFF(a,b) a.tv_usec - b.tv_usec + \
@@ -384,7 +395,7 @@ int em8300_audio_flush(struct em8300_s *em);
int em8300_audio_open(struct em8300_s *em);
int em8300_audio_release(struct em8300_s *em);
int em8300_audio_setup(struct em8300_s *em);
-int em8300_audio_write(struct em8300_s *em, const char * buf,
+ssize_t em8300_audio_write(struct em8300_s *em, const char * buf,
size_t count, loff_t *ppos);
int mpegaudio_command(struct em8300_s *em, int cmd);
@@ -415,13 +426,13 @@ int em8300_video_flush(struct em8300_s *em);
int em8300_video_setup(struct em8300_s *em);
int em8300_video_release(struct em8300_s *em);
void em8300_video_setspeed(struct em8300_s *em, int speed);
-int em8300_video_write(struct em8300_s *em, const char * buf,
+ssize_t em8300_video_write(struct em8300_s *em, const char * buf,
size_t count, loff_t *ppos);
int em8300_video_ioctl(struct em8300_s *em, unsigned int cmd, unsigned long arg);
void em8300_video_check_ptsfifo(struct em8300_s *em);
/* em8300_spu.c */
-int em8300_spu_write(struct em8300_s *em, const char * buf,
+ssize_t em8300_spu_write(struct em8300_s *em, const char * buf,
size_t count, loff_t *ppos);
int em8300_spu_open(struct em8300_s *em);
int em8300_spu_ioctl(struct em8300_s *em, unsigned int cmd, unsigned long arg);
@@ -439,7 +450,7 @@ int em8300_ioctl_init(struct em8300_s *em, em8300_microcode_t *useruc);
void em8300_ioctl_enable_videoout(struct em8300_s *em, int mode);
int em8300_ioctl_setplaymode(struct em8300_s *em, int mode);
int em8300_ioctl_setaudiomode(struct em8300_s *em, int mode);
-int em8300_ioctl_getaudiomode(struct em8300_s *em, int mode);
+int em8300_ioctl_getaudiomode(struct em8300_s *em, long int mode);
int em8300_ioctl_overlay_calibrate(struct em8300_s *em, em8300_overlay_calibrate_t *c);
int em8300_ioctl_overlay_setwindow(struct em8300_s *em,em8300_overlay_window_t *w);
int em8300_ioctl_overlay_setscreen(struct em8300_s *em,em8300_overlay_screen_t *s);
diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c
index 593e8cbd7..f6f3f69f6 100644
--- a/src/dxr3/video_out_dxr3.c
+++ b/src/dxr3/video_out_dxr3.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: video_out_dxr3.c,v 1.96 2003/12/14 22:13:22 siggi Exp $
+ * $Id: video_out_dxr3.c,v 1.97 2004/01/04 22:26:29 mroi Exp $
*/
/* mpeg1 encoding video out plugin for the dxr3.
@@ -896,6 +896,9 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
this->aspect = dxr3_set_property(this_gen, VO_PROP_ASPECT_RATIO,
(this->widescreen_enabled ? XINE_VO_ASPECT_4_3 : frame->aspect));
if (frame->pan_scan && !this->pan_scan) {
+ /* the card needs a break before enabling zoom mode, otherwise it fails
+ * sometimes (like in the initial menu of "Breakfast at Tiffany's" RC2) */
+ xine_usec_sleep(50000);
dxr3_set_property(this_gen, VO_PROP_ZOOM_X, 1);
this->pan_scan = 1;
}
@@ -937,8 +940,19 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
if (this->need_update) {
/* we cannot do this earlier, because vo_frame.duration is only valid here */
- if (this->enc && this->enc->on_update_format)
- this->enc->on_update_format(this, frame);
+ if (this->enc && this->enc->on_update_format) {
+ /* set the dxr3 playmode */
+ if (this->enc->on_update_format(this, frame) && this->enhanced_mode) {
+ em8300_register_t reg;
+ reg.microcode_register = 1;
+ reg.reg = 0;
+ reg.val = MVCOMMAND_SYNC;
+ ioctl(this->fd_control, EM8300_IOCTL_WRITEREG, &reg);
+ pthread_mutex_lock(&this->class->scr->mutex);
+ this->class->scr->sync = 1;
+ pthread_mutex_unlock(&this->class->scr->mutex);
+ }
+ }
this->need_update = 0;
}
diff --git a/src/dxr3/video_out_dxr3.h b/src/dxr3/video_out_dxr3.h
index e9481851f..1e54e1c4d 100644
--- a/src/dxr3/video_out_dxr3.h
+++ b/src/dxr3/video_out_dxr3.h
@@ -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: video_out_dxr3.h,v 1.20 2003/12/05 15:54:58 f1rmb Exp $
+ * $Id: video_out_dxr3.h,v 1.21 2004/01/04 22:26:29 mroi Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -49,6 +49,8 @@ struct coeff {
};
typedef struct dxr3_overlay_s {
+ xine_t *xine;
+
int fd_control;
int xoffset;
@@ -65,7 +67,6 @@ typedef struct dxr3_overlay_s {
struct coeff colcal_upper[3];
struct coeff colcal_lower[3];
- xine_t *xine;
} dxr3_overlay_t;
typedef struct dxr3_driver_class_s {