* Close Video *********************************************************************** * **********************************************************************/
| 2495 | * |
| 2496 | **********************************************************************/ |
| 2497 | static void syncVideoClose( hb_work_object_t * w ) |
| 2498 | { |
| 2499 | hb_work_private_t * pv = w->private_data; |
| 2500 | hb_job_t * job; |
| 2501 | |
| 2502 | if (pv == NULL) |
| 2503 | { |
| 2504 | return; |
| 2505 | } |
| 2506 | job = pv->common->job; |
| 2507 | |
| 2508 | hb_log("sync: got %d frames, %d expected", |
| 2509 | pv->stream->frame_count, pv->common->est_frame_count ); |
| 2510 | if (pv->stream->min_frame_duration > 0 && |
| 2511 | pv->stream->max_frame_duration > 0 && |
| 2512 | pv->stream->current_duration > 0) |
| 2513 | { |
| 2514 | hb_log("sync: framerate min %.3f fps, max %.3f fps, avg %.3f fps", |
| 2515 | 90000. / pv->stream->max_frame_duration, |
| 2516 | 90000. / pv->stream->min_frame_duration, |
| 2517 | (pv->stream->frame_count * 90000.) / |
| 2518 | pv->stream->current_duration); |
| 2519 | } |
| 2520 | |
| 2521 | /* save data for second pass */ |
| 2522 | if( job->pass_id == HB_PASS_ENCODE_ANALYSIS ) |
| 2523 | { |
| 2524 | /* Preserve frame count for better accuracy in pass 2 */ |
| 2525 | hb_interjob_t * interjob = hb_interjob_get( job->h ); |
| 2526 | interjob->frame_count = pv->stream->frame_count; |
| 2527 | } |
| 2528 | sync_delta_t * delta; |
| 2529 | while ((delta = hb_list_item(pv->stream->delta_list, 0)) != NULL) |
| 2530 | { |
| 2531 | hb_list_rem(pv->stream->delta_list, delta); |
| 2532 | free(delta); |
| 2533 | } |
| 2534 | hb_list_close(&pv->stream->delta_list); |
| 2535 | hb_list_empty(&pv->stream->in_queue); |
| 2536 | hb_list_empty(&pv->stream->scr_delay_queue); |
| 2537 | |
| 2538 | // Close work threads |
| 2539 | hb_work_object_t * work; |
| 2540 | while ((work = hb_list_item(pv->common->list_work, 0))) |
| 2541 | { |
| 2542 | hb_list_rem(pv->common->list_work, work); |
| 2543 | if (work->thread != NULL) |
| 2544 | { |
| 2545 | hb_thread_close(&work->thread); |
| 2546 | } |
| 2547 | if (work->close) work->close(work); |
| 2548 | free(work); |
| 2549 | } |
| 2550 | hb_list_close(&pv->common->list_work); |
| 2551 | |
| 2552 | hb_lock_close(&pv->common->mutex); |
| 2553 | free(pv->common->streams); |
| 2554 | free(pv->common); |
nothing calls this directly
no test coverage detected