On 02/13/2012 10:18 AM, Anton Khirnov wrote:

> ---
>  libavcodec/svq1enc.c |   24 +++++++++++++++++-------
>  1 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
> index 80bae3c..4afd72e 100644
> --- a/libavcodec/svq1enc.c
> +++ b/libavcodec/svq1enc.c
> @@ -497,14 +497,19 @@ static av_cold int svq1_encode_init(AVCodecContext 
> *avctx)
>      return 0;
>  }
>  
> -static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf,
> -    int buf_size, void *data)
> +static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
> +                             const AVFrame *pict, int *got_packet)
>  {
>      SVQ1Context * const s = avctx->priv_data;
> -    AVFrame *pict = data;
>      AVFrame * const p= (AVFrame*)&s->picture;
>      AVFrame temp;
> -    int i;
> +    int i, ret;
> +
> +    if (!pkt->data &&
> +        (ret = av_new_packet(pkt, 
> s->y_block_width*s->y_block_height*MAX_MB_BYTES*3 + FF_MIN_BUFFER_SIZE) < 0)) 
> {
> +        av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
> +        return ret;
> +    }


It looks like the encoder currently only returns an error *after* it has
written too many bits. So allowing the user to specify any buffer size
seem somewhat unsafe. But then again your patch is not changing the
current behavior, so I suppose it's ok...

-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to