The attached patch adds a new zoom/clip preset, which does auto-clipping
but no zooming. It also sets the "additional options" for the transcode
command to the appropriate --export_par setting according to the probed
aspect ratio of the title.
Is the the right way to submit patches? Or would you prefer something
different?
- Marc
diff -r -u DVDRip/Audio.pm /usr/share/perl5/Video/DVDRip/Audio.pm
--- DVDRip/Audio.pm 2006-08-16 15:34:38.000000000 -0400
+++ /usr/share/perl5/Video/DVDRip/Audio.pm 2008-01-11 14:39:10.000000000
-0500
@@ -156,9 +156,10 @@
= @par{ 'tc_ac3_bitrate', 'tc_samplerate' };
$tc_target_track = -1 if not defined $tc_target_track;
+ $tc_ac3_passthrough = 1 if not defined $tc_ac3_passthrough;
$tc_audio_codec = "ac3" if $tc_ac3_passthrough;
$tc_audio_codec ||= "mp3";
- $tc_bitrate ||= 128;
+ $tc_bitrate ||= 192;
$tc_mp3_quality ||= 2;
$tc_audio_filter ||= 'rescale';
$tc_option_n ||= '';
diff -r -u DVDRip/Config.pm /usr/share/perl5/Video/DVDRip/Config.pm
--- DVDRip/Config.pm 2007-04-01 15:52:35.000000000 -0400
+++ /usr/share/perl5/Video/DVDRip/Config.pm 2008-01-11 13:06:30.000000000
-0500
@@ -384,6 +384,11 @@
tc_fast_bisection => 0,
),
Video::DVDRip::Preset->new(
+ name => "auto_clip",
+ title => __ "Autoadjust, Clipping only",
+ auto_clip => 1,
+ ),
+ Video::DVDRip::Preset->new(
name => "auto_big",
title => __ "Autoadjust, Big Frame Size, HQ Resize",
tc_fast_resize => 0,
diff -r -u DVDRip/Preset.pm /usr/share/perl5/Video/DVDRip/Preset.pm
--- DVDRip/Preset.pm 2006-08-16 15:34:38.000000000 -0400
+++ /usr/share/perl5/Video/DVDRip/Preset.pm 2008-01-11 13:03:40.000000000
-0500
@@ -19,6 +19,7 @@
sub name { shift->{name} }
sub title { shift->{title} }
sub auto { shift->{auto} }
+sub auto_clip { shift->{auto_clip} }
sub frame_size { shift->{frame_size} }
sub tc_clip1_top { shift->{tc_clip1_top} }
@@ -36,6 +37,7 @@
sub set_name { shift->{name} = $_[1] }
sub set_title { shift->{title} = $_[1] }
sub set_auto { shift->{auto} = $_[1] }
+sub set_auto_clip { shift->{auto_clip} = $_[1] }
sub set_frame_size { shift->{frame_size} = $_[1] }
sub set_tc_clip1_top { shift->{tc_clip1_top} = $_[1] }
sub set_tc_clip1_bottom { shift->{tc_clip1_bottom} = $_[1]
}
@@ -68,12 +70,13 @@
'tc_clip2_top', 'tc_clip2_bottom',
'tc_clip2_left', 'tc_clip2_right'
};
- my ( $auto, $frame_size ) = @par{ 'auto', 'frame_size' };
+ my ( $auto, $auto_clip, $frame_size ) = @par{ 'auto', 'auto_clip',
'frame_size' };
my $self = {
name => $name,
title => $title,
auto => $auto,
+ auto_clip => $auto_clip,
frame_size => $frame_size,
tc_clip1_top => $tc_clip1_top,
tc_clip1_bottom => $tc_clip1_bottom,
diff -r -u DVDRip/Probe.pm /usr/share/perl5/Video/DVDRip/Probe.pm
--- DVDRip/Probe.pm 2006-08-18 17:43:37.000000000 -0400
+++ /usr/share/perl5/Video/DVDRip/Probe.pm 2008-01-11 14:43:52.000000000
-0500
@@ -114,7 +114,7 @@
tc_nr => $i,
tc_target_track => ( $i == 0 ? 0 : -1 ),
tc_audio_codec => "mp3",
- tc_bitrate => 128,
+ tc_bitrate => 192,
tc_mp3_quality => 0,
tc_samplerate => $audio->{sample_rate},
);
@@ -253,7 +253,7 @@
tc_nr => $audio->{ix} - 1,
tc_target_track => ( $audio->{ix} == 1 ? 0 : -1 ),
tc_audio_codec => "mp3",
- tc_bitrate => 128,
+ tc_bitrate => 192,
tc_mp3_quality => 0,
tc_samplerate => $audio->{frequency},
);
diff -r -u DVDRip/Title.pm /usr/share/perl5/Video/DVDRip/Title.pm
--- DVDRip/Title.pm 2007-03-24 07:00:40.000000000 -0400
+++ /usr/share/perl5/Video/DVDRip/Title.pm 2008-01-11 14:24:39.000000000
-0500
@@ -1097,6 +1097,11 @@
$self->set_last_applied_preset( $preset->name );
+ if ( $preset->auto_clip ) {
+ $self->auto_adjust_clip_only();
+ return 1;
+ }
+
if ( $preset->auto ) {
$self->auto_adjust_clip_zoom(
frame_size => $preset->frame_size,
@@ -1226,6 +1231,35 @@
return ( $clip2_width, $clip2_height, $zoom_ratio );
}
+sub auto_adjust_clip_only {
+ my $self = shift;
+
+ $self->set_tc_fast_resize(1);
+
+ my $result = $self->get_zoom_parameters(
+ target_width => undef,
+ target_height => undef,
+ fast_resize_align => 16,
+ result_align => 16,
+ result_align_clip2 => 1,
+ auto_clip => 1,
+ use_clip1 => 0,
+ );
+
+ $self->set_tc_zoom_width( undef );
+ $self->set_tc_zoom_height( undef );
+ $self->set_tc_clip1_left( 0 );
+ $self->set_tc_clip1_right( 0 );
+ $self->set_tc_clip1_top( 0 );
+ $self->set_tc_clip1_bottom( 0 );
+ $self->set_tc_clip2_left( $result->{clip2_left} );
+ $self->set_tc_clip2_right( $result->{clip2_right} );
+ $self->set_tc_clip2_top( $result->{clip2_top} );
+ $self->set_tc_clip2_bottom( $result->{clip2_bottom} );
+
+ 1;
+}
+
sub auto_adjust_clip_zoom {
my $self = shift;
my %par = @_;
@@ -2050,9 +2084,16 @@
$self->set_tc_container('vcd');
}
- $self->set_preset("auto_medium_fast")
+ $self->set_preset("auto_clip")
unless $self->last_applied_preset;
+ if( $self->aspect_ratio eq '16:9' ) {
+ $self->set_tc_options("--export_par 32,27");
+ }
+ else {
+ $self->set_tc_options("--export_par 8,9");
+ }
+
my $subtitle_langs = $self->get_subtitle_languages;
if ( $subtitle_langs->{$pref_lang} ) {
|