diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-08-11 20:34:45 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-08-16 20:24:20 +0200 |
commit | 48f9e457ea0143e14b04f7ae9cc5358904f9475a (patch) | |
tree | bc39e61a4f1e3241c698221fcfbefcd2752e504a /libavformat/utils.c | |
parent | bca06e77e1b07f1dab04c3b9fef6fdcb62b4a401 (diff) | |
download | ffmpeg-48f9e457ea0143e14b04f7ae9cc5358904f9475a.tar.gz |
lavf: add avformat_query_codec().
It allows to check if a given codec can be written into a container.
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index b848ebb827..6e3cb2fa54 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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; +} |