Mercurial > libavcodec.hg
comparison targaenc.c @ 6919:7cf90c252373 libavcodec
set coded_frame
author | michael |
---|---|
date | Wed, 28 May 2008 11:33:28 +0000 |
parents | e1302edb0f69 |
children | e943e1409077 |
comparison
equal
deleted
inserted
replaced
6918:c1b722b79649 | 6919:7cf90c252373 |
---|---|
18 * License along with FFmpeg; if not, write to the Free Software | 18 * License along with FFmpeg; if not, write to the Free Software |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | 20 */ |
21 #include "avcodec.h" | 21 #include "avcodec.h" |
22 #include "rle.h" | 22 #include "rle.h" |
23 | |
24 typedef struct TargaContext { | |
25 AVFrame picture; | |
26 } TargaContext; | |
23 | 27 |
24 /** | 28 /** |
25 * RLE compress the image, with maximum size of out_size | 29 * RLE compress the image, with maximum size of out_size |
26 * @param outbuf Output buffer | 30 * @param outbuf Output buffer |
27 * @param out_size Maximum output size | 31 * @param out_size Maximum output size |
133 return out + 26 - outbuf; | 137 return out + 26 - outbuf; |
134 } | 138 } |
135 | 139 |
136 static av_cold int targa_encode_init(AVCodecContext *avctx) | 140 static av_cold int targa_encode_init(AVCodecContext *avctx) |
137 { | 141 { |
142 TargaContext *s = avctx->priv_data; | |
143 | |
144 avcodec_get_frame_defaults(&s->picture); | |
145 s->picture.key_frame= 1; | |
146 avctx->coded_frame= &s->picture; | |
147 | |
138 return 0; | 148 return 0; |
139 } | 149 } |
140 | 150 |
141 AVCodec targa_encoder = { | 151 AVCodec targa_encoder = { |
142 .name = "targa", | 152 .name = "targa", |
143 .type = CODEC_TYPE_VIDEO, | 153 .type = CODEC_TYPE_VIDEO, |
144 .id = CODEC_ID_TARGA, | 154 .id = CODEC_ID_TARGA, |
145 .priv_data_size = 0, | 155 .priv_data_size = sizeof(TargaContext), |
146 .init = targa_encode_init, | 156 .init = targa_encode_init, |
147 .encode = targa_encode_frame, | 157 .encode = targa_encode_frame, |
148 .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, PIX_FMT_NONE}, | 158 .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, PIX_FMT_NONE}, |
149 .long_name= "Truevision Targa image", | 159 .long_name= "Truevision Targa image", |
150 }; | 160 }; |