Browse code

Setting proper values in extradata for future use in muxer

Originally committed as revision 24939 to svn://svn.ffmpeg.org/ffmpeg/trunk

Tobias Bindhammer authored on 2010/08/26 19:02:59
Showing 1 changed files
... ...
@@ -199,6 +199,12 @@ static av_cold int a64multi_init_encoder(AVCodecContext *avctx)
199 199
     c->mc_colram        = av_mallocz(CHARSET_CHARS * sizeof(uint8_t));
200 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 208
     avcodec_get_frame_defaults(&c->picture);
203 209
     avctx->coded_frame            = &c->picture;
204 210
     avctx->coded_frame->pict_type = FF_I_TYPE;
... ...
@@ -243,6 +249,10 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
243 243
     int *meta            = c->mc_meta_charset;
244 244
     int *best_cb         = c->mc_best_cb;
245 245
 
246
+    int charset_size = 0x800 * (INTERLACED + 1);
247
+    int screen_size  = 0x400;
248
+    int colram_size  = 0x100 * c->mc_use_5col;
249
+
246 250
     /* no data, means end encoding asap */
247 251
     if (!data) {
248 252
         /* all done, end encoding */
... ...
@@ -314,6 +324,10 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
314 314
             charmap += 1000;
315 315
         }
316 316
 
317
+        AV_WB32(avctx->extradata+4,  c->mc_frame_counter);
318
+        AV_WB32(avctx->extradata+8,  charset_size);
319
+        AV_WB32(avctx->extradata+12, screen_size + colram_size);
320
+
317 321
         /* reset counter */
318 322
         c->mc_frame_counter = 0;
319 323