Skip to content

Commit

Permalink
Merge branch 'ign-common4' into Crola1702/5_to_4_25-04-2024
Browse files Browse the repository at this point in the history
Signed-off-by: Cristóbal Arroyo <j.arroyo@uniandes.edu.co>
  • Loading branch information
Crola1702 authored May 8, 2024
2 parents 51926a6 + 6dba329 commit 4b07733
Show file tree
Hide file tree
Showing 3 changed files with 21 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 @@ -67,7 +67,13 @@ void AudioDecoder::Cleanup()
{
// Close the codec
if (this->data->codecCtx)
{
#if LIBAVFORMAT_VERSION_MAJOR < 59
avcodec_close(this->data->codecCtx);
#else
avcodec_free_context(&this->data->codecCtx);
#endif
}

// Close the audio file
if (this->data->formatCtx)
Expand Down Expand Up @@ -157,7 +163,11 @@ bool AudioDecoder::Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize)
// decodedFrame->linesize[0].
int size = decodedFrame->nb_samples *
av_get_bytes_per_sample(this->data->codecCtx->sample_fmt) *
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)
this->data->codecCtx->ch_layout.nb_channels;
#else
this->data->codecCtx->channels;
#endif
// Resize the audio buffer as necessary
if (*_outBufferSize + size > maxBufferSize)
{
Expand Down
4 changes: 4 additions & 0 deletions av/src/Video.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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
7 changes: 7 additions & 0 deletions include/gz/common/EnumIface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ namespace ignition
/// std::cout << "Type++ Name[" << myTypeIface.Str(*i) << "]\n";
/// }
/// \verbatim
#if defined __APPLE__ && defined __clang__
_Pragma("clang diagnostic push")
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
#endif
IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
template<typename Enum>
class EnumIterator
Expand Down Expand Up @@ -222,6 +226,9 @@ namespace ignition
private: Enum c;
};
IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
#if defined __APPLE__ && defined __clang__
_Pragma("clang diagnostic pop")
#endif

/// \brief Equality operator
/// \param[in] _e1 First iterator
Expand Down

0 comments on commit 4b07733

Please sign in to comment.