mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-23 11:29:03 +00:00
ffmpeg: check encoder earlier.
Fixes a segfault with Ogg output, libtheora not compiled in and no codec specified.
This commit is contained in:
parent
044f7275d3
commit
34c426be4a
12
ffmpeg.c
12
ffmpeg.c
@ -3013,6 +3013,12 @@ static int transcode_init(void)
|
|||||||
} else {
|
} else {
|
||||||
if (!ost->enc)
|
if (!ost->enc)
|
||||||
ost->enc = avcodec_find_encoder(codec->codec_id);
|
ost->enc = avcodec_find_encoder(codec->codec_id);
|
||||||
|
if (!ost->enc) {
|
||||||
|
snprintf(error, sizeof(error), "Encoder (codec %s) not found for output stream #%d:%d",
|
||||||
|
avcodec_get_name(ost->st->codec->codec_id), ost->file_index, ost->index);
|
||||||
|
ret = AVERROR(EINVAL);
|
||||||
|
goto dump_format;
|
||||||
|
}
|
||||||
|
|
||||||
if (ist)
|
if (ist)
|
||||||
ist->decoding_needed = 1;
|
ist->decoding_needed = 1;
|
||||||
@ -3154,12 +3160,6 @@ static int transcode_init(void)
|
|||||||
if (ost->encoding_needed) {
|
if (ost->encoding_needed) {
|
||||||
AVCodec *codec = ost->enc;
|
AVCodec *codec = ost->enc;
|
||||||
AVCodecContext *dec = NULL;
|
AVCodecContext *dec = NULL;
|
||||||
if (!codec) {
|
|
||||||
snprintf(error, sizeof(error), "Encoder (codec %s) not found for output stream #%d:%d",
|
|
||||||
avcodec_get_name(ost->st->codec->codec_id), ost->file_index, ost->index);
|
|
||||||
ret = AVERROR(EINVAL);
|
|
||||||
goto dump_format;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ist = get_input_stream(ost)))
|
if ((ist = get_input_stream(ost)))
|
||||||
dec = ist->st->codec;
|
dec = ist->st->codec;
|
||||||
|
Loading…
Reference in New Issue
Block a user