AudioDecoder destructor
This commit is contained in:
parent
a69d1b7f04
commit
3389b9e421
|
@ -26,6 +26,21 @@ AudioDecoder::AudioDecoder() : offset_(0) {
|
|||
}
|
||||
|
||||
AudioDecoder::~AudioDecoder() {
|
||||
if (context_) {
|
||||
if (context_->extradata) {
|
||||
delete context_->extradata;
|
||||
}
|
||||
if (avcodec_is_open(context_)) {
|
||||
avcodec_close(context_);
|
||||
}
|
||||
av_free(context_);
|
||||
}
|
||||
if (decoded_frame_) {
|
||||
avcodec_free_frame(&decoded_frame_);
|
||||
}
|
||||
if (current_frame_) {
|
||||
delete current_frame_;
|
||||
}
|
||||
}
|
||||
|
||||
int AudioDecoder::Initialize(int bits) {
|
||||
|
|
|
@ -95,11 +95,14 @@ X_STATUS AudioSystem::Setup() {
|
|||
|
||||
// Create a new decoder per context
|
||||
// Needed because some data needs to be persisted across calls
|
||||
// TODO: Need to destroy this on class destruction
|
||||
xma_context_array_[i].decoder = new AudioDecoder();
|
||||
xma_context_array_[i].decoder->Initialize(16);
|
||||
}
|
||||
registers_.next_context = 1;
|
||||
|
||||
// Threads
|
||||
|
||||
worker_running_ = true;
|
||||
worker_thread_ = new kernel::XHostThread(emulator()->kernel_state(),
|
||||
128 * 1024, 0, [this]() {
|
||||
|
|
Loading…
Reference in New Issue