aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2024-03-20 16:03:42 +0100
committerStefano Sabatini <stefasab@gmail.com>2024-03-23 11:42:13 +0100
commit5c60be3ab64fa3bcf8d2cbf3443b3e4b3d85cf13 (patch)
treec95063ea4139aa7486f35ad0a3088b7662b4bc8d
parent3733aa7b17dda9ff83deff0ca3002809a84aff96 (diff)
downloadffmpeg-5c60be3ab64fa3bcf8d2cbf3443b3e4b3d85cf13.tar.gz
lavf/gxfenc: return proper error codes in case of failure
-rw-r--r--libavformat/gxfenc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 9ea24c2f27..0aea7bd7c2 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -692,7 +692,7 @@ static int gxf_write_header(AVFormatContext *s)
if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) {
av_log(s, AV_LOG_ERROR, "gxf muxer does not support streamed output, patch welcome\n");
- return -1;
+ return AVERROR_PATCHWELCOME;
}
gxf->flags |= 0x00080000; /* material is simple clip */
@@ -707,15 +707,15 @@ static int gxf_write_header(AVFormatContext *s)
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
if (st->codecpar->codec_id != AV_CODEC_ID_PCM_S16LE) {
av_log(s, AV_LOG_ERROR, "only 16 BIT PCM LE allowed for now\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (st->codecpar->sample_rate != 48000) {
av_log(s, AV_LOG_ERROR, "only 48000hz sampling rate is allowed\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (st->codecpar->ch_layout.nb_channels != 1) {
av_log(s, AV_LOG_ERROR, "only mono tracks are allowed\n");
- return -1;
+ return AVERROR(EINVAL);
}
ret = ff_stream_add_bitstream_filter(st, "pcm_rechunk", "n="AV_STRINGIFY(GXF_SAMPLES_PER_FRAME));
if (ret < 0)
@@ -733,7 +733,7 @@ static int gxf_write_header(AVFormatContext *s)
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
if (i != 0) {
av_log(s, AV_LOG_ERROR, "video stream must be the first track\n");
- return -1;
+ return AVERROR(EINVAL);
}
/* FIXME check from time_base ? */
if (st->codecpar->height == 480 || st->codecpar->height == 512) { /* NTSC or NTSC+VBI */
@@ -750,7 +750,7 @@ static int gxf_write_header(AVFormatContext *s)
} else {
av_log(s, AV_LOG_ERROR, "unsupported video resolution, "
"gxf muxer only accepts PAL or NTSC resolutions currently\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (!tcr)
tcr = av_dict_get(st->metadata, "timecode", NULL, 0);