diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2020-03-21 18:31:06 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-07-08 14:08:00 +0200 |
commit | 24e4127cb4e0ded3052907540b944b0df564a6ba (patch) | |
tree | 5df148ddca0944143c42510a2c6cac294ced241c /libavformat/tiertexseq.c | |
parent | 7ef252b64afa7195e2eba3651559ac19c1a33c73 (diff) | |
download | ffmpeg-24e4127cb4e0ded3052907540b944b0df564a6ba.tar.gz |
avformat/tiertexseq: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/tiertexseq.c')
-rw-r--r-- | libavformat/tiertexseq.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index 164a75bd53..ecc15e4039 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -202,20 +202,16 @@ static int seq_read_header(AVFormatContext *s) /* init internal buffers */ rc = seq_init_frame_buffers(seq, pb); - if (rc) { - seq_read_close(s); + if (rc < 0) return rc; - } seq->current_frame_offs = 0; /* preload (no audio data, just buffer operations related data) */ for (i = 1; i <= 100; i++) { rc = seq_parse_frame_data(seq, pb); - if (rc) { - seq_read_close(s); + if (rc < 0) return rc; - } } seq->current_frame_pts = 0; @@ -224,10 +220,8 @@ static int seq_read_header(AVFormatContext *s) /* initialize the video decoder stream */ st = avformat_new_stream(s, NULL); - if (!st) { - seq_read_close(s); + if (!st) return AVERROR(ENOMEM); - } avpriv_set_pts_info(st, 32, 1, SEQ_FRAME_RATE); seq->video_stream_index = st->index; @@ -239,10 +233,8 @@ static int seq_read_header(AVFormatContext *s) /* initialize the audio decoder stream */ st = avformat_new_stream(s, NULL); - if (!st) { - seq_read_close(s); + if (!st) return AVERROR(ENOMEM); - } st->start_time = 0; avpriv_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE); @@ -320,6 +312,7 @@ const AVInputFormat ff_tiertexseq_demuxer = { .name = "tiertexseq", .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ"), .priv_data_size = sizeof(SeqDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = seq_probe, .read_header = seq_read_header, .read_packet = seq_read_packet, |