summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-02-05 00:14:02 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-02-05 00:14:02 +0000
commit5b2b54e92e118a2ab916fd814dc1a2bec58e1e07 (patch)
tree3da02961c54207c085260b0253a15ff257be16ce /src
parent4e0331fac2b197b5d6b20a987f2e54cff2f67ad4 (diff)
downloadxine-lib-5b2b54e92e118a2ab916fd814dc1a2bec58e1e07.tar.gz
xine-lib-5b2b54e92e118a2ab916fd814dc1a2bec58e1e07.tar.bz2
last tvmode update from Snaggen
CVS patchset: 4106 CVS date: 2003/02/05 00:14:02
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/nvtv/Makefile.am4
-rw-r--r--src/xine-engine/nvtv/back_client.c29
-rw-r--r--src/xine-engine/nvtv/back_client.h8
-rw-r--r--src/xine-engine/nvtv/backend.h2
-rw-r--r--src/xine-engine/nvtv/debug.h14
-rw-r--r--src/xine-engine/nvtv/error.c28
-rw-r--r--src/xine-engine/nvtv/error.h84
-rw-r--r--src/xine-engine/nvtv/local.h9
-rw-r--r--src/xine-engine/nvtv/pipe.c10
-rw-r--r--src/xine-engine/nvtv/pipe.h2
-rw-r--r--src/xine-engine/nvtv/tv_chip.h3
-rw-r--r--src/xine-engine/nvtv/tv_common.h6
-rw-r--r--src/xine-engine/nvtv/xfree.h20
-rw-r--r--src/xine-engine/tvmode.c48
14 files changed, 182 insertions, 85 deletions
diff --git a/src/xine-engine/nvtv/Makefile.am b/src/xine-engine/nvtv/Makefile.am
index d4a146ff7..097b58cf2 100644
--- a/src/xine-engine/nvtv/Makefile.am
+++ b/src/xine-engine/nvtv/Makefile.am
@@ -4,7 +4,7 @@ AM_CFLAGS = $(X_CFLAGS)
noinst_LTLIBRARIES= libnvclient.la
-libnvclient_sources = back_client.c pipe.c
+libnvclient_sources = back_client.c pipe.c error.c
libnvclient_dummy = libnvclient_dummy.c
@@ -18,7 +18,7 @@ libnvclient_la_SOURCES = $(nvtv_modules) $(libnvclient_dummy)
noinst_HEADERS = backend.h local.h tv_chip.h xf86i2c.h back_client.h debug.h \
- miscstruct.h pipe.h tv_common.h xfree.h
+ miscstruct.h pipe.h tv_common.h xfree.h error.h
libnvclient_la_LIBADD = $(X_LIBS)
diff --git a/src/xine-engine/nvtv/back_client.c b/src/xine-engine/nvtv/back_client.c
index e984a6974..e8c1aadaf 100644
--- a/src/xine-engine/nvtv/back_client.c
+++ b/src/xine-engine/nvtv/back_client.c
@@ -16,7 +16,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: back_client.c,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: back_client.c,v 1.2 2003/02/05 00:14:02 miguelfreitas Exp $
*
* Contents:
*
@@ -25,11 +25,19 @@
*/
#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
+
+
#include <fcntl.h>
-#include <unistd.h>
#include "debug.h"
+#include "error.h"
#include "backend.h"
#include "back_client.h"
#include "pipe.h"
@@ -218,6 +226,10 @@ TVConnect bcl_getConnection (void)
return c;
}
+/* Attention! The 'size' and 'aspect' strings returned mode.spec are
+ allocated, and should be freed when not needed anymore.
+*/
+
Bool bcl_findBySize (TVSystem system, int xres, int yres, char *size,
TVMode *mode)
{
@@ -229,8 +241,10 @@ Bool bcl_findBySize (TVSystem system, int xres, int yres, char *size,
sizeof(xres), &xres, sizeof(yres), &yres,
strlen(size)+1, size);
pipeReadCmd (pipe_in);
- n = pipeReadArgs (pipe_in, 1, sizeof(TVMode), mode);
- return (n >= 1);
+ mode->spec.size = mode->spec.aspect = NULL;
+ n = pipeReadArgs (pipe_in, 3, sizeof(TVMode), mode,
+ 0, &mode->spec.size, 0, &mode->spec.aspect);
+ return (n >= 3);
}
Bool bcl_findByOverscan (TVSystem system, int xres, int yres,
@@ -244,8 +258,10 @@ Bool bcl_findByOverscan (TVSystem system, int xres, int yres,
sizeof(xres), &xres, sizeof(yres), &yres,
sizeof(hoc), &hoc, sizeof(voc), &voc);
pipeReadCmd (pipe_in);
- n = pipeReadArgs (pipe_in, 1, sizeof(TVMode), mode);
- return (n >= 1);
+ mode->spec.size = mode->spec.aspect = NULL;
+ n = pipeReadArgs (pipe_in, 3, sizeof(TVMode), mode,
+ 0, &mode->spec.size, 0, &mode->spec.aspect);
+ return (n >= 3);
}
void bcl_initSharedView (int *view_x, int *view_y)
@@ -339,6 +355,7 @@ BackCardRec bcl_card_func = {
#endif
setHeads: bcl_setHeads,
getHeads: bcl_getHeads,
+ getHeadDev: bcl_getHeadDev,
probeChips: bcl_probeChips,
setChip: bcl_setChip,
setSettings: bcl_setSettings,
diff --git a/src/xine-engine/nvtv/back_client.h b/src/xine-engine/nvtv/back_client.h
index c2dada5c4..111f61e04 100644
--- a/src/xine-engine/nvtv/back_client.h
+++ b/src/xine-engine/nvtv/back_client.h
@@ -16,7 +16,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: back_client.h,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: back_client.h,v 1.2 2003/02/05 00:14:02 miguelfreitas Exp $
*
* Contents:
*
@@ -34,6 +34,12 @@ CardPtr back_client_init (void);
/* client backend methods */
+/* Attention! The 'size' and 'aspect' strings returned by the find
+ operations in mode.spec are allocated, and should be freed when not
+ needed anymore. For the moment, this creates a memory leak, as this
+ behaviour is different from the other backends.
+*/
+
void bcl_openCard (CardPtr card);
void bcl_closeCard (void);
#ifdef DEBUG_PROBE
diff --git a/src/xine-engine/nvtv/backend.h b/src/xine-engine/nvtv/backend.h
index 2bcf2629e..434065362 100644
--- a/src/xine-engine/nvtv/backend.h
+++ b/src/xine-engine/nvtv/backend.h
@@ -16,7 +16,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: backend.h,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: backend.h,v 1.2 2003/02/05 00:14:03 miguelfreitas Exp $
*
* Contents:
*
diff --git a/src/xine-engine/nvtv/debug.h b/src/xine-engine/nvtv/debug.h
index e5b116558..72b0a5cf7 100644
--- a/src/xine-engine/nvtv/debug.h
+++ b/src/xine-engine/nvtv/debug.h
@@ -205,16 +205,4 @@
#define FAKE_CRTC
#endif
-#define ERROR(X...) fprintf(stderr, X)
-
-/* Fake output */
-#define FPRINTF(X...) fprintf(stderr, X)
-
-#ifdef NVTV_DEBUG
-#define DPRINTF(X...) fprintf(stderr, X)
-#define NO_TIMEOUT
-#else
-#define DPRINTF(X...) /* */
-#endif
-
-#endif
+#endif /* _DEBUG_H */
diff --git a/src/xine-engine/nvtv/error.c b/src/xine-engine/nvtv/error.c
new file mode 100644
index 000000000..45092cdd4
--- /dev/null
+++ b/src/xine-engine/nvtv/error.c
@@ -0,0 +1,28 @@
+/* NVTV error -- Dirk Thierbach <dthierbach@gmx.de>
+ *
+ * This file is part of nvtv, a tool for tv-output on NVidia cards.
+ *
+ * nvtv is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * nvtv is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: error.c,v 1.1 2003/02/05 00:14:03 miguelfreitas Exp $
+ *
+ * Contents:
+ *
+ * Error handling.
+ *
+ */
+
+#include "error.h"
+
diff --git a/src/xine-engine/nvtv/error.h b/src/xine-engine/nvtv/error.h
new file mode 100644
index 000000000..a7718d28f
--- /dev/null
+++ b/src/xine-engine/nvtv/error.h
@@ -0,0 +1,84 @@
+/* NVTV error header -- Dirk Thierbach <dthierbach@gmx.de>
+ *
+ * This file is part of nvtv, a tool for tv-output on NVidia cards.
+ *
+ * nvtv is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * nvtv is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: error.h,v 1.1 2003/02/05 00:14:03 miguelfreitas Exp $
+ *
+ * Contents:
+ *
+ * Error handling.
+ *
+ */
+
+#ifndef _ERROR_H
+#define _ERROR_H
+
+#include "debug.h"
+
+/*
+ * This header file must do the following:
+ *
+ * 1) Define error macros for standalone usage
+ * 2) Map error macros to XFree error macros if compiled under X
+ * 3) Map error macros and XFree macros function names for Borland C++,
+ * as the compiler does not support macros with a variable number
+ * of arguments.
+ */
+
+
+#ifdef __BORLANDC__
+
+#include <stdarg.h>
+
+int dprintf (char *format, ...);
+int errorf (char *format, ...);
+int errorf1 (int arg1, char *format, ...);
+int errorf2 (int arg1, int arg2, char *format, ...);
+
+#define ERROR errorf
+#define FPRINTF errorf
+#define DPRINTF dprintf
+#define xf86Msg errorf1
+#define xf86DrvMsg errorf2
+
+#else /* __BORLANDC__ */
+
+/* -------- */
+
+#define ERROR(X...) fprintf(stderr, X)
+
+/* Fake output */
+#define FPRINTF(X...) fprintf(stderr, X)
+
+#ifdef NVTV_DEBUG
+#define DPRINTF(X...) fprintf(stderr, X)
+#else
+#define DPRINTF(X...) /* */
+#endif
+
+/* -------- */
+
+#define xf86Msg(type,format,args...) /* fprintf(stderr,format,args) */
+#define xf86DrvMsg(scrnIndex,type,format, args...) /* fprintf(stderr,format,args) */
+
+#endif /* __BORLANDC__ */
+
+#define DEBUG(x) /*x*/
+#define ErrorF ERROR
+
+#endif /* _ERROR_H */
+
diff --git a/src/xine-engine/nvtv/local.h b/src/xine-engine/nvtv/local.h
index 518553337..499982cfa 100644
--- a/src/xine-engine/nvtv/local.h
+++ b/src/xine-engine/nvtv/local.h
@@ -16,7 +16,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: local.h,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: local.h,v 1.2 2003/02/05 00:14:03 miguelfreitas Exp $
*
* Contents:
*
@@ -30,6 +30,10 @@
#ifndef _LOCAL_H
#define _LOCAL_H
+#ifdef __BORLANDC__
+#define inline
+#endif
+
#ifdef HAVE_GTK
#if GTK_MAJOR_VERSION >= 2
@@ -42,7 +46,10 @@
#endif /* HAVE_GTK */
#ifndef _XDEFS_H
+
+#ifndef __BORLANDC__
typedef int Bool;
+#endif
#ifndef TRUE
#define TRUE 1
diff --git a/src/xine-engine/nvtv/pipe.c b/src/xine-engine/nvtv/pipe.c
index b12dc3bd1..9798072e7 100644
--- a/src/xine-engine/nvtv/pipe.c
+++ b/src/xine-engine/nvtv/pipe.c
@@ -16,7 +16,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: pipe.c,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: pipe.c,v 1.2 2003/02/05 00:14:03 miguelfreitas Exp $
*
* Contents:
*
@@ -27,8 +27,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <string.h>
#include "debug.h"
+#include "error.h"
#include "pipe.h"
/*
@@ -154,9 +156,9 @@ int pipeReadArgs (FILE *pipe, int n, ...)
/*
* Read optional arguments from a pipe. Ellipsis parameters are:
* size_1, pointer_1, result_1, ..., size_n, pointer_n, result_n
- * Ignore zero size or null pointer arguments. Return number of
- * initial arguments that matched input stream, and set each result
- * either to NULL or to pointer.
+ * Ignore zero size or null pointer data. Return number of initial
+ * arguments that matched input stream, and set each result either to
+ * NULL or to pointer.
*/
int pipeReadArgsOpt (FILE *pipe, int n, ...)
diff --git a/src/xine-engine/nvtv/pipe.h b/src/xine-engine/nvtv/pipe.h
index dbb012d95..b65b5235e 100644
--- a/src/xine-engine/nvtv/pipe.h
+++ b/src/xine-engine/nvtv/pipe.h
@@ -16,7 +16,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: pipe.h,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: pipe.h,v 1.2 2003/02/05 00:14:03 miguelfreitas Exp $
*
* Contents:
*
diff --git a/src/xine-engine/nvtv/tv_chip.h b/src/xine-engine/nvtv/tv_chip.h
index e8110a566..7b5a94634 100644
--- a/src/xine-engine/nvtv/tv_chip.h
+++ b/src/xine-engine/nvtv/tv_chip.h
@@ -16,7 +16,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: tv_chip.h,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: tv_chip.h,v 1.2 2003/02/05 00:14:03 miguelfreitas Exp $
*
* Contents:
*
@@ -320,6 +320,7 @@ typedef struct {
#define CH_FLAG_ACIV (1 << 4)
#define CH_FLAG_CFRB (1 << 5)
#define CH_FLAG_CVBW (1 << 6)
+#define CH_FLAG_SCART (1 << 7)
typedef struct {
int dmr_ir; /* time */
diff --git a/src/xine-engine/nvtv/tv_common.h b/src/xine-engine/nvtv/tv_common.h
index bd441f147..41cf81082 100644
--- a/src/xine-engine/nvtv/tv_common.h
+++ b/src/xine-engine/nvtv/tv_common.h
@@ -16,7 +16,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: tv_common.h,v 1.1 2003/01/18 15:29:22 miguelfreitas Exp $
+ * $Id: tv_common.h,v 1.2 2003/02/05 00:14:03 miguelfreitas Exp $
*
* Contents:
*
@@ -45,8 +45,6 @@ struct _TvEncoderObj {
TVChip chip;
I2CDevPtr dev;
long minClock, maxClock; /* in kHz */
- int hwconfig;
- int hwstate;
void (*Create) (TVEncoderObj *this, TVChip chip, I2CDevPtr dev);
void (*InitRegs) (TVEncoderObj *this, int port);
void (*SetRegs) (TVEncoderObj *this, TVEncoderRegs *r, TVState state);
@@ -54,6 +52,8 @@ struct _TvEncoderObj {
void (*SetState) (TVEncoderObj *this, TVEncoderRegs *r, TVState state);
TVConnect (*GetConnect) (TVEncoderObj *this);
long (*GetStatus) (TVEncoderObj *this, int index);
+ int hwconfig;
+ int hwstate;
};
/* I2C Id of device for use in (s)printf */
diff --git a/src/xine-engine/nvtv/xfree.h b/src/xine-engine/nvtv/xfree.h
index 426a60c54..47d964b5a 100644
--- a/src/xine-engine/nvtv/xfree.h
+++ b/src/xine-engine/nvtv/xfree.h
@@ -16,9 +16,6 @@
#include "miscstruct.h"
-#define DEBUG(x) /*x*/
-#define ErrorF(x...) fprintf(stderr,x)
-
#define __inline__ inline
/**** libc_wrapper.c */
@@ -84,6 +81,20 @@ void xf86getsecs(long * secs, long * usecs);
/**** common/xf86str.h */
+/* Flags for driver messages */
+typedef enum {
+ X_PROBED, /* Value was probed */
+ X_CONFIG, /* Value was given in the config file */
+ X_DEFAULT, /* Value is a default */
+ X_CMDLINE, /* Value was given on the command line */
+ X_NOTICE, /* Notice */
+ X_ERROR, /* Error message */
+ X_WARNING, /* Warning message */
+ X_INFO, /* Informational message */
+ X_NONE, /* No prefix */
+ X_NOT_IMPLEMENTED /* Not implemented */
+} MessageType;
+
/* Video mode flags */
typedef enum {
@@ -230,9 +241,6 @@ typedef struct _ScrnInfoRec *ScrnInfoPtr;
extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
-#define xf86Msg(type,format,args...) /* fprintf(stderr,format,args) */
-#define xf86DrvMsg(scrnIndex,type,format, args...) /* fprintf(stderr,format,args) */
-
/* ---------------- nv driver files ---------------- */
/**** nv_local.h */
diff --git a/src/xine-engine/tvmode.c b/src/xine-engine/tvmode.c
index 787be4dd6..8d1bcd915 100644
--- a/src/xine-engine/tvmode.c
+++ b/src/xine-engine/tvmode.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: tvmode.c,v 1.11 2003/01/19 14:55:56 miguelfreitas Exp $
+ * $Id: tvmode.c,v 1.12 2003/02/05 00:14:02 miguelfreitas Exp $
*
* tvmode - TV output selection
*
@@ -147,27 +147,6 @@ static void tvmode_connect(xine_t *this) {
fprintf(stderr, "tvmode: cannot connect to nvtvd - no TV mode switching available\n");
}
- /*
-
- CardInfo *card = 0;
-
- if (back_card)
- back_card->closeCard ();
-
- if (back_client_avail ()) {
- if (! (card = back_client_init ()))
- back_card = 0;
- } else {
- back_card = 0;
- }
-
- if (back_card) {
- back_card->openCard (card);
- was_enabled = 1;
- }
- else
- printf("tvmode: cannot connect to nvtvd - no TV mode switching available\n");
- */
}
@@ -213,31 +192,19 @@ static void tvmode_settvstate (xine_t *this, int width, int height, double fps)
for (scano = scan_overscan; *scano && ! found; scano++) {
fprintf(stderr,"tvmode: trying to use %dx%d %s\n",
scanm[0], scanm[1], *scano);
- /*
+
if (back_card->findBySize (opt_system, scanm[0], scanm[1], *scano,
&mode)) {
current_width = scanm[0];
current_height = scanm[1];
current_fps = 25;
found++;
- } */
- if (back_card->findBySize (opt_system, 800, 600, "Large",
- &mode)) {
- current_width = 800;
- current_height = 600;
- current_fps = 25; /* TODO: currently this is PAL only */
- found++;
}
}
}
/* Switch to mode */
if (found) {
- /* back_card->setModeSettings (TV_PRIV_TVMODE | TV_PRIV_DUALVIEW,
- &crt, &tv, &settings); */
- /* mode.regs.devFlags = DEV_MONITOR | DEV_TELEVISION; */
- /* Modify the settings */
-
back_card->getSettings (&settings);
if (opt_connect > CONNECT_NONE) {
settings.connector = opt_connect;
@@ -251,10 +218,6 @@ static void tvmode_settvstate (xine_t *this, int width, int height, double fps)
back_card->setModeSettings (&mode.regs, &settings);
printf("tvmode: Trying to use mode %i x %i\n",current_width,current_height);
- /*
- back_card->setMode(&mode.regs);
- back_card->setTestImage (NULL, &settings);
- */
current_type = 1;
} else {
printf("tvmode: cannot find any valid TV mode - TV output disabled\n");
@@ -338,13 +301,6 @@ void xine_tvmode_init (xine_t *this) {
printf("tvmode: Initializing tvmode\n");
xine_config_register_bool (this, "misc.nv_tvmode", 0, _("NVidia TV-Out support."), NULL, 0, nvtvmode_enable_cb, this);
- /*
- tvmode_enabled = this->config->register_bool(this->config, "misc.nv_tvmode",
- 0,
- _("NVidia TV-Out support."),
- NULL, 10,
- nvtvmode_enable_cb, this);
- */
_tvmode_init(this);
}