On 02/19/2012 09:44 AM, Anton Khirnov wrote:
> ---
> libavcodec/huffyuv.c | 29 ++++++++++++++++++++---------
> 1 files changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
> index 0c5f6be..8a195e3 100644
> --- a/libavcodec/huffyuv.c
> +++ b/libavcodec/huffyuv.c
> @@ -1226,9 +1226,10 @@ static av_cold int decode_end(AVCodecContext *avctx)
> #endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */
>
> #if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
> -static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int
> buf_size, void *data){
> +static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
> + const AVFrame *pict, int *got_packet)
> +{
> HYuvContext *s = avctx->priv_data;
> - AVFrame *pict = data;
> const int width= s->width;
> const int width2= s->width>>1;
> const int height= s->height;
> @@ -1236,7 +1237,13 @@ static int encode_frame(AVCodecContext *avctx,
> unsigned char *buf, int buf_size,
> const int fake_ustride= s->interlaced ? pict->linesize[1]*2 :
> pict->linesize[1];
> const int fake_vstride= s->interlaced ? pict->linesize[2]*2 :
> pict->linesize[2];
> AVFrame * const p= &s->picture;
> - int i, j, size=0;
> + int i, j, size = 0, ret;
> +
> + if (!pkt->data &&
> + (ret = av_new_packet(pkt, width*height*3*4 + FF_MIN_BUFFER_SIZE)) <
> 0) {
add some spaces please.
> + av_log(avctx, AV_LOG_ERROR, "Error allocating output packet.\n");
> + return ret;
> + }
>
> *p = *pict;
> p->pict_type= AV_PICTURE_TYPE_I;
> @@ -1247,7 +1254,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned
> char *buf, int buf_size,
> generate_len_table(s->len[i], s->stats[i]);
> if(generate_bits_table(s->bits[i], s->len[i])<0)
> return -1;
> - size+= store_table(s, s->len[i], &buf[size]);
> + size+= store_table(s, s->len[i], &pkt->data[size]);
go ahead and add a space before += please.
the rest lgtm.
-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel