comparison a64multienc.c @ 12427:1b8f44e2754e libavcodec

Setting proper values in extradata for future use in muxer
author bindhammer
date Thu, 26 Aug 2010 10:02:59 +0000
parents 87e6af0a6a5a
children 06453ad84991
comparison
equal deleted inserted replaced
12426:7defcfe74c72 12427:1b8f44e2754e
197 c->mc_best_cb = av_malloc (CHARSET_CHARS * 32 * sizeof(int)); 197 c->mc_best_cb = av_malloc (CHARSET_CHARS * 32 * sizeof(int));
198 c->mc_charmap = av_mallocz(1000 * c->mc_lifetime * sizeof(int)); 198 c->mc_charmap = av_mallocz(1000 * c->mc_lifetime * sizeof(int));
199 c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t)); 199 c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t));
200 c->mc_charset = av_malloc (0x800 * (INTERLACED+1) * sizeof(uint8_t)); 200 c->mc_charset = av_malloc (0x800 * (INTERLACED+1) * sizeof(uint8_t));
201 201
202 /* set up extradata */
203 avctx->extradata = av_mallocz(8 * 4 + FF_INPUT_BUFFER_PADDING_SIZE);
204 avctx->extradata_size = 8 * 4;
205 AV_WB32(avctx->extradata, c->mc_lifetime);
206 AV_WB32(avctx->extradata+16, INTERLACED);
207
202 avcodec_get_frame_defaults(&c->picture); 208 avcodec_get_frame_defaults(&c->picture);
203 avctx->coded_frame = &c->picture; 209 avctx->coded_frame = &c->picture;
204 avctx->coded_frame->pict_type = FF_I_TYPE; 210 avctx->coded_frame->pict_type = FF_I_TYPE;
205 avctx->coded_frame->key_frame = 1; 211 avctx->coded_frame->key_frame = 1;
206 if (!avctx->codec_tag) 212 if (!avctx->codec_tag)
240 int *charmap = c->mc_charmap; 246 int *charmap = c->mc_charmap;
241 uint8_t *colram = c->mc_colram; 247 uint8_t *colram = c->mc_colram;
242 uint8_t *charset = c->mc_charset; 248 uint8_t *charset = c->mc_charset;
243 int *meta = c->mc_meta_charset; 249 int *meta = c->mc_meta_charset;
244 int *best_cb = c->mc_best_cb; 250 int *best_cb = c->mc_best_cb;
251
252 int charset_size = 0x800 * (INTERLACED + 1);
253 int screen_size = 0x400;
254 int colram_size = 0x100 * c->mc_use_5col;
245 255
246 /* no data, means end encoding asap */ 256 /* no data, means end encoding asap */
247 if (!data) { 257 if (!data) {
248 /* all done, end encoding */ 258 /* all done, end encoding */
249 if(!c->mc_lifetime) return 0; 259 if(!c->mc_lifetime) return 0;
311 } 321 }
312 322
313 /* advance to next charmap */ 323 /* advance to next charmap */
314 charmap += 1000; 324 charmap += 1000;
315 } 325 }
326
327 AV_WB32(avctx->extradata+4, c->mc_frame_counter);
328 AV_WB32(avctx->extradata+8, charset_size);
329 AV_WB32(avctx->extradata+12, screen_size + colram_size);
316 330
317 /* reset counter */ 331 /* reset counter */
318 c->mc_frame_counter = 0; 332 c->mc_frame_counter = 0;
319 333
320 if (req_size > buf_size) { 334 if (req_size > buf_size) {