[MPlayer-dev-eng] [PATCH] -identify DVD titles

Guillaume POIRIER poirierg at gmail.com
Mon Sep 19 22:29:00 CEST 2005


Hi,

On 9/17/05, kiriuja <mplayer-patches at en-directo.net> wrote:
> > Prints the number of titles, the numbers of chapters and angles for
> > each title, and the time length of each title if -identify is given
> > when playing a DVD.
> 
> Updated patch. Additionally prints DVD disk ID.

+// dvdtimetomsec is based on lsdvd.c by Chris Phillips (GPL2+)
+static int dvdtimetomsec(dvd_time_t *dt)
+{
+  static int framerates[4] = {0, 2500, 0, 2997};
+  int framerate = framerates[(dt->frame_u & 0xc0) >> 6];
+  int msec = (((dt->hour & 0xf0) >> 3) * 5 + (dt->hour & 0x0f)) * 3600000;
+  msec += (((dt->minute & 0xf0) >> 3) * 5 + (dt->minute & 0x0f)) * 60000;
+  msec += (((dt->second & 0xf0) >> 3) * 5 + (dt->second & 0x0f)) * 1000;
+  if(framerate > 0)
+    msec += ((dt->frame_u & 0x30) >> 3) * 5 + (dt->frame_u & 0x0f) *
100000 / framerate;
+  return msec;
+}
 
Even though the code is understandable, could you please add the
appropriate doxygen comments to that function?

I'm also not too sure that 
+  static int framerates[4] = {0, 2500, 0, 2997};
+  int framerate = framerates[(dt->frame_u & 0xc0) >> 6];
+  int msec = (((dt->hour & 0xf0) >> 3) * 5 + (dt->hour & 0x0f)) * 3600000;

is well supported by ol' compilers such as GCC-2.95. Could you check that?

+    if (identify)
+    {
+      unsigned char discid [16];

this is probably as silly question, but is it 100% sure that the disc
ID fits in the 16 chars array? What happens with a non-spec compliant
dvd?

+      int vts_no, title_no, vts_ttn, pgc_no, msec;

Could you add the doxygen comments of those? I think the syntax is smth like:

int vts_no //< this baby stores the title number of ...

+      if (DVDDiscID(dvd, discid) >= 0)
+        mp_msg(MSGT_GLOBAL, MSGL_INFO,
"ID_DVD_DISC_ID=%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n",
+          discid[0], discid[1], discid[2], discid[3], discid[4],
discid[5], discid[6], discid[7],
+          discid[8], discid[9], discid[10], discid[11], discid[12],
discid[13], discid[14], discid[15]);

Good Lord! Isn't there a  cleaner way to print the disk ID of the DVD?

Guillaume
-- 
Reading doesn't hurt, really!
  -- Dominik 'Rathann' Mierzejewski




More information about the MPlayer-dev-eng mailing list