[MPlayer-cvslog] CVS: main/libmpdemux vcd_read_nbsd.h, 1.5, 1.6 vcd_read_fbsd.h, 1.7, 1.8 vcd_read_darwin.h, 1.2, 1.3 vcd_read.h, 1.14, 1.15

Guillaume Poirier CVS syncmail at mplayerhq.hu
Thu Sep 22 10:46:08 CEST 2005


CVS change done by Guillaume Poirier CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv19377/libmpdemux

Modified Files:
	vcd_read_nbsd.h vcd_read_fbsd.h vcd_read_darwin.h vcd_read.h 
Log Message:
Prints the numbers of start and end tracks and MSF length for each
track of a VCD when -identify is given.
Patch by kiriuja < mplayer TIREH patches AH en TIREH directo POIS net >
Original Thread:
Date: Sep 11, 2005 3:30 AM
Subject: [MPlayer-dev-eng] [PATCH] -identify VCD tracks


Index: vcd_read_nbsd.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/vcd_read_nbsd.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- vcd_read_nbsd.h	11 Jul 2004 22:23:57 -0000	1.5
+++ vcd_read_nbsd.h	22 Sep 2005 08:46:05 -0000	1.6
@@ -84,16 +84,21 @@
 {
   struct ioc_toc_header tochdr;
   mp_vcd_priv_t* vcd;
-  int             i;
+  int i, min = 0, sec = 0, frame = 0;
   if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) {
     mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
     return;
   }
-  for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) {
+  if (identify)
+  {
+    mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", tochdr.starting_track);
+    mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", tochdr.ending_track);
+  }
+  for (i = tochdr.starting_track; i <= tochdr.ending_track + 1; i++) {
     struct ioc_read_toc_entry tocentry;
     struct cd_toc_entry tocentry_data;
 
-    tocentry.starting_track = i;
+    tocentry.starting_track = i<=tochdr.ending_track ? i : CDROM_LEADOUT;
     tocentry.address_format = CD_MSF_FORMAT;
     tocentry.data_len = sizeof(struct cd_toc_entry);
     tocentry.data = &tocentry_data;
@@ -102,6 +107,7 @@
       mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno));
       return NULL;
     }
+    if (i <= tochdr.ending_track)
     mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d:  adr=%d  ctrl=%d  format=%d  %02d:%02d:%02d\n",
 	   (int) tocentry.starting_track,
 	   (int) tocentry.data->addr_type,
@@ -111,6 +117,30 @@
 	   (int) tocentry.data->addr.msf.second,
 	   (int) tocentry.data->addr.msf.frame
       );
+
+    if (identify)
+    {
+      if (i > tochdr.starting_track)
+      {
+        min = tocentry.data->addr.msf.minute - min;
+        sec = tocentry.data->addr.msf.second - sec;
+        frame = tocentry.data->addr.msf.frame - frame;
+        if ( frame < 0 )
+        {
+          frame += 75;
+          sec --;
+        }
+        if ( sec < 0 )
+        {
+          sec += 60;
+          min --;
+        }
+        mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame);
+      }
+      min = tocentry.data->addr.msf.minute;
+      sec = tocentry.data->addr.msf.second;
+      frame = tocentry.data->addr.msf.frame;
+    }
   }
   vcd = malloc(sizeof(mp_vcd_priv_t));
   vcd->fd = fd;

Index: vcd_read_fbsd.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/vcd_read_fbsd.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- vcd_read_fbsd.h	10 Apr 2003 08:34:43 -0000	1.7
+++ vcd_read_fbsd.h	22 Sep 2005 08:46:05 -0000	1.8
@@ -60,15 +60,20 @@
 mp_vcd_priv_t* vcd_read_toc(int fd){
   struct ioc_toc_header tochdr;
   mp_vcd_priv_t* vcd;
-  int i;
+  int i, min = 0, sec = 0, frame = 0;
   if (ioctl(fd,CDIOREADTOCHEADER,&tochdr)==-1) {
     mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
     return NULL;
   }
-  for (i=tochdr.starting_track ; i<=tochdr.ending_track ; i++){
+  if (identify)
+  {
+    mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", tochdr.starting_track);
+    mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", tochdr.ending_track);
+  }
+  for (i=tochdr.starting_track ; i<=tochdr.ending_track + 1; i++){
       struct ioc_read_toc_single_entry tocentry;
 
-      tocentry.track  = i;
+      tocentry.track  = i<=tochdr.ending_track ? i : CDROM_LEADOUT;
       tocentry.address_format = CD_MSF_FORMAT;
 
       if (ioctl(fd,CDIOREADTOCENTRY,&tocentry)==-1) {
@@ -76,6 +81,7 @@
 	return NULL;
       }
         
+      if (i<=tochdr.ending_track)
       mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d:  adr=%d  ctrl=%d  format=%d  %02d:%02d:%02d\n",
           (int)tocentry.track,
           (int)tocentry.entry.addr_type,
@@ -85,6 +91,30 @@
           (int)tocentry.entry.addr.msf.second,
           (int)tocentry.entry.addr.msf.frame
       );
+
+      if (identify)
+      {
+        if (i > tochdr.starting_track)
+        {
+          min = tocentry.entry.addr.msf.minute - min;
+          sec = tocentry.entry.addr.msf.second - sec;
+          frame = tocentry.entry.addr.msf.frame - frame;
+          if ( frame < 0 )
+          {
+            frame += 75;
+            sec --;
+          }
+          if ( sec < 0 )
+          {
+            sec += 60;
+            min --;
+          }
+          mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame);
+        }
+        min = tocentry.entry.addr.msf.minute;
+        sec = tocentry.entry.addr.msf.second;
+        frame = tocentry.entry.addr.msf.frame;
+      }
     }
   vcd = malloc(sizeof(mp_vcd_priv_t));
   vcd->fd = fd;

Index: vcd_read_darwin.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/vcd_read_darwin.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vcd_read_darwin.h	1 Nov 2004 17:57:00 -0000	1.2
+++ vcd_read_darwin.h	22 Sep 2005 08:46:05 -0000	1.3
@@ -110,7 +110,7 @@
 	CDMSF trackMSF;
 	
 	mp_vcd_priv_t* vcd;
-	int i;
+	int i, min = 0, sec = 0, frame = 0;
   
 	//read toc header
     memset(&tochdr, 0, sizeof(tochdr));
@@ -124,11 +124,16 @@
     }
 	
 	//print all track info
-	for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB ; i++)
+	if (identify)
+	{
+		mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", hdr.firstTrackNumberInLastSessionLSB);
+		mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", hdr.lastTrackNumberInLastSessionLSB);
+	}
+	for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
 	{
 		memset( &tocentry, 0, sizeof(tocentry));
 		tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
-		tocentry.address = i;
+		tocentry.address = i<=hdr.lastTrackNumberInLastSessionLSB ? i : CDROM_LEADOUT;
 		tocentry.bufferLength = sizeof(entry);
 		tocentry.buffer = &entry;
 
@@ -141,6 +146,7 @@
 		trackMSF = CDConvertLBAToMSF(entry.trackStartAddress);
         
 		//mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d:  adr=%d  ctrl=%d  format=%d  %02d:%02d:%02d\n",
+		if (i<=hdr.lastTrackNumberInLastSessionLSB)
 		mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: format=%d  %02d:%02d:%02d\n",
           (int)tocentry.address,
           //(int)tocentry.entry.addr_type,
@@ -150,6 +156,30 @@
           (int)trackMSF.second,
           (int)trackMSF.frame
 		);
+
+		if (identify)
+		{
+		  if (i > hdr.firstTrackNumberInLastSessionLSB)
+		  {
+		    min = trackMSF.minute - min;
+		    sec = trackMSF.second - sec;
+		    frame = trackMSF.frame - frame;
+		    if ( frame < 0 )
+		    {
+		      frame += 75;
+		      sec --;
+		    }
+		    if ( sec < 0 )
+		    {
+		      sec += 60;
+		      min --;
+		    }
+		    mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame);
+		  }
+		  min = trackMSF.minute;
+		  sec = trackMSF.second;
+		  frame = trackMSF.frame;
+		}
 	}
  
 	vcd = malloc(sizeof(mp_vcd_priv_t));

Index: vcd_read.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/vcd_read.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- vcd_read.h	17 Jun 2003 22:28:29 -0000	1.14
+++ vcd_read.h	22 Sep 2005 08:46:05 -0000	1.15
@@ -60,15 +60,20 @@
 mp_vcd_priv_t* vcd_read_toc(int fd){
   struct cdrom_tochdr tochdr;
   mp_vcd_priv_t* vcd;
-  int i;
+  int i, min = 0, sec = 0, frame = 0;
   if (ioctl(fd,CDROMREADTOCHDR,&tochdr)==-1) {
     mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
     return NULL;
   }
-  for (i=tochdr.cdth_trk0 ; i<=tochdr.cdth_trk1 ; i++){
+  if (identify)
+  {
+    mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", tochdr.cdth_trk0);
+    mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", tochdr.cdth_trk1);
+  }
+  for (i=tochdr.cdth_trk0 ; i<=tochdr.cdth_trk1 + 1; i++){
       struct cdrom_tocentry tocentry;
 
-      tocentry.cdte_track  = i;
+      tocentry.cdte_track  = i<=tochdr.cdth_trk1 ? i : CDROM_LEADOUT;
       tocentry.cdte_format = CDROM_MSF;
 
       if (ioctl(fd,CDROMREADTOCENTRY,&tocentry)==-1) {
@@ -76,6 +81,7 @@
 	return NULL;
       }
         
+      if (i<=tochdr.cdth_trk1)
       mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d:  adr=%d  ctrl=%d  format=%d  %02d:%02d:%02d  mode: %d\n",
           (int)tocentry.cdte_track,
           (int)tocentry.cdte_adr,
@@ -86,6 +92,30 @@
           (int)tocentry.cdte_addr.msf.frame,
           (int)tocentry.cdte_datamode
       );
+
+      if (identify)
+      {
+        if (i > tochdr.cdth_trk0)
+        {
+          min = tocentry.cdte_addr.msf.minute - min;
+          sec = tocentry.cdte_addr.msf.second - sec;
+          frame = tocentry.cdte_addr.msf.frame - frame;
+          if ( frame < 0 )
+          {
+            frame += 75;
+            sec --;
+          }
+          if ( sec < 0 )
+          {
+            sec += 60;
+            min --;
+          }
+          mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame);
+        }
+        min = tocentry.cdte_addr.msf.minute;
+        sec = tocentry.cdte_addr.msf.second;
+        frame = tocentry.cdte_addr.msf.frame;
+      }
     }
   vcd = malloc(sizeof(mp_vcd_priv_t));
   vcd->fd = fd;




More information about the MPlayer-cvslog mailing list