diff options
author | sfan5 <sfan5@live.de> | 2023-01-10 18:59:21 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-01-12 22:02:07 +0100 |
commit | 7b03cd367dd5416a4728ccea7e47dcd2827cbab7 (patch) | |
tree | cea4075b81850000890f55d6cd01de117a2138a0 /video/mp_image.c | |
parent | b6b83805183618f3a46f2cc77d85dcff72ef6396 (diff) | |
download | mpv-7b03cd367dd5416a4728ccea7e47dcd2827cbab7.tar.bz2 mpv-7b03cd367dd5416a4728ccea7e47dcd2827cbab7.tar.xz |
various: replace if + abort() with MP_HANDLE_OOM()
MP_HANDLE_OOM also aborts but calls assert() first, which
will result in an useful message if compiled in debug mode.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 533061465d..6c28a54c47 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -1102,24 +1102,21 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src) dst->chroma_location = mp_chroma_location_to_av(src->params.chroma_location); dst->opaque_ref = av_buffer_alloc(sizeof(struct mp_image_params)); - if (!dst->opaque_ref) - abort(); + MP_HANDLE_OOM(dst->opaque_ref); *(struct mp_image_params *)dst->opaque_ref->data = src->params; if (src->icc_profile) { AVFrameSideData *sd = av_frame_new_side_data_from_buf(dst, AV_FRAME_DATA_ICC_PROFILE, new_ref->icc_profile); - if (!sd) - abort(); + MP_HANDLE_OOM(sd); new_ref->icc_profile = NULL; } if (src->params.color.sig_peak) { AVContentLightMetadata *clm = av_content_light_metadata_create_side_data(dst); - if (!clm) - abort(); + MP_HANDLE_OOM(clm); clm->MaxCLL = src->params.color.sig_peak * MP_REF_WHITE; } @@ -1130,8 +1127,7 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src) if (!av_frame_get_side_data(dst, mpsd->type)) { AVFrameSideData *sd = av_frame_new_side_data_from_buf(dst, mpsd->type, mpsd->buf); - if (!sd) - abort(); + MP_HANDLE_OOM(sd); mpsd->buf = NULL; } } |