Index: wxsvg-1.5.23/include/wxSVG/mediadec_ffmpeg.h =================================================================== --- wxsvg-1.5.23.orig/include/wxSVG/mediadec_ffmpeg.h +++ wxsvg-1.5.23/include/wxSVG/mediadec_ffmpeg.h @@ -81,6 +81,7 @@ private: bool OpenVideoDecoder(); void CloseVideoDecoder(); AVStream* GetVideoStream(); + int64_t m_cur_dts; }; #endif //FFMPEG_MEDIA_DECODER_H Index: wxsvg-1.5.23/src/mediadec_ffmpeg.cpp =================================================================== --- wxsvg-1.5.23.orig/src/mediadec_ffmpeg.cpp +++ wxsvg-1.5.23/src/mediadec_ffmpeg.cpp @@ -20,6 +20,7 @@ #define UINT64_C(val) val##ULL #endif extern "C" { +#include #include #include #include @@ -153,6 +154,9 @@ StreamType wxFfmpegMediaDecoder::GetStre } wxString wxFfmpegMediaDecoder::GetCodecName(unsigned int streamIndex) { +#if LIBAVCODEC_VERSION_MAJOR >= 59 + const +#endif AVCodec *codec = avcodec_find_decoder(m_formatCtx->streams[streamIndex]->codecpar->codec_id); if (codec) { return wxString(codec->name, wxConvLocal); @@ -193,6 +197,9 @@ bool wxFfmpegMediaDecoder::OpenVideoDeco // find and open the decoder for the video stream AVStream* stream = m_formatCtx->streams[m_videoStream]; +#if LIBAVCODEC_VERSION_MAJOR >= 59 + const +#endif AVCodec* codec = avcodec_find_decoder(stream->codecpar->codec_id); if (!codec) return false; @@ -255,7 +262,11 @@ double wxFfmpegMediaDecoder::GetPosition AVStream *st = GetVideoStream(); if (st == NULL) return -1; +#if LIBAVCODEC_VERSION_MAJOR >= 59 + int64_t timestamp = m_cur_dts; +#else int64_t timestamp = st->cur_dts; +#endif if (timestamp == (int64_t)AV_NOPTS_VALUE) return -1; timestamp = av_rescale(timestamp, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den); @@ -308,6 +319,7 @@ wxImage wxFfmpegMediaDecoder::GetNextFra uint8_t *rgbSrc[3] = { img.GetData(), NULL, NULL }; int rgbStride[3] = { 3 * m_width, 0, 0 }; sws_scale(imgConvertCtx, m_frame->data, m_frame->linesize, 0, m_codecCtx->height, rgbSrc, rgbStride); + m_cur_dts = packet.dts; av_packet_unref(&packet); sws_freeContext(imgConvertCtx); return img;