--- a/dlna/avdetector.cpp +++ b/dlna/avdetector.cpp @@ -262,7 +262,8 @@ int cAudioVideoDetector::detectDLNAProfi } AVCodecContext* cCodecToolKit::getFirstCodecContext(AVFormatContext* FormatCtx, CodecType Type){ - return cCodecToolKit::getFirstStream(FormatCtx, Type)->codec; + AVStream* ret = cCodecToolKit::getFirstStream(FormatCtx, Type); + return ret ? ret->codec : NULL; } AVStream* cCodecToolKit::getFirstStream(AVFormatContext* FormatCtx, CodecType Type){ --- a/dlna/profiles/mpeg2.cpp +++ b/dlna/profiles/mpeg2.cpp @@ -159,6 +159,8 @@ VideoPortionProfile cMPEG2Profiler::prob AVCodecContext* VideoCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_VIDEO); AVStream* VideoStream = cCodecToolKit::getFirstStream(FormatCtx, CODEC_TYPE_VIDEO); + if (VideoCodec == NULL || VideoStream == NULL) + return DLNA_VPP_UNKNOWN; MESSAGE(VERBOSE_METADATA, "Codec-ID: %d", VideoCodec->codec_id); MESSAGE(VERBOSE_METADATA, "Codec-Name: %s", VideoCodec->codec_name); MESSAGE(VERBOSE_METADATA, "Codec Bitrate: %d", VideoCodec->bit_rate);