Discussion:
[libdvdcss-devel] Using the dvdcss structure in C
Fabrice DELENTE
2010-06-20 16:41:19 UTC
Permalink
Hello.

I'm trying to design a way to uniquely identify a DVD; I looked at the
libdvdcss.c file and managed to retrieve the disc name and its timestamp
that are at offset 40 and 813 on the first sector of the DVD.

libdvdcss.c seems to imply that the key is mandatory to uniquely identify a
disc, how can I recover the key?

I have tried

dvdcss_t dvdcss;

dvdcss = dvdcss_open( "/dev/sr0" );
dvdcss_seek( dvdcss, 0, 0 );
dvdcss_read( dvdcss, buffer, 1, 0 );

then

printf("%.2x", dvdcss->css.p_disc_key[0] );

but gcc doesn't compile...

Any hint?

Thanks!
--
F. Delente
Sam Hocevar
2010-06-24 08:37:05 UTC
Permalink
Post by Fabrice DELENTE
I'm trying to design a way to uniquely identify a DVD; I looked at the
libdvdcss.c file and managed to retrieve the disc name and its timestamp
that are at offset 40 and 813 on the first sector of the DVD.
libdvdcss.c seems to imply that the key is mandatory to uniquely identify a
disc, how can I recover the key?
libdvdcss identifies a disc with only the name and the timestamp/
serial information. If the key was needed to identify the disc, there
would be no point in caching the key... We do invalidate the cached
key if we do find out that the key does not work, but this should not
usually happen.
Post by Fabrice DELENTE
printf("%.2x", dvdcss->css.p_disc_key[0] );
but gcc doesn't compile...
This doesn't work because dvdcss_t and css_t are opaque structures.
For it to work, you would need to copy their definition from
libdvdcss.h, but that would break as soon as libdvdcss changes its
internal structures. Another solution would be if libdvdcss exported
a means to get the key. We never saw a need for that, and you don't
actually look like you really need it.

Cheers,
--
Sam.
Fabrice DELENTE
2010-06-24 09:46:56 UTC
Permalink
Post by Sam Hocevar
libdvdcss identifies a disc with only the name and the timestamp/
serial information.
Thanks, that should simplify my work!
Post by Sam Hocevar
We never saw a need for that, and you don't actually look like you really
need it.
Ok, I'll skip trying to retrieve the key.

Thanks for your help!
--
F. Delente
Loading...