On Wed, Feb 22, 2012 at 06:29:46PM +0100, Anton Khirnov wrote:
> ---
> libavcodec/flashsvenc.c | 25 ++++++++++++++-----------
> 1 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c
> index 669badc..681ad10 100644
> --- a/libavcodec/flashsvenc.c
> +++ b/libavcodec/flashsvenc.c
> @@ -49,6 +49,7 @@
> #include <zlib.h>
>
> #include "avcodec.h"
> +#include "internal.h"
> #include "put_bits.h"
> #include "bytestream.h"
>
> @@ -194,11 +195,10 @@ static int encode_bitstream(FlashSVContext *s, AVFrame
> *p, uint8_t *buf,
> }
>
>
> -static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
> - int buf_size, void *data)
> +static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
> + const AVFrame *pict, int *got_packet)
> {
> FlashSVContext * const s = avctx->priv_data;
> - AVFrame *pict = data;
> AVFrame * const p = &s->frame;
> uint8_t *pfptr;
> int res;
> @@ -228,15 +228,15 @@ static int flashsv_encode_frame(AVCodecContext *avctx,
> uint8_t *buf,
> I_frame = 1;
> }
>
> - if (buf_size < s->image_width * s->image_height * 3) {
> + if ((res = ff_alloc_packet(pkt, s->image_width * s->image_height * 3)) <
> 0) {
> //Conservative upper bound check for compressed data
> - av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n",
> - buf_size, s->image_width * s->image_height * 3);
> - return -1;
> + av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size
> %d.\n",
> + s->image_width * s->image_height * 3);
> + return res;
> }
>
> - res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16,
> - pfptr, &I_frame);
> + pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16,
> opt_h * 16,
> + pfptr, &I_frame);
>
> //save the current frame
> if (p->linesize[0] > 0)
> @@ -259,7 +259,10 @@ static int flashsv_encode_frame(AVCodecContext *avctx,
> uint8_t *buf,
>
> avctx->coded_frame = p;
>
> - return res;
> + pkt->flags |= AV_PKT_FLAG_KEY*p->key_frame;
change that to if() and commit
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel