summaryrefslogtreecommitdiffstats
path: root/libhb/muxcommon.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-12-10 17:44:05 +0000
committerjstebbins <[email protected]>2009-12-10 17:44:05 +0000
commitf6986e59735724f22f37646693a22c2fe650ecff (patch)
tree598c15b561b289fa448451bbe2684ed5e547447b /libhb/muxcommon.c
parent49c3c9ae4db1bf7d50e951f01003a952b14c5f23 (diff)
Only display mux stats once
Close prints mux stats and gets called for each stream. So only print the stats when the last stream is closed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3023 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/muxcommon.c')
-rw-r--r--libhb/muxcommon.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c
index 7ea3c7933..95e1ab168 100644
--- a/libhb/muxcommon.c
+++ b/libhb/muxcommon.c
@@ -279,59 +279,59 @@ void muxClose( hb_work_object_t * w )
hb_track_t * track;
int i;
- // we're all done muxing -- print final stats and cleanup.
- if( job->pass == 0 || job->pass == 2 )
+ hb_lock( mux->mutex );
+ if ( --mux->ref == 0 )
{
- struct stat sb;
- uint64_t bytes_total, frames_total;
-
- /* Update the UI */
- hb_state_t state;
- state.state = HB_STATE_MUXING;
- state.param.muxing.progress = 0;
- hb_set_state( job->h, &state );
+ if( mux->m )
+ {
+ mux->m->end( mux->m );
+ free( mux->m );
+ }
- if( !stat( job->file, &sb ) )
+ // we're all done muxing -- print final stats and cleanup.
+ if( job->pass == 0 || job->pass == 2 )
{
- hb_deep_log( 2, "mux: file size, %"PRId64" bytes", (uint64_t) sb.st_size );
+ struct stat sb;
+ uint64_t bytes_total, frames_total;
+
+ /* Update the UI */
+ hb_state_t state;
+ state.state = HB_STATE_MUXING;
+ state.param.muxing.progress = 0;
+ hb_set_state( job->h, &state );
- bytes_total = 0;
- frames_total = 0;
- for( i = 0; i < mux->ntracks; ++i )
+ if( !stat( job->file, &sb ) )
{
- track = mux->track[i];
- hb_log( "mux: track %d, %"PRId64" frames, %"PRId64" bytes, %.2f kbps, fifo %d",
- i, track->frames, track->bytes,
- 90000.0 * track->bytes / mux->pts / 125,
- track->mf.flen );
- if( !i && ( job->vquality < 0.0 || job->vquality > 1.0 ) )
+ hb_deep_log( 2, "mux: file size, %"PRId64" bytes", (uint64_t) sb.st_size );
+
+ bytes_total = 0;
+ frames_total = 0;
+ for( i = 0; i < mux->ntracks; ++i )
{
- /* Video */
- hb_deep_log( 2, "mux: video bitrate error, %+"PRId64" bytes",
- (int64_t)(track->bytes - mux->pts * job->vbitrate * 125 / 90000) );
+ track = mux->track[i];
+ hb_log( "mux: track %d, %"PRId64" frames, %"PRId64" bytes, %.2f kbps, fifo %d",
+ i, track->frames, track->bytes,
+ 90000.0 * track->bytes / mux->pts / 125,
+ track->mf.flen );
+ if( !i && ( job->vquality < 0.0 || job->vquality > 1.0 ) )
+ {
+ /* Video */
+ hb_deep_log( 2, "mux: video bitrate error, %+"PRId64" bytes",
+ (int64_t)(track->bytes - mux->pts * job->vbitrate * 125 / 90000) );
+ }
+ bytes_total += track->bytes;
+ frames_total += track->frames;
}
- bytes_total += track->bytes;
- frames_total += track->frames;
- }
- if( bytes_total && frames_total )
- {
- hb_deep_log( 2, "mux: overhead, %.2f bytes per frame",
- (float) ( sb.st_size - bytes_total ) /
- frames_total );
+ if( bytes_total && frames_total )
+ {
+ hb_deep_log( 2, "mux: overhead, %.2f bytes per frame",
+ (float) ( sb.st_size - bytes_total ) /
+ frames_total );
+ }
}
}
- }
- hb_lock( mux->mutex );
- if ( --mux->ref == 0 )
- {
- if( mux->m )
- {
- mux->m->end( mux->m );
- free( mux->m );
- }
-
for( i = 0; i < mux->ntracks; ++i )
{
track = mux->track[i];