summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-03-01 22:12:16 +0100
committerJan Ekström <jeebjp@gmail.com>2018-03-03 02:38:01 +0200
commitfd90c003d29e4de1def462c7d6fd127e9e9d75d2 (patch)
tree08b666265c8115e7c41b932736893e7cf117c5bf
parent14c2f20bffb09452b427cb58d7c792e05f3ca792 (diff)
downloadmpv-fd90c003d29e4de1def462c7d6fd127e9e9d75d2.tar.bz2
mpv-fd90c003d29e4de1def462c7d6fd127e9e9d75d2.tar.xz
mp_image: replace rude function with less rude FFmpeg upstream function
This is new, thus a dependency bump is required.
-rw-r--r--common/av_common.c48
-rw-r--r--common/av_common.h3
-rw-r--r--video/mp_image.c6
-rw-r--r--wscript2
4 files changed, 5 insertions, 54 deletions
diff --git a/common/av_common.c b/common/av_common.c
index a76dd37117..00c7d79a74 100644
--- a/common/av_common.c
+++ b/common/av_common.c
@@ -365,51 +365,3 @@ int mp_set_avopts(struct mp_log *log, void *avobj, char **kv)
}
return success;
}
-
-#if LIBAVUTIL_VERSION_MICRO >= 100
-AVFrameSideData *ffmpeg_garbage(AVFrame *frame,
- enum AVFrameSideDataType type,
- AVBufferRef *buf)
-{
- AVFrameSideData *ret, **tmp;
-
- if (!buf)
- return NULL;
-
- if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
- goto fail;
-
- tmp = av_realloc(frame->side_data,
- (frame->nb_side_data + 1) * sizeof(*frame->side_data));
- if (!tmp)
- goto fail;
- frame->side_data = tmp;
-
- ret = av_mallocz(sizeof(*ret));
- if (!ret)
- goto fail;
-
- ret->buf = buf;
- ret->data = ret->buf->data;
- ret->size = buf->size;
- ret->type = type;
-
- frame->side_data[frame->nb_side_data++] = ret;
-
- return ret;
-fail:
- av_buffer_unref(&buf);
- return NULL;
-}
-#else
-AVFrameSideData *ffmpeg_garbage(AVFrame *frame,
- enum AVFrameSideDataType type,
- AVBufferRef *buf)
-{
- AVFrameSideData *sd = av_frame_new_side_data(frame, type, buf->size);
- if (sd)
- memcpy(sd->data, buf->data, buf->size);
- av_buffer_unref(&buf);
- return sd;
-}
-#endif
diff --git a/common/av_common.h b/common/av_common.h
index 0e7c838884..6cbadb4a96 100644
--- a/common/av_common.h
+++ b/common/av_common.h
@@ -47,8 +47,5 @@ const char *mp_codec_from_av_codec_id(int codec_id);
void mp_set_avdict(struct AVDictionary **dict, char **kv);
void mp_avdict_print_unset(struct mp_log *log, int msgl, struct AVDictionary *d);
int mp_set_avopts(struct mp_log *log, void *avobj, char **kv);
-AVFrameSideData *ffmpeg_garbage(AVFrame *frame,
- enum AVFrameSideDataType type,
- AVBufferRef *buf);
#endif
diff --git a/video/mp_image.c b/video/mp_image.c
index 3511246b5b..108dba6545 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -988,7 +988,8 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src)
#if LIBAVUTIL_VERSION_MICRO >= 100
if (src->icc_profile) {
AVFrameSideData *sd =
- ffmpeg_garbage(dst, AV_FRAME_DATA_ICC_PROFILE, new_ref->icc_profile);
+ av_frame_new_side_data_from_buf(dst, AV_FRAME_DATA_ICC_PROFILE,
+ new_ref->icc_profile);
if (!sd)
abort();
new_ref->icc_profile = NULL;
@@ -1007,7 +1008,8 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src)
for (int n = 0; n < new_ref->num_ff_side_data; n++) {
struct mp_ff_side_data *mpsd = &new_ref->ff_side_data[n];
if (!av_frame_get_side_data(dst, mpsd->type)) {
- AVFrameSideData *sd = ffmpeg_garbage(dst, mpsd->type, mpsd->buf);
+ AVFrameSideData *sd = av_frame_new_side_data_from_buf(dst, mpsd->type,
+ mpsd->buf);
if (!sd)
abort();
mpsd->buf = NULL;
diff --git a/wscript b/wscript
index f44c8a357d..9675101a6a 100644
--- a/wscript
+++ b/wscript
@@ -412,7 +412,7 @@ iconv support use --disable-iconv.",
]
ffmpeg_pkg_config_checks = [
- 'libavutil', '>= 56.7.100',
+ 'libavutil', '>= 56.8.100',
'libavcodec', '>= 58.10.100',
'libavformat', '>= 58.9.100',
'libswscale', '>= 5.0.101',