History

avcodec/libaribb24: Use FF_CODEC_CAP_INIT_CLEANUP

libaribb24_close() does the same as the fail path in libaribb24_init().

Andreas Rheinhardt committed 3 years ago

Commit 038b9921 parent c1714a41 file · +9 −20Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/libaribb24.c+9−20
@@ -147,12 +147,12 @@ static int libaribb24_init(AVCodecContext *avctx) · 146 unmodified lines
147147 {
148148 Libaribb24Context *b24 = avctx->priv_data;
149149 void(* arib_dec_init)(arib_decoder_t* decoder) = NULL;
150− int ret_code = AVERROR_EXTERNAL;
150+ int ret;
151151 int profile = avctx->profile;
152152
153153 if (!(b24->lib_instance = arib_instance_new(avctx))) {
154154 av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24!\n");
155− goto init_fail;
155+ return AVERROR_EXTERNAL;
156156 }
157157
158158 if (b24->aribb24_base_path) {
@@ -165,11 +165,11 @@ static int libaribb24_init(AVCodecContext *avctx) · 6 unmodified lines
165165
166166 if (!(b24->parser = arib_get_parser(b24->lib_instance))) {
167167 av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 PES parser!\n");
168− goto init_fail;
168+ return AVERROR_EXTERNAL;
169169 }
170170 if (!(b24->decoder = arib_get_decoder(b24->lib_instance))) {
171171 av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 decoder!\n");
172− goto init_fail;
172+ return AVERROR_EXTERNAL;
173173 }
174174
175175 if (profile == AV_PROFILE_UNKNOWN)
@@ -184,27 +184,16 @@ static int libaribb24_init(AVCodecContext *avctx) · 8 unmodified lines
184184 break;
185185 default:
186186 av_log(avctx, AV_LOG_ERROR, "Unknown or unsupported profile set!\n");
187− ret_code = AVERROR(EINVAL);
188− goto init_fail;
187+ return AVERROR(EINVAL);
189188 }
190189
191190 arib_dec_init(b24->decoder);
192191
193− if (libaribb24_generate_ass_header(avctx) < 0) {
194− ret_code = AVERROR(ENOMEM);
195− goto init_fail;
196− }
192+ ret = libaribb24_generate_ass_header(avctx);
193+ if (ret < 0)
194+ return ret;
197195
198196 return 0;
199−
200−init_fail:
201− if (b24->decoder)
202− arib_finalize_decoder(b24->decoder);
203−
204− if (b24->lib_instance)
205− arib_instance_destroy(b24->lib_instance);
206−
207− return ret_code;
208197 }
209198
210199 static int libaribb24_close(AVCodecContext *avctx)
@@ -410,7 +399,7 @@ const FFCodec ff_libaribb24_decoder = { · 199 unmodified lines
410399 .p.id = AV_CODEC_ID_ARIB_CAPTION,
411400 .p.priv_class = &aribb24_class,
412401 .p.wrapper_name = "libaribb24",
413− .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
402+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_NOT_INIT_THREADSAFE,
414403 .priv_data_size = sizeof(Libaribb24Context),
415404 .init = libaribb24_init,
416405 .close = libaribb24_close,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t