PipeWire: mem.h File Reference

PipeWire 0.3.7

Data Structures | Macros | Enumerations | Functions
mem.h File Reference
Include dependency graph for mem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | pw_mempool
class | pw_memblock
struct | pw_memmap
| a mapped region of a pw_memblock More...
struct | pw_mempool_events
struct | pw_map_range
| parameters to map a memory range More...

## Macros
#define | PW_VERSION_MEMPOOL_EVENTS 0
#define | PW_MAP_RANGE_INIT (struct pw_map_range){ 0, }

## Enumerations
enum | pw_memmap_flags { PW_MEMMAP_FLAG_NONE = 0, PW_MEMMAP_FLAG_READ = (1 << 0), PW_MEMMAP_FLAG_WRITE = (1 << 1), PW_MEMMAP_FLAG_TWICE = (1 << 2), PW_MEMMAP_FLAG_PRIVATE = (1 << 3), PW_MEMMAP_FLAG_READWRITE = PW_MEMMAP_FLAG_READ | PW_MEMMAP_FLAG_WRITE }

## Functions
struct pw_mempool * | pw_mempool_new (struct pw_properties *props)
| Create a new memory pool. More...
void | pw_mempool_add_listener (struct pw_mempool *pool, struct spa_hook *listener, const struct pw_mempool_events *events, void *data)
| Listen for events. More...
void | pw_mempool_clear (struct pw_mempool *pool)
| Clear a pool. More...
void | pw_mempool_destroy (struct pw_mempool *pool)
| Clear and destroy a pool. More...
struct pw_memblock * | pw_mempool_alloc (struct pw_mempool *pool, enum pw_memblock_flags flags, uint32_t type, size_t size)
| Allocate a memory block from the pool. More...
struct pw_memblock * | pw_mempool_import_block (struct pw_mempool *pool, struct pw_memblock *mem)
| Import a block from another pool. More...
struct pw_memblock * | pw_mempool_import (struct pw_mempool *pool, enum pw_memblock_flags flags, uint32_t type, int fd)
| Import an fd into the pool. More...
void | pw_memblock_free (struct pw_memblock *mem)
| Free a memblock regardless of the refcount and destroy all mappings. More...
int | pw_mempool_remove_id (struct pw_mempool *pool, uint32_t id)
| Remove a memblock for given id. More...
struct pw_memblock * | pw_mempool_find_ptr (struct pw_mempool *pool, const void *ptr)
| Find memblock for given ptr. More...
struct pw_memblock * | pw_mempool_find_id (struct pw_mempool *pool, uint32_t id)
| Find memblock for given id. More...
struct pw_memblock * | pw_mempool_find_fd (struct pw_mempool *pool, int fd)
| Find memblock for given fd. More...
struct pw_memmap * | pw_memblock_map (struct pw_memblock *block, enum pw_memmap_flags flags, uint32_t offset, uint32_t size, uint32_t tag[5])
| Map a region of a memory block. More...
struct pw_memmap * | pw_mempool_map_id (struct pw_mempool *pool, uint32_t id, enum pw_memmap_flags flags, uint32_t offset, uint32_t size, uint32_t tag[5])
| Map a region of a memory block with id. More...
struct pw_memmap * | pw_mempool_import_map (struct pw_mempool *pool, struct pw_mempool *other, void *data, uint32_t size, uint32_t tag[5])
struct pw_memmap * | pw_mempool_find_tag (struct pw_mempool *pool, uint32_t tag[5], size_t size)
| find a map with the given tag More...
int | pw_memmap_free (struct pw_memmap *map)
| Unmap a region. More...

## Macro Definition Documentation

## ◆ PW_MAP_RANGE_INIT

#define PW_MAP_RANGE_INIT (struct pw_map_range){ 0, }

## ◆ PW_VERSION_MEMPOOL_EVENTS

#define PW_VERSION_MEMPOOL_EVENTS 0

## Enumeration Type Documentation

## ◆ pw_memmap_flags

enum pw_memmap_flags

Enumerator
PW_MEMMAP_FLAG_NONE |
PW_MEMMAP_FLAG_READ | map in read mode
PW_MEMMAP_FLAG_WRITE | map in write mode
PW_MEMMAP_FLAG_TWICE | map the same area twice afer eachother, creating a circular ringbuffer
PW_MEMMAP_FLAG_PRIVATE | writes will be private
PW_MEMMAP_FLAG_READWRITE |

## Function Documentation

## ◆ pw_memblock_free()

void pw_memblock_free | ( | struct pw_memblock * | mem | ) |

Free a memblock regardless of the refcount and destroy all mappings.

## ◆ pw_memblock_map()

struct pw_memmap* pw_memblock_map | ( | struct pw_memblock * | block,
|  | enum pw_memmap_flags | flags,
|  | uint32_t | offset,
|  | uint32_t | size,
|  | uint32_t | tag[5]
| ) |  |

Map a region of a memory block.

References pw_memblock::pool.

Referenced by pw_memblock::pw_mempool_alloc(), and pw_mempool_map_id().

## ◆ pw_memmap_free()

int pw_memmap_free | ( | struct pw_memmap * | map | ) |

Unmap a region.

References mapping::block, pw_memblock::fd, memmap::link, memmap::mapping, NAME, pw_memblock::pool, pw_memmap::ptr, pw_log::pw_log_debug, mapping::ref, memblock::this, and memmap::this.

Referenced by pw_memblock::pw_memblock_free().

## ◆ pw_mempool_add_listener()

void pw_mempool_add_listener | ( | struct pw_mempool * | pool,
|  | struct spa_hook * | listener,
|  | const struct pw_mempool_events * | events,
|  | void * | data
| ) |  |

Listen for events.

Referenced by pw_impl_client::pw_context_create_client().

## ◆ pw_mempool_alloc()

struct pw_memblock* pw_mempool_alloc | ( | struct pw_mempool * | pool,
|  | enum pw_memblock_flags | flags,
|  | uint32_t | type,
|  | size_t | size
| ) |  |

Allocate a memory block from the pool.

## ◆ pw_mempool_clear()

void pw_mempool_clear | ( | struct pw_mempool * | pool | ) |

Clear a pool.

References memblock::link, NAME, pw_log::pw_log_debug, pw_memblock::pw_memblock_free(), and memblock::this.

Referenced by pw_mempool_destroy().

## ◆ pw_mempool_destroy()

void pw_mempool_destroy | ( | struct pw_mempool * | pool | ) |

Clear and destroy a pool.

References NAME, pw_mempool::props, pw_log::pw_log_debug, pw_map::pw_map_clear(), pw_mempool_clear(), pw_mempool_emit_destroy, and pw_properties::pw_properties_free().

## ◆ pw_mempool_find_fd()

struct pw_memblock* pw_mempool_find_fd | ( | struct pw_mempool * | pool,
|  | int | fd
| ) |  |

Find memblock for given fd.

## ◆ pw_mempool_find_id()

struct pw_memblock* pw_mempool_find_id | ( | struct pw_mempool * | pool,
|  | uint32_t | id
| ) |  |

Find memblock for given id.

References NAME, pw_log::pw_log_debug, pw_map::pw_map_lookup(), and memblock::this.

## ◆ pw_mempool_find_ptr()

struct pw_memblock* pw_mempool_find_ptr | ( | struct pw_mempool * | pool,
|  | const void * | ptr
| ) |  |

Find memblock for given ptr.

References pw_memblock::id, mapping::link, memblock::mappings, NAME, mapping::ptr, pw_log::pw_log_debug, mapping::size, and memblock::this.

Referenced by pw_mempool_import_map().

## ◆ pw_mempool_find_tag()

struct pw_memmap* pw_mempool_find_tag | ( | struct pw_mempool * | pool,
|  | uint32_t | tag[5],
|  | size_t | size
| ) |  |

find a map with the given tag

References memmap::link, memblock::memmaps, NAME, pw_log::pw_log_debug, pw_memmap::tag, and memmap::this.

## ◆ pw_mempool_import()

struct pw_memblock* pw_mempool_import | ( | struct pw_mempool * | pool,
|  | enum pw_memblock_flags | flags,
|  | uint32_t | type,
|  | int | fd
| ) |  |

Import an fd into the pool.

Referenced by pw_mempool_import_block().

## ◆ pw_mempool_import_block()

struct pw_memblock* pw_mempool_import_block | ( | struct pw_mempool * | pool,
|  | struct pw_memblock * | mem
| ) |  |

Import a block from another pool.

References pw_memblock::fd, pw_memblock::flags, NAME, pw_memblock::pool, pw_log::pw_log_debug, PW_MEMBLOCK_FLAG_DONT_CLOSE, pw_mempool_import(), and pw_memblock::type.

Referenced by pw_mempool_import_map().

## ◆ pw_mempool_import_map()

struct pw_memmap* pw_mempool_import_map | ( | struct pw_mempool * | pool,
|  | struct pw_mempool * | other,
|  | void * | data,
|  | uint32_t | size,
|  | uint32_t | tag[5]
| ) |  |

References pw_memmap::block, mapping::block, pw_memblock::map, pw_memmap::offset, pw_mempool_find_ptr(), pw_mempool_import_block(), and pw_memblock::ref.

## ◆ pw_mempool_map_id()

struct pw_memmap* pw_mempool_map_id | ( | struct pw_mempool * | pool,
|  | uint32_t | id,
|  | enum pw_memmap_flags | flags,
|  | uint32_t | offset,
|  | uint32_t | size,
|  | uint32_t | tag[5]
| ) |  |

Map a region of a memory block with id.

References pw_map::pw_map_lookup(), pw_memblock_map(), and memblock::this.

## ◆ pw_mempool_new()

struct pw_mempool* pw_mempool_new | ( | struct pw_properties * | props | ) |

Create a new memory pool.

References NAME, pw_mempool::props, pw_log::pw_log_debug, pw_map::pw_map_init(), and impl::this.

Referenced by pw_impl_client::pw_context_create_client().

## ◆ pw_mempool_remove_id()

int pw_mempool_remove_id | ( | struct pw_mempool * | pool,
|  | uint32_t | id
| ) |  |

Remove a memblock for given id.

References pw_memblock::fd, pw_memblock::id, NAME, pw_log::pw_log_debug, pw_map::pw_map_lookup(), pw_map::pw_map_remove(), pw_memblock::ref, and memblock::this.