| 619 | } |
| 620 | |
| 621 | static int muxInit( hb_work_object_t * muxer, hb_job_t * job ) |
| 622 | { |
| 623 | muxer->private_data = calloc( sizeof(hb_work_private_t ), 1); |
| 624 | if (muxer->private_data == NULL) |
| 625 | { |
| 626 | return -1; |
| 627 | } |
| 628 | hb_work_private_t *pv = muxer->private_data; |
| 629 | |
| 630 | hb_mux_t *mux = calloc( sizeof( hb_mux_t ), 1 ); |
| 631 | if (mux == NULL) |
| 632 | { |
| 633 | goto fail; |
| 634 | } |
| 635 | |
| 636 | mux->mutex = hb_lock_init(); |
| 637 | if (mux->mutex == NULL) |
| 638 | { |
| 639 | goto fail; |
| 640 | } |
| 641 | |
| 642 | pv->mux = mux; |
| 643 | pv->job = job; |
| 644 | pv->track = mux->ntracks; |
| 645 | |
| 646 | /* Get a real muxer */ |
| 647 | if( job->pass_id == HB_PASS_ENCODE || job->pass_id == HB_PASS_ENCODE_FINAL ) |
| 648 | { |
| 649 | switch( job->mux ) |
| 650 | { |
| 651 | case HB_MUX_AV_MP4: |
| 652 | case HB_MUX_AV_MOV: |
| 653 | case HB_MUX_AV_MKV: |
| 654 | case HB_MUX_AV_WEBM: |
| 655 | mux->m = hb_mux_avformat_init( job ); |
| 656 | break; |
| 657 | default: |
| 658 | hb_error("No muxer selected, exiting"); |
| 659 | goto fail; |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | pv->list_work = hb_list_init(); |
| 664 | |
| 665 | // The bit vectors must be allocated before hb_thread_init for the |
| 666 | // audio and subtitle muxer jobs below. |
| 667 | int bit_vec_size = 1 + hb_list_count(job->list_audio) + |
| 668 | hb_list_count(job->list_subtitle); |
| 669 | mux->rdy = hb_bitvec_new(bit_vec_size); |
| 670 | mux->eof = hb_bitvec_new(bit_vec_size); |
| 671 | mux->allRdy = hb_bitvec_new(bit_vec_size); |
| 672 | mux->allEof = hb_bitvec_new(bit_vec_size); |
| 673 | |
| 674 | if (mux->rdy == NULL || mux->eof == NULL || |
| 675 | mux->allRdy == NULL || mux->allEof == NULL) |
| 676 | { |
| 677 | goto fail; |
| 678 | } |
nothing calls this directly
no test coverage detected