[FFmpeg-devel] [PATCH 08/17] avformat/mxfenc: Improve returned error codes

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Nov 9 20:01:46 EET 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavformat/mxfenc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index c20ba9bfca..cf63340313 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2509,7 +2509,7 @@ static int mxf_init(AVFormatContext *s)
 
     if (s->oformat == &ff_mxf_opatom_muxer && s->nb_streams !=1) {
         av_log(s, AV_LOG_ERROR, "there must be exactly one stream for mxf opatom\n");
-        return -1;
+        return AVERROR(EINVAL);
     }
 
     if (!av_dict_get(s->metadata, "comment_", NULL, AV_DICT_IGNORE_SUFFIX))
@@ -2525,7 +2525,7 @@ static int mxf_init(AVFormatContext *s)
 
         if (((i == 0) ^ (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)) && s->oformat != &ff_mxf_opatom_muxer) {
             av_log(s, AV_LOG_ERROR, "there must be exactly one video stream and it must be the first one\n");
-            return -1;
+            return AVERROR(EINVAL);
         }
 
         if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -2590,7 +2590,7 @@ static int mxf_init(AVFormatContext *s)
                     ul_index = 4+ntsc;
                 } else {
                     av_log(s, AV_LOG_ERROR, "error MXF D-10 only support 30/40/50 mbit/s\n");
-                    return -1;
+                    return AVERROR(EINVAL);
                 }
 
                 sc->codec_ul = &mxf_d10_codec_uls[ul_index];
@@ -2607,13 +2607,13 @@ static int mxf_init(AVFormatContext *s)
             char bsf_arg[32];
             if (st->codecpar->sample_rate != 48000) {
                 av_log(s, AV_LOG_ERROR, "only 48khz is implemented\n");
-                return -1;
+                return AVERROR_PATCHWELCOME;
             }
             avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
             if (s->oformat == &ff_mxf_d10_muxer) {
                 if (st->index != 1) {
                     av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n");
-                    return -1;
+                    return AVERROR(EINVAL);
                 }
                 if (st->codecpar->codec_id != AV_CODEC_ID_PCM_S16LE &&
                     st->codecpar->codec_id != AV_CODEC_ID_PCM_S24LE) {
@@ -2657,11 +2657,11 @@ static int mxf_init(AVFormatContext *s)
                 sc->index = INDEX_S436M;
             } else {
                 av_log(s, AV_LOG_ERROR, "track %d: unsupported data type\n", i);
-                return -1;
+                return AVERROR(EINVAL);
             }
             if (st->index != s->nb_streams - 1) {
                 av_log(s, AV_LOG_ERROR, "data track must be placed last\n");
-                return -1;
+                return AVERROR(EINVAL);
             }
         }
 
@@ -2670,7 +2670,7 @@ static int mxf_init(AVFormatContext *s)
             if (sc->index == -1) {
                 av_log(s, AV_LOG_ERROR, "track %d: could not find essence container ul, "
                        "codec not currently supported in container\n", i);
-                return -1;
+                return AVERROR(EINVAL);
             }
         }
 
-- 
2.30.2



More information about the ffmpeg-devel mailing list