From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Nov 25 16:30:29 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 01CE316A4CE for ; Thu, 25 Nov 2004 16:30:29 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B77B143D5F for ; Thu, 25 Nov 2004 16:30:28 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iAPGUSFW007373 for ; Thu, 25 Nov 2004 16:30:28 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iAPGUS28007369; Thu, 25 Nov 2004 16:30:28 GMT (envelope-from gnats) Resent-Date: Thu, 25 Nov 2004 16:30:28 GMT Resent-Message-Id: <200411251630.iAPGUS28007369@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Zahemszky Gabor Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8CF816A4CE for ; Thu, 25 Nov 2004 16:23:21 +0000 (GMT) Received: from zahemszky.hu (103.204-182-adsl-pool.axelero.hu [81.182.204.103]) by mx1.FreeBSD.org (Postfix) with ESMTP id B8A6143D1F for ; Thu, 25 Nov 2004 16:23:20 +0000 (GMT) (envelope-from zgabor@zahemszky.hu) Received: from zahemszky.hu (localhost [127.0.0.1]) by Picasso.Zahemszky.HU (8.13.1/8.13.1) with ESMTP id iAPGOFc1091972 for ; Thu, 25 Nov 2004 17:24:16 +0100 (CET) (envelope-from zgabor@zahemszky.hu) Received: (from zgabor@localhost) by zahemszky.hu (8.13.1/8.13.1/Submit) id iAPGOEpW091971; Thu, 25 Nov 2004 17:24:14 +0100 (CET) (envelope-from zgabor) Message-Id: <200411251624.iAPGOEpW091971@zahemszky.hu> Date: Thu, 25 Nov 2004 17:24:14 +0100 (CET) From: Zahemszky Gabor To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/74375: [PATCH] sysutils/dvdbackup cannot get DVD-title X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Zahemszky Gabor List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2004 16:30:29 -0000 >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@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: