Skip to content

Commit ce2739d

Browse files
committed
Stop using av_stream_get_codec_timebase()
It deprecated now
1 parent 862207b commit ce2739d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/codeccontext.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,14 @@ CodecContext2::encodeCommon(Packet &outPacket,
10491049
outPacket.setStreamIndex(inFrame.streamIndex());
10501050
} else if (m_stream.isValid()) {
10511051
#if USE_CODECPAR
1052+
#if USE_AV_STREAM_GET_CODEC_TIMEBASE
10521053
outPacket.setTimeBase(av_stream_get_codec_timebase(m_stream.raw()));
1054+
#else
1055+
// TBD: additional checking are needed
1056+
if (timeBase() != Rational{}) {
1057+
outPacket.setTimeBase(timeBase());
1058+
}
1059+
#endif
10531060
#else
10541061
FF_DISABLE_DEPRECATION_WARNINGS
10551062
if (m_stream.raw()->codec) {

src/ffmpeg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ inline AVMediaType avfilter_pad_get_type(AVFilterPad *pads, int pad_idx)
6666
#define DEPRECATED_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR >= 58)
6767

6868
#define USE_AVCODEC_GET_SUPPORTED_CONFIG (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100))
69+
#define USE_AV_STREAM_GET_CODEC_TIMEBASE (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(61, 5, 101))
6970

7071
template<typename T>
7172
struct FFWrapperPtr

0 commit comments

Comments
 (0)