[MPlayer-dev-eng] [PATCH] -identify DVD titles
kiriuja
mplayer-patches at en-directo.net
Tue Sep 20 00:17:41 CEST 2005
On 9/19/05, Guillaume POIRIER wrote:
> +// 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?
OK, I will.
> 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?
Like Rich said, this is plain C, so nothing can go wrong with any C compiler.
> + 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?
It is an MD5 sum that libdvdcss code makes, and so the size does not depend
on a particular DVD. The ID is always 128 bit long. There are comments for
DVDDiscID in dvd_reader.h that talk about that.
> + 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 ...
OK.
> + 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?
Can't think of any shorter or more elegant way to do this in plain C.
Don't want to call sprintf 17 times.
--
kiriuja
More information about the MPlayer-dev-eng
mailing list