summaryrefslogtreecommitdiffstats
path: root/src/xvmc/block.c
blob: 78fddfb79e00b21e677b1419104bec683377c15b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/extensions/XvMClib.h>
#include <util/u_memory.h>
#include "xvmc_private.h"

Status XvMCCreateBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks)
{
   assert(dpy);

   if (!context)
      return XvMCBadContext;
   if (num_blocks == 0)
      return BadValue;

   assert(blocks);

   blocks->context_id = context->context_id;
   blocks->num_blocks = num_blocks;
   blocks->blocks = MALLOC(BLOCK_SIZE_BYTES * num_blocks);
   blocks->privData = NULL;

   return Success;
}

Status XvMCDestroyBlocks(Display *dpy, XvMCBlockArray *blocks)
{
   assert(dpy);
   assert(blocks);
   FREE(blocks->blocks);

   return Success;
}

Status XvMCCreateMacroBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks)
{
   assert(dpy);

   if (!context)
      return XvMCBadContext;
   if (num_blocks == 0)
      return BadValue;

   assert(blocks);

   blocks->context_id = context->context_id;
   blocks->num_blocks = num_blocks;
   blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks);
   blocks->privData = NULL;

   return Success;
}

Status XvMCDestroyMacroBlocks(Display *dpy, XvMCMacroBlockArray *blocks)
{
   assert(dpy);
   assert(blocks);
   FREE(blocks->macro_blocks);

   return Success;
}