summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2009-03-09 08:04:41 +0000
committerGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2009-03-09 08:04:41 +0000
commit68e5d5235edbb1b837eef046811255a95d6225f9 (patch)
treee53ea187c7490121a794d9cac4257dc753243530 /libavcodec/mpegvideo.c
parentaf79f1ae7804b0c715014a4a53ffb71b6a73d218 (diff)
Add private HW accel data infrastructure.
Originally committed as revision 17899 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 43f2f1ff1d..9602604b35 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -170,6 +170,7 @@ void ff_copy_picture(Picture *dst, Picture *src){
static void free_frame_buffer(MpegEncContext *s, Picture *pic)
{
s->avctx->release_buffer(s->avctx, (AVFrame*)pic);
+ av_freep(&pic->hwaccel_data_private);
}
/**
@@ -179,10 +180,22 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
{
int r;
+ if (s->avctx->hwaccel) {
+ assert(!pic->hwaccel_data_private);
+ if (s->avctx->hwaccel->priv_data_size) {
+ pic->hwaccel_data_private = av_malloc(s->avctx->hwaccel->priv_data_size);
+ if (!pic->hwaccel_data_private) {
+ av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
+ return -1;
+ }
+ }
+ }
+
r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic);
if (r<0 || !pic->age || !pic->type || !pic->data[0]) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
+ av_freep(&pic->hwaccel_data_private);
return -1;
}