| 2393 | } |
| 2394 | |
| 2395 | static const AVCodec *get_decoder_for_stream(AVFormatContext *fmt_ctx, AVStream *stream) |
| 2396 | { |
| 2397 | const AVCodec *codec = NULL; |
| 2398 | switch (stream->codecpar->codec_type) { |
| 2399 | case AVMEDIA_TYPE_VIDEO: codec = fmt_ctx->video_codec; break; |
| 2400 | case AVMEDIA_TYPE_AUDIO: codec = fmt_ctx->audio_codec; break; |
| 2401 | case AVMEDIA_TYPE_SUBTITLE: codec = fmt_ctx->subtitle_codec; break; |
| 2402 | case AVMEDIA_TYPE_DATA: codec = fmt_ctx->data_codec; break; |
| 2403 | } |
| 2404 | |
| 2405 | if (codec != NULL) |
| 2406 | return codec; |
| 2407 | |
| 2408 | if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) { |
| 2409 | av_log(NULL, AV_LOG_WARNING, |
| 2410 | "Failed to probe codec for input stream %d\n", stream->index); |
| 2411 | return NULL; |
| 2412 | } |
| 2413 | |
| 2414 | codec = avcodec_find_decoder(stream->codecpar->codec_id); |
| 2415 | if (codec == NULL) { |
| 2416 | av_log(NULL, AV_LOG_WARNING, |
| 2417 | "Unsupported codec with id %d for input stream %d\n", |
| 2418 | stream->codecpar->codec_id, stream->index); |
| 2419 | return NULL; |
| 2420 | } |
| 2421 | |
| 2422 | return codec; |
| 2423 | } |
| 2424 | |
| 2425 | static int open_input_file(InputFile *ifile, const char *filename, |
| 2426 | const char *print_filename) |
no test coverage detected