changeset 7672:e6b46875e1b9

- fixed a 10l bug: setting PTS flag even if no PTS stored - support for file-writing even if --enable-dvb: -vo mpegpes:filename.mpg
author arpi
date Tue, 08 Oct 2002 23:11:49 +0000
parents 2d186a94dd5f
children a401a6ea5358
files libvo/vo_mpegpes.c
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_mpegpes.c	Tue Oct 08 22:57:39 2002 +0000
+++ b/libvo/vo_mpegpes.c	Tue Oct 08 23:11:49 2002 +0000
@@ -84,6 +84,7 @@
 
 static uint32_t preinit(const char *arg){
 #ifdef HAVE_DVB
+    if(!arg){
     //|O_NONBLOCK
 	if((vo_mpegpes_fd = open("/dev/ost/video",O_RDWR)) < 0){
 		perror("DVB VIDEO DEVICE: ");
@@ -120,22 +121,24 @@
 		perror("DVB VIDEO PLAY: ");
 		return -1;
 	}
-	if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_AV_SYNC, true) < 0)){
+	if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_AV_SYNC, false) < 0)){
 		perror("DVB AUDIO SET AV SYNC: ");
 		return -1;
 	}
-	if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MUTE, false) < 0)){
+//	if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MUTE, false) < 0)){
+	if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MUTE, true) < 0)){
 		perror("DVB AUDIO SET MUTE: ");
 		return -1;
 	}
-
-#else
-    vo_mpegpes_fd=open("grab.mpg",O_WRONLY|O_CREAT,0666);
+	return 0;
+    }
+#endif
+    vo_mpegpes_fd=open(arg ? arg : "grab.mpg",O_WRONLY|O_CREAT,0666);
     if(vo_mpegpes_fd<0){	
 	perror("vo_mpegpes");
 	return -1;
     }
-#endif
+    vo_mpegpes_fd2=vo_mpegpes_fd;
     return 0;
 }
 
@@ -248,8 +251,11 @@
 	      pes_header[5]=(payload_size+3+ptslen+7)&255;
 
 	      // stuffing:
+	      // TTCCxxxx  CC=css TT=type: 1=STD 0=mpeg1 2=vob
 	      pes_header[6]=0x81;
-	      pes_header[7]=0x80;
+	      
+	      // FFxxxxxx   FF=pts flags=2 vs 0
+	      pes_header[7]=ptslen ? 0x80 : 0;
 
 	      // hdrlen:
 	      pes_header[8]=ptslen;
@@ -332,8 +338,9 @@
 static void
 uninit(void)
 {
+    if(vo_mpegpes_fd2>=0 && vo_mpegpes_fd2!=vo_mpegpes_fd) close(vo_mpegpes_fd2);
+    vo_mpegpes_fd2=-1;
     if(vo_mpegpes_fd>=0){ close(vo_mpegpes_fd);vo_mpegpes_fd=-1;}
-    if(vo_mpegpes_fd2>=0){ close(vo_mpegpes_fd2);vo_mpegpes_fd2=-1;}
 }