MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / muxClose

Function muxClose

libhb/muxcommon.c:497–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497static void muxClose( hb_work_object_t * muxer )
498{
499 hb_work_private_t * pv = muxer->private_data;
500 if (pv == NULL)
501 {
502 // Not initialized
503 return;
504 }
505
506 hb_mux_t * mux = pv->mux;
507
508 if (mux == NULL)
509 {
510 free(pv);
511 muxer->private_data = NULL;
512 return;
513 }
514
515 hb_job_t * job = pv->job;
516 hb_track_t * track;
517 hb_work_object_t * w;
518 int i;
519
520 hb_lock( mux->mutex );
521 muxFlush(mux);
522
523 // Update state before closing muxer. Closing the muxer
524 // may initiate optimization which can take a while and
525 // we want the muxing state to be visible while this is
526 // happening.
527 if( job->pass_id == HB_PASS_ENCODE ||
528 job->pass_id == HB_PASS_ENCODE_FINAL )
529 {
530 /* Update the UI */
531 hb_state_t state;
532 hb_get_state2(job->h, &state);
533 state.state = HB_STATE_MUXING;
534 state.param.muxing.progress = 0;
535 hb_set_state(job->h, &state);
536 }
537
538 if( mux->m )
539 {
540 mux->m->end( mux->m );
541 free( mux->m );
542 }
543
544 // we're all done muxing -- print final stats and cleanup.
545 if( job->pass_id == HB_PASS_ENCODE ||
546 job->pass_id == HB_PASS_ENCODE_FINAL )
547 {
548 hb_stat_t sb;
549 uint64_t bytes_total, frames_total;
550
551 if (!hb_stat(job->file, &sb))
552 {
553 hb_deep_log( 2, "mux: file size, %"PRId64" bytes", (uint64_t) sb.st_size );
554

Callers

nothing calls this directly

Calls 15

hb_lockFunction · 0.85
muxFlushFunction · 0.85
hb_get_state2Function · 0.85
hb_set_stateFunction · 0.85
hb_statFunction · 0.85
hb_deep_logFunction · 0.85
hb_logFunction · 0.85
mf_pullFunction · 0.85
hb_buffer_closeFunction · 0.85
hb_unlockFunction · 0.85
hb_lock_closeFunction · 0.85

Tested by

no test coverage detected