X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fffmpeg.C;h=2f1a1987cf6cd7fe6397da5ccb43381d4b82827d;hp=de983a3a4b5032b4c5241c1770a6855f3725684a;hb=e3c81d537528ce9e4300d54fc5c89e20c21070a0;hpb=0b311f8973ab36038f053abd2ae3ff2dd2347944 diff --git a/cinelerra-5.0/cinelerra/ffmpeg.C b/cinelerra-5.0/cinelerra/ffmpeg.C index de983a3a..2f1a1987 100644 --- a/cinelerra-5.0/cinelerra/ffmpeg.C +++ b/cinelerra-5.0/cinelerra/ffmpeg.C @@ -1339,7 +1339,13 @@ int FFMPEG::open_decoder() AVStream *st = fmt_ctx->streams[i]; if( st->duration == AV_NOPTS_VALUE ) bad_time = 1; AVCodecContext *avctx = st->codec; + const AVCodecDescriptor *codec_desc = avcodec_descriptor_get(avctx->codec_id); + if( !codec_desc ) continue; if( avctx->codec_type == AVMEDIA_TYPE_VIDEO ) { + if( avctx->width < 1 ) continue; + if( avctx->height < 1 ) continue; + AVRational framerate = av_guess_frame_rate(fmt_ctx, st, 0); + if( framerate.num < 1 ) continue; has_video = 1; FFVideoStream *vid = new FFVideoStream(this, st, i); int vidx = ffvideo.size(); @@ -1347,7 +1353,6 @@ int FFMPEG::open_decoder() ffvideo.append(vid); vid->width = avctx->width; vid->height = avctx->height; - AVRational framerate = av_guess_frame_rate(fmt_ctx, st, 0); vid->frame_rate = !framerate.den ? 0 : (double)framerate.num / framerate.den; double secs = to_secs(st->duration, st->time_base); vid->length = secs * vid->frame_rate; @@ -1358,6 +1363,8 @@ int FFMPEG::open_decoder() vid->create_filter(opt_video_filter, avctx,avctx); } else if( avctx->codec_type == AVMEDIA_TYPE_AUDIO ) { + if( avctx->channels < 1 ) continue; + if( avctx->sample_rate < 1 ) continue; has_audio = 1; FFAudioStream *aud = new FFAudioStream(this, st, i); int aidx = ffaudio.size();