forked from FFmpeg/FFmpeg
avformat/rawdec: Deduplicate AVClasses based upon ff_raw_options
The child_class_next API relied on different (de)muxers to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
168565ce44
commit
6a055bf036
14 changed files with 27 additions and 57 deletions
|
@ -102,7 +102,6 @@ static int ac3_probe(const AVProbeData *p)
|
|||
return ac3_eac3_probe(p, AV_CODEC_ID_AC3);
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(ac3)
|
||||
const AVInputFormat ff_ac3_demuxer = {
|
||||
.name = "ac3",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw AC-3"),
|
||||
|
@ -113,7 +112,7 @@ const AVInputFormat ff_ac3_demuxer = {
|
|||
.extensions = "ac3",
|
||||
.raw_codec_id = AV_CODEC_ID_AC3,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &ac3_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -123,7 +122,6 @@ static int eac3_probe(const AVProbeData *p)
|
|||
return ac3_eac3_probe(p, AV_CODEC_ID_EAC3);
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(eac3)
|
||||
const AVInputFormat ff_eac3_demuxer = {
|
||||
.name = "eac3",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
|
||||
|
@ -134,6 +132,6 @@ const AVInputFormat ff_eac3_demuxer = {
|
|||
.extensions = "eac3",
|
||||
.raw_codec_id = AV_CODEC_ID_EAC3,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &eac3_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -60,7 +60,6 @@ static int acm_read_header(AVFormatContext *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(acm)
|
||||
const AVInputFormat ff_acm_demuxer = {
|
||||
.name = "acm",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Interplay ACM"),
|
||||
|
@ -71,5 +70,5 @@ const AVInputFormat ff_acm_demuxer = {
|
|||
.extensions = "acm",
|
||||
.raw_codec_id = AV_CODEC_ID_INTERPLAY_ACM,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &acm_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -132,7 +132,6 @@ static int dts_probe(const AVProbeData *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(dts)
|
||||
const AVInputFormat ff_dts_demuxer = {
|
||||
.name = "dts",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw DTS"),
|
||||
|
@ -143,4 +142,5 @@ const AVInputFormat ff_dts_demuxer = {
|
|||
.extensions = "dts",
|
||||
.raw_codec_id = AV_CODEC_ID_DTS,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &dts_demuxer_class,};
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -328,7 +328,6 @@ static int flac_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
|
|||
return -1;
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(flac)
|
||||
const AVInputFormat ff_flac_demuxer = {
|
||||
.name = "flac",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw FLAC"),
|
||||
|
@ -341,5 +340,5 @@ const AVInputFormat ff_flac_demuxer = {
|
|||
.extensions = "flac",
|
||||
.raw_codec_id = AV_CODEC_ID_FLAC,
|
||||
.priv_data_size = sizeof(FLACDecContext),
|
||||
.priv_class = &flac_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -46,7 +46,6 @@ static int g722_read_header(AVFormatContext *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(g722)
|
||||
const AVInputFormat ff_g722_demuxer = {
|
||||
.name = "g722",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
|
||||
|
@ -56,4 +55,5 @@ const AVInputFormat ff_g722_demuxer = {
|
|||
.extensions = "g722,722",
|
||||
.raw_codec_id = AV_CODEC_ID_ADPCM_G722,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &g722_demuxer_class,};
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -68,13 +68,6 @@ static int ipu_read_header(AVFormatContext *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const AVClass ipu_demuxer_class = {
|
||||
.class_name = "ipu demuxer",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_raw_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVInputFormat ff_ipu_demuxer = {
|
||||
.name = "ipu",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw IPU Video"),
|
||||
|
@ -85,5 +78,5 @@ const AVInputFormat ff_ipu_demuxer = {
|
|||
.flags = AVFMT_GENERIC_INDEX,
|
||||
.raw_codec_id = AV_CODEC_ID_IPU,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &ipu_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -83,7 +83,6 @@ static int loas_read_header(AVFormatContext *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(loas)
|
||||
const AVInputFormat ff_loas_demuxer = {
|
||||
.name = "loas",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("LOAS AudioSyncStream"),
|
||||
|
@ -93,5 +92,5 @@ const AVInputFormat ff_loas_demuxer = {
|
|||
.flags= AVFMT_GENERIC_INDEX,
|
||||
.raw_codec_id = AV_CODEC_ID_AAC_LATM,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &loas_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -56,7 +56,6 @@ static int mlp_probe(const AVProbeData *p)
|
|||
return mlp_thd_probe(p, 0xf8726fbb);
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(mlp)
|
||||
const AVInputFormat ff_mlp_demuxer = {
|
||||
.name = "mlp",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw MLP"),
|
||||
|
@ -67,7 +66,7 @@ const AVInputFormat ff_mlp_demuxer = {
|
|||
.extensions = "mlp",
|
||||
.raw_codec_id = AV_CODEC_ID_MLP,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &mlp_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -77,7 +76,6 @@ static int thd_probe(const AVProbeData *p)
|
|||
return mlp_thd_probe(p, 0xf8726fba);
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(truehd)
|
||||
const AVInputFormat ff_truehd_demuxer = {
|
||||
.name = "truehd",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
|
||||
|
@ -88,7 +86,7 @@ const AVInputFormat ff_truehd_demuxer = {
|
|||
.extensions = "thd",
|
||||
.raw_codec_id = AV_CODEC_ID_TRUEHD,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &truehd_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -125,14 +125,19 @@ const AVOption ff_rawvideo_options[] = {
|
|||
};
|
||||
#undef OFFSET
|
||||
#define OFFSET(x) offsetof(FFRawDemuxerContext, x)
|
||||
const AVOption ff_raw_options[] = {
|
||||
static const AVOption raw_options[] = {
|
||||
{ "raw_packet_size", "", OFFSET(raw_packet_size), AV_OPT_TYPE_INT, {.i64 = RAW_PACKET_SIZE }, 1, INT_MAX, DEC},
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
#if CONFIG_DATA_DEMUXER
|
||||
FF_RAW_DEMUXER_CLASS(raw_data)
|
||||
const AVClass ff_raw_demuxer_class = {
|
||||
.class_name = "generic raw demuxer",
|
||||
.item_name = av_default_item_name,
|
||||
.option = raw_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
#if CONFIG_DATA_DEMUXER
|
||||
const AVInputFormat ff_data_demuxer = {
|
||||
.name = "data",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw data"),
|
||||
|
@ -141,7 +146,7 @@ const AVInputFormat ff_data_demuxer = {
|
|||
.raw_codec_id = AV_CODEC_ID_NONE,
|
||||
.flags = AVFMT_NOTIMESTAMPS,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),\
|
||||
.priv_class = &raw_data_demuxer_class,\
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef struct FFRawDemuxerContext {
|
|||
} FFRawDemuxerContext;
|
||||
|
||||
extern const AVOption ff_rawvideo_options[];
|
||||
extern const AVOption ff_raw_options[];
|
||||
extern const AVClass ff_raw_demuxer_class;
|
||||
|
||||
int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt);
|
||||
|
||||
|
@ -52,14 +52,6 @@ int ff_raw_subtitle_read_header(AVFormatContext *s);
|
|||
|
||||
int ff_raw_data_read_header(AVFormatContext *s);
|
||||
|
||||
#define FF_RAW_DEMUXER_CLASS(name)\
|
||||
static const AVClass name ## _demuxer_class = {\
|
||||
.class_name = #name " demuxer",\
|
||||
.item_name = av_default_item_name,\
|
||||
.option = ff_raw_options,\
|
||||
.version = LIBAVUTIL_VERSION_INT,\
|
||||
};
|
||||
|
||||
#define FF_RAWVIDEO_DEMUXER_CLASS(name)\
|
||||
static const AVClass name ## _demuxer_class = {\
|
||||
.class_name = #name " demuxer",\
|
||||
|
@ -86,16 +78,7 @@ const AVInputFormat ff_ ## shortname ## _demuxer = {\
|
|||
#define FF_DEF_RAWVIDEO_DEMUXER(shortname, longname, probe, ext, id)\
|
||||
FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, AVFMT_GENERIC_INDEX)
|
||||
|
||||
#define FF_RAWSUB_DEMUXER_CLASS(name)\
|
||||
static const AVClass name ## _demuxer_class = {\
|
||||
.class_name = #name " demuxer",\
|
||||
.item_name = av_default_item_name,\
|
||||
.option = ff_raw_options,\
|
||||
.version = LIBAVUTIL_VERSION_INT,\
|
||||
};
|
||||
|
||||
#define FF_DEF_RAWSUB_DEMUXER(shortname, longname, probe, ext, id, flag)\
|
||||
FF_RAWSUB_DEMUXER_CLASS(shortname)\
|
||||
const AVInputFormat ff_ ## shortname ## _demuxer = {\
|
||||
.name = #shortname,\
|
||||
.long_name = NULL_IF_CONFIG_SMALL(longname),\
|
||||
|
@ -106,7 +89,7 @@ const AVInputFormat ff_ ## shortname ## _demuxer = {\
|
|||
.flags = flag,\
|
||||
.raw_codec_id = id,\
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),\
|
||||
.priv_class = &shortname ## _demuxer_class,\
|
||||
.priv_class = &ff_raw_demuxer_class,\
|
||||
};
|
||||
|
||||
#endif /* AVFORMAT_RAWDEC_H */
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "avformat.h"
|
||||
#include "rawdec.h"
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(sbc)
|
||||
const AVInputFormat ff_sbc_demuxer = {
|
||||
.name = "sbc",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw SBC (low-complexity subband codec)"),
|
||||
|
@ -32,5 +31,5 @@ const AVInputFormat ff_sbc_demuxer = {
|
|||
.read_packet = ff_raw_read_partial_packet,
|
||||
.flags = AVFMT_GENERIC_INDEX,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &sbc_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -65,7 +65,6 @@ static int shn_probe(const AVProbeData *p)
|
|||
return AVPROBE_SCORE_EXTENSION + 1;
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(shorten)
|
||||
const AVInputFormat ff_shorten_demuxer = {
|
||||
.name = "shn",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw Shorten"),
|
||||
|
@ -76,5 +75,5 @@ const AVInputFormat ff_shorten_demuxer = {
|
|||
.extensions = "shn",
|
||||
.raw_codec_id = AV_CODEC_ID_SHORTEN,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &shorten_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -212,7 +212,6 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||
return ret;
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(tak)
|
||||
const AVInputFormat ff_tak_demuxer = {
|
||||
.name = "tak",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw TAK"),
|
||||
|
@ -223,5 +222,5 @@ const AVInputFormat ff_tak_demuxer = {
|
|||
.flags = AVFMT_GENERIC_INDEX,
|
||||
.extensions = "tak",
|
||||
.raw_codec_id = AV_CODEC_ID_TAK,
|
||||
.priv_class = &tak_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
|
@ -161,7 +161,6 @@ static int wsd_read_header(AVFormatContext *s)
|
|||
return avio_seek(pb, data_offset, SEEK_SET);
|
||||
}
|
||||
|
||||
FF_RAW_DEMUXER_CLASS(wsd)
|
||||
const AVInputFormat ff_wsd_demuxer = {
|
||||
.name = "wsd",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Wideband Single-bit Data (WSD)"),
|
||||
|
@ -172,5 +171,5 @@ const AVInputFormat ff_wsd_demuxer = {
|
|||
.flags = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
|
||||
.raw_codec_id = AV_CODEC_ID_DSD_MSBF,
|
||||
.priv_data_size = sizeof(FFRawDemuxerContext),
|
||||
.priv_class = &wsd_demuxer_class,
|
||||
.priv_class = &ff_raw_demuxer_class,
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue