diff options
Diffstat (limited to 'libavcodec/libxavs.c')
-rw-r--r-- | libavcodec/libxavs.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index 7a74e361c1..92dceceac1 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -2,20 +2,20 @@ * AVS encoding using the xavs library * Copyright (C) 2010 Amanda, Y.N. Wu <amanda11192003@gmail.com> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -88,10 +88,8 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt, for (i = 0; i < nnal; i++) size += nals[i].i_payload; - if ((ret = ff_alloc_packet(pkt, size)) < 0) { - av_log(ctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", size); + if ((ret = ff_alloc_packet2(ctx, pkt, size)) < 0) return ret; - } p = pkt->data; /* Write the SEI as part of the first frame. */ @@ -145,7 +143,7 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, if (!ret) { if (!frame && !(x4->end_of_stream)) { - if ((ret = ff_alloc_packet(pkt, 4)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, 4)) < 0) return ret; pkt->data[0] = 0x0; @@ -153,7 +151,7 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, pkt->data[2] = 0x01; pkt->data[3] = 0xb1; pkt->dts = 2*x4->pts_buffer[(x4->out_frame_count-1)%(avctx->max_b_frames+1)] - - x4->pts_buffer[(x4->out_frame_count-2)%(avctx->max_b_frames+1)]; + x4->pts_buffer[(x4->out_frame_count-2)%(avctx->max_b_frames+1)]; x4->end_of_stream = END_OF_STREAM; *got_packet = 1; } @@ -355,7 +353,7 @@ static av_cold int XAVS_init(AVCodecContext *avctx) if (!x4->enc) return -1; - if (!(x4->pts_buffer = av_mallocz((avctx->max_b_frames+1) * sizeof(*x4->pts_buffer)))) + if (!(x4->pts_buffer = av_mallocz_array((avctx->max_b_frames+1), sizeof(*x4->pts_buffer)))) return AVERROR(ENOMEM); avctx->coded_frame = av_frame_alloc(); @@ -394,10 +392,10 @@ static av_cold int XAVS_init(AVCodecContext *avctx) #define OFFSET(x) offsetof(XavsContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE }, + { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, { "qp", "Constant quantization parameter rate control method",OFFSET(cqp), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, VE }, { "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), AV_OPT_TYPE_INT, {.i64 = INT_MIN}, INT_MIN, INT_MAX, VE }, - { "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), AV_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE}, + { "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE}, { "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, VE, "direct-pred" }, { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" }, { "spatial", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" }, @@ -410,7 +408,7 @@ static const AVOption options[] = { { NULL }, }; -static const AVClass class = { +static const AVClass xavs_class = { .class_name = "libxavs", .item_name = av_default_item_name, .option = options, @@ -433,6 +431,6 @@ AVCodec ff_libxavs_encoder = { .close = XAVS_close, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, - .priv_class = &class, + .priv_class = &xavs_class, .defaults = xavs_defaults, }; |