|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|