avformat/matroskaenc: Only compile functions when needed

Fixes unused function warnings in case e.g. the WebM muxer is disabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-20 09:39:04 +02:00
parent 201b8a4d67
commit 88b3e31562
1 changed files with 25 additions and 27 deletions

View File

@ -2632,33 +2632,6 @@ after_cues:
return ret2;
}
static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
{
int i;
for (i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_codec_tags[i].id == codec_id)
return 1;
if (std_compliance < FF_COMPLIANCE_NORMAL) {
enum AVMediaType type = avcodec_get_type(codec_id);
// mkv theoretically supports any video/audio through VFW/ACM
if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
return 1;
}
return 0;
}
static int webm_query_codec(enum AVCodecID codec_id, int std_compliance)
{
int i;
for (i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_webm_codec_tags[i].id == codec_id)
return 1;
return 0;
}
static uint64_t mkv_get_uid(const mkv_track *tracks, int i, AVLFG *c)
{
while (1) {
@ -2833,6 +2806,22 @@ static const AVClass matroska_webm_class = {
};
#if CONFIG_MATROSKA_MUXER
static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
{
for (int i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_codec_tags[i].id == codec_id)
return 1;
if (std_compliance < FF_COMPLIANCE_NORMAL) {
enum AVMediaType type = avcodec_get_type(codec_id);
// mkv theoretically supports any video/audio through VFW/ACM
if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
return 1;
}
return 0;
}
const AVOutputFormat ff_matroska_muxer = {
.name = "matroska",
.long_name = NULL_IF_CONFIG_SMALL("Matroska"),
@ -2862,6 +2851,15 @@ const AVOutputFormat ff_matroska_muxer = {
#endif
#if CONFIG_WEBM_MUXER
static int webm_query_codec(enum AVCodecID codec_id, int std_compliance)
{
for (int i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_webm_codec_tags[i].id == codec_id)
return 1;
return 0;
}
const AVOutputFormat ff_webm_muxer = {
.name = "webm",
.long_name = NULL_IF_CONFIG_SMALL("WebM"),