[FFmpeg-cvslog] avformat/tiertexseq: Simplify cleanup after read_header failure
Andreas Rheinhardt
git at videolan.org
Thu Jul 8 16:45:33 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat Mar 21 18:31:06 2020 +0100| [24e4127cb4e0ded3052907540b944b0df564a6ba] | committer: Andreas Rheinhardt
avformat/tiertexseq: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24e4127cb4e0ded3052907540b944b0df564a6ba
---
libavformat/tiertexseq.c | 17 +++++------------
1 file 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,
More information about the ffmpeg-cvslog
mailing list