|
Packit |
971217 |
/* GStreamer
|
|
Packit |
971217 |
* Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
971217 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
971217 |
* License as published by the Free Software Foundation; either
|
|
Packit |
971217 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
971217 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
971217 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
971217 |
* Library General Public License for more details.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
971217 |
* License along with this library; if not, write to the
|
|
Packit |
971217 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit |
971217 |
* Boston, MA 02111-1307, USA.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* SECTION:gstphysmemoryallocator
|
|
Packit |
971217 |
* @title: GstPhysMemoryAllocator
|
|
Packit |
971217 |
* @short_description: Interface for allocators that pass around physical memory addresses
|
|
Packit |
971217 |
* @see_also: #GstMemory
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Since: 1.14
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
971217 |
#include "config.h"
|
|
Packit |
971217 |
#endif
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#include "gstphysmemory.h"
|
|
Packit |
971217 |
|
|
Packit |
971217 |
G_DEFINE_INTERFACE (GstPhysMemoryAllocator, gst_phys_memory_allocator,
|
|
Packit |
971217 |
GST_TYPE_ALLOCATOR);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
static void
|
|
Packit |
971217 |
gst_phys_memory_allocator_default_init (GstPhysMemoryAllocatorInterface * iface)
|
|
Packit |
971217 |
{
|
|
Packit |
971217 |
}
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* gst_is_phys_memory:
|
|
Packit |
971217 |
* @mem: a #GstMemory
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Returns: whether the memory at @mem is backed by physical memory
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Since: 1.14
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
gboolean
|
|
Packit |
971217 |
gst_is_phys_memory (GstMemory * mem)
|
|
Packit |
971217 |
{
|
|
Packit |
971217 |
return mem != NULL && mem->allocator != NULL
|
|
Packit |
971217 |
&& g_type_is_a (G_OBJECT_TYPE (mem->allocator),
|
|
Packit |
971217 |
GST_TYPE_PHYS_MEMORY_ALLOCATOR);
|
|
Packit |
971217 |
}
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* gst_phys_memory_get_phys_addr:
|
|
Packit |
971217 |
* @mem: a #GstMemory
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Returns: Physical memory address that is backing @mem, or 0 if none
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Since: 1.14
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
guintptr
|
|
Packit |
971217 |
gst_phys_memory_get_phys_addr (GstMemory * mem)
|
|
Packit |
971217 |
{
|
|
Packit |
971217 |
GstPhysMemoryAllocatorInterface *iface;
|
|
Packit |
971217 |
|
|
Packit |
971217 |
g_return_val_if_fail (gst_is_phys_memory (mem), 0);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
iface = GST_PHYS_MEMORY_ALLOCATOR_GET_INTERFACE (mem->allocator);
|
|
Packit |
971217 |
g_return_val_if_fail (iface->get_phys_addr != NULL, 0);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
return iface->get_phys_addr ((GstPhysMemoryAllocator *) mem->allocator, mem);
|
|
Packit |
971217 |
}
|