[FFmpeg-devel] [PATCH 1/17] avformat: Use correct error in case muxer is not found

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Mar 2 06:35:17 EET 2020


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/mpegtsenc.c     | 2 +-
 libavformat/mux.c           | 4 ++--
 libavformat/rtpenc_chain.c  | 2 +-
 libavformat/rtpenc_mpegts.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index ccb631d746..47463cbcdb 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -971,7 +971,7 @@ static int mpegts_init(AVFormatContext *s)
                 av_guess_format((ts->flags & MPEGTS_FLAG_AAC_LATM) ? "latm" : "adts",
                                 NULL, NULL);
             if (!ts_st->amux->oformat) {
-                ret = AVERROR(EINVAL);
+                ret = AVERROR_MUXER_NOT_FOUND;
                 goto fail;
             }
             if (!(ast = avformat_new_stream(ts_st->amux, NULL))) {
diff --git a/libavformat/mux.c b/libavformat/mux.c
index d88746e8c5..565a7d7c18 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -160,15 +160,15 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, ff_const59 AVOutputF
             oformat = av_guess_format(format, NULL, NULL);
             if (!oformat) {
                 av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format);
-                ret = AVERROR(EINVAL);
+                ret = AVERROR_MUXER_NOT_FOUND;
                 goto error;
             }
         } else {
             oformat = av_guess_format(NULL, filename, NULL);
             if (!oformat) {
-                ret = AVERROR(EINVAL);
                 av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n",
                        filename);
+                ret = AVERROR_MUXER_NOT_FOUND;
                 goto error;
             }
         }
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c
index e6b603db70..a4a9fb8c3a 100644
--- a/libavformat/rtpenc_chain.c
+++ b/libavformat/rtpenc_chain.c
@@ -36,7 +36,7 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
     AVDictionary *opts = NULL;
 
     if (!rtp_format) {
-        ret = AVERROR(ENOSYS);
+        ret = AVERROR_MUXER_NOT_FOUND;
         goto fail;
     }
 
diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c
index 7d7377db7a..1650462eef 100644
--- a/libavformat/rtpenc_mpegts.c
+++ b/libavformat/rtpenc_mpegts.c
@@ -54,7 +54,7 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
     AVStream *st;
 
     if (!mpegts_format || !rtp_format)
-        return AVERROR(ENOSYS);
+        return AVERROR_MUXER_NOT_FOUND;
     mpegts_ctx = avformat_alloc_context();
     if (!mpegts_ctx)
         return AVERROR(ENOMEM);
-- 
2.20.1



More information about the ffmpeg-devel mailing list