summaryrefslogtreecommitdiff
path: root/libavformat/psxstr.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/psxstr.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/psxstr.c')
-rw-r--r--libavformat/psxstr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index ddc17e35d2..678b9f90ac 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -160,7 +160,7 @@ static int str_read_packet(AVFormatContext *s,
AVIOContext *pb = s->pb;
StrDemuxContext *str = s->priv_data;
unsigned char sector[RAW_CD_SECTOR_SIZE];
- int channel;
+ int channel, ret;
AVPacket *pkt;
AVStream *st;
@@ -213,8 +213,9 @@ static int str_read_packet(AVFormatContext *s,
if(pkt->data)
av_log(s, AV_LOG_ERROR, "mismatching sector_count\n");
av_packet_unref(pkt);
- if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
- return AVERROR(EIO);
+ ret = av_new_packet(pkt, sector_count * VIDEO_DATA_CHUNK_SIZE);
+ if (ret < 0)
+ return ret;
memset(pkt->data, 0, sector_count*VIDEO_DATA_CHUNK_SIZE);
pkt->pos= avio_tell(pb) - RAW_CD_SECTOR_SIZE;
@@ -267,8 +268,8 @@ static int str_read_packet(AVFormatContext *s,
st->start_time = 0;
}
pkt = ret_pkt;
- if (av_new_packet(pkt, 2304))
- return AVERROR(EIO);
+ if ((ret = av_new_packet(pkt, 2304)) < 0)
+ return ret;
memcpy(pkt->data,sector+24,2304);
pkt->stream_index =