dmabuf: Fix compilation if no mmap is available
Also #ifdef some more code paths that don't make sense without mmap. https://bugzilla.gnome.org/show_bug.cgi?id=708372
This commit is contained in:
parent
556687b94b
commit
9f91b2769d
@ -32,8 +32,10 @@
|
|||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_MMAP
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GstDmaBufMemory
|
* GstDmaBufMemory
|
||||||
@ -61,6 +63,7 @@ GST_DEBUG_CATEGORY_STATIC (dmabuf_debug);
|
|||||||
static void
|
static void
|
||||||
gst_dmabuf_allocator_free (GstAllocator * allocator, GstMemory * gmem)
|
gst_dmabuf_allocator_free (GstAllocator * allocator, GstMemory * gmem)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_MMAP
|
||||||
GstDmaBufMemory *mem = (GstDmaBufMemory *) gmem;
|
GstDmaBufMemory *mem = (GstDmaBufMemory *) gmem;
|
||||||
|
|
||||||
if (mem->data) {
|
if (mem->data) {
|
||||||
@ -71,6 +74,7 @@ gst_dmabuf_allocator_free (GstAllocator * allocator, GstMemory * gmem)
|
|||||||
g_mutex_clear (&mem->lock);
|
g_mutex_clear (&mem->lock);
|
||||||
g_slice_free (GstDmaBufMemory, mem);
|
g_slice_free (GstDmaBufMemory, mem);
|
||||||
GST_DEBUG ("%p: freed", mem);
|
GST_DEBUG ("%p: freed", mem);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
@ -128,7 +132,7 @@ out:
|
|||||||
static void
|
static void
|
||||||
gst_dmabuf_mem_unmap (GstMemory * gmem)
|
gst_dmabuf_mem_unmap (GstMemory * gmem)
|
||||||
{
|
{
|
||||||
#if HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
GstDmaBufMemory *mem = (GstDmaBufMemory *) gmem;
|
GstDmaBufMemory *mem = (GstDmaBufMemory *) gmem;
|
||||||
g_mutex_lock (&mem->lock);
|
g_mutex_lock (&mem->lock);
|
||||||
|
|
||||||
@ -146,6 +150,7 @@ gst_dmabuf_mem_unmap (GstMemory * gmem)
|
|||||||
static GstMemory *
|
static GstMemory *
|
||||||
gst_dmabuf_mem_share (GstMemory * gmem, gssize offset, gssize size)
|
gst_dmabuf_mem_share (GstMemory * gmem, gssize offset, gssize size)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_MMAP
|
||||||
GstDmaBufMemory *mem = (GstDmaBufMemory *) gmem;
|
GstDmaBufMemory *mem = (GstDmaBufMemory *) gmem;
|
||||||
GstDmaBufMemory *sub;
|
GstDmaBufMemory *sub;
|
||||||
GstMemory *parent;
|
GstMemory *parent;
|
||||||
@ -170,6 +175,9 @@ gst_dmabuf_mem_share (GstMemory * gmem, gssize offset, gssize size)
|
|||||||
g_mutex_init (&sub->lock);
|
g_mutex_init (&sub->lock);
|
||||||
|
|
||||||
return GST_MEMORY_CAST (sub);
|
return GST_MEMORY_CAST (sub);
|
||||||
|
#else /* !HAVE_MMAP */
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -249,6 +257,7 @@ gst_dmabuf_allocator_new (void)
|
|||||||
GstMemory *
|
GstMemory *
|
||||||
gst_dmabuf_allocator_alloc (GstAllocator * allocator, gint fd, gsize size)
|
gst_dmabuf_allocator_alloc (GstAllocator * allocator, gint fd, gsize size)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_MMAP
|
||||||
GstDmaBufMemory *mem;
|
GstDmaBufMemory *mem;
|
||||||
|
|
||||||
if (!GST_IS_DMABUF_ALLOCATOR (allocator)) {
|
if (!GST_IS_DMABUF_ALLOCATOR (allocator)) {
|
||||||
@ -269,6 +278,9 @@ gst_dmabuf_allocator_alloc (GstAllocator * allocator, gint fd, gsize size)
|
|||||||
mem->mem.maxsize);
|
mem->mem.maxsize);
|
||||||
|
|
||||||
return (GstMemory *) mem;
|
return (GstMemory *) mem;
|
||||||
|
#else /* !HAVE_MMAP */
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user