This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 70d84bdd8472124e65fb7f80cb6116ea2b252cef Author: James Almer <[email protected]> AuthorDate: Mon Jan 5 23:50:41 2026 -0300 Commit: James Almer <[email protected]> CommitDate: Wed Jan 7 20:25:17 2026 -0300 avformat/demux: use a stream specific temporary packet for the parser This will be useful for the next commit. Signed-off-by: James Almer <[email protected]> --- libavformat/avformat.c | 2 ++ libavformat/demux.c | 2 +- libavformat/internal.h | 15 +++++++++++++++ libavformat/options.c | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.c b/libavformat/avformat.c index 18ca4643ee..ee3f7ee1b2 100644 --- a/libavformat/avformat.c +++ b/libavformat/avformat.c @@ -59,6 +59,8 @@ void ff_free_stream(AVStream **pst) av_freep(&sti->index_entries); av_freep(&sti->probe_data.buf); + av_packet_free(&sti->parse_pkt); + av_bsf_free(&sti->extract_extradata.bsf); if (sti->info) { diff --git a/libavformat/demux.c b/libavformat/demux.c index b40739dc3a..89b947730b 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -1175,9 +1175,9 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, { FormatContextInternal *const fci = ff_fc_internal(s); FFFormatContext *const si = &fci->fc; - AVPacket *out_pkt = si->parse_pkt; AVStream *st = s->streams[stream_index]; FFStream *const sti = ffstream(st); + AVPacket *out_pkt = sti->parse_pkt; const AVPacketSideData *sd = NULL; const uint8_t *data = pkt->data; uint8_t *extradata = sti->avctx->extradata; diff --git a/libavformat/internal.h b/libavformat/internal.h index 245f6eeb86..64452cce6e 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -314,6 +314,21 @@ typedef struct FFStream { enum AVStreamParseType need_parsing; struct AVCodecParserContext *parser; + /** + * The generic code uses this as a temporary packet + * to parse packets or for muxing, especially flushing. + * For demuxers, it may also be used for other means + * for short periods that are guaranteed not to overlap + * with calls to av_read_frame() (or ff_read_packet()) + * or with each other. + * It may be used by demuxers as a replacement for + * stack packets (unless they call one of the aforementioned + * functions with their own AVFormatContext). + * Every user has to ensure that this packet is blank + * after using it. + */ + AVPacket *parse_pkt; + /** * Number of frames that have been demuxed during avformat_find_stream_info() */ diff --git a/libavformat/options.c b/libavformat/options.c index 7e4130b405..28aa2da942 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -270,6 +270,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) sti->fmtctx = s; + sti->parse_pkt = av_packet_alloc(); + if (!sti->parse_pkt) + goto fail; + if (s->iformat) { sti->avctx = avcodec_alloc_context3(NULL); if (!sti->avctx) _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
