1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-28 12:32:17 +02:00

avformat/3dostr: Return directly after having read packet

Avoids an avio_skip(s->pb, 0).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-07-27 05:19:18 +02:00
parent becfdaaa09
commit edcd7c735c

@ -110,15 +110,12 @@ static int threedostr_read_header(AVFormatContext *s)
static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt) static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
unsigned chunk, size, found_ssmp = 0; unsigned chunk, size;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
int64_t pos; int64_t pos;
int ret = 0; int ret = 0;
while (!found_ssmp) { while (!avio_feof(s->pb)) {
if (avio_feof(s->pb))
return AVERROR_EOF;
pos = avio_tell(s->pb); pos = avio_tell(s->pb);
chunk = avio_rl32(s->pb); chunk = avio_rl32(s->pb);
size = avio_rb32(s->pb); size = avio_rb32(s->pb);
@ -143,9 +140,7 @@ static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos = pos; pkt->pos = pos;
pkt->stream_index = 0; pkt->stream_index = 0;
pkt->duration = size / st->codecpar->channels; pkt->duration = size / st->codecpar->channels;
size = 0; return ret;
found_ssmp = 1;
break;
default: default:
av_log(s, AV_LOG_DEBUG, "skipping unknown chunk: %X\n", chunk); av_log(s, AV_LOG_DEBUG, "skipping unknown chunk: %X\n", chunk);
break; break;
@ -154,7 +149,7 @@ static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_skip(s->pb, size); avio_skip(s->pb, size);
} }
return ret; return AVERROR_EOF;
} }
AVInputFormat ff_threedostr_demuxer = { AVInputFormat ff_threedostr_demuxer = {