diff options
Diffstat (limited to 'libavcodec/lclenc.c')
-rw-r--r-- | libavcodec/lclenc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c index 0fb303cca6..09beb98c86 100644 --- a/libavcodec/lclenc.c +++ b/libavcodec/lclenc.c @@ -2,20 +2,20 @@ * LCL (LossLess Codec Library) Codec * Copyright (c) 2002-2004 Roberto Togni * - * 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 */ @@ -41,7 +41,9 @@ #include <stdio.h> #include <stdlib.h> +#include "libavutil/avassert.h" #include "avcodec.h" +#include "internal.h" #include "lcl.h" #include "libavutil/internal.h" #include "libavutil/mem.h" @@ -79,11 +81,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int zret; // Zlib return code int max_size = deflateBound(&c->zstream, avctx->width * avctx->height * 3); - if (!pkt->data && - (ret = av_new_packet(pkt, max_size)) < 0) { - av_log(avctx, AV_LOG_ERROR, "Error allocating packet of size %d.\n", max_size); + if ((ret = ff_alloc_packet2(avctx, pkt, max_size)) < 0) return ret; - } *p = *pict; p->pict_type= AV_PICTURE_TYPE_I; @@ -136,13 +135,14 @@ static av_cold int encode_init(AVCodecContext *avctx) c->avctx= avctx; - assert(avctx->width && avctx->height); + av_assert0(avctx->width && avctx->height); avctx->extradata= av_mallocz(8); avctx->coded_frame= &c->pic; - // Will be user settable someday - c->compression = 6; + c->compression = avctx->compression_level == FF_COMPRESSION_DEFAULT ? + COMP_ZLIB_NORMAL : + av_clip(avctx->compression_level, 0, 9); c->flags = 0; c->imgtype = IMGTYPE_RGB24; avctx->bits_per_coded_sample= 24; |