lavf: add avformat_query_codec().

It allows to check if a given codec can be written into a container.
This commit is contained in:
Anton Khirnov
2011-08-11 20:34:45 +02:00
parent bca06e77e1
commit 48f9e457ea
3 changed files with 35 additions and 0 deletions

View File

@@ -3904,3 +3904,17 @@ int64_t ff_iso8601_to_unix_time(const char *datestr)
return 0;
#endif
}
int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance)
{
if (ofmt) {
if (ofmt->query_codec)
return ofmt->query_codec(codec_id, std_compliance);
else if (ofmt->codec_tag)
return !!av_codec_get_tag(ofmt->codec_tag, codec_id);
else if (codec_id == ofmt->video_codec || codec_id == ofmt->audio_codec ||
codec_id == ofmt->subtitle_codec)
return 1;
}
return AVERROR_PATCHWELCOME;
}