1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat: Make init function out of write_header functions if possible

Also mark them as av_cold while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-03-20 00:51:30 +01:00
parent 37f0dbbc39
commit 073251316e
5 changed files with 10 additions and 10 deletions

View File

@ -125,7 +125,7 @@ const FFInputFormat ff_bit_demuxer = {
#endif #endif
#if CONFIG_BIT_MUXER #if CONFIG_BIT_MUXER
static int write_header(AVFormatContext *s) static av_cold int init(AVFormatContext *s)
{ {
AVCodecParameters *par = s->streams[0]->codecpar; AVCodecParameters *par = s->streams[0]->codecpar;
@ -170,7 +170,7 @@ const FFOutputFormat ff_bit_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE, .p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH | .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS, FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = write_header, .init = init,
.write_packet = write_packet, .write_packet = write_packet,
}; };
#endif #endif

View File

@ -58,7 +58,7 @@ static void deinit(AVFormatContext *s)
} }
} }
static int write_header(AVFormatContext *s) static av_cold int init(AVFormatContext *s)
{ {
ChromaprintMuxContext *cpr = s->priv_data; ChromaprintMuxContext *cpr = s->priv_data;
AVStream *st; AVStream *st;
@ -181,7 +181,7 @@ const FFOutputFormat ff_chromaprint_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE, .p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH | .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS, FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = write_header, .init = init,
.write_packet = write_packet, .write_packet = write_packet,
.write_trailer = write_trailer, .write_trailer = write_trailer,
.deinit = deinit, .deinit = deinit,

View File

@ -32,7 +32,7 @@
#define RAND_TAG MKBETAG('R','a','n','d') #define RAND_TAG MKBETAG('R','a','n','d')
static int write_header(AVFormatContext *s) static av_cold int init(AVFormatContext *s)
{ {
if (s->streams[0]->codecpar->format != AV_PIX_FMT_RGBA) { if (s->streams[0]->codecpar->format != AV_PIX_FMT_RGBA) {
av_log(s, AV_LOG_ERROR, "only AV_PIX_FMT_RGBA is supported\n"); av_log(s, AV_LOG_ERROR, "only AV_PIX_FMT_RGBA is supported\n");
@ -69,7 +69,7 @@ const FFOutputFormat ff_filmstrip_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE, .p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH | .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS, FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = write_header, .init = init,
.write_packet = ff_raw_write_packet, .write_packet = ff_raw_write_packet,
.write_trailer = write_trailer, .write_trailer = write_trailer,
}; };

View File

@ -40,7 +40,7 @@ typedef struct GIFContext {
AVPacket *prev_pkt; AVPacket *prev_pkt;
} GIFContext; } GIFContext;
static int gif_write_header(AVFormatContext *s) static av_cold int gif_init(AVFormatContext *s)
{ {
avpriv_set_pts_info(s->streams[0], 64, 1, 100); avpriv_set_pts_info(s->streams[0], 64, 1, 100);
@ -208,7 +208,7 @@ const FFOutputFormat ff_gif_muxer = {
.p.subtitle_codec = AV_CODEC_ID_NONE, .p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH | .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS, FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
.write_header = gif_write_header, .init = gif_init,
.write_packet = gif_write_packet, .write_packet = gif_write_packet,
.write_trailer = gif_write_trailer, .write_trailer = gif_write_trailer,
.p.priv_class = &gif_muxer_class, .p.priv_class = &gif_muxer_class,

View File

@ -72,7 +72,7 @@ static int sup_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0; return 0;
} }
static int sup_write_header(AVFormatContext *s) static av_cold int sup_init(AVFormatContext *s)
{ {
avpriv_set_pts_info(s->streams[0], 32, 1, 90000); avpriv_set_pts_info(s->streams[0], 32, 1, 90000);
@ -89,6 +89,6 @@ const FFOutputFormat ff_sup_muxer = {
.p.subtitle_codec = AV_CODEC_ID_HDMV_PGS_SUBTITLE, .p.subtitle_codec = AV_CODEC_ID_HDMV_PGS_SUBTITLE,
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT, .p.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH, .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
.write_header = sup_write_header, .init = sup_init,
.write_packet = sup_write_packet, .write_packet = sup_write_packet,
}; };