avformat/mux: Add flag for "only default codecs allowed"

AVOutputFormat has default codecs for audio, video and subtitle
and often these are the only codecs of this type allowed.
So add a flag to AVOutputFormat so that this can be checked generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2024-03-19 23:28:36 +01:00
parent 03b04eef72
commit a24bccc238
27 changed files with 72 additions and 169 deletions

View File

@@ -31,16 +31,6 @@ typedef struct WvMuxContext {
int64_t samples;
} WvMuxContext;
static av_cold int wv_init(AVFormatContext *ctx)
{
if (ctx->streams[0]->codecpar->codec_id != AV_CODEC_ID_WAVPACK) {
av_log(ctx, AV_LOG_ERROR, "This muxer only supports a single WavPack stream.\n");
return AVERROR(EINVAL);
}
return 0;
}
static int wv_write_packet(AVFormatContext *ctx, AVPacket *pkt)
{
WvMuxContext *s = ctx->priv_data;
@@ -85,9 +75,9 @@ const FFOutputFormat ff_wv_muxer = {
.p.audio_codec = AV_CODEC_ID_WAVPACK,
.p.video_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_NONE,
.init = wv_init,
.write_packet = wv_write_packet,
.write_trailer = wv_write_trailer,
.p.flags = AVFMT_NOTIMESTAMPS,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
};