Skip to content

Commit

Permalink
Merge 4 into 5
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed May 7, 2024
2 parents 27ee4d6 + 6dba329 commit a7dce9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions av/src/AudioDecoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ AudioDecoder::AudioDecoder()
: dataPtr(utils::MakeUniqueImpl<Implementation>())
{
common::load();
{
#if LIBAVFORMAT_VERSION_MAJOR < 59
#else
avcodec_free_context(&this->data->codecCtx);
#endif
}
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -140,6 +146,10 @@ bool AudioDecoder::Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize)

#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)
int numChannels = this->dataPtr->codecCtx->ch_layout.nb_channels;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)
#else
this->data->codecCtx->channels;
#endif
#else
int numChannels = this->dataPtr->codecCtx->channels;
#endif
Expand Down
4 changes: 4 additions & 0 deletions av/src/Video.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ void Video::Cleanup()
avformat_close_input(&this->dataPtr->formatCtx);

// Close the codec
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
avcodec_free_context(&this->dataPtr->codecCtx);
#else
avcodec_close(this->dataPtr->codecCtx);
#endif

av_free(this->dataPtr->avFrameDst);
}
Expand Down

0 comments on commit a7dce9d

Please sign in to comment.