mmeAllocBufferAndGetShminfo(3mms) — Subroutines
Name
mmeAllocBufferAndGetShminfo --- Allocate memory for data buffers and return shared memory information
Syntax
#include <mme/mme_api.h>
void ∗ mmeAllocBufferAndGetShminfo(size_t size,
mmeShmSegmentInfo ∗ shminforet);
Arguments
size_t size
Specifies the amount of memory (in bytes) to allocate.
mmeShmSegmentInfo ∗ shminforet
Specifies a pointer to the mmeShmSegmentInfo data structure that is filled by this function. This data structure does not have to be allocated with the Multimedia Services for DEC OSF/1 AXP memory allocation functions.
The mmeShmSegmentInfo data structure is filled in by the
mmeAllocBufferAndGetShminfo function to specify the shared memory segment.
typedef struct {
ShmSeg shmseg; /∗ resource ID ∗/
int shmid; /∗ kernel ID ∗/
char ∗shmaddr; /∗ address in client ∗/
Bool readOnly; /∗ how the server should attach it ∗/
} mmeShmSegmentInfo;
The mmeShmSegmentInfo data structure has the following fields:
shmseg
Specifies the shared memory segment resource ID.
shmid
Specifies the kernel ID for the shared memory segment.
shmaddr
Specifies the address of the shared memory segment.
readOnly
Specifies the segment as read-only.
If an application wants to pass the shared memory segment address to one of the multimedia functions, such as ICCompress, then it passes shminforet->shmaddr as the pointer.
If there is a local connection to an X server and if the X server supports the MIT Shared Memory Extension, then an application can communicate the shared buffer to the X server. To do this, it needs to pass the shminforet pointer to XShmAttach. When calling the XCreateImage function, pass shminforet->shmaddr as the data pointer. For example:
if ( (image = XCreateImage(
display,
visual,
lpbiOutput->biBitCount,
ZPixmap,
0,
shminforet->shmaddr,
lpbiOutput->biWidth,
lpbiOutput->biHeight,
XBitmapPad(display),
((lpbiOut->biWidth+3)/4) ∗ 4)) == (XImage ∗)NULL)
return 1;
image->obdata = (char ∗)(shminforet);
XShmPutImage(display, window, gc, image, 0, 0, 0, 0,
lpbiOutput->biWidth, lpbiOutput->biHeight, False);
Basically, the shmaddr field of the mmeShmSegmentInfo data structure is the only relevant field for the multimedia functions.
Description
The mmeAllocBufferAndGetShminfo function allocates memory to be used for buffers containing raw data being passed to or from devices through the multimedia API, and returns shared memory information.
The mmeAllocBufferAndGetShminfo function fills in the mmeShmSegmentInfo data structure to specify the shared memory segment.
Extensions
The mmeAllocBufferAndGetShminfo function is a Digital extension to the Microsoft multimedia API specification.
Return Values
Returns a pointer to the memory that was allocated if the function is successful; otherwise, it returns a null pointer.