diff -ruN dvbackup-0.0.4/Makefile dvbackup/Makefile --- dvbackup-0.0.4/Makefile 2002-03-24 22:08:57 +0300 +++ dvbackup/Makefile 2003-04-08 01:15:50 +0400 @@ -5,13 +5,17 @@ #Flags for profiling: #CFLAGS=-Wall -O3 -pg +# Comment out the next two lines if you have libavc1394 librom1394 libraw1394 +HAVE_AVC1394=-DHAVE_LIBAVC1394 +LIBAVC1394=-lavc1394 -lrom1394 -lraw1394 + #install into: install_dir=/usr/local/bin all: dvbackup dvconnect Makefile dvconnect: dvconnect.c Makefile - gcc $(CFLAGS) -DHAVE_LIBPOPT -o dvconnect dvconnect.c -lpopt -lpthread + gcc $(CFLAGS) -DHAVE_LIBPOPT $(HAVE_AVC1394) -o dvconnect dvconnect.c -lpopt -lpthread $(LIBAVC1394) dvbackup: dvbackup.c minilogo.c Makefile gcc $(CFLAGS) -I/usr/include -o dvbackup dvbackup.c minilogo.c -lpopt -lm -lz diff -ruN dvbackup-0.0.4/scripts/dvback dvbackup/scripts/dvback --- dvbackup-0.0.4/scripts/dvback 1970-01-01 03:00:00 +0300 +++ dvbackup/scripts/dvback 2002-09-29 12:59:09 +0400 @@ -0,0 +1,119 @@ +#!/usr/bin/perl + +$sto = "16000"; #default 12000. Sets --syt-offset for dvconnect -s (see dvconnect --help) + #adjust this for your camcorder/firewire card + #until the screen no longer flickers while "dvconnect -s"-ing +$bufmult = 10000; #im sure this could be fine tuned, but this may be sufficient +$tmploc = "/tmp/vidout"; #location of tmp file. This could be big depending on value of buffer + #if you have a custom picture for the camcorder...# +$setpicture_option='--set-picture="/usr/local/share/gimp/minilogo.ppm"'; + +$message = " +Run cpio to backup to dv tape +Usage dvback [OPTIONS] [BACKUP_DIRECTORY] + + --help print this screen + -h host rsh to host to run cpio|tar + -b buffer_size buffer size for \"dvconnect -s\" + (default 500) + -v verbose + -z filter through gunzip + -t use tar format instead of crc format + -r (default on) run through rsbep FEC (error correction) + -R turn off rsbep FEC (error correction) + -d differential backup since the \"lastbackup.dvback\" + file was written + -f mark this backup as a full + (i.e. touch BACKUP_DIRECTORY/lastbackup.dvback) + BACKUP_DIRECTORY directory on local or if -h remote machine + where backup will begin (recursive backup) +"; + +if ($args =~ /--help/ ) { + print $message; + exit; +} +use Getopt::Std; +getopts('b:h:vztrdfR', \%arg); + +print `/sbin/modprobe ohci1394; /sbin/modprobe raw1394; /sbin/modprobe video1394`; +$args = join " " , @ARGV; + + + +$args =~ s/-+\w*//g; # get rid of arguments + + +$pipeitto = '|'; + + + +if ( $arg{'h'} ) { + $host = $arg{'h'}; + $hostcommand = "rsh $host "; + $pipeitto = '"|"'; +} + +if ( $arg{'z'} ) { + $ziprun = "| gzip -c"; +} + +if ( $arg{'b'} ) { + $buffer = $arg{'b'}; +} else { $buffer = '500'; } + + +unless ( $arg{'R'} ) { + $which=`/usr/bin/which rsbep`; + unless ($which) { + die "rsbep not found (download available at http://www.s.netic.de/gfiala/dvbackup.html)"; + } + $rsbeprun = "| rsbep"; +} else { + die "Make a choice. Can't have -r and -R $message" if $arv{'r'}; +} + +$args =~ s/^\s+//; +$args =~ s/\s+$//; +$args =~ s/\/$//; #remove trailing / if any + +if ($args =~ /\s/) { + die "too many extra arguments: which one is the directory?\n(got '$args')\n$message"; +} + +if ($args eq "") { + die "must include a directory name\n$message"; +} else { $dir=$args}; + +$bufmult = $buffer * $bufmult; + +if ($arg{'f'} && $arg{'d'}) { + die "cannot use -d and -f at the same time\n$message"; +} + +if ( $arg{'f'} ) { + $touch_cmd = "touch $dir/lastbackup.dvback;"; + $touch_cmd = $hostcommand . $touch_cmd if $arg{'h'}; +} + +if ( $arg{'d'} ) { + $checkcmd = "ls $dir/lastbackup.dvback"; + $checkcmd = $hostcommand . $checkcmd if $arg{'h'}; + $msg = `$checkcmd`; + die "cannot find $dir/lastbackup.dvback\n" if $msg eq ""; + $findarg = "-newer $dir/lastbackup.dvback;"; +} + +if ($arg{'t'}) { + $cpioarg="-o -H tar"; +} else { + $cpioarg="-o -H crc"; +} + +if ( $arg{'v'} ) { + $cpioarg .= " -v"; +} + +$command = "$touch_cmd $hostcommand find $dir $findarg $pipeitto cpio $cpioarg $ziprun $rsbeprun | dvbackup -n $setpicture_option -p 125 | ( (head -c $bufmult > $tmploc) ; ( (sleep 2; dvcont record)& cat $tmploc ); tee ) | dvconnect -v -s -k 32 -b $buffer --syt-offset=$sto ; dvcont stop; rm -r $tmploc"; +print "$command\n\n"; +exec ( $command) ; diff -ruN dvbackup-0.0.4/scripts/dvrestore dvbackup/scripts/dvrestore --- dvbackup-0.0.4/scripts/dvrestore 1970-01-01 03:00:00 +0300 +++ dvbackup/scripts/dvrestore 2002-09-29 12:59:09 +0400 @@ -0,0 +1,77 @@ +#!/usr/bin/perl + +$message = " +Usage dvrestore [OPTIONS] [RESTORE_DIRECTORY] + + -h host rsh to host and restore there + -v verbose + -z filter through gunzip + -r (default on) run through rsbep FEC (error correction) + -R turn off rsbep FEC (error correction) + RESTORE_DIRECTORY directory on local or if -h remote machine + where restore will begin (no absolute restores) +"; + +if ($args =~ /--help/ ) { + print $message; +exit; +} + +use Getopt::Std; +getopts('h:vztrR', \%arg); + +print `/sbin/modprobe ohci1394; /sbin/modprobe raw1394; /sbin/modprobe video1394`; +$args = join " " , @ARGV; + +$cpioarg = " -idm --no-absolute-filenames"; + +#dvcont play; dvconnect | dvbackup -d | gunzip -c | cpio -v -idm --no-absolute-filenames; dvcont stop + + + +$args =~ s/-+\w*//g; + +if ( $arg{'h'} ) { + $host = $arg{'h'}; + $hostcommand = "rsh $host "; +} + + +if ( $arg{'v'} ) { + $cpioarg .= " -v"; +} + +if ( $arg{'z'} ) { + $ziprun = " | gunzip -c "; +} + +unless ( $arg{'R'} ) { + $which=`/usr/bin/which rsbep`; + unless ($which) { + die "rsbep not found (download available at http://www.s.netic.de/gfiala/dvbackup.html)"; + } + $rsbeprun = " | rsbep -d"; +} else { + die "can't use -r and -R $message" if $arg{'r'}; +} + + +#print "'$args'\n"; +$args =~ s/^\s+//; +$args =~ s/\s+$//; +if ($args =~ /\s/) { die "too many arguments: which one is the directory? +($args)\n$message" } + +if ($args ne "") { + if ($hostcommand) { + $dir= "cd $args " . '";" '; + } else { + $dir= "cd $args ; "; + } +}; + + +$command = 'dvcont play; dvconnect | dvbackup -d ' . $ziprun . $rsbeprun . ' | (' . $hostcommand . $dir . 'cpio' . $cpioarg . ') ; dvcont stop'; + +print "doing '$command'\n\n"; +exec ( $command) ; diff -ruN dvbackup-0.0.4/scripts/dvverify dvbackup/scripts/dvverify --- dvbackup-0.0.4/scripts/dvverify 1970-01-01 03:00:00 +0300 +++ dvbackup/scripts/dvverify 2002-09-29 12:59:09 +0400 @@ -0,0 +1,53 @@ +#!/usr/bin/perl +$args = join " " , @ARGV; + +$message = " +Do a crc check of tape cpio content (requires tape made with -H crc ) + +Usage dvverify [OPTIONS] [RESTORE_DIRECTORY] + + -v verbose + -z filter through gunzip + -r (default on) run through \"rsbep -d\" FEC (error correction) + -R turn off rsbep FEC (error correction) +"; +if ($args =~ /--help/ ) { + print $message; + exit; +} + + +use Getopt::Std; +getopts('vzrR', \%arg); + + +print `/sbin/modprobe ohci1394; /sbin/modprobe raw1394; /sbin/modprobe video1394`; + +$cpioarg = " -i --only-verify-crc"; + + +#print $args; + +if ( $arg{'v'} ) { + $cpioarg .= " -v"; +} + +if ( $arg{'z'} ) { + $ziprun = " | gunzip -c "; +} + +unless ( $arg{'R'} ) { + $which=`/usr/bin/which rsbep`; + unless ($which) { + die "rsbep not found (download available at http://www.s.netic.de/gfiala/dvbackup.html)"; + } + $rsbeprun = " | rsbep -d -v"; +} else { + die "Can't usr -r and -R $message" if $arg{'r'}; +} + + +$command = 'dvcont play; dvconnect | dvbackup -d ' . $rsbeprun . $ziprun . ' | ' . 'cpio' . $cpioarg . ' ; dvcont stop'; + +print "doing '$command'\n\n"; +exec ( $command) ; diff -ruN dvbackup-0.0.4/ChangeLog dvbackup/ChangeLog --- dvbackup-0.0.4/ChangeLog 2002-03-24 22:32:02 +0300 +++ dvbackup/ChangeLog 2003-04-08 01:15:50 +0400 @@ -15,4 +15,7 @@ * Added underrun-picture support * Added setscheduler support (thanks to Swen Thümmler) * Added ppm-reader bugfixes (thanks to Georgi Georgiev) - \ ÷ ËÏÎÃÅ ÆÁÊÌÁ ÎÅÔ ÎÏ×ÏÊ ÓÔÒÏËÉ +Version 0.0.5 + * Fixed time-stamping and VAUX header fields + * Added backup-scripts (thanks to Aaron) + * Added AVC Control by dvconnect (thanks to CARON Dominique) diff -ruN dvbackup-0.0.4/dvbackup.c dvbackup/dvbackup.c --- dvbackup-0.0.4/dvbackup.c 2002-03-24 22:25:31 +0300 +++ dvbackup/dvbackup.c 2003-08-16 12:51:50 +0400 @@ -391,10 +391,10 @@ { target[0] = 0x61; - target[1] = 0x33; /* scrambling off, compression 1, + target[1] = 0x3f; /* scrambling off, compression no info, input-source no-info, copy-control off */ target[2] = 0xc8; /* 4x3 fullscreen, record: original */ - target[3] = 0xfd; /* not record start, bcsys type 1, not still-picture + target[3] = 0xfc; /* not record start, bcsys type 0, not still-picture field-time-offset > 0, interlaced yes, same-frame no, both-fields-used yes */ @@ -406,7 +406,9 @@ target[0] = 0x62; target[1] = 0xff; write_bcd(target + 2, now->tm_mday); - write_bcd(target + 3, now->tm_mon); + write_bcd(target + 3, now->tm_mon + 1); + target[3] &= 0x1f; + target[3] |= now->tm_wday << 5; write_bcd(target + 4, now->tm_year % 100); } void write_timecode_63(unsigned char* target, struct tm * now) @@ -414,8 +416,11 @@ target[0] = 0x63; target[1] = 0xff; write_bcd(target + 2, now->tm_sec); + target[2] |= 0x80; write_bcd(target + 3, now->tm_min); + target[3] |= 0x80; write_bcd(target + 4, now->tm_hour); + target[4] |= 0xc0; } void write_subcode_blocks(unsigned char* target, int ds, int frame, @@ -1184,11 +1189,12 @@ #define OPT_PICTURE 5 #define OPT_VERBOSE 6 #define OPT_PREFIX 7 -#define OPT_TEST 8 -#define OPT_RECOVER 9 -#define OPT_ENABLE_AUDIO 10 -#define OPT_AUTOHELP 11 -#define NUM_OPTS 12 +#define OPT_POSTFIX 8 +#define OPT_TEST 9 +#define OPT_RECOVER 10 +#define OPT_ENABLE_AUDIO 11 +#define OPT_AUTOHELP 12 +#define NUM_OPTS 13 int main(int argc, char *argv[]) { @@ -1199,6 +1205,7 @@ int verify = 0; int verbose = 0; int prefix = 0; + int postfix = 0; int testmode = -1; int recover = 0; int enable_audio = 0; @@ -1275,6 +1282,15 @@ descrip: "prefix data with 'count' empty frames" }; /* picture */ + option_table[OPT_POSTFIX] = (struct poptOption) { + longName: "postfix", + shortName: 'o', + argInfo: POPT_ARG_INT, + arg: &postfix, + argDescrip: "count", + descrip: "postfix data with 'count' empty frames" + }; /* picture */ + option_table[OPT_TEST] = (struct poptOption) { longName: "test", argInfo: POPT_ARG_INT, @@ -1291,15 +1307,6 @@ }; /* recover */ - option_table[OPT_PREFIX] = (struct poptOption) { - longName: "prefix", - shortName: 'p', - argInfo: POPT_ARG_INT, - arg: &prefix, - argDescrip: "count", - descrip: "prefix data with 'count' empty frames" - }; /* picture */ - option_table[OPT_ENABLE_AUDIO] = (struct poptOption) { longName: "enable-audio", arg: &enable_audio, @@ -1373,7 +1380,7 @@ rval = verify_data(databuffer,verbose); if (rval >= 0 || recover) { write_extracted_data( - databuffer, recover); + databuffer,(rval < 0)); } if (rval == 1) { eof = 1; @@ -1459,6 +1466,15 @@ current_address += chunk_size - header_size; } } + for (i = 0; i < postfix; i++) { + build_header(databuffer, 0, 0, + header_size, 0, backup_title); + add_info_blocks(isPAL, framebuffer, &now, + enable_audio); + insert_data(databuffer, isPAL, framebuffer); + fwrite(framebuffer, 1, + isPAL ? 144000 : 120000, stdout); + } } return 0;