[Mplayer-cvslog] CVS: main/libvo vo_mpegpes.c,1.39,1.40

Nico Sabbi CVS syncmail at mplayerhq.hu
Thu Aug 19 11:51:09 CEST 2004


CVS change done by Nico Sabbi CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv13505

Modified Files:
	vo_mpegpes.c 
Log Message:
user can select dvb card number to use (V3 api only)

Index: vo_mpegpes.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_mpegpes.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- vo_mpegpes.c	12 Jan 2003 17:46:21 -0000	1.39
+++ vo_mpegpes.c	19 Aug 2004 09:51:07 -0000	1.40
@@ -100,29 +100,40 @@
 
 static uint32_t preinit(const char *arg){
 #ifdef HAVE_DVB
+    int card = 0;
+    char vo_file[30], ao_file[30], *tmp;
+    
+    if(arg != NULL){
+	if((tmp = strstr(arg, "card=")) != NULL) {
+	    card = atoi(&tmp[5]);
+	    if((card < 1) || (card > 4)) {
+		mp_msg(MSGT_VO, MSGL_ERR, "DVB card number must be between 1 and 4\n");
+		return -1;
+	    }
+	    card--;
+	    arg = NULL;
+	}
+    }
+    
     if(!arg){
     //|O_NONBLOCK
 #ifndef HAVE_DVB_HEAD
-	printf("Opening /dev/ost/video+audio\n");
-	if((vo_mpegpes_fd = open("/dev/ost/video",O_RDWR)) < 0){
-		perror("DVB VIDEO DEVICE: ");
-		return -1;
-	}
-	if((vo_mpegpes_fd2 = open("/dev/ost/audio",O_RDWR|O_NONBLOCK)) < 0){
-		perror("DVB AUDIO DEVICE: ");
-		return -1;
-	}
+	mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/ost/video+audio\n");
+	sprintf(vo_file, "/dev/ost/video");
+	sprintf(ao_file, "/dev/ost/audio");
 #else
-	printf("Opening /dev/dvb/adapter0/video0+audio0\n");
-	if((vo_mpegpes_fd = open("/dev/dvb/adapter0/video0",O_RDWR)) < 0){
+	mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/dvb/adapter%d/video0+audio0\n", card);
+	sprintf(vo_file, "/dev/dvb/adapter%d/video0", card);
+	sprintf(ao_file, "/dev/dvb/adapter%d/audio0", card);
+#endif
+	if((vo_mpegpes_fd = open(vo_file,O_RDWR)) < 0){
         	perror("DVB VIDEO DEVICE: ");
         	return -1;
 	}
-	if((vo_mpegpes_fd2 = open("/dev/dvb/adapter0/audio0",O_RDWR|O_NONBLOCK)) < 0){
+	if((vo_mpegpes_fd2 = open(ao_file,O_RDWR|O_NONBLOCK)) < 0){
         	perror("DVB AUDIO DEVICE: ");
         	return -1;
 	}
-#endif
 	if ( (ioctl(vo_mpegpes_fd,VIDEO_SET_BLANK, false) < 0)){
 		perror("DVB VIDEO SET BLANK: ");
 		return -1;
@@ -162,7 +173,9 @@
 	return 0;
     }
 #endif
-    vo_mpegpes_fd=open(arg ? arg : "grab.mpg",O_WRONLY|O_CREAT,0666);
+    arg = (arg ? arg : "grab.mpg");
+    mp_msg(MSGT_VO,MSGL_INFO, "Saving PES stream to %s\n", arg);
+    vo_mpegpes_fd=open(arg,O_WRONLY|O_CREAT,0666);
     if(vo_mpegpes_fd<0){	
 	perror("vo_mpegpes");
 	return -1;




More information about the MPlayer-cvslog mailing list