Mercurial > libavcodec.hg
comparison raw.c @ 1195:f7522f310c7e libavcodec
segfault fix
author | michaelni |
---|---|
date | Thu, 17 Apr 2003 19:53:36 +0000 |
parents | c85d33c011ab |
children | b88dfc4bbf8c |
comparison
equal
deleted
inserted
replaced
1194:432d9a42a244 | 1195:f7522f310c7e |
---|---|
50 | 50 |
51 typedef struct RawVideoContext { | 51 typedef struct RawVideoContext { |
52 unsigned char * buffer; /* block of memory for holding one frame */ | 52 unsigned char * buffer; /* block of memory for holding one frame */ |
53 unsigned char * p; /* current position in buffer */ | 53 unsigned char * p; /* current position in buffer */ |
54 int length; /* number of bytes in buffer */ | 54 int length; /* number of bytes in buffer */ |
55 AVFrame pic; ///< AVCodecContext.coded_frame | |
55 } RawVideoContext; | 56 } RawVideoContext; |
56 | 57 |
57 | 58 |
58 static int raw_init(AVCodecContext *avctx) | 59 static int raw_init(AVCodecContext *avctx) |
59 { | 60 { |
65 | 66 |
66 context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); | 67 context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); |
67 context->buffer = av_malloc(context->length); | 68 context->buffer = av_malloc(context->length); |
68 context->p = context->buffer; | 69 context->p = context->buffer; |
69 | 70 |
71 context->pic.pict_type= FF_I_TYPE; | |
72 context->pic.key_frame= 1; | |
73 avctx->coded_frame= &context->pic; | |
74 | |
70 if (! context->buffer) { | 75 if (! context->buffer) { |
71 return -1; | 76 return -1; |
72 } | 77 } |
73 | 78 |
74 return 0; | 79 return 0; |