]> git.sesse.net Git - ffmpeg/commitdiff
set coded_frame
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 28 May 2008 11:33:28 +0000 (11:33 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 28 May 2008 11:33:28 +0000 (11:33 +0000)
Originally committed as revision 13492 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/targaenc.c
libavcodec/tiffenc.c

index 90dc8cba617f4a35c0d47594b0e42b21512c107d..35e667996db73d498327266a391f965d70eb3e01 100644 (file)
 #include "avcodec.h"
 #include "rle.h"
 
+typedef struct TargaContext {
+    AVFrame picture;
+} TargaContext;
+
 /**
  * RLE compress the image, with maximum size of out_size
  * @param outbuf Output buffer
@@ -135,6 +139,12 @@ static int targa_encode_frame(AVCodecContext *avctx,
 
 static av_cold int targa_encode_init(AVCodecContext *avctx)
 {
+    TargaContext *s = avctx->priv_data;
+
+    avcodec_get_frame_defaults(&s->picture);
+    s->picture.key_frame= 1;
+    avctx->coded_frame= &s->picture;
+
     return 0;
 }
 
@@ -142,7 +152,7 @@ AVCodec targa_encoder = {
     .name = "targa",
     .type = CODEC_TYPE_VIDEO,
     .id = CODEC_ID_TARGA,
-    .priv_data_size = 0,
+    .priv_data_size = sizeof(TargaContext),
     .init = targa_encode_init,
     .encode = targa_encode_frame,
     .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, PIX_FMT_NONE},
index c2b942f1d98a40fab20fe4b3f7782cdd4410200a..1ec27efe207dcde40135b6f22901d6a6e7f09d00 100644 (file)
@@ -222,6 +222,7 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
     *p = *pict;
     p->pict_type = FF_I_TYPE;
     p->key_frame = 1;
+    avctx->coded_frame= &s->picture;
 
     s->compr = TIFF_PACKBITS;
     if (avctx->compression_level == 0) {