diff options
author | Måns Rullgård <mans@mansr.com> | 2007-07-15 19:23:55 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2007-07-15 19:23:55 +0000 |
commit | e0eddd1269cc81a6e3b685adb2080b4208489e7c (patch) | |
tree | abcf1a58de17a20a17549af5b9cf1ea71240e713 /libavcodec/pngenc.c | |
parent | 9a5a05d0b37b7a9345e928290c54af20528ac27f (diff) | |
download | ffmpeg-e0eddd1269cc81a6e3b685adb2080b4208489e7c.tar.gz |
hardly anything in PNGContext is shared; split it
Originally committed as revision 9689 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pngenc.c')
-rw-r--r-- | libavcodec/pngenc.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index d4cd6deae3..22365e9da3 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -31,6 +31,18 @@ //#define DEBUG +#define IOBUF_SIZE 4096 + +typedef struct PNGEncContext { + uint8_t *bytestream; + uint8_t *bytestream_start; + uint8_t *bytestream_end; + AVFrame picture; + + z_stream zstream; + uint8_t buf[IOBUF_SIZE]; +} PNGEncContext; + static void png_get_interlaced_row(uint8_t *dst, int row_size, int bits_per_pixel, int pass, const uint8_t *src, int width) @@ -106,7 +118,7 @@ static void png_write_chunk(uint8_t **f, uint32_t tag, } /* XXX: do filtering */ -static int png_write_row(PNGContext *s, const uint8_t *data, int size) +static int png_write_row(PNGEncContext *s, const uint8_t *data, int size) { int ret; @@ -127,7 +139,7 @@ static int png_write_row(PNGContext *s, const uint8_t *data, int size) } static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ - PNGContext *s = avctx->priv_data; + PNGEncContext *s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&s->picture; int bit_depth, color_type, y, len, row_size, ret, is_progressive; @@ -297,12 +309,21 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, goto the_end; } +static int png_enc_init(AVCodecContext *avctx){ + PNGEncContext *s = avctx->priv_data; + + avcodec_get_frame_defaults((AVFrame*)&s->picture); + avctx->coded_frame= (AVFrame*)&s->picture; + + return 0; +} + AVCodec png_encoder = { "png", CODEC_TYPE_VIDEO, CODEC_ID_PNG, - sizeof(PNGContext), - ff_png_common_init, + sizeof(PNGEncContext), + png_enc_init, encode_frame, NULL, //encode_end, .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, -1}, |