changeset 5088:942d497875b4

update by Charles Henrich
author alex
date Fri, 15 Mar 2002 16:08:14 +0000
parents 1d54c3a27093
children d28504b410ad
files libmpdemux/tvi_v4l.c
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l.c	Fri Mar 15 16:07:06 2002 +0000
+++ b/libmpdemux/tvi_v4l.c	Fri Mar 15 16:08:14 2002 +0000
@@ -63,6 +63,7 @@
     struct video_mmap		*buf;
     int				nbuf;
     int				queue;
+	int				currentframe;
 
     /* audio */
     int				audio_id;
@@ -163,7 +164,7 @@
 
     /* set video device name */
     if (!device)
-	priv->video_device = strdup("/dev/video0");
+	priv->video_device = strdup("/dev/video");
     else
 	priv->video_device = strdup(device);
 
@@ -174,7 +175,7 @@
     }
 
     /* set audio device name */
-    priv->audio_device = strdup("/dev/dsp");
+    priv->audio_device = "/dev/dsp";
 
     return(h);
 }
@@ -184,6 +185,8 @@
     int i;
 
     priv->video_fd = open(priv->video_device, O_RDWR);
+    mp_msg(MSGT_TV, MSGL_DBG2, "Video fd: %d, %x\n", priv->video_fd,
+	priv->video_device);
     if (priv->video_fd == -1)
     {
 	mp_msg(MSGT_TV, MSGL_ERR, "unable to open '%s': %s\n",
@@ -331,7 +334,7 @@
     memset(priv->buf, 0, priv->nbuf * sizeof(struct video_mmap));
     
     /* audio init */
-#if 0
+#if 1
     priv->audio_fd = open(priv->audio_device, O_RDONLY);
     if (priv->audio_fd < 0)
     {
@@ -508,6 +511,7 @@
 	win.height = priv->height;
 	win.chromakey = -1;
 	win.flags = 0;
+	//win.clipcount = 0;
 	
 	ioctl(priv->video_fd, VIDIOCSWIN, &win);
     }
@@ -537,7 +541,7 @@
 	    return(TVI_CONTROL_FALSE);
 	}
 	case TVI_CONTROL_IS_AUDIO:
-	    return(TVI_CONTROL_FALSE);
+//	    return(TVI_CONTROL_FALSE);
 /* also disable audio for as it's not working! */
 	    if (priv->channels[priv->act_channel].flags & VIDEO_VC_AUDIO)
 	    {
@@ -808,6 +812,8 @@
     int frame = priv->queue % priv->nbuf;
     int nextframe = (priv->queue+1) % priv->nbuf;
 
+	priv->currentframe++;
+
     mp_dbg(MSGT_TV, MSGL_DBG2, "grab_video_frame(priv=%p, buffer=%p, len=%d)\n",
 	priv, buffer, len);
 
@@ -835,7 +841,7 @@
     /* copy the actual frame */
     memcpy(buffer, priv->mmap+priv->mbuf.offsets[frame], len);
 
-    return(len);
+    return(priv->currentframe);
 }
 
 static int get_video_framesize(priv_t *priv)
@@ -846,11 +852,12 @@
 static int grab_audio_frame(priv_t *priv, char *buffer, int len)
 {
     int in_len = 0;
+//    int max_tries = 128;
 
-    /* DBG2 !! */
-    mp_dbg(MSGT_TV, MSGL_V, "grab_audio_frame(priv=%p, buffer=%p, len=%d)\n",
+    mp_dbg(MSGT_TV, MSGL_DBG2, "grab_audio_frame(priv=%p, buffer=%p, len=%d)\n",
 	priv, buffer, len);
     
+//    while (--max_tries > 0)
     for (;;)
     {
 	in_len = read(priv->audio_fd, buffer, len);
@@ -865,6 +872,7 @@
 	    break;
 	}
     }
+//    printf("tries: %d\n", 128-max_tries);
 
     return(in_len);
 }