diff --git a/aegisub/libffms/src/core/audiosource.cpp b/aegisub/libffms/src/core/audiosource.cpp index 08f1606df..136d5b93b 100644 --- a/aegisub/libffms/src/core/audiosource.cpp +++ b/aegisub/libffms/src/core/audiosource.cpp @@ -238,7 +238,7 @@ void FFMS_AudioSource::GetAudio(void *Buf, int64_t Start, int64_t Count) { while (NewPacketNumber > 0 && !Frames[NewPacketNumber].KeyFrame) --NewPacketNumber; // Only seek forward if it'll actually result in moving forward - if (Start < CurrentSample || NewPacketNumber > PacketNumber) { + if (Start < CurrentSample || static_cast(NewPacketNumber) > PacketNumber) { PacketNumber = NewPacketNumber; Decoded = 0; CurrentSample = -1; diff --git a/aegisub/libffms/src/core/lavfindexer.cpp b/aegisub/libffms/src/core/lavfindexer.cpp index 8213750d3..c48dfb682 100644 --- a/aegisub/libffms/src/core/lavfindexer.cpp +++ b/aegisub/libffms/src/core/lavfindexer.cpp @@ -50,9 +50,6 @@ FFMS_Index *FFLAVFIndexer::DoIndexing() { static_cast(FormatContext->streams[i]->codec->codec_type))); if (FormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) { - VideoContexts[i].Parser = av_parser_init(FormatContext->streams[i]->codec->codec_id); - if (!VideoContexts[i].Parser) continue; - AVCodec *VideoCodec = avcodec_find_decoder(FormatContext->streams[i]->codec->codec_id); if (!VideoCodec) throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED, @@ -63,7 +60,9 @@ FFMS_Index *FFLAVFIndexer::DoIndexing() { "Could not open video codec"); VideoContexts[i].CodecContext = FormatContext->streams[i]->codec; - VideoContexts[i].Parser->flags = PARSER_FLAG_COMPLETE_FRAMES; + VideoContexts[i].Parser = av_parser_init(FormatContext->streams[i]->codec->codec_id); + if (VideoContexts[i].Parser) + VideoContexts[i].Parser->flags = PARSER_FLAG_COMPLETE_FRAMES; IndexMask |= 1 << i; } else if (IndexMask & (1 << i) && FormatContext->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) { diff --git a/aegisub/libffms/src/core/utils.cpp b/aegisub/libffms/src/core/utils.cpp index 248f92205..a004dfa6c 100644 --- a/aegisub/libffms/src/core/utils.cpp +++ b/aegisub/libffms/src/core/utils.cpp @@ -30,10 +30,6 @@ # include extern "C" { # include "libavutil/avstring.h" - /* if you have this, we'll assume you have a new enough libavutil too */ -# if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0, 12, 0) -# include -# endif } #endif // _WIN32 @@ -49,6 +45,11 @@ extern const AVCodecTag ff_codec_bmp_tags[]; extern const CodecTags ff_mkv_codec_tags[]; extern const AVCodecTag ff_codec_movvideo_tags[]; extern const AVCodecTag ff_codec_wav_tags[]; + +/* if you have this, we'll assume you have a new enough libavutil too */ +#if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0, 12, 0) +# include +#endif } extern int CPUFeatures;