| 381 | } |
| 382 | |
| 383 | static void encavcodecaClose(hb_work_object_t * w) |
| 384 | { |
| 385 | hb_work_private_t * pv = w->private_data; |
| 386 | |
| 387 | if (pv != NULL) |
| 388 | { |
| 389 | if (pv->context != NULL) |
| 390 | { |
| 391 | Finalize(w); |
| 392 | hb_deep_log(2, "encavcodecaudio: closing libavcodec"); |
| 393 | if (pv->context->codec != NULL) { |
| 394 | avcodec_flush_buffers(pv->context); |
| 395 | } |
| 396 | hb_avcodec_free_context(&pv->context); |
| 397 | } |
| 398 | |
| 399 | av_packet_free(&pv->pkt); |
| 400 | |
| 401 | if (pv->output_buf != NULL) |
| 402 | { |
| 403 | free(pv->output_buf); |
| 404 | } |
| 405 | if (pv->input_buf != NULL && pv->input_buf != pv->output_buf) |
| 406 | { |
| 407 | free(pv->input_buf); |
| 408 | } |
| 409 | pv->output_buf = pv->input_buf = NULL; |
| 410 | |
| 411 | if (pv->list != NULL) |
| 412 | { |
| 413 | hb_list_empty(&pv->list); |
| 414 | } |
| 415 | |
| 416 | if (pv->swresample != NULL) |
| 417 | { |
| 418 | swr_free(&pv->swresample); |
| 419 | } |
| 420 | |
| 421 | free(pv); |
| 422 | w->private_data = NULL; |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | static void get_packets( hb_work_object_t * w, hb_buffer_list_t * list ) |
| 427 | { |
nothing calls this directly
no test coverage detected