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 | 1371 | if (!av_dict_get(ist->opts, "threads", NULL, 0)) |
| 1372 | 1372 | av_dict_set(&ist->opts, "threads", "auto", 0); |
| 1373 | 1373 | if ((ret = avcodec_open2(ist->st->codec, codec, &ist->opts)) < 0) { |
| 1374 | + char errbuf[128]; | |
| 1374 | 1375 | if (ret == AVERROR_EXPERIMENTAL) |
| 1375 | 1376 | abort_codec_experimental(codec, 0); |
| 1376 | − snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d", | |
| 1377 | − ist->file_index, ist->st->index); | |
| 1377 | + | |
| 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 | 1384 | return ret; |
| 1379 | 1385 | } |
| 1380 | 1386 | assert_avoptions(ist->opts); |