Skip to content

Commit

Permalink
Merge pull request #604 from azeey/3_to_4
Browse files Browse the repository at this point in the history
Merge ign-common3 ➡️  ign-common4
  • Loading branch information
azeey authored May 7, 2024
2 parents 454595b + 955365c commit 6dba329
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 @@ -142,6 +142,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
template<typename Enum>
class EnumIterator
: std::iterator<std::bidirectional_iterator_tag, Enum>
Expand Down Expand Up @@ -219,6 +223,9 @@ namespace ignition
/// member value ever used.
private: Enum c;
};
#if defined __APPLE__ && defined __clang__
_Pragma("clang diagnostic pop")
#endif

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

0 comments on commit 6dba329

Please sign in to comment.