[MPlayer-cvslog] CVS: main/libmpdemux tv.c, 1.67, 1.68 tv.h, 1.28, 1.29 tvi_v4l2.c, 1.16, 1.17
Jindrich Makovicka CVS
syncmail at mplayerhq.hu
Fri Nov 19 14:04:26 CET 2004
CVS change done by Jindrich Makovicka CVS
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv8953
Modified Files:
tv.c tv.h tvi_v4l2.c
Log Message:
setting the norm using text ID instead of numeric
Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- tv.c 17 Mar 2004 03:53:02 -0000 1.67
+++ tv.c 19 Nov 2004 13:04:24 -0000 1.68
@@ -123,8 +123,11 @@
return 1;
}
-static int norm_from_string(char* norm)
+static int norm_from_string(tvi_handle_t *tvh, char* norm)
{
+#ifdef HAVE_TV_V4L2
+ if (strcmp(tv_param_driver, "v4l2") != 0) {
+#endif
if (!strcasecmp(norm, "pal"))
return TV_NORM_PAL;
else if (!strcasecmp(norm, "ntsc"))
@@ -143,6 +146,17 @@
mp_msg(MSGT_TV, MSGL_V, "tv.c: norm_from_string(%s): Bogus norm parameter, setting PAL.\n", norm);
return TV_NORM_PAL;
}
+#ifdef HAVE_TV_V4L2
+ } else {
+ tvi_functions_t *funcs = tvh->functions;
+ char str[8];
+ strncpy(str, norm, sizeof(str)-1);
+ str[sizeof(str)-1] = '\0';
+ if (funcs->control(tvh->priv, TVI_CONTROL_SPC_GET_NORMID, str) != TVI_CONTROL_TRUE)
+ return 0;
+ return *(int *)str;
+ }
+#endif
}
static int open_tv(tvi_handle_t *tvh)
@@ -181,10 +195,16 @@
funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input);
#ifdef HAVE_TV_V4L2
- if (strcmp(tv_param_driver, "v4l2") != 0) {
+ if (!strcmp(tv_param_driver, "v4l2") && tv_param_normid >= 0) {
+ mp_msg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", tv_param_normid);
+ if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) {
+ mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n");
+ return 0;
+ }
+ } else {
#endif
/* select video norm */
- tvh->norm = norm_from_string(tv_param_norm);
+ tvh->norm = norm_from_string(tvh, tv_param_norm);
mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
@@ -192,14 +212,6 @@
return 0;
}
#ifdef HAVE_TV_V4L2
- } else {
- if (tv_param_normid >= 0) {
- mp_msg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", tv_param_normid);
- if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) {
- mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n");
- return 0;
- }
- }
}
#endif
@@ -826,7 +838,7 @@
int tv_set_norm(tvi_handle_t *tvh, char* norm)
{
- tvh->norm = norm_from_string(norm);
+ tvh->norm = norm_from_string(tvh, norm);
mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
Index: tv.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- tv.h 11 Jan 2004 17:07:32 -0000 1.28
+++ tv.h 19 Nov 2004 13:04:24 -0000 1.29
@@ -156,6 +156,7 @@
/* SPECIFIC controls */
#define TVI_CONTROL_SPC_GET_INPUT 0x401 /* set input channel (tv,s-video,composite..) */
#define TVI_CONTROL_SPC_SET_INPUT 0x402 /* set input channel (tv,s-video,composite..) */
+#define TVI_CONTROL_SPC_GET_NORMID 0x403 /* get normid from norm name */
extern tvi_handle_t *tv_begin(void);
extern int tv_init(tvi_handle_t *tvh);
Index: tvi_v4l2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_v4l2.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- tvi_v4l2.c 19 Jul 2004 23:17:37 -0000 1.16
+++ tvi_v4l2.c 19 Nov 2004 13:04:24 -0000 1.17
@@ -693,6 +693,22 @@
return TVI_CONTROL_FALSE;
}
return TVI_CONTROL_TRUE;
+ case TVI_CONTROL_SPC_GET_NORMID:
+ {
+ int i;
+ for (i = 0;; i++) {
+ struct v4l2_standard standard;
+ memset(&standard, 0, sizeof(standard));
+ standard.index = i;
+ if (-1 == ioctl(priv->video_fd, VIDIOC_ENUMSTD, &standard))
+ return TVI_CONTROL_FALSE;
+ if (!strcasecmp(standard.name, (char *)arg)) {
+ *(int *)arg = i;
+ return TVI_CONTROL_TRUE;
+ }
+ }
+ return TVI_CONTROL_FALSE;
+ }
case TVI_CONTROL_SPC_GET_INPUT:
if (ioctl(priv->video_fd, VIDIOC_G_INPUT, (int *)arg) < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl get input failed: %s\n",
More information about the MPlayer-cvslog
mailing list