Mercurial > libavcodec.hg
comparison mpegvideo.c @ 9155:9e66ada64b76 libavcodec
Add private HW accel data infrastructure.
author | gb |
---|---|
date | Mon, 09 Mar 2009 08:04:41 +0000 |
parents | 7f0d34340349 |
children | 3a54ad453dbf |
comparison
equal
deleted
inserted
replaced
9154:aa459306ee59 | 9155:9e66ada64b76 |
---|---|
168 * Releases a frame buffer | 168 * Releases a frame buffer |
169 */ | 169 */ |
170 static void free_frame_buffer(MpegEncContext *s, Picture *pic) | 170 static void free_frame_buffer(MpegEncContext *s, Picture *pic) |
171 { | 171 { |
172 s->avctx->release_buffer(s->avctx, (AVFrame*)pic); | 172 s->avctx->release_buffer(s->avctx, (AVFrame*)pic); |
173 av_freep(&pic->hwaccel_data_private); | |
173 } | 174 } |
174 | 175 |
175 /** | 176 /** |
176 * Allocates a frame buffer | 177 * Allocates a frame buffer |
177 */ | 178 */ |
178 static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) | 179 static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) |
179 { | 180 { |
180 int r; | 181 int r; |
181 | 182 |
183 if (s->avctx->hwaccel) { | |
184 assert(!pic->hwaccel_data_private); | |
185 if (s->avctx->hwaccel->priv_data_size) { | |
186 pic->hwaccel_data_private = av_malloc(s->avctx->hwaccel->priv_data_size); | |
187 if (!pic->hwaccel_data_private) { | |
188 av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n"); | |
189 return -1; | |
190 } | |
191 } | |
192 } | |
193 | |
182 r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic); | 194 r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic); |
183 | 195 |
184 if (r<0 || !pic->age || !pic->type || !pic->data[0]) { | 196 if (r<0 || !pic->age || !pic->type || !pic->data[0]) { |
185 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]); | 197 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]); |
198 av_freep(&pic->hwaccel_data_private); | |
186 return -1; | 199 return -1; |
187 } | 200 } |
188 | 201 |
189 if (s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])) { | 202 if (s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])) { |
190 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n"); | 203 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n"); |