External codec may have corner case reason to fail at init, better report them instead having the user wonder.
Unified · Split
| @@ -1371,10 +1371,16 @@ static int init_input_stream(int ist_index, char *error, int error_len) · 1370 unmodified lines | |||
| 1371 | if (!av_dict_get(ist->opts, "threads", NULL, 0)) | 1371 | if (!av_dict_get(ist->opts, "threads", NULL, 0)) |
| 1372 | av_dict_set(&ist->opts, "threads", "auto", 0); | 1372 | av_dict_set(&ist->opts, "threads", "auto", 0); |
| 1373 | if ((ret = avcodec_open2(ist->st->codec, codec, &ist->opts)) < 0) { | 1373 | if ((ret = avcodec_open2(ist->st->codec, codec, &ist->opts)) < 0) { |
| 1374 | char errbuf[128]; | ||
| 1374 | if (ret == AVERROR_EXPERIMENTAL) | 1375 | if (ret == AVERROR_EXPERIMENTAL) |
| 1375 | abort_codec_experimental(codec, 0); | 1376 | abort_codec_experimental(codec, 0); |
| 1376 | snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d", | 1377 | |
| 1377 | ist->file_index, ist->st->index); | 1378 | av_strerror(ret, errbuf, sizeof(errbuf)); |
| 1379 | |||
| 1380 | snprintf(error, error_len, | ||
| 1381 | "Error while opening decoder for input stream " | ||
| 1382 | "#%d:%d : %s", | ||
| 1383 | ist->file_index, ist->st->index, errbuf); | ||
| 1378 | return ret; | 1384 | return ret; |
| 1379 | } | 1385 | } |
| 1380 | assert_avoptions(ist->opts); | 1386 | assert_avoptions(ist->opts); |