| 495 | } |
| 496 | |
| 497 | static 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 |
nothing calls this directly
no test coverage detected