diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index cd49be53d..8a1516d77 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -251,6 +251,17 @@ void cDvbSubtitleConverter::Reset(void) Timeout.Set(0xFFFF*1000); } +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100) +static void get_packet_defaults(AVPacket *pkt) +{ + memset(pkt, 0, sizeof(*pkt)); + + pkt->pts = AV_NOPTS_VALUE; + pkt->dts = AV_NOPTS_VALUE; + pkt->pos = -1; +} +#endif + int cDvbSubtitleConverter::Convert(const uchar *Data, int Length, int64_t pts) { AVPacket avpkt; @@ -268,6 +279,8 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length, int64_t pts) AVSubtitle * sub = Bitmaps->GetSub(); #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&avpkt); +#else + get_packet_defaults(&avpkt); #endif avpkt.data = (uint8_t*) Data; avpkt.size = Length; diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 5536d504d..611a75565 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -233,6 +233,16 @@ void CFfmpegDec::DeInit(void) } in = NULL; } +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100) +static void get_packet_defaults(AVPacket *pkt) +{ + memset(pkt, 0, sizeof(*pkt)); + + pkt->pts = AV_NOPTS_VALUE; + pkt->dts = AV_NOPTS_VALUE; + pkt->pos = -1; +} +#endif CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, CAudioMetaData* _meta_data, time_t* time_played, unsigned int* secondsToSkip) { @@ -288,6 +298,8 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, AVPacket rpacket; #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&rpacket); +#else + get_packet_defaults(&rpacket); #endif c->channel_layout = c->channel_layout ? c->channel_layout : AV_CH_LAYOUT_STEREO; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 2617e484f..fa34c0892 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2406,6 +2406,16 @@ bool CStreamRec::Open(CZapitChannel * channel) #endif return true; } +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100) +static void get_packet_defaults(AVPacket *pkt) +{ + memset(pkt, 0, sizeof(*pkt)); + + pkt->pts = AV_NOPTS_VALUE; + pkt->dts = AV_NOPTS_VALUE; + pkt->pos = -1; +} +#endif void CStreamRec::run() { @@ -2424,6 +2434,8 @@ void CStreamRec::run() while (!stopped) { #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&pkt); +#else + get_packet_defaults(&pkt); #endif if (av_read_frame(ifcx, &pkt) < 0) break; diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 75fe52a84..f58e7e8fc 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -949,6 +949,16 @@ bool CStreamStream::Stop() interrupt = false; return (ret == 0); } +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100) +static void get_packet_defaults(AVPacket *pkt) +{ + memset(pkt, 0, sizeof(*pkt)); + + pkt->pts = AV_NOPTS_VALUE; + pkt->dts = AV_NOPTS_VALUE; + pkt->pos = -1; +} +#endif void CStreamStream::run() { @@ -963,6 +973,8 @@ void CStreamStream::run() while (!stopped) { #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&pkt); +#else + get_packet_defaults(&pkt); #endif if (av_read_frame(ifcx, &pkt) < 0) break;