| m2vmp2cut-0.63-dev/ANNOUNCE | | m2vmp2cut-0.65-dev/ANNOUNCE |
| 1 | Last committed: $Id: ANNOUNCE 2059 2008-05-09 20:24:28Z too $ | 1 | Last committed: $Id: ANNOUNCE 2101 2008-05-26 19:57:03Z too $ |
| 2 | | 2 | |
| 3 | ANNOUNCE for m2vmp2cut 0.63 (Epic Fail): | 3 | ANNOUNCE for m2vmp2cut 0.65 (Faux pas): |
| 4 | | 4 | |
| 5 | This is development release of m2vmp2cut -- frame accurate (currently PAL) | 5 | This is development release of m2vmp2cut -- frame accurate (currently PAL) |
| 6 | mpeg2 video (m2v file) with accompanied mp2 audio (mp2 file) cutter. | 6 | mpeg2 video (m2v file) with accompanied mp2 audio (mp2 file) cutter. |
| 13 | | 13 | |
| 14 | This software is available currently at http://www.iki.fi/too/sw/m2vmp2cut/ | 14 | This software is available currently at http://www.iki.fi/too/sw/m2vmp2cut/ |
| 15 | and is licensed under GNU Public License (GPL). | 15 | and is licensed under GNU Public License (GPL). |
| | 16 | |
| | 17 | Changes since 0.63 (r2069, Epic Fail): |
| | 18 | Target size estimation |
| | 19 | Keyboard control adjustments in gui |
| | 20 | Bug fixes |
| 16 | | 21 | |
| 17 | Changes since 0.62 (r1256, Gender-neutral pronouns): | 22 | Changes since 0.62 (r1256, Gender-neutral pronouns): |
| 18 | Added graphical gui client for cutpoint selection. | 23 | Added graphical gui client for cutpoint selection. |
| m2vmp2cut-0.63-dev/Makefile | | m2vmp2cut-0.65-dev/Makefile |
| 3 | | 3 | |
| 4 | .PHONY: ALWAYS | 4 | .PHONY: ALWAYS |
| 5 | | 5 | |
| 6 | install release chkprefix: VER=`sed -n '1s/ .*//p' VERSION` | 6 | install release chkprefix: VER=`sed -n '1s/ .*/-dev/p' VERSION` |
| 7 | snapshot: VER=r`svnversion . | tr : +`-`sed -n '1s/ .*//p' VERSION` | 7 | snapshot: VER=`sed -n '1s/ .*//p' VERSION`+r`svnversion . | tr : =` |
| 8 | | 8 | |
| 9 | all: ALWAYS | 9 | all: ALWAYS |
| 10 | cd src && make all | 10 | cd src && make all |
| 57 | chkrelease: SvnVersion_unmodified HISTORY | 57 | chkrelease: SvnVersion_unmodified HISTORY |
| 58 | rm -f SvnVersion | 58 | rm -f SvnVersion |
| 59 | @case $(VER) in \ | 59 | @case $(VER) in \ |
| 60 | *[1357]) ;; \ | 60 | *-dev) ;; [2468]) ;; \ |
| 61 | *) echo Version $(VER) not suitable for release.; exit 1 ;; \ | 61 | *) echo Version $(VER) not suitable for release.; exit 1 ;; \ |
| 62 | esac | 62 | esac |
| | 63 | |
| | 64 | # XXX _dist depends on chkrelease. Parallel build would fail... |
| | 65 | .NOTPARALLEL: |
| 63 | | 66 | |
| 64 | release: chkrelease _dist | 67 | release: chkrelease _dist |
| 65 | | 68 | |
| 69 | cd tools && sh tarlisted.c | 72 | cd tools && sh tarlisted.c |
| 70 | | 73 | |
| 71 | _dist: tools/tarlisted | 74 | _dist: tools/tarlisted |
| 72 | version=m2vmp2cut-$(VER)-dev; { echo 755 root root . $$version /; \ | 75 | version=m2vmp2cut-$(VER); { echo 755 root root . $$version /; \ |
| 73 | grep '^#,#' Makefile | while read _ f x; do p=755; d=$$f; \ | 76 | grep '^#,#' Makefile | while read _ f x; do p=755; d=$$f; \ |
| 74 | test -d $$f && d=/ || case $$x in '') p=644;; esac; \ | 77 | test -d $$f && d=/ || case $$x in '') p=644;; esac; \ |
| 75 | echo $$p root root . $$version/$$f $$d; done; } \ | 78 | echo $$p root root . $$version/$$f $$d; done; } \ |
| 97 | | 100 | |
| 98 | #,# ANNOUNCE | 101 | #,# ANNOUNCE |
| 99 | #,# COPYING | 102 | #,# COPYING |
| | 103 | #,# HISTORY |
| 100 | #,# INSTALL | 104 | #,# INSTALL |
| 101 | #,# m2vmp2cut x | 105 | #,# m2vmp2cut x |
| 102 | #,# Makefile | 106 | #,# Makefile |
| m2vmp2cut-0.63-dev/README | | m2vmp2cut-0.65-dev/README |
| 1 | Last committed: $Id: README 2068 2008-05-11 17:04:13Z too $ | 1 | Last committed: $Id: README 2101 2008-05-26 19:57:03Z too $ |
| 2 | | 2 | |
| 3 | README for m2vmp2cut 0.63: | 3 | README for m2vmp2cut 0.65: |
| 4 | | 4 | |
| 5 | m2vmp2cut is frame accurate (currently PAL) mpeg2 video (m2v file) | 5 | m2vmp2cut is frame accurate (currently PAL) mpeg2 video (m2v file) |
| 6 | with accompanied mp2 audio (mp2 file) cutter. | 6 | with accompanied mp2 audio (mp2 file) cutter. |
| 18 | | 18 | |
| 19 | REQUIREMENTS: | 19 | REQUIREMENTS: |
| 20 | | 20 | |
| 21 | mjpegtools -- for mpeg2enc and mplex tools | 21 | Mjpegtools -- for mpeg2enc and mplex tools |
| 22 | ProjecX (project-x.sourceforge.net) -- to demux source mpeg files | 22 | ProjecX (project-x.sourceforge.net) -- to demux source mpeg files |
| 23 | Java runtime -- to run ProjectX | 23 | Java runtime -- to run ProjectX (some non-sun vm:s work also) |
| 24 | | 24 | |
| | 25 | Uxterm -- for help and info windows... |
| 25 | perl -- m2vmp2cut.pl (run frontend) is written in perl | 26 | Perl -- m2vmp2cut.pl (run frontend) is written in perl |
| 26 | python -- some m2vmp2cut utilities are written in python | 27 | Bython -- some m2vmp2cut utilities are written in python |
| 27 | bash/ksh -- /bin/sh may not be good enough for some shell script | 28 | Bash/ksh -- /bin/sh may not be good enough for some shell script |
| 28 | constructs used. | 29 | constructs used. |
| 29 | | 30 | |
| 30 | C compiler -- there are some C utilities that needs to be compiled. | 31 | C compiler -- there are some C utilities that needs to be compiled |
| 31 | Java Compiler -- if you need to compile ProjectX | 32 | Java compiler -- if you need to compile ProjectX |
| 32 | | 33 | |
| 33 | STRONGLY RECOMMENDED: | 34 | STRONGLY RECOMMENDED: |
| 34 | | 35 | |
| 35 | transcode -- for requantize option | 36 | Transcode -- for requantize option |
| 36 | | 37 | |
| 37 | | 38 | |
| 38 | | 39 | |
| m2vmp2cut-0.63-dev/bin/m2vmp2cut.pl | | m2vmp2cut-0.65-dev/bin/m2vmp2cut.pl |
| 6 | # All rights reserved | 6 | # All rights reserved |
| 7 | # | 7 | # |
| 8 | # Created: Sun Sep 05 11:12:24 EEST 2004 too | 8 | # Created: Sun Sep 05 11:12:24 EEST 2004 too |
| 9 | # Last modified: Fri May 09 20:17:59 EEST 2008 too | 9 | # Last modified: Mon May 26 19:57:49 EEST 2008 too |
| 10 | # | 10 | # |
| 11 | # This program is licensed under the GPL v2. See file COPYING for details. | 11 | # This program is licensed under the GPL v2. See file COPYING for details. |
| 12 | | 12 | |
| 215 | # find last line from scan output file -- it contains average bit rate. | 215 | # find last line from scan output file -- it contains average bit rate. |
| 216 | | 216 | |
| 217 | seek(I, -200, 2) || die "Seek failed: $!.\n"; | 217 | seek(I, -200, 2) || die "Seek failed: $!.\n"; |
| 218 | my $avbr; | 218 | my ($allframes, $avbr); |
| 219 | { | 219 | { |
| 220 | my $l; | 220 | my $l; |
| 221 | $l = $_ while (<I>); | 221 | $l = $_ while (<I>); |
| | 222 | ($l =~ /frames\s+(\d+)\s.*abr\s+(\d+)/) |
| 222 | ($l =~ /abr\s+(\d+)/) || die "Incorrect index file format.\n"; | 223 | || die "Incorrect index file format.\n"; |
| | 224 | $allframes = $1; |
| 223 | $avbr = int($1 / 1000); | 225 | $avbr = int($2 / 1000); |
| 224 | } | 226 | } |
| | 227 | |
| 225 | seek(I, 0, 0) || die "Seek failed: $!.\n"; | 228 | seek(I, 0, 0) || die "Seek failed: $!.\n"; |
| | 229 | |
| | 230 | my ($vsize, $asize) = ((stat $vfile)[7], (stat $afile)[7]); |
| | 231 | my $estimate = int(($vsize + $asize) * $frames / $allframes * 1.033); |
| | 232 | undef $vsize; undef $asize; |
| 226 | | 233 | |
| 227 | open SH, '>', "$wd/do.sh" || die "Can not create job script: $!\n"; | 234 | open SH, '>', "$wd/do.sh" || die "Can not create job script: $!\n"; |
| 228 | chmod 0755, "$wd/do.sh"; | 235 | chmod 0755, "$wd/do.sh"; |
| 239 | print SH << "EOF"; | 246 | print SH << "EOF"; |
| 240 | | 247 | |
| 241 | # This program is licensed under the GPL v2. See file COPYING for details. | 248 | # This program is licensed under the GPL v2. See file COPYING for details. |
| | 249 | |
| | 250 | LANG=C LC_ALL=C; export LANG LC_ALL |
| 242 | | 251 | |
| 243 | die () { echo "\$@" >&2; exit 1; } | 252 | die () { echo "\$@" >&2; exit 1; } |
| 244 | | 253 | |
| 253 | */*) : ;; *) die mplex does not exist. please install mjpegtools ;; | 262 | */*) : ;; *) die mplex does not exist. please install mjpegtools ;; |
| 254 | esac | 263 | esac |
| 255 | | 264 | |
| 256 | test -d "$wd" || die Directory \\'$wd\\' does not exist. | 265 | test -d "$wd" || die Directory \\'$wd\\' does not exist '(changed working direct |
| | | ory?)'. |
| 257 | vfile="$vfile" | 266 | vfile="$vfile" |
| 258 | afile="$afile" | 267 | afile="$afile" |
| 259 | for f in "\$vfile" "\$afile" | 268 | for f in "\$vfile" "\$afile" |
| 446 | undef $s; undef $e; | 455 | undef $s; undef $e; |
| 447 | $" = ','; | 456 | $" = ','; |
| 448 | | 457 | |
| | 458 | close I; |
| | 459 | |
| 449 | print STDERR "Related timecodes: @timecodes\n"; | 460 | print STDERR "Related timecodes: @timecodes\n"; |
| 450 | | 461 | |
| 451 | unless ($aonly) | 462 | unless ($aonly) |
| 510 | "mv -f \"$wd/incomplete.mp2\" \"$wd/out.mp2\"\n"; } | 521 | "mv -f \"$wd/incomplete.mp2\" \"$wd/out.mp2\"\n"; } |
| 511 | else { print SH "mv -f \"$wd/incomplete.mpg\" \"$wd/out.mpg\"\n"; } | 522 | else { print SH "mv -f \"$wd/incomplete.mpg\" \"$wd/out.mpg\"\n"; } |
| 512 | | 523 | |
| 513 | print SH "set +x\n", "ls -lrtac \"$wd\"\n; date; ls -l \"$wd/out.mpg\"\n\n"; | 524 | print SH <<"EOF"; |
| | 525 | set +x |
| | 526 | ls -lrtac "$wd" |
| | 527 | date |
| | 528 | EOF |
| | 529 | if (! $nomux) { |
| | 530 | print SH "\n", 'numtune () { ', "\n"; |
| | 531 | print SH q( echo $1 | sed 's/\\(...\\)$/ \\1/; s/\\(...\\) / \\1 /; s/\\( |
| | | ...\\) / \\1 /'; }), "\n\n"; |
| | 532 | print SH "echo; echo estimated size: `numtune $estimate` bytes\n"; |
| | 533 | print SH "size=`ls -l \"$wd\"/out.mpg | awk '{ print \$5 }'`\n"; |
| | 534 | print SH "echo target \"'$wd/out.mpg'\" size: `numtune \$size` bytes\n"; |
| | 535 | print SH "difference=`expr $estimate - \$size | tr -d -`\n"; |
| | 536 | print SH "echo difference: `numtune \$difference` bytes\n"; |
| | 537 | } else { |
| | 538 | print SH "ls -l \"$wd\"/out.*\n"; |
| | 539 | } |
| | 540 | |
| | 541 | print SH "echo pictures: ", $frames, ", time: ", palframe2timecode($frames, 0), |
| | 542 | "\n\n"; |
| 514 | | 543 | |
| 515 | close SH; | 544 | close SH; |
| 516 | | 545 | |
| m2vmp2cut-0.63-dev/bin/wrapper.sh | | m2vmp2cut-0.65-dev/bin/wrapper.sh |
| 7 | # All rights reserved | 7 | # All rights reserved |
| 8 | # | 8 | # |
| 9 | # Created: Tue Apr 22 19:10:35 EEST 2008 too | 9 | # Created: Tue Apr 22 19:10:35 EEST 2008 too |
| 10 | # Last modified: Fri May 09 20:21:52 EEST 2008 too | 10 | # Last modified: Wed May 14 17:35:56 EEST 2008 too |
| 11 | | 11 | |
| 12 | die () { echo "$@" >&2; exit 1; } | 12 | eae () { echo; echo Press ENTER to close this window '' | tr -d \\012; read _; e |
| | | xit $1; } |
| | 13 | |
| | 14 | die () { exec 1>&2; echo; echo "$@"; eae 1; } |
| | 15 | |
| | 16 | #numtune () { echo $1 | sed 's/\(...\)\(...\)\(...\)$/ \1 \2 \3/; |
| | 17 | # s/\(...\)\(...\)$/ \1 \2/; s/\(...\)$/ \1/'; } |
| | 18 | |
| | 19 | numtune () { |
| | 20 | echo $1 | sed 's/\(...\)$/ \1/; s/\(...\) / \1 /; s/\(...\) / \1 /' |
| | 21 | } |
| | 22 | |
| | 23 | exec_xterm () { |
| | 24 | geometry=$1 |
| | 25 | title=$2 |
| | 26 | font=-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1 |
| | 27 | shift 2 |
| | 28 | exec uxterm -fg black -bg gray70 -g $geometry -T "$title" \ |
| | 29 | +sb -fn $font -u8 -e "$0" "$@" |
| | 30 | } |
| 13 | | 31 | |
| 14 | case $1 in | 32 | case $1 in |
| 15 | m2vcut_help) | 33 | m2vcut_help) |
| 16 | # XXX common for utf-8 support is currently a problem. help! :) | | |
| 17 | exec xterm -g 76x28-0+0 -fn 10x20 -T 'M2vCut Help' +u8 -e "$0" m2vcut_ou | 34 | exec_xterm 76x28-0+0 'M2vCut Help' m2vcut_outputhelp |
| tputhelp | | |
| 18 | ;; | 35 | ;; |
| 19 | m2vcut_outputhelp) | 36 | m2vcut_outputhelp) |
| 20 | f=`echo $LANG |sed 's/[^A-Za-z_].*//'` | 37 | f=`echo $LANG |sed 's/[^A-Za-z_].*//'` |
| 23 | test -f "$helpprefix-$f" && cat "$helpprefix-$f" || cat "$helpprefix-def | 40 | test -f "$helpprefix-$f" && cat "$helpprefix-$f" || cat "$helpprefix-def |
| ault" | | ault" |
| 24 | read line | 41 | read line |
| 25 | ;; | 42 | ;; |
| | 43 | m2vcut_info) |
| | 44 | shift |
| | 45 | exec_xterm 76x20-0+0 'M2vCut Info' m2vcut_runinfo "$@" |
| | 46 | ;; |
| | 47 | m2vcut_runinfo) |
| | 48 | #echo "$@" - $5 |
| | 49 | case $5 in [0-9]*) ;; |
| | 50 | *) die usage: $1 videofile allframes cutframes alltime cuttime |
| | 51 | ;; esac |
| | 52 | shift; #set -x |
| | 53 | test -f "$1" || die "'$1'": not a file. |
| | 54 | fdn=`dirname "$1"` vbn=`basename "$1"` |
| | 55 | case $vbn in |
| | 56 | video.m2v) abn=audio.mp2 ;; |
| | 57 | *.m2v) abn=`basename "$vbn" .m2v`.mp2 ;; |
| | 58 | *) die File "'$vbn'" has unknown suffix. ;; |
| | 59 | esac |
| | 60 | test -f "$fdn/$abn" || die "'$fdn/$abn'": no such file. |
| | 61 | vsize=`stat -L -c %s "$1"` |
| | 62 | case $vsize in '') die File "'$1'" could not be read ;; esac |
| | 63 | asize=`stat -L -c %s "$fdn/$abn"` |
| | 64 | case $asize in '') die File "'$1'" could not be read ;; esac |
| | 65 | echo |
| | 66 | echo Input length: '' `echo $4 | sed 's/\..*//'` "($2 frames)" |
| | 67 | echo Output length: `echo $5 | sed 's/\..*//'` "($3 frames)" |
| | 68 | echo |
| | 69 | echo Input video: $vbn '' `numtune $vsize` bytes |
| | 70 | echo Input audio: $abn '' `numtune $asize` bytes |
| | 71 | echo |
| | 72 | tss=`expr $vsize + $asize` |
| | 73 | echo Total source size: `numtune $tss` bytes |
| | 74 | eds=`expr $tss \* $3 / $2` |
| | 75 | echo Estimated target size: `numtune $eds` bytes |
| | 76 | wmo=`expr $eds \* 1033 / 1000` |
| | 77 | echo With estimated muxing '"overhead" (3.3%)': `numtune $wmo` bytes |
| | 78 | #echo $fdn $vbn $abn $vsize $asize |
| | 79 | eae 0 |
| | 80 | ;; |
| 26 | m2vcut_test) | 81 | m2vcut_test) |
| 27 | shift | 82 | shift |
| 28 | exec xterm -g 76x28-0+0 -fn 10x20 -T 'M2vCut Test' +u8 -e "$0" m2vcut_ru | 83 | exec_xterm 76x28-0+0 'M2vCut Test' m2vcut_runtest "$@" |
| ntest "$@" | | |
| 29 | ;; | 84 | ;; |
| 30 | m2vcut_runtest) | 85 | m2vcut_runtest) |
| 31 | range= | 86 | range= |
| 39 | mplayer "$vd"/m2vcut-test/out.mpg | 94 | mplayer "$vd"/m2vcut-test/out.mpg |
| 40 | echo try again ? | 95 | echo try again ? |
| 41 | read line | 96 | read line |
| 42 | exit 0 | 97 | case $line in *yes*) ;; *) exit 0 ;; esac |
| 43 | done | 98 | done |
| 44 | ;; | 99 | ;; |
| 45 | die) | 100 | die) |
| m2vmp2cut-0.63-dev/doc/m2vcut_help-default | | m2vmp2cut-0.65-dev/doc/m2vcut_help-default |
| 8 | Up Arrow: 1 gop (usually 1/2 sec) forward. | 8 | Up Arrow: 1 gop (usually 1/2 sec) forward. |
| 9 | Down Arrow: 1 gop (usually 1/2 sec) backward. | 9 | Down Arrow: 1 gop (usually 1/2 sec) backward. |
| 10 | | 10 | |
| 11 | Page Up: 5 gops forward, after 7 jumps, 25 gops forward (*) | 11 | Page Up: 5 gops forward, after 20 jumps, 25 gops forward (*) |
| 12 | Page Down: 5 gops backward, after 7 jumps, 25 gops forward (*) | 12 | Page Down: 5 gops backward, after 20 jumps, 25 gops forward (*) |
| 13 | | 13 | |
| 14 | (*) Changing Page Up/Down "direction", first time continue 25 gop. | 14 | (*) Changing Page Up/Down "direction", first time continue 25 gop. |
| 15 | jumps; after second change, go back to 5 gop jumps. | 15 | jumps; after second change, go back to 5 gop jumps. |
| 24 | | 24 | |
| 25 | q: Quit, Saving cutpoints to file. | 25 | q: Quit, Saving cutpoints to file. |
| 26 | | 26 | |
| | 27 | t: Test output around current/closest cutpoint. |
| | 28 | |
| | 29 | i: information (about estimated final file size). |
| 27 | | 30 | |
| 28 | Press ENTER to close this window | 31 | Press ENTER to close this window |
| m2vmp2cut-0.63-dev/doc/m2vcut_help-fi_FI | | m2vmp2cut-0.65-dev/doc/m2vcut_help-fi_FI |
| 1 | | 1 | |
| 2 | Näppäimet: | 2 | Näppäimet: |
| 3 | | 3 | |
| 4 | Vasen nuoli: 1 kuva taaksepäin | 4 | Vasen nuoli: 1 kuva taaksepäin |
| 5 | Oikea nuoli: 1 kuva eteenpäin | 5 | Oikea nuoli: 1 kuva eteenpäin |
| 6 | | 6 | |
| 7 | Ylänuoli: 1 gop (yleensä puoli sekuntia) eteenpäin | 7 | Ylänuoli: 1 gop (yleensä puoli sekuntia) eteenpäin |
| 8 | Alanuoli: 1 gop (yleensä puoli sekuntia) taaksepäin | 8 | Alanuoli: 1 gop (yleensä puoli sekuntia) taaksepäin |
| 9 | | 9 | |
| 10 | Page Up: 5 goppia eteenpäin, 7 hypyn jälkeen 25 goppia eteenpäin (*) | 10 | Page Up: 5 goppia eteenpäin, 20 hypyn jälkeen 25 goppia eteenpäin (*) |
| 11 | Page Down: 5 goppia taaksepäin, 7 hypyn jälkeen 25 goppia taaksepäin (*) | 11 | Page Down: 5 goppia taaksepäin, 20 hypyn jälkeen 25 goppia taaksepäin (*) |
| 12 | | 12 | |
| 13 | (*) Vaihtaessa Page Up/Down -suuntaa, ensimmäisellä kerralla jatka 25 | 13 | (*) Vaihtaessa Page Up/Down -suuntaa, ensimmäisellä kerralla jatka 25 |
| 14 | gopin hyppyjä; toisen suunnan vaihdon jälkeen palaa 5 gopin hyppyihin. | 14 | gopin hyppyjä; toisen suunnan vaihdon jälkeen palaa 5 gopin hyppyihin. |
| 15 | | 15 | |
| 16 | TAB: Merkitse leikkauspiste tämänhetkiseen kohtaan. | 16 | TAB: Merkitse leikkauspiste tämänhetkiseen kohtaan. |
| 17 | BackSpace: Poista leikkauspiste mikäli ollaan leikkauspisteen "päällä". | 17 | BackSpace: Poista leikkauspiste mikäli ollaan leikkauspisteen "päällä". |
| 18 | | 18 | |
| 19 | , (pilkku): Siirry edelliseen leikkauspisteeseen nykypaikasta. | 19 | , (pilkku): Siirry edelliseen leikkauspisteeseen nykypaikasta. |
| 20 | . (piste): Siirry seuraavaan leikkauspisteeseen nykypaikasta. | 20 | . (piste): Siirry seuraavaan leikkauspisteeseen nykypaikasta. |
| 21 | | 21 | |
| 22 | q: Lopeta, tallentaen leikkauspisteet tiedostoon. | 22 | q: Lopeta, tallentaen leikkauspisteet tiedostoon. |
| 23 | | 23 | |
| | 24 | t: Testaa tulos lähimmän leikkauspisteen kohdalta. |
| | 25 | |
| | 26 | i: tietoa (lopullisesta tiedostokoosta). |
| | 27 | |
| 24 | Paina ENTERiä sulkeaksesi tämän ikkunan | 28 | Paina ENTERiä sulkeaksesi tämän ikkunan |
| m2vmp2cut-0.63-dev/src/m2vcut-gui.c | | m2vmp2cut-0.65-dev/src/m2vcut-gui.c |
| 21 | * All rights reserved | 21 | * All rights reserved |
| 22 | * | 22 | * |
| 23 | * Created: Sun Dec 30 14:17:12 EET 2007 too | 23 | * Created: Sun Dec 30 14:17:12 EET 2007 too |
| 24 | * Last modified: Sun May 11 18:40:11 EEST 2008 too | 24 | * Last modified: Mon May 26 20:54:27 EEST 2008 too |
| 25 | */ | 25 | */ |
| 26 | | 26 | |
| 27 | // later (maybe?) test, undo, append-cut/merge to file (w/htonl())) | 27 | // later (maybe?) test, undo, append-cut/merge to file (w/htonl())) |
| 62 | | 62 | |
| 63 | typedef unsigned int u_int; // c99 blocks this definition in <sys/types.h> | 63 | typedef unsigned int u_int; // c99 blocks this definition in <sys/types.h> |
| 64 | | 64 | |
| 65 | #if 1 | 65 | #if 0 |
| 66 | #define DEBUG 1 | 66 | #define DEBUG 1 |
| 67 | #define d2(x) do { printf("%d ", __LINE__); printf x; printf("\n"); } while (0) | 67 | #define d2(x) do { printf("%d ", __LINE__); printf x; printf("\n"); } while (0) |
| 68 | #define d1(x) do { printf("%d ", __LINE__); printf x; printf("\n"); } while (0) | 68 | #define d1(x) do { printf("%d ", __LINE__); printf x; printf("\n"); } while (0) |
| 1236 | int h = frameno / (60 * 60 * 25); if (h >= 1000) h = 999; | 1236 | int h = frameno / (60 * 60 * 25); if (h >= 1000) h = 999; |
| 1237 | int m = (frameno / (60 * 25)) % 60; | 1237 | int m = (frameno / (60 * 25)) % 60; |
| 1238 | int s = (frameno / 25) % 60; | 1238 | int s = (frameno / 25) % 60; |
| 1239 | int f = frameno % 25; | 1239 | //int f = frameno % 25; |
| | 1240 | int ms = frameno % 25 * 4; |
| 1240 | | 1241 | |
| 1241 | // XXX add 3rd hour digit. | 1242 | // XXX add 3rd hour digit. |
| 1242 | #if 0 | 1243 | #if 0 |
| 1247 | utosl0(p + 0, h, 2); | 1248 | utosl0(p + 0, h, 2); |
| 1248 | utosl0(p + 3, m, 2); | 1249 | utosl0(p + 3, m, 2); |
| 1249 | utosl0(p + 6, s, 2); | 1250 | utosl0(p + 6, s, 2); |
| 1250 | utosl0(p + 9, f, 2); | 1251 | utosl0(p + 9, ms, 2); |
| 1251 | | 1252 | |
| 1252 | utosl(p + 12, frameno, 6); | 1253 | utosl(p + 12, frameno, 6); |
| 1253 | } | 1254 | } |
| 1320 | } | 1321 | } |
| 1321 | label_frametime(W.labeltext + 71, frameno2); | 1322 | label_frametime(W.labeltext + 71, frameno2); |
| 1322 | label_frametime(W.labeltext + 92, G.greenframes); | 1323 | label_frametime(W.labeltext + 92, G.greenframes); |
| | 1324 | |
| | 1325 | // FIXME: some info does not need to be updated always, like greenframes) |
| 1323 | | 1326 | |
| 1324 | int wxp = G.frame->pixwidth * G.frame->width; | 1327 | int wxp = G.frame->pixwidth * G.frame->width; |
| 1325 | int hxp = G.frame->pixheight * G.frame->height; | 1328 | int hxp = G.frame->pixheight * G.frame->height; |
| 1595 | void previous_gop(int n) | 1598 | void previous_gop(int n) |
| 1596 | { | 1599 | { |
| 1597 | if (G.currentindex == 0) return; | 1600 | if (G.currentindex == 0) return; |
| | 1601 | if (G.currentinner > 0) n--; |
| 1598 | n = G.currentindex - n; | 1602 | n = G.currentindex - n; |
| 1599 | if (n < 0) n = 0; | 1603 | if (n < 0) n = 0; |
| 1600 | show_iframe(n); | 1604 | show_iframe(n); |
| 1741 | run_command(m2vmp2cut_command("wrapper.sh"), "m2vcut_help", null); | 1745 | run_command(m2vmp2cut_command("wrapper.sh"), "m2vcut_help", null); |
| 1742 | } | 1746 | } |
| 1743 | | 1747 | |
| | 1748 | static void show_info(void) |
| | 1749 | { |
| | 1750 | char allframes[20], greenframes[20]; |
| | 1751 | |
| | 1752 | // XXX quick hack, tune label_frametime() interface |
| | 1753 | memcpy(allframes, "00:00:00.00\0 0\0\0", 20); |
| | 1754 | memcpy(greenframes, allframes, 20); |
| | 1755 | label_frametime(allframes, G.lastframe); |
| | 1756 | label_frametime(greenframes, G.greenframes); |
| | 1757 | |
| | 1758 | char * afp = allframes + 12; while (isspace(*afp)) afp++; |
| | 1759 | char * gfp = greenframes + 12; while (isspace(*gfp)) gfp++; |
| | 1760 | |
| | 1761 | run_command(m2vmp2cut_command("wrapper.sh"), "m2vcut_info", |
| | 1762 | M.mpeg2filename, afp, gfp, allframes, greenframes, null); |
| | 1763 | } |
| | 1764 | |
| 1744 | gboolean main_window_delete_event(void * w, void * e, void * d) | 1765 | gboolean main_window_delete_event(void * w, void * e, void * d) |
| 1745 | { | 1766 | { |
| 1746 | (void)w; (void)e; (void)d; | 1767 | (void)w; (void)e; (void)d; |
| 1790 | case GDK_Page_Up: | 1811 | case GDK_Page_Up: |
| 1791 | if (prevkey == GDK_Page_Up) { | 1812 | if (prevkey == GDK_Page_Up) { |
| 1792 | keycount++; | 1813 | keycount++; |
| 1793 | next_gop(keycount > 7? 25: 5); | 1814 | next_gop(keycount > 20? 25: 5); |
| 1794 | break; | 1815 | break; |
| 1795 | } | 1816 | } |
| 1796 | else if (prevkey == GDK_Page_Down && keycount > 7) { | 1817 | else if (prevkey == GDK_Page_Down && keycount > 20) { |
| 1797 | keycount += 10 * 1000 * 1000; | 1818 | keycount += 10 * 1000 * 1000; |
| 1798 | if (keycount < 20 * 1000 * 1000) { next_gop(25); break; } | 1819 | if (keycount < 20 * 1000 * 1000) { next_gop(25); break; } |
| 1799 | } | 1820 | } |
| 1801 | case GDK_Page_Down: | 1822 | case GDK_Page_Down: |
| 1802 | if (prevkey == GDK_Page_Down) { | 1823 | if (prevkey == GDK_Page_Down) { |
| 1803 | keycount++; | 1824 | keycount++; |
| 1804 | previous_gop(keycount > 7? 25: 5); | 1825 | previous_gop(keycount > 20? 25: 5); |
| 1805 | break; | 1826 | break; |
| 1806 | } | 1827 | } |
| 1807 | else if (prevkey == GDK_Page_Up && keycount > 7) { | 1828 | else if (prevkey == GDK_Page_Up && keycount > 20) { |
| 1808 | keycount += 10 * 1000 * 1000; | 1829 | keycount += 10 * 1000 * 1000; |
| 1809 | if (keycount < 20 * 1000 * 1000) { previous_gop(25); break; } | 1830 | if (keycount < 20 * 1000 * 1000) { previous_gop(25); break; } |
| 1810 | } | 1831 | } |
| 1817 | case GDK_BackSpace: merge_here(); break; | 1838 | case GDK_BackSpace: merge_here(); break; |
| 1818 | | 1839 | |
| 1819 | case GDK_h: show_help(); break; | 1840 | case GDK_h: show_help(); break; |
| 1820 | | 1841 | case GDK_i: show_info(); break; |
| 1821 | case GDK_t: test_cutpoint(); break; | 1842 | case GDK_t: test_cutpoint(); break; |
| 1822 | | 1843 | |
| 1823 | case GDK_q: main_window_delete_event(null,null,null); | 1844 | case GDK_q: main_window_delete_event(null,null,null); |