summaryrefslogtreecommitdiff
path: root/libavformat/avisynth.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-12-10 22:59:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-12 19:25:33 +0100
commitc1e439d7e9abab3cebdc937636393b1656e095d9 (patch)
treebe0ae941a23b62c42b152e2b9aa0a22f8c793d4e /libavformat/avisynth.c
parentcb88cdf7730e309df22ddbbc1ae4ebcd9ebc529e (diff)
downloadffmpeg-c1e439d7e9abab3cebdc937636393b1656e095d9.tar.gz
avformat: Forward errors where possible
It is not uncommon to find code where the caller thinks to know better what the return value should be than the callee. E.g. something like "if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit changes several instances of this to instead forward the actual error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/avisynth.c')
-rw-r--r--libavformat/avisynth.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 5dfe94ae0c..55a2efd884 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -640,7 +640,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
AVS_VideoFrame *frame;
unsigned char *dst_p;
const unsigned char *src_p;
- int n, i, plane, rowsize, planeheight, pitch, bits;
+ int n, i, plane, rowsize, planeheight, pitch, bits, ret;
const char *error;
int avsplus av_unused;
@@ -676,8 +676,8 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
if (!pkt->size)
return AVERROR_UNKNOWN;
- if (av_new_packet(pkt, pkt->size) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = av_new_packet(pkt, pkt->size)) < 0)
+ return ret;
pkt->pts = n;
pkt->dts = n;
@@ -739,7 +739,7 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt,
{
AviSynthContext *avs = s->priv_data;
AVRational fps, samplerate;
- int samples;
+ int samples, ret;
int64_t n;
const char *error;
@@ -782,8 +782,8 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt,
if (!pkt->size)
return AVERROR_UNKNOWN;
- if (av_new_packet(pkt, pkt->size) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = av_new_packet(pkt, pkt->size)) < 0)
+ return ret;
pkt->pts = n;
pkt->dts = n;