How to create global variable and access it in videodev.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good day!

I want to have global variable with current frame buffer if file videodev.h
I added next code:

static int PutCurrectPicutre(void* pBuffer, pj_size_t lsize);
static int GetCurrectPicutre(void* pBuffer, pj_size_t lsize);
static pjmedia_frame frameBuffer;
static void* g_Buffer;
int PutCurrectPicutre(void* pBuffer, pj_size_t lsize)
{
 if (g_Buffer == 0 && lsize > 0 && pBuffer != 0)
 {
  // alocate memory
  g_Buffer = (void *) malloc(lsize);
 }
 // do copy
 if (pBuffer != 0 && g_Buffer != 0)
 {
  pj_memcpy(g_Buffer, pBuffer, lsize);
  frameBuffer.buf = pBuffer;
 }
 //free(g_Buffer);
 return 0;
}
int GetCurrectPicutre(void* pBuffer, pj_size_t lsize)
{
 if (pBuffer != 0 && g_Buffer != 0)
 {
  pj_memcpy(pBuffer, g_Buffer, lsize * 2);
  pj_memcpy(pBuffer, frameBuffer.buf, lsize * 2);
 }
 return 0;
}
I call PutCurrectPicutre from my UI at MFC and I sucessfully allocate
buffer or copy my buffer to pjmedia_frame.
But then I call GetCurrectPicutre from videodev.c (method
pjmedia_vid_dev_stream_get_frame). My allocated buffer and frame buffer are
not initialized.

Question1: How can I create global variable in PJSIP to access it from
different threads?
Question2: How can I create my own callback to ask UI about frame?

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120217/b2b9ef01/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux