mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
avconv: fix a segfault when default encoder for a format doesn't exist.
Fail earlier and with a more descriptive error message.
This commit is contained in:
parent
b5c3f0b994
commit
2994913d70
18
avconv.c
18
avconv.c
@ -2684,8 +2684,16 @@ static int transcode_init(void)
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!ost->enc)
|
if (!ost->enc) {
|
||||||
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
|
/* should only happen when a default codec is not present. */
|
||||||
|
snprintf(error, sizeof(error), "Automatic encoder selection "
|
||||||
|
"failed for output stream #%d:%d. Default encoder for "
|
||||||
|
"format %s is probably disabled. Please choose an "
|
||||||
|
"encoder manually.\n", ost->file_index, ost->index,
|
||||||
|
oc->oformat->name);
|
||||||
|
ret = AVERROR(EINVAL);
|
||||||
|
goto dump_format;
|
||||||
|
}
|
||||||
|
|
||||||
if (ist)
|
if (ist)
|
||||||
ist->decoding_needed = 1;
|
ist->decoding_needed = 1;
|
||||||
@ -2819,12 +2827,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 id %d) not found for output stream #%d:%d",
|
|
||||||
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…
x
Reference in New Issue
Block a user