avformat/mux: Rename FF_FMT_ALLOW_FLUSH->FF_OFMT_FLAG_ALLOW_FLUSH

It better reflects that this is a muxer-only flag.
Also document the flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2024-03-15 18:18:23 +01:00 committed by Paul B Mahol
parent b72c92b0d9
commit d60818308d
11 changed files with 36 additions and 28 deletions

View File

@ -800,5 +800,5 @@ const FFOutputFormat ff_pulse_muxer = {
.p.flags = AVFMT_NOFILE,
#endif
.p.priv_class = &pulse_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};

View File

@ -727,5 +727,5 @@ const FFOutputFormat ff_fifo_muxer = {
.write_packet = fifo_write_packet,
.write_trailer = fifo_write_trailer,
.deinit = fifo_deinit,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};

View File

@ -3204,7 +3204,7 @@ const FFOutputFormat ff_hls_muxer = {
.p.flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER | AVFMT_NODIMENSIONS,
#endif
.p.priv_class = &hls_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
.priv_data_size = sizeof(HLSContext),
.init = hls_init,
.write_header = hls_write_header,

View File

@ -3568,7 +3568,7 @@ const FFOutputFormat ff_matroska_muxer = {
.query_codec = mkv_query_codec,
.check_bitstream = mkv_check_bitstream,
.p.priv_class = &matroska_webm_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@ -3605,7 +3605,7 @@ const FFOutputFormat ff_webm_muxer = {
AVFMT_TS_NONSTRICT,
#endif
.p.priv_class = &matroska_webm_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@ -3635,6 +3635,6 @@ const FFOutputFormat ff_matroska_audio_muxer = {
ff_codec_wav_tags, additional_audio_tags, 0
},
.p.priv_class = &matroska_webm_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif

View File

@ -8239,7 +8239,7 @@ const FFOutputFormat ff_mov_muxer = {
},
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_TGP_MUXER
@ -8263,7 +8263,7 @@ const FFOutputFormat ff_tgp_muxer = {
.p.codec_tag = codec_3gp_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_MP4_MUXER
@ -8289,7 +8289,7 @@ const FFOutputFormat ff_mp4_muxer = {
.p.codec_tag = mp4_codec_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_PSP_MUXER
@ -8314,7 +8314,7 @@ const FFOutputFormat ff_psp_muxer = {
.p.codec_tag = mp4_codec_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_TG2_MUXER
@ -8338,7 +8338,7 @@ const FFOutputFormat ff_tg2_muxer = {
.p.codec_tag = codec_3gp_tags_list,
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_IPOD_MUXER
@ -8363,7 +8363,7 @@ const FFOutputFormat ff_ipod_muxer = {
.p.codec_tag = (const AVCodecTag* const []){ codec_ipod_tags, 0 },
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_ISMV_MUXER
@ -8389,7 +8389,7 @@ const FFOutputFormat ff_ismv_muxer = {
codec_mp4_tags, codec_ism_tags, 0 },
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_F4V_MUXER
@ -8414,7 +8414,7 @@ const FFOutputFormat ff_f4v_muxer = {
.p.codec_tag = (const AVCodecTag* const []){ codec_f4v_tags, 0 },
.check_bitstream = mov_check_bitstream,
.p.priv_class = &mov_isobmff_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
#if CONFIG_AVIF_MUXER
@ -8437,6 +8437,6 @@ const FFOutputFormat ff_avif_muxer = {
#endif
.p.codec_tag = codec_avif_tags_list,
.p.priv_class = &mov_avif_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif

View File

@ -2414,6 +2414,6 @@ const FFOutputFormat ff_mpegts_muxer = {
#else
.p.flags = AVFMT_VARIABLE_FPS | AVFMT_NODIMENSIONS,
#endif
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
.p.priv_class = &mpegts_muxer_class,
};

View File

@ -1208,10 +1208,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *in)
if (!in) {
#if FF_API_ALLOW_FLUSH || LIBAVFORMAT_VERSION_MAJOR >= 61
// Hint: The pulse audio output device has this set,
// so we can't switch the check to FF_FMT_ALLOW_FLUSH immediately.
// so we can't switch the check to FF_OFMT_FLAG_ALLOW_FLUSH immediately.
if (s->oformat->flags & AVFMT_ALLOW_FLUSH) {
#else
if (ffofmt(s->oformat)->flags_internal & FF_FMT_ALLOW_FLUSH) {
if (ffofmt(s->oformat)->flags_internal & FF_OFMT_FLAG_ALLOW_FLUSH) {
#endif
ret = ffofmt(s->oformat)->write_packet(s, NULL);
flush_if_needed(s);

View File

@ -27,7 +27,15 @@
struct AVDeviceInfoList;
#define FF_FMT_ALLOW_FLUSH (1 << 1)
/**
* This flag indicates that the muxer stores data internally
* and supports flushing it. Flushing is signalled by sending
* a NULL packet to the muxer's write_packet callback;
* without this flag, a muxer never receives NULL packets.
* So the documentation of write_packet below for the semantics
* of the return value in case of flushing.
*/
#define FF_OFMT_FLAG_ALLOW_FLUSH (1 << 1)
typedef struct FFOutputFormat {
/**
@ -40,13 +48,13 @@ typedef struct FFOutputFormat {
int priv_data_size;
/**
* Internal flags. See FF_FMT_* in internal.h and mux.h.
* Internal flags. See FF_OFMT_FLAG_* above and FF_FMT_FLAG_* in internal.h.
*/
int flags_internal;
int (*write_header)(AVFormatContext *);
/**
* Write a packet. If FF_FMT_ALLOW_FLUSH is set in flags_internal,
* Write a packet. If FF_OFMT_FLAG_ALLOW_FLUSH is set in flags_internal,
* pkt can be NULL in order to flush data buffered in the muxer.
* When flushing, return 0 if there still is more data to flush,
* or 1 if everything was flushed and there is no more buffered

View File

@ -776,7 +776,7 @@ const FFOutputFormat ff_ogg_muxer = {
.p.flags = AVFMT_TS_NEGATIVE | AVFMT_TS_NONSTRICT,
#endif
.p.priv_class = &ogg_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@ -799,7 +799,7 @@ const FFOutputFormat ff_oga_muxer = {
.p.flags = AVFMT_TS_NEGATIVE,
#endif
.p.priv_class = &ogg_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@ -825,7 +825,7 @@ const FFOutputFormat ff_ogv_muxer = {
.p.flags = AVFMT_TS_NEGATIVE | AVFMT_TS_NONSTRICT,
#endif
.p.priv_class = &ogg_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@ -848,7 +848,7 @@ const FFOutputFormat ff_spx_muxer = {
.p.flags = AVFMT_TS_NEGATIVE,
#endif
.p.priv_class = &ogg_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif
@ -871,6 +871,6 @@ const FFOutputFormat ff_opus_muxer = {
.p.flags = AVFMT_TS_NEGATIVE,
#endif
.p.priv_class = &ogg_muxer_class,
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};
#endif

View File

@ -613,5 +613,5 @@ const FFOutputFormat ff_tee_muxer = {
#else
.p.flags = AVFMT_NOFILE | AVFMT_TS_NEGATIVE,
#endif
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};

View File

@ -159,7 +159,7 @@ const FFOutputFormat ff_fifo_test_muxer = {
#else
.p.flags = AVFMT_NOFILE,
#endif
.flags_internal = FF_FMT_ALLOW_FLUSH,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
};