mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
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>
This commit is contained in:
parent
7ef252b64a
commit
24e4127cb4
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user