summaryrefslogtreecommitdiff
path: root/libavformat/flic.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-01-07 14:55:44 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-08 01:32:26 +0100
commit45e7c67affb57f0286fc111e61686025f4ef4a04 (patch)
treec00b4d1c671acb6f59837c2f41064340ed5a862e /libavformat/flic.c
parentbb20f3dd730689c3a99f7820cff8b74b06992fff (diff)
downloadffmpeg-45e7c67affb57f0286fc111e61686025f4ef4a04.tar.gz
avformat: Improve returned error codes
This commit improves returned error codes by forwarding error codes. In some instances, the hardcoded returned error codes made no sense at all: The normal error code for failure of av_new_packet() is AVERROR(ENOMEM), yet there were instances where AVERROR(EIO) was returned. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/flic.c')
-rw-r--r--libavformat/flic.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libavformat/flic.c b/libavformat/flic.c
index 615d6b25c5..d2a5cf995c 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -215,10 +215,9 @@ static int flic_read_packet(AVFormatContext *s,
magic = AV_RL16(&preamble[4]);
if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) && size > FLIC_PREAMBLE_SIZE) {
- if (av_new_packet(pkt, size)) {
- ret = AVERROR(EIO);
- break;
- }
+ if ((ret = av_new_packet(pkt, size)) < 0)
+ return ret;
+
pkt->stream_index = flic->video_stream_index;
pkt->pts = flic->frame_number++;
pkt->pos = avio_tell(pb);
@@ -231,10 +230,8 @@ static int flic_read_packet(AVFormatContext *s,
}
packet_read = 1;
} else if (magic == FLIC_TFTD_CHUNK_AUDIO) {
- if (av_new_packet(pkt, size)) {
- ret = AVERROR(EIO);
- break;
- }
+ if ((ret = av_new_packet(pkt, size)) < 0)
+ return ret;
/* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */
avio_skip(pb, 10);