Skip to content

Commit 5cb04f8

Browse files
committed
add the better framecount calculation to mencoder, and update it overall -- no need for lastgop stuff anymore so just grab the last mark in the table
1 parent d10cf41 commit 5cb04f8

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

trunk/export/ffmpeg.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,9 @@ package export::ffmpeg;
294294
$frames = 0;
295295
$fps = 0.0;
296296
$start = time();
297-
my $total_frames = $episode->{'lastgop'} * (($episode->{'finfo'}{'fps'} =~ /^2(?:5|4\.9)/) ? 12 : 15);
298-
$total_frames -= $episode->{'cutlist_frames'} if ($total_frames > 0);
297+
my $total_frames = $episode->{'last_frame'} > 0
298+
? $episode->{'last_frame'} - $episode->{'cutlist_frames'}
299+
: 0;
299300
# Keep track of any warnings
300301
my $warnings = '';
301302
my $death_timer = 0;

trunk/export/mencoder.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ package export::mencoder;
164164
my ($frames, $fps);
165165
$frames = 0;
166166
$fps = 0.0;
167-
my $total_frames = $episode->{'lastgop'} * (($episode->{'finfo'}{'fps'} =~ /^2(?:5|4\.9)/) ? 12 : 15);
167+
my $total_frames = $episode->{'last_frame'} > 0
168+
? $episode->{'last_frame'} - $episode->{'cutlist_frames'}
169+
: 0;
168170
# Keep track of any warnings
169171
my $warnings = '';
170172
my $death_timer = 0;
@@ -201,7 +203,7 @@ package export::mencoder;
201203
while (has_data($mythtrans_h) and $l = <$mythtrans_h>) {
202204
if ($l =~ /Processed:\s*(\d+)\s*of\s*(\d+)\s*frames\s*\((\d+)\s*seconds\)/) {
203205
#$frames = int($1);
204-
$total_frames = $2;
206+
$total_frames ||= $2 - $episode->{'cutlist_frames'};
205207
}
206208
}
207209
}

trunk/export/transcode.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,9 @@ package export::transcode;
324324
my ($frames, $fps);
325325
$frames = 0;
326326
$fps = 0.0;
327-
my $total_frames = $episode->{'lastgop'} * (($episode->{'finfo'}{'fps'} =~ /^2(?:5|4\.9)/) ? 12 : 15);
328-
$total_frames -= $episode->{'cutlist_frames'} if ($total_frames > 0);
327+
my $total_frames = $episode->{'last_frame'} > 0
328+
? $episode->{'last_frame'} - $episode->{'cutlist_frames'}
329+
: 0;
329330
# Keep track of any warnings
330331
my $warnings = '';
331332
my $death_timer = 0;

trunk/mythtv/recordings.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ package mythtv::recordings;
7777
die "No valid recordings found!\n\n" unless (@files);
7878

7979
# Prepare a query to look up GOP info used to determine mpeg recording length
80-
$q = 'SELECT mark FROM recordedmarkup WHERE chanid=? AND starttime=? AND type=6 ORDER BY mark DESC LIMIT 1';
80+
$q = 'SELECT MAX(mark) FROM recordedmarkup WHERE chanid=? AND starttime=?';
8181
$sh = $dbh->prepare($q);
8282

8383
# Prepare a query to pull out cutlist information
@@ -114,7 +114,7 @@ package mythtv::recordings;
114114
# Pull out GOP info for mpeg files
115115
$sh->execute($info{'chanid'}, $info{'starttime'})
116116
or die "Could not execute ($q): $!\n\n";
117-
($info{'lastgop'}) = $sh->fetchrow_array();
117+
($info{'last_frame'}) = $sh->fetchrow_array();
118118
# Cleanup
119119
$info{'starttime_sep'} = $info{'starttime'};
120120
$info{'starttime_sep'} =~ s/\D+/-/sg;
@@ -136,7 +136,7 @@ package mythtv::recordings;
136136
'transcoder' => ($info{'transcoder'} or 'autodetect'),
137137
'hostname' => ($info{'hostname'} or ''),
138138
'cutlist' => ($info{'cutlist'} or ''),
139-
'lastgop' => ($info{'lastgop'} or 0),
139+
'last_frame' => ($info{'last_frame'} or 0),
140140
'cutlist_frames' => ($cutlist_frames or 0),
141141
'showtime' => generate_showtime(split(/-/, $info{'starttime_sep'})),
142142
# This field is too slow to populate here, so it will be populated in ui.pm on-demand

0 commit comments

Comments
 (0)