This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new dc4c798970 avformat: Use ff_*_muxer directly
dc4c798970 is described below

commit dc4c7989704a204dc81eb381261dd5be59930cdb
Author:     Jack Lau <[email protected]>
AuthorDate: Mon Feb 23 07:54:18 2026 +0800
Commit:     Jack Lau <[email protected]>
CommitDate: Wed Feb 25 02:55:43 2026 +0000

    avformat: Use ff_*_muxer directly
    
    These muxers already set hard dependencies in
    configure so they cannot be enabled unless the
    dependencies are enabled.
    
    So these error handling is unreachable.
    
    Directly Using ff_*_muxer is simpler than calling
    av_guess_format()
    
    Refer to 289cb3beff
    
    Signed-off-by: Jack Lau <[email protected]>
---
 libavformat/hdsenc.c             |  9 +++------
 libavformat/hlsenc.c             | 14 +++++++-------
 libavformat/rtpenc_mpegts.c      | 11 +++++------
 libavformat/smoothstreamingenc.c |  9 +++------
 libavformat/webm_chunk.c         |  8 +++-----
 libavformat/whip.c               | 11 ++++-------
 6 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index 01efa1f8da..d3292a8342 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -29,6 +29,7 @@
 #include "mux.h"
 #include "os_support.h"
 
+#include "libavutil/attributes_internal.h"
 #include "libavutil/avstring.h"
 #include "libavutil/base64.h"
 #include "libavutil/intreadwrite.h"
@@ -311,7 +312,6 @@ static void close_file(AVFormatContext *s, OutputStream *os)
 static int hds_write_header(AVFormatContext *s)
 {
     HDSContext *c = s->priv_data;
-    const AVOutputFormat *oformat;
     int ret = 0, i;
 
     if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {
@@ -319,10 +319,6 @@ static int hds_write_header(AVFormatContext *s)
         return AVERROR(errno);
     }
 
-    oformat = av_guess_format("flv", NULL, NULL);
-    if (!oformat) {
-        return AVERROR_MUXER_NOT_FOUND;
-    }
 
     c->streams = av_calloc(s->nb_streams, sizeof(*c->streams));
     if (!c->streams) {
@@ -363,7 +359,8 @@ static int hds_write_header(AVFormatContext *s)
                 return AVERROR(ENOMEM);
             }
             os->ctx = ctx;
-            ctx->oformat = oformat;
+            EXTERN const FFOutputFormat ff_flv_muxer;
+            ctx->oformat = &ff_flv_muxer.p;
             ctx->interrupt_callback = s->interrupt_callback;
             ctx->flags = s->flags;
 
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index dcf5da9bb8..957b9a5ddd 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #endif
 
+#include "libavutil/attributes_internal.h"
 #include "libavutil/avassert.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/avstring.h"
@@ -2972,12 +2973,12 @@ static int hls_init(AVFormatContext *s)
         if (vs->has_video > 1)
             av_log(s, AV_LOG_WARNING, "More than a single video stream 
present, expect issues decoding it.\n");
         if (hls->segment_type == SEGMENT_TYPE_FMP4) {
-            vs->oformat = av_guess_format("mp4", NULL, NULL);
+            EXTERN const FFOutputFormat ff_mp4_muxer;
+            vs->oformat = &ff_mp4_muxer.p;
         } else {
-            vs->oformat = av_guess_format("mpegts", NULL, NULL);
+            EXTERN const FFOutputFormat ff_mpegts_muxer;
+            vs->oformat = &ff_mpegts_muxer.p;
         }
-        if (!vs->oformat)
-            return AVERROR_MUXER_NOT_FOUND;
 
         if (hls->segment_filename) {
             ret = format_name(hls->segment_filename, &vs->basename, i, 
vs->varname);
@@ -3054,9 +3055,8 @@ static int hls_init(AVFormatContext *s)
             return ret;
 
         if (vs->has_subtitle) {
-            vs->vtt_oformat = av_guess_format("webvtt", NULL, NULL);
-            if (!vs->vtt_oformat)
-                return AVERROR_MUXER_NOT_FOUND;
+            EXTERN const FFOutputFormat ff_webvtt_muxer;
+            vs->vtt_oformat = &ff_webvtt_muxer.p;
 
             p = strrchr(vs->m3u8_name, '.');
             if (p)
diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c
index f9ff7e99cd..897db10f76 100644
--- a/libavformat/rtpenc_mpegts.c
+++ b/libavformat/rtpenc_mpegts.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/attributes_internal.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
@@ -58,22 +59,19 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
 {
     MuxChain *chain = s->priv_data;
     AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL;
-    const AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, 
NULL);
-    const AVOutputFormat *rtp_format    = av_guess_format("rtp", NULL, NULL);
     int i, ret = AVERROR(ENOMEM);
     AVStream *st;
     AVDictionary *mpegts_muxer_options = NULL;
     AVDictionary *rtp_muxer_options = NULL;
 
-    if (!mpegts_format || !rtp_format)
-        return AVERROR(ENOSYS);
     mpegts_ctx = avformat_alloc_context();
     if (!mpegts_ctx)
         return AVERROR(ENOMEM);
     chain->pkt = av_packet_alloc();
     if (!chain->pkt)
         goto fail;
-    mpegts_ctx->oformat   = mpegts_format;
+    EXTERN const FFOutputFormat ff_mpegts_muxer;
+    mpegts_ctx->oformat   = &ff_mpegts_muxer.p;
     mpegts_ctx->max_delay = s->max_delay;
     av_dict_copy(&mpegts_ctx->metadata, s->metadata, 0);
     for (i = 0; i < s->nb_streams; i++) {
@@ -106,7 +104,8 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
         ret = AVERROR(ENOMEM);
         goto fail;
     }
-    rtp_ctx->oformat = rtp_format;
+    EXTERN const FFOutputFormat ff_rtp_muxer;
+    rtp_ctx->oformat = &ff_rtp_muxer.p;
     st = avformat_new_stream(rtp_ctx, NULL);
     if (!st) {
         ret = AVERROR(ENOMEM);
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index adf3008003..3a4c1e0413 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -31,6 +31,7 @@
 #include "avc.h"
 #include "url.h"
 
+#include "libavutil/attributes_internal.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/avstring.h"
@@ -283,17 +284,12 @@ static int ism_write_header(AVFormatContext *s)
 {
     SmoothStreamingContext *c = s->priv_data;
     int ret = 0, i;
-    const AVOutputFormat *oformat;
 
     if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {
         av_log(s, AV_LOG_ERROR, "mkdir failed\n");
         return AVERROR(errno);
     }
 
-    oformat = av_guess_format("ismv", NULL, NULL);
-    if (!oformat) {
-        return AVERROR_MUXER_NOT_FOUND;
-    }
 
     c->streams = av_calloc(s->nb_streams, sizeof(*c->streams));
     if (!c->streams) {
@@ -325,7 +321,8 @@ static int ism_write_header(AVFormatContext *s)
         }
         if ((ret = ff_copy_whiteblacklists(ctx, s)) < 0)
             return ret;
-        ctx->oformat = oformat;
+        EXTERN const FFOutputFormat ff_ismv_muxer;
+        ctx->oformat = &ff_ismv_muxer.p;
         ctx->interrupt_callback = s->interrupt_callback;
 
         if (!(st = avformat_new_stream(ctx, NULL))) {
diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 57329f1788..19506faebe 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -30,6 +30,7 @@
 #include "internal.h"
 #include "mux.h"
 
+#include "libavutil/attributes_internal.h"
 #include "libavutil/bprint.h"
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
@@ -51,7 +52,6 @@ typedef struct WebMChunkContext {
 static int webm_chunk_init(AVFormatContext *s)
 {
     WebMChunkContext *wc = s->priv_data;
-    const AVOutputFormat *oformat;
     AVFormatContext *oc;
     AVStream *st, *ost = s->streams[0];
     AVDictionary *dict = NULL;
@@ -68,11 +68,9 @@ static int webm_chunk_init(AVFormatContext *s)
 
     wc->prev_pts = AV_NOPTS_VALUE;
 
-    oformat = av_guess_format("webm", s->url, "video/webm");
-    if (!oformat)
-        return AVERROR_MUXER_NOT_FOUND;
+    EXTERN const FFOutputFormat ff_webm_muxer;
 
-    ret = avformat_alloc_output_context2(&wc->avf, oformat, NULL, NULL);
+    ret = avformat_alloc_output_context2(&wc->avf, &ff_webm_muxer.p, NULL, 
NULL);
     if (ret < 0)
         return ret;
     oc = wc->avf;
diff --git a/libavformat/whip.c b/libavformat/whip.c
index 08bd19d9c7..8306296b20 100644
--- a/libavformat/whip.c
+++ b/libavformat/whip.c
@@ -21,6 +21,8 @@
 
 #include "libavcodec/h264.h"
 #include "libavcodec/startcode.h"
+
+#include "libavutil/attributes_internal.h"
 #include "libavutil/avassert.h"
 #include "libavutil/base64.h"
 #include "libavutil/bprint.h"
@@ -1540,12 +1542,6 @@ static int create_rtp_muxer(AVFormatContext *s)
     WHIPContext *whip = s->priv_data;
     whip->udp->flags |= AVIO_FLAG_NONBLOCK;
 
-    const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
-    if (!rtp_format) {
-        av_log(whip, AV_LOG_ERROR, "Failed to guess rtp muxer\n");
-        ret = AVERROR(ENOSYS);
-        goto end;
-    }
 
     /* The UDP buffer size, may greater than MTU. */
     buffer_size = MAX_UDP_BUFFER_SIZE;
@@ -1559,7 +1555,8 @@ static int create_rtp_muxer(AVFormatContext *s)
             goto end;
         }
 
-        rtp_ctx->oformat = rtp_format;
+        EXTERN const FFOutputFormat ff_rtp_muxer;
+        rtp_ctx->oformat = &ff_rtp_muxer.p;
         if (!avformat_new_stream(rtp_ctx, NULL)) {
             ret = AVERROR(ENOMEM);
             goto end;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to