2 * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
24 #include "gstphysmemory.h"
26 G_DEFINE_INTERFACE (GstPhysMemoryAllocator, gst_phys_memory_allocator,
30 gst_phys_memory_allocator_default_init (GstPhysMemoryAllocatorInterface * iface)
38 * Returns: whether the memory at @mem is backed by physical memory
43 gst_is_phys_memory (GstMemory * mem)
45 return mem != NULL && mem->allocator != NULL
46 && g_type_is_a (G_OBJECT_TYPE (mem->allocator),
47 GST_TYPE_PHYS_MEMORY_ALLOCATOR);
51 * gst_phys_memory_get_phys_addr:
54 * Returns: Physical memory address that is backing @mem, or 0 if none
59 gst_phys_memory_get_phys_addr (GstMemory * mem)
61 GstPhysMemoryAllocatorInterface *iface;
63 g_return_val_if_fail (gst_is_phys_memory (mem), 0);
65 iface = GST_PHYS_MEMORY_ALLOCATOR_GET_INTERFACE (mem->allocator);
66 g_return_val_if_fail (iface->get_phys_addr != NULL, 0);
68 return iface->get_phys_addr ((GstPhysMemoryAllocator *) mem->allocator, mem);