ports/74375: [PATCH] sysutils/dvdbackup cannot get DVD-title
Zahemszky Gabor
gabor at zahemszky.hu
Thu Nov 25 16:30:29 UTC 2004
>Number: 74375
>Category: ports
>Synopsis: [PATCH] sysutils/dvdbackup cannot get DVD-title
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Nov 25 16:30:28 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Zahemszky Gabor
>Release: FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD zahemszky.hu 5.3-STABLE FreeBSD 5.3-STABLE #0: Tue Nov 23 23:53:24 CET 2004 root at Picasso.Zahemszky.HU:/usr/obj/usr/src/sys/PICASSO i386
>Description:
With sysutils/dvdbackup, I cannot read the DVD-title. Neither with a SCSI
DVD-ROM (Pioneer DVD 305S), nor an ATAPI DVD-ROM (Samsung/Toshiba TS-H552B
- I tried both with /dev/acd0 device, and with ATAPICAM as /dev/cd1). As
libdvdcss can read the DVD-title (as we can found in the ~/.dvdcss
"cache directory"), the problem is with dvdbackup.
>How-To-Repeat:
Try running:
dvdbackup -i /dev/dvd -I
and looking the output. (Or try to make a backup with
dvdbackup -i /dev/dvd -M -o savedir
and read the error message.)
>Fix:
By reading libdvdcss source, and dvdbackup source, the only difference is
that libdvdcss reads one 2048 bytes sector at a time. But dvdbackup
tries to read eg. 32 bytes in one read. So the obvious fix is to change
dvdbackup's title-reading to read the whole sector in a temporary buffer,
and after it, copy the DVD-title from this temporary buffer to the correct
location. This is in the DVDGetTitleName routine
By the way, this patch makes two another corrections:
a) add the missing -n option into the help (it's in the README file, and in
the source, but dvdrecord doesn't write it) - in the "usage" routine
b) corrects some typos. - in the same "usage", and in DVDDisplayInfo
=== patch-dvdbackup.c
*** src/dvdbackup.c.orig Mon Aug 5 08:08:39 2002
--- src/dvdbackup.c Thu Nov 25 16:43:19 2004
*************** void usage(){
*** 210,215 ****
--- 210,216 ----
fprintf(stderr,"\t-v X\t\twhere X is the amount of verbosity\n");
fprintf(stderr,"\t-I\t\tfor information about the DVD\n");
fprintf(stderr,"\t-o directory\twhere directory is your backup target\n");
+ fprintf(stderr,"\t-n\t\tuse this as DVD name (if we can't get it)\n");
fprintf(stderr,"\t-M\t\tbackup the whole DVD\n");
fprintf(stderr,"\t-F\t\tbackup the main feature of the DVD\n");
fprintf(stderr,"\t-T X\t\tbackup title set X\n");
*************** void usage(){
*** 219,226 ****
fprintf(stderr,"\t-a 0\t\tto get aspect ratio 4:3 instead of 16:9 if both are present\n");
fprintf(stderr,"\t-h\t\tprint a brief usage message\n");
fprintf(stderr,"\t-?\t\tprint a brief usage message\n\n");
! fprintf(stderr,"\t-i is manditory\n");
! fprintf(stderr,"\t-o is manditory except if you use -I\n");
fprintf(stderr,"\t-a is option to the -F switch and has no effect on other options\n");
fprintf(stderr,"\t-s and -e should prefereibly be used together with -t \n\n");
exit(1);
--- 220,227 ----
fprintf(stderr,"\t-a 0\t\tto get aspect ratio 4:3 instead of 16:9 if both are present\n");
fprintf(stderr,"\t-h\t\tprint a brief usage message\n");
fprintf(stderr,"\t-?\t\tprint a brief usage message\n\n");
! fprintf(stderr,"\t-i is mandatory\n");
! fprintf(stderr,"\t-o is mandatory except if you use -I\n");
fprintf(stderr,"\t-a is option to the -F switch and has no effect on other options\n");
fprintf(stderr,"\t-s and -e should prefereibly be used together with -t \n\n");
exit(1);
*************** int DVDGetTitleName(const char *device,
*** 1530,1536 ****
/* Seek to title of first track, which is at (track_no * 32768) + 40 */
! if ( 32808 != lseek(filehandle, 32808, SEEK_SET) ) {
close(filehandle);
fprintf(stderr, "Can't seek DVD device %s - check your DVD device\n", device);
return(1);
--- 1531,1537 ----
/* Seek to title of first track, which is at (track_no * 32768) + 40 */
! if ( 32768 != lseek(filehandle, 32768, SEEK_SET) ) {
close(filehandle);
fprintf(stderr, "Can't seek DVD device %s - check your DVD device\n", device);
return(1);
*************** int DVDGetTitleName(const char *device,
*** 1538,1549 ****
/* Read the DVD-Video title */
! if ( 32 != read(filehandle, title, 32)) {
close(filehandle);
fprintf(stderr, "Can't read title from DVD device %s\n", device);
return(1);
}
/* Terminate the title string */
title[32] = '\0';
--- 1539,1556 ----
/* Read the DVD-Video title */
! #define DVD_SEC_SIZ 2048
! {
! char tempBuf[ DVD_SEC_SIZ ];
!
! if ( DVD_SEC_SIZ != read(filehandle, tempBuf, DVD_SEC_SIZ)) {
close(filehandle);
fprintf(stderr, "Can't read title from DVD device %s\n", device);
return(1);
}
+ snprintf( title, 32, "%s", tempBuf + 40 );
+ }
/* Terminate the title string */
title[32] = '\0';
*************** int DVDDisplayInfo(dvd_reader_t * _dvd,
*** 2164,2170 ****
DVDGetTitleName(dvd,title_name);
! fprintf(stdout,"\n\n\nDVD-Video information of the DVD with tile %s\n\n", title_name);
/* Print file structure */
--- 2171,2177 ----
DVDGetTitleName(dvd,title_name);
! fprintf(stdout,"\n\n\nDVD-Video information of the DVD with title %s\n\n", title_name);
/* Print file structure */
===
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list