[mythtv-users] [PATCH] more intelligent default width/height setting in nuvexport
Brian J. Murrell
brian at interlinx.bc.ca
Thu Feb 11 13:53:23 UTC 2010
This patch adds some more intelligence to the default settings of height
and width in nuvexport. Specifically, if one sets width to auto and
height to a specific value (i.e. to constrain by height, not width) this
patch defaults width based on the pre-set (either in the converter
module itself or from nuvexportc) height.
I hope the nuvexport maintainer will consider adding this patch to the
sources.
FWIW, there is a cleanup in nuvexport needed. For example,
mythtv/nuvinfo.pm seems to be (at least somewhat) unused with some of
the functionality from it moved into the mythtv perl library itself.
b.
--- export/generic.pm.dist 2010-02-11 08:49:49.000000000 -0500
+++ export/generic.pm 2010-02-11 08:46:05.000000000 -0500
@@ -247,10 +247,14 @@
my $self = shift;
# No height given -- use auto?
if (!$self->val('width') || $self->val('width') =~ /^\s*\D/) {
- $self->{'width'} = $episodes[0]->{'finfo'}{'width'};
- print 'Default resolution based on ',
- ($self->val('force_aspect') ? 'forced ' : ''),
- $episodes[0]->{'finfo'}{'aspect'}, " aspect ratio.\n";
+ if ($self->val('height') && $self->val('height') =~ /^\s*\d/) {
+ $self->{'width'} = $self->{'height'} * $episodes[0]->{'finfo'}{'aspect_f'};
+ } else {
+ $self->{'width'} = $episodes[0]->{'finfo'}{'width'};
+ print 'Default resolution based on ',
+ ($self->val('force_aspect') ? 'forced ' : ''),
+ $episodes[0]->{'finfo'}{'aspect'}, " aspect ratio.\n";
+ }
}
else {
print "Default resolution based on requested dimensions.\n";
@@ -274,6 +278,12 @@
if (!$self->val('height') || $self->val('height') =~ /^\s*\D/) {
$self->{'height'} = $self->{'width'} / $episodes[0]->{'finfo'}{'aspect_f'};
$self->{'height'} = int(($self->{'height'} + 8) / 16) * 16;
+ } else {
+ my $aspect_height = $self->{'width'} / $episodes[0]->{'finfo'}{'aspect_f'};
+ if ($aspect_height != $self->{'height'}) {
+ print "Defaulting to requested height, but to maintain aspect you should use ",
+ $aspect_height, "\n";
+ }
}
# Ask about the height
while (1) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100211/76c1bafc/attachment.pgp>
More information about the mythtv-users
mailing list