| 928 | } |
| 929 | |
| 930 | int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, |
| 931 | hb_buffer_t ** buf_out ) |
| 932 | { |
| 933 | hb_work_private_t *pv = w->private_data; |
| 934 | hb_buffer_t *in = *buf_in; |
| 935 | |
| 936 | *buf_out = NULL; |
| 937 | |
| 938 | if (in->s.flags & HB_BUF_FLAG_EOF) |
| 939 | { |
| 940 | // EOF on input. Flush any frames still in the decoder then |
| 941 | // send the eof downstream to tell the muxer we're done. |
| 942 | x264_picture_t pic_out; |
| 943 | int i_nal; |
| 944 | x264_nal_t *nal; |
| 945 | hb_buffer_list_t list; |
| 946 | |
| 947 | hb_buffer_list_clear(&list); |
| 948 | |
| 949 | // flush delayed frames |
| 950 | while ( pv->api->encoder_delayed_frames( pv->x264 ) ) |
| 951 | { |
| 952 | pv->api->encoder_encode( pv->x264, &nal, &i_nal, NULL, &pic_out ); |
| 953 | if ( i_nal == 0 ) |
| 954 | continue; |
| 955 | if ( i_nal < 0 ) |
| 956 | break; |
| 957 | |
| 958 | hb_buffer_t *buf = nal_encode( w, &pic_out, i_nal, nal ); |
| 959 | hb_buffer_list_append(&list, buf); |
| 960 | } |
| 961 | // add the EOF to the end of the chain |
| 962 | hb_buffer_list_append(&list, in); |
| 963 | |
| 964 | *buf_out = hb_buffer_list_clear(&list); |
| 965 | *buf_in = NULL; |
| 966 | return HB_WORK_DONE; |
| 967 | } |
| 968 | |
| 969 | // Not EOF - encode the packet & wrap it in a NAL |
| 970 | *buf_out = x264_encode( w, in ); |
| 971 | return HB_WORK_OK; |
| 972 | } |
| 973 | |
| 974 | static int apply_h264_profile(const x264_api_t *api, x264_param_t *param, |
| 975 | const char *h264_profile, int verbose) |
nothing calls this directly
no test coverage detected