Skip to content

Commit cbdfd98

Browse files
committed
Introduce AVCPP_API_HAS_AVSIDEDATADESCRIPTOR
AVSideDataDescriptor and related functionality was introduced about ffmpeg 7.0. Handle it to build with ffmpeg 4.0+
1 parent b94db9f commit cbdfd98

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/avcpp/avcompat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ extern "C" {
4949
#endif // if AVCPP_HAS_AVFORMAT
5050
// AVBuffer API switch to size_t
5151
#define AVCPP_API_AVBUFFER_SIZE_T (AVCPP_AVUTIL_VERSION_MAJOR >= 57)
52+
// AVSideDataDescriptor exisits
53+
#define AVCPP_API_HAS_AVSIDEDATADESCRIPTOR (AVCPP_AVUTIL_VERSION_INT >= AV_VERSION_INT(59, 10, 100))
5254

5355
#if defined(__ICL) || defined (__INTEL_COMPILER)
5456
# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478))

src/avcpp/frame.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ Dictionary FrameSideData::metadata() const noexcept
893893
return m_raw ? Dictionary{m_raw->metadata, false} : Dictionary{};
894894
}
895895

896+
#if AVCPP_API_HAS_AVSIDEDATADESCRIPTOR
896897
std::optional<AVSideDataDescriptor> FrameSideData::descriptor() const noexcept
897898
{
898899
return m_raw ? descriptor(m_raw->type) : std::nullopt;
@@ -903,6 +904,7 @@ std::optional<AVSideDataDescriptor> FrameSideData::descriptor(AVFrameSideDataTyp
903904
auto desc = av_frame_side_data_desc(type);
904905
return desc ? std::optional(*desc) : std::nullopt;
905906
}
907+
#endif
906908

907909
bool FrameSideData::empty() const noexcept
908910
{

src/avcpp/frame.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ class FrameSideData : public FFWrapperPtr<AVFrameSideData>
5353
*/
5454
Dictionary metadata() const noexcept;
5555

56-
std::optional<AVSideDataDescriptor> descriptor() const noexcept;
57-
5856
static std::string_view name(AVFrameSideDataType type) noexcept;
57+
58+
#if AVCPP_API_HAS_AVSIDEDATADESCRIPTOR
59+
std::optional<AVSideDataDescriptor> descriptor() const noexcept;
5960
static std::optional<AVSideDataDescriptor> descriptor(AVFrameSideDataType type) noexcept;
61+
#endif // AVCPP_API_HAS_AVSIDEDATADESCRIPTOR
6062

6163
bool empty() const noexcept;
6264
operator bool() const noexcept;

0 commit comments

Comments
 (0)