diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-14 16:00:53 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-14 16:00:53 +0300 |
commit | 3d93ff289e0421d71cd63e246727d8ace256f27d (patch) | |
tree | 550f02bdee0db06ef5231921d9ebe0eb4f387869 /libavcodec/libschroedingerenc.c | |
parent | 9c3f75c29d2938bc3dd77a7733a11059ed2bc488 (diff) | |
parent | 6fdd4c678ac1ce0776f9645cd534209e5f1ae1e3 (diff) |
Merge commit '6fdd4c678ac1ce0776f9645cd534209e5f1ae1e3'
* commit '6fdd4c678ac1ce0776f9645cd534209e5f1ae1e3':
libschroedinger: Properly use AVFrame API
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/libschroedingerenc.c')
-rw-r--r-- | libavcodec/libschroedingerenc.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index d70552ed56..c5d6e764c7 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -33,6 +33,8 @@ #include "libavutil/attributes.h" #include "libavutil/avassert.h" +#include "libavutil/imgutils.h" + #include "avcodec.h" #include "internal.h" #include "libschroedinger.h" @@ -155,9 +157,9 @@ static av_cold int libschroedinger_encode_init(AVCodecContext *avctx) p_schro_params->format->frame_rate_numerator = avctx->time_base.den; p_schro_params->format->frame_rate_denominator = avctx->time_base.num; - p_schro_params->frame_size = avpicture_get_size(avctx->pix_fmt, - avctx->width, - avctx->height); + p_schro_params->frame_size = av_image_get_buffer_size(avctx->pix_fmt, + avctx->width, + avctx->height, 1); if (!avctx->gop_size) { schro_encoder_setting_set_double(p_schro_params->encoder, @@ -234,17 +236,17 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avctx, const AVFrame *frame) { SchroEncoderParams *p_schro_params = avctx->priv_data; - SchroFrame *in_frame; - /* Input line size may differ from what the codec supports. Especially - * when transcoding from one format to another. So use avpicture_layout - * to copy the frame. */ - in_frame = ff_create_schro_frame(avctx, p_schro_params->frame_format); - - if (in_frame) - avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, - avctx->width, avctx->height, - in_frame->components[0].data, - p_schro_params->frame_size); + SchroFrame *in_frame = ff_create_schro_frame(avctx, + p_schro_params->frame_format); + + if (in_frame) { + /* Copy input data to SchroFrame buffers (they match the ones + * referenced by the AVFrame stored in priv) */ + if (av_frame_copy(in_frame->priv, frame) < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to copy input data\n"); + return NULL; + } + } return in_frame; } |