|
|
@ -153,6 +153,21 @@ int ff_set_dimensions(AVCodecContext *s, int width, int height) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ff_set_sar(AVCodecContext *avctx, AVRational sar) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int ret = av_image_check_sar(avctx->width, avctx->height, sar); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ret < 0) { |
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", |
|
|
|
|
|
|
|
sar.num, sar.den); |
|
|
|
|
|
|
|
avctx->sample_aspect_ratio = (AVRational){ 0, 1 }; |
|
|
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
avctx->sample_aspect_ratio = sar; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int ff_side_data_update_matrix_encoding(AVFrame *frame, |
|
|
|
int ff_side_data_update_matrix_encoding(AVFrame *frame, |
|
|
|
enum AVMatrixEncoding matrix_encoding) |
|
|
|
enum AVMatrixEncoding matrix_encoding) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -636,6 +651,14 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) |
|
|
|
if (!frame->sample_aspect_ratio.num) |
|
|
|
if (!frame->sample_aspect_ratio.num) |
|
|
|
frame->sample_aspect_ratio = avctx->sample_aspect_ratio; |
|
|
|
frame->sample_aspect_ratio = avctx->sample_aspect_ratio; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (av_image_check_sar(frame->width, frame->height, |
|
|
|
|
|
|
|
frame->sample_aspect_ratio) < 0) { |
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", |
|
|
|
|
|
|
|
frame->sample_aspect_ratio.num, |
|
|
|
|
|
|
|
frame->sample_aspect_ratio.den); |
|
|
|
|
|
|
|
frame->sample_aspect_ratio = (AVRational){ 0, 1 }; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) |
|
|
|
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1071,6 +1094,16 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code |
|
|
|
ff_set_dimensions(avctx, 0, 0); |
|
|
|
ff_set_dimensions(avctx, 0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (avctx->width > 0 && avctx->height > 0) { |
|
|
|
|
|
|
|
if (av_image_check_sar(avctx->width, avctx->height, |
|
|
|
|
|
|
|
avctx->sample_aspect_ratio) < 0) { |
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", |
|
|
|
|
|
|
|
avctx->sample_aspect_ratio.num, |
|
|
|
|
|
|
|
avctx->sample_aspect_ratio.den); |
|
|
|
|
|
|
|
avctx->sample_aspect_ratio = (AVRational){ 0, 1 }; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* if the decoder init function was already called previously,
|
|
|
|
/* if the decoder init function was already called previously,
|
|
|
|
* free the already allocated subtitle_header before overwriting it */ |
|
|
|
* free the already allocated subtitle_header before overwriting it */ |
|
|
|
if (av_codec_is_decoder(codec)) |
|
|
|
if (av_codec_is_decoder(codec)) |
|
|
|