mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
avformat/sccdec: 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
7ae7d93653
commit
9ef7582446
@ -145,7 +145,7 @@ static int scc_read_header(AVFormatContext *s)
|
|||||||
|
|
||||||
sub = ff_subtitles_queue_insert(&scc->q, out, i, 0);
|
sub = ff_subtitles_queue_insert(&scc->q, out, i, 0);
|
||||||
if (!sub)
|
if (!sub)
|
||||||
goto fail;
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
sub->pos = pos;
|
sub->pos = pos;
|
||||||
pos += i;
|
pos += i;
|
||||||
@ -164,7 +164,7 @@ static int scc_read_header(AVFormatContext *s)
|
|||||||
|
|
||||||
sub = ff_subtitles_queue_insert(&scc->q, out, i, 0);
|
sub = ff_subtitles_queue_insert(&scc->q, out, i, 0);
|
||||||
if (!sub)
|
if (!sub)
|
||||||
goto fail;
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
sub->pos = pos;
|
sub->pos = pos;
|
||||||
sub->pts = ts;
|
sub->pts = ts;
|
||||||
@ -175,9 +175,6 @@ static int scc_read_header(AVFormatContext *s)
|
|||||||
ff_subtitles_queue_finalize(s, &scc->q);
|
ff_subtitles_queue_finalize(s, &scc->q);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
|
||||||
ff_subtitles_queue_clean(&scc->q);
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scc_read_packet(AVFormatContext *s, AVPacket *pkt)
|
static int scc_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
@ -205,6 +202,7 @@ const AVInputFormat ff_scc_demuxer = {
|
|||||||
.name = "scc",
|
.name = "scc",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Scenarist Closed Captions"),
|
.long_name = NULL_IF_CONFIG_SMALL("Scenarist Closed Captions"),
|
||||||
.priv_data_size = sizeof(SCCContext),
|
.priv_data_size = sizeof(SCCContext),
|
||||||
|
.flags_internal = FF_FMT_INIT_CLEANUP,
|
||||||
.read_probe = scc_probe,
|
.read_probe = scc_probe,
|
||||||
.read_header = scc_read_header,
|
.read_header = scc_read_header,
|
||||||
.read_packet = scc_read_packet,
|
.read_packet = scc_read_packet,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user