while ( ( buf = mf_peek( track ) ) != NULL && buf->start < mux->pts )
{
- m->mux( m, track->mux_data, mf_pull( track ) );
+ buf = mf_pull( track );
track->frames += 1;
track->bytes += buf->size;
+ m->mux( m, track->mux_data, buf );
}
}
hb_lock( mux->mutex );
if ( --mux->ref == 0 )
{
+ // Update state before closing muxer. Closing the muxer
+ // may initiate optimization which can take a while and
+ // we want the muxing state to be visible while this is
+ // happening.
+ if( job->pass == 0 || job->pass == 2 )
+ {
+ /* 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 );
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( !stat( job->file, &sb ) )
{
hb_deep_log( 2, "mux: file size, %"PRId64" bytes", (uint64_t) sb.st_size );
}
w->status = w->work( w, &buf_in, NULL );
+ if( buf_in )
+ {
+ hb_buffer_close( &buf_in );
+ }
}
}
muxer->private_data->track = mux->ntracks;
muxer->fifo_in = job->fifo_mpeg4;
add_mux_track( mux, job->mux_data, 1 );
- muxer->done = &job->done;
- muxer->thread = hb_thread_init( muxer->name, mux_loop, muxer, HB_NORMAL_PRIORITY );
+ muxer->done = &muxer->private_data->mux->done;
for( i = 0; i < hb_list_count( title->list_audio ); i++ )
{