diff options
Diffstat (limited to 'build/doc/html/map_8h_source.html')
-rw-r--r-- | build/doc/html/map_8h_source.html | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/build/doc/html/map_8h_source.html b/build/doc/html/map_8h_source.html new file mode 100644 index 00000000..545948c9 --- /dev/null +++ b/build/doc/html/map_8h_source.html @@ -0,0 +1,109 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.15"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>PipeWire: map.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="navtree.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="resize.js"></script> +<script type="text/javascript" src="navtreedata.js"></script> +<script type="text/javascript" src="navtree.js"></script> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ + $(document).ready(initResizable); +/* @license-end */</script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">PipeWire +  <span id="projectnumber">0.2.9</span> + </div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.15 --> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(function() { + initMenu('',false,false,'search.php','Search'); +}); +/* @license-end */</script> +<div id="main-nav"></div> +</div><!-- top --> +<div id="side-nav" class="ui-resizable side-nav-resizable"> + <div id="nav-tree"> + <div id="nav-tree-contents"> + <div id="nav-sync" class="sync"></div> + </div> + </div> + <div id="splitbar" style="-moz-user-select:none;" + class="ui-resizable-handle"> + </div> +</div> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(document).ready(function(){initNavTree('map_8h_source.html','');}); +/* @license-end */ +</script> +<div id="doc-content"> +<div class="header"> + <div class="headertitle"> +<div class="title">map.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="map_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/* PipeWire</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> *</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Copyright © 2018 Wim Taymans</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> *</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * copy of this software and associated documentation files (the "Software"),</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * to deal in the Software without restriction, including without limitation</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * Software is furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> *</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * The above copyright notice and this permission notice (including the next</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * paragraph) shall be included in all copies or substantial portions of the</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * Software.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * DEALINGS IN THE SOFTWARE.</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> */</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#ifndef PIPEWIRE_MAP_H</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#define PIPEWIRE_MAP_H</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#include <errno.h></span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#include <spa/utils/defs.h></span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#include <<a class="code" href="array_8h.html">pipewire/array.h</a>></span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="unionpw__map__item.html"> 44</a></span> <span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> {</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="unionpw__map__item.html#a51685fc6de470af5d8a477bc98de5bb2"> 45</a></span>  uint32_t <a class="code" href="unionpw__map__item.html#a51685fc6de470af5d8a477bc98de5bb2">next</a>; </div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38"> 46</a></span>  <span class="keywordtype">void</span> *<a class="code" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">data</a>; </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> };</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="structpw__map.html"> 50</a></span> <span class="keyword">struct </span><a class="code" href="structpw__map.html">pw_map</a> {</div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b"> 51</a></span>  <span class="keyword">struct </span><a class="code" href="structpw__array.html">pw_array</a> <a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>; </div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87"> 52</a></span>  uint32_t <a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a>; </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> };</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="map_8h.html#ab8be77b792f9714ce04160c5a5cbcfac"> 55</a></span> <span class="preprocessor">#define PW_MAP_INIT(extend) (struct pw_map) { PW_ARRAY_INIT(extend), 0 }</span></div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="map_8h.html#a2ef0d619ea803c94409128752bb89763"> 57</a></span> <span class="preprocessor">#define pw_map_get_size(m) pw_array_get_len(&(m)->items, union pw_map_item)</span></div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="map_8h.html#ae4711748f39e5e8235faf961f35fb8a2"> 58</a></span> <span class="preprocessor">#define pw_map_get_item(m,id) pw_array_get_unchecked(&(m)->items,id,union pw_map_item)</span></div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="map_8h.html#abbbe18fa2f93752c95f83ccac5a8e9a6"> 59</a></span> <span class="preprocessor">#define pw_map_item_is_free(item) ((item)->next & 0x1)</span></div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="map_8h.html#ac7d645f3b51c4be5a442464a5d8132cf"> 60</a></span> <span class="preprocessor">#define pw_map_id_is_free(m,id) (pw_map_item_is_free(pw_map_get_item(m,id)))</span></div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="map_8h.html#a0b288cc2632c67d0ea9f6891baf3ab54"> 61</a></span> <span class="preprocessor">#define pw_map_check_id(m,id) ((id) < pw_map_get_size(m))</span></div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="map_8h.html#a68baeb8bdb9f86831c82ce4115bc65ef"> 62</a></span> <span class="preprocessor">#define pw_map_has_item(m,id) (pw_map_check_id(m,id) && !pw_map_id_is_free(m, id))</span></div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="map_8h.html#a7060d2d1b6d51f457b25f1ff1143ab1e"> 63</a></span> <span class="preprocessor">#define pw_map_lookup_unchecked(m,id) pw_map_get_item(m,id)->data</span></div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="structpw__map.html#a3e84b47d125ced3009966a174bb256fa"> 66</a></span> <span class="preprocessor">#define PW_MAP_ID_TO_PTR(id) (SPA_UINT32_TO_PTR((id)<<1))</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div><div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="structpw__map.html#a91899b8a60f9dddea1580fd68aa1ae5f"> 68</a></span> <span class="preprocessor">#define PW_MAP_PTR_TO_ID(p) (SPA_PTR_TO_UINT32(p)>>1)</span></div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structpw__map.html#acdd13c22e79cecf19a28d30e1154d323"> 76</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structpw__map.html#acdd13c22e79cecf19a28d30e1154d323">pw_map_init</a>(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map, <span class="keywordtype">size_t</span> <a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a>, <span class="keywordtype">size_t</span> <a class="code" href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c">extend</a>)</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> {</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <a class="code" href="structpw__array.html#a41905dd179bcee03cceef47579e0a22e">pw_array_init</a>(&map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>, <a class="code" href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c">extend</a>);</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <a class="code" href="structpw__array.html#a3045d41af637079f6cba71102050f119">pw_array_ensure_size</a>(&map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>, <a class="code" href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">size</a> * <span class="keyword">sizeof</span>(<span class="keyword">union</span> <a class="code" href="unionpw__map__item.html">pw_map_item</a>));</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  map-><a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a> = SPA_ID_INVALID;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> }</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> </div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="structpw__map.html#a962f1ba02a79802e16088c4ae8174804"> 87</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structpw__map.html#a962f1ba02a79802e16088c4ae8174804">pw_map_clear</a>(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map)</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> {</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  pw_array_clear(&map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> }</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> pw_map_reset(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map)</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> {</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  pw_array_reset(&map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>);</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  map-><a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a> = SPA_ID_INVALID;</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> }</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div><div class="line"><a name="l00105"></a><span class="lineno"><a class="line" href="structpw__map.html#a39efc6ce617c07d672b287945cf7a46b"> 105</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="structpw__map.html#a39efc6ce617c07d672b287945cf7a46b">pw_map_insert_new</a>(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map, <span class="keywordtype">void</span> *<a class="code" href="structdata.html">data</a>)</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> {</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *start, *item;</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  uint32_t id;</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> </div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordflow">if</span> (map-><a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a> != SPA_ID_INVALID) {</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  start = (<span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *) map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>.<a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a>;</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  item = &start[map-><a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a> >> 1];</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  map-><a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a> = item-><a class="code" href="unionpw__map__item.html#a51685fc6de470af5d8a477bc98de5bb2">next</a>;</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  item = (<span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *) <a class="code" href="structpw__array.html#adf6a4fd9f9bd810eb374737b3d1169b2">pw_array_add</a>(&map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>, <span class="keyword">sizeof</span>(<span class="keyword">union</span> <a class="code" href="unionpw__map__item.html">pw_map_item</a>));</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">if</span> (item == NULL)</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordflow">return</span> SPA_ID_INVALID;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  start = (<span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *) map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>.<a class="code" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">data</a>;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  }</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  item-><a class="code" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">data</a> = <a class="code" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">data</a>;</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keywordtype">id</span> = (item - start);</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordflow">return</span> id;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> }</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="structpw__map.html#a10124711c6ab6ad3c1b9e6cab49dc4e4"> 133</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="structpw__map.html#a10124711c6ab6ad3c1b9e6cab49dc4e4">pw_map_insert_at</a>(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map, uint32_t <span class="keywordtype">id</span>, <span class="keywordtype">void</span> *<a class="code" href="structdata.html">data</a>)</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> {</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordtype">size_t</span> size = <a class="code" href="map_8h.html#a2ef0d619ea803c94409128752bb89763">pw_map_get_size</a>(map);</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *item;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordflow">if</span> (<span class="keywordtype">id</span> > size)</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keywordflow">return</span> -ENOSPC;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == size) {</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  item = (<span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *) <a class="code" href="structpw__array.html#adf6a4fd9f9bd810eb374737b3d1169b2">pw_array_add</a>(&map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>, <span class="keyword">sizeof</span>(<span class="keyword">union</span> <a class="code" href="unionpw__map__item.html">pw_map_item</a>));</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keywordflow">if</span> (item == NULL)</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordflow">return</span> -errno;</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  }</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">else</span> {</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  item = <a class="code" href="map_8h.html#ae4711748f39e5e8235faf961f35fb8a2">pw_map_get_item</a>(map, <span class="keywordtype">id</span>);</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  }</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  item-><a class="code" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">data</a> = <a class="code" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">data</a>;</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> }</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> </div><div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="structpw__map.html#a07ee8a656f7e1ffbc10cb343b4881a86"> 157</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structpw__map.html#a07ee8a656f7e1ffbc10cb343b4881a86">pw_map_remove</a>(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map, uint32_t <span class="keywordtype">id</span>)</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> {</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <a class="code" href="map_8h.html#ae4711748f39e5e8235faf961f35fb8a2">pw_map_get_item</a>(map, <span class="keywordtype">id</span>)->next = map-><a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a>;</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  map-><a class="code" href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">free_list</a> = (<span class="keywordtype">id</span> << 1) | 1;</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> }</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> </div><div class="line"><a name="l00169"></a><span class="lineno"><a class="line" href="structpw__map.html#a9656703501cdaa5a82adb9db60f76fc6"> 169</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> *<a class="code" href="structpw__map.html#a9656703501cdaa5a82adb9db60f76fc6">pw_map_lookup</a>(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map, uint32_t <span class="keywordtype">id</span>)</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> {</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">if</span> (SPA_LIKELY(<a class="code" href="map_8h.html#a0b288cc2632c67d0ea9f6891baf3ab54">pw_map_check_id</a>(map, <span class="keywordtype">id</span>))) {</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *item = <a class="code" href="map_8h.html#ae4711748f39e5e8235faf961f35fb8a2">pw_map_get_item</a>(map, <span class="keywordtype">id</span>);</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keywordflow">if</span> (!<a class="code" href="map_8h.html#abbbe18fa2f93752c95f83ccac5a8e9a6">pw_map_item_is_free</a>(item))</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <span class="keywordflow">return</span> item-><a class="code" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">data</a>;</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  }</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span> }</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span> </div><div class="line"><a name="l00188"></a><span class="lineno"><a class="line" href="structpw__map.html#adcd4d2843a41d2f0d70bfd80790a9518"> 188</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="structpw__map.html#adcd4d2843a41d2f0d70bfd80790a9518">pw_map_for_each</a>(<span class="keyword">struct</span> <a class="code" href="structpw__map.html">pw_map</a> *map,</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="keywordtype">int</span> (*func) (<span class="keywordtype">void</span> *item_data, <span class="keywordtype">void</span> *<a class="code" href="structdata.html">data</a>), <span class="keywordtype">void</span> *<a class="code" href="structdata.html">data</a>)</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> {</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keyword">union </span><a class="code" href="unionpw__map__item.html">pw_map_item</a> *item;</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keywordtype">int</span> res = 0;</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <a class="code" href="array_8h.html#aa960ca693013e1b7fce13b0968db70b8">pw_array_for_each</a>(item, &map-><a class="code" href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">items</a>) {</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (!<a class="code" href="map_8h.html#abbbe18fa2f93752c95f83ccac5a8e9a6">pw_map_item_is_free</a>(item))</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordflow">if</span> ((res = func(item-><a class="code" href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">data</a>, <a class="code" href="structdata.html">data</a>)) != 0)</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> }</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> </div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> } <span class="comment">/* extern "C" */</span></div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> </div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="preprocessor">#endif </span><span class="comment">/* PIPEWIRE_MAP_H */</span><span class="preprocessor"></span></div><div class="ttc" id="structpw__map_html_a962f1ba02a79802e16088c4ae8174804"><div class="ttname"><a href="structpw__map.html#a962f1ba02a79802e16088c4ae8174804">pw_map::pw_map_clear</a></div><div class="ttdeci">static void pw_map_clear(struct pw_map *map)</div><div class="ttdoc">Clear a map.</div><div class="ttdef"><b>Definition:</b> map.h:87</div></div> +<div class="ttc" id="structpw__array_html_a3045d41af637079f6cba71102050f119"><div class="ttname"><a href="structpw__array.html#a3045d41af637079f6cba71102050f119">pw_array::pw_array_ensure_size</a></div><div class="ttdeci">static int pw_array_ensure_size(struct pw_array *arr, size_t size)</div><div class="ttdoc">Make sure size bytes can be added to the array.</div><div class="ttdef"><b>Definition:</b> array.h:99</div></div> +<div class="ttc" id="map_8h_html_a2ef0d619ea803c94409128752bb89763"><div class="ttname"><a href="map_8h.html#a2ef0d619ea803c94409128752bb89763">pw_map_get_size</a></div><div class="ttdeci">#define pw_map_get_size(m)</div><div class="ttdef"><b>Definition:</b> map.h:57</div></div> +<div class="ttc" id="structpw__array_html_adf6a4fd9f9bd810eb374737b3d1169b2"><div class="ttname"><a href="structpw__array.html#adf6a4fd9f9bd810eb374737b3d1169b2">pw_array::pw_array_add</a></div><div class="ttdeci">static void * pw_array_add(struct pw_array *arr, size_t size)</div><div class="ttdoc">Add ref size bytes to arr.</div><div class="ttdef"><b>Definition:</b> array.h:121</div></div> +<div class="ttc" id="structpw__map_html_acf2ad4417afa20b00e4a1f3837573d87"><div class="ttname"><a href="structpw__map.html#acf2ad4417afa20b00e4a1f3837573d87">pw_map::free_list</a></div><div class="ttdeci">uint32_t free_list</div><div class="ttdoc">the free items</div><div class="ttdef"><b>Definition:</b> map.h:52</div></div> +<div class="ttc" id="map_8h_html_ae4711748f39e5e8235faf961f35fb8a2"><div class="ttname"><a href="map_8h.html#ae4711748f39e5e8235faf961f35fb8a2">pw_map_get_item</a></div><div class="ttdeci">#define pw_map_get_item(m, id)</div><div class="ttdef"><b>Definition:</b> map.h:58</div></div> +<div class="ttc" id="array_8h_html_aa960ca693013e1b7fce13b0968db70b8"><div class="ttname"><a href="array_8h.html#aa960ca693013e1b7fce13b0968db70b8">pw_array_for_each</a></div><div class="ttdeci">#define pw_array_for_each(pos, array)</div><div class="ttdef"><b>Definition:</b> array.h:67</div></div> +<div class="ttc" id="structpw__map_html_adcd4d2843a41d2f0d70bfd80790a9518"><div class="ttname"><a href="structpw__map.html#adcd4d2843a41d2f0d70bfd80790a9518">pw_map::pw_map_for_each</a></div><div class="ttdeci">static int pw_map_for_each(struct pw_map *map, int(*func)(void *item_data, void *data), void *data)</div><div class="ttdoc">Iterate all map items.</div><div class="ttdef"><b>Definition:</b> map.h:188</div></div> +<div class="ttc" id="structpw__array_html_ab0929cdf2f7acb291f2f17be299b8ea5"><div class="ttname"><a href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">pw_array::data</a></div><div class="ttdeci">void * data</div><div class="ttdoc">pointer to array data</div><div class="ttdef"><b>Definition:</b> array.h:44</div></div> +<div class="ttc" id="unionpw__map__item_html_a51685fc6de470af5d8a477bc98de5bb2"><div class="ttname"><a href="unionpw__map__item.html#a51685fc6de470af5d8a477bc98de5bb2">pw_map_item::next</a></div><div class="ttdeci">uint32_t next</div><div class="ttdoc">next free index</div><div class="ttdef"><b>Definition:</b> map.h:45</div></div> +<div class="ttc" id="array_8h_html"><div class="ttname"><a href="array_8h.html">array.h</a></div></div> +<div class="ttc" id="map_8h_html_abbbe18fa2f93752c95f83ccac5a8e9a6"><div class="ttname"><a href="map_8h.html#abbbe18fa2f93752c95f83ccac5a8e9a6">pw_map_item_is_free</a></div><div class="ttdeci">#define pw_map_item_is_free(item)</div><div class="ttdef"><b>Definition:</b> map.h:59</div></div> +<div class="ttc" id="structpw__map_html_acdd13c22e79cecf19a28d30e1154d323"><div class="ttname"><a href="structpw__map.html#acdd13c22e79cecf19a28d30e1154d323">pw_map::pw_map_init</a></div><div class="ttdeci">static void pw_map_init(struct pw_map *map, size_t size, size_t extend)</div><div class="ttdoc">Initialize a map.</div><div class="ttdef"><b>Definition:</b> map.h:76</div></div> +<div class="ttc" id="map_8h_html_a0b288cc2632c67d0ea9f6891baf3ab54"><div class="ttname"><a href="map_8h.html#a0b288cc2632c67d0ea9f6891baf3ab54">pw_map_check_id</a></div><div class="ttdeci">#define pw_map_check_id(m, id)</div><div class="ttdef"><b>Definition:</b> map.h:61</div></div> +<div class="ttc" id="structpw__array_html_a41905dd179bcee03cceef47579e0a22e"><div class="ttname"><a href="structpw__array.html#a41905dd179bcee03cceef47579e0a22e">pw_array::pw_array_init</a></div><div class="ttdeci">static void pw_array_init(struct pw_array *arr, size_t extend)</div><div class="ttdoc">Initialize the array with given extend.</div><div class="ttdef"><b>Definition:</b> array.h:79</div></div> +<div class="ttc" id="structpw__map_html_a9656703501cdaa5a82adb9db60f76fc6"><div class="ttname"><a href="structpw__map.html#a9656703501cdaa5a82adb9db60f76fc6">pw_map::pw_map_lookup</a></div><div class="ttdeci">static void * pw_map_lookup(struct pw_map *map, uint32_t id)</div><div class="ttdoc">Find an item in the map.</div><div class="ttdef"><b>Definition:</b> map.h:169</div></div> +<div class="ttc" id="structpw__map_html_a10124711c6ab6ad3c1b9e6cab49dc4e4"><div class="ttname"><a href="structpw__map.html#a10124711c6ab6ad3c1b9e6cab49dc4e4">pw_map::pw_map_insert_at</a></div><div class="ttdeci">static int pw_map_insert_at(struct pw_map *map, uint32_t id, void *data)</div><div class="ttdoc">Insert data in the map at an index.</div><div class="ttdef"><b>Definition:</b> map.h:133</div></div> +<div class="ttc" id="structpw__array_html"><div class="ttname"><a href="structpw__array.html">pw_array</a></div><div class="ttdoc">An array object.</div><div class="ttdef"><b>Definition:</b> array.h:43</div></div> +<div class="ttc" id="unionpw__map__item_html"><div class="ttname"><a href="unionpw__map__item.html">pw_map_item</a></div><div class="ttdoc">An entry in the map.</div><div class="ttdef"><b>Definition:</b> map.h:44</div></div> +<div class="ttc" id="structpw__map_html_a07ee8a656f7e1ffbc10cb343b4881a86"><div class="ttname"><a href="structpw__map.html#a07ee8a656f7e1ffbc10cb343b4881a86">pw_map::pw_map_remove</a></div><div class="ttdeci">static void pw_map_remove(struct pw_map *map, uint32_t id)</div><div class="ttdoc">Remove an item at index.</div><div class="ttdef"><b>Definition:</b> map.h:157</div></div> +<div class="ttc" id="structpw__array_html_a92ae2df32c3d6935897f41b6e7f5ad3c"><div class="ttname"><a href="structpw__array.html#a92ae2df32c3d6935897f41b6e7f5ad3c">pw_array::extend</a></div><div class="ttdeci">size_t extend</div><div class="ttdoc">number of bytes to extend with</div><div class="ttdef"><b>Definition:</b> array.h:47</div></div> +<div class="ttc" id="structpw__map_html_a39efc6ce617c07d672b287945cf7a46b"><div class="ttname"><a href="structpw__map.html#a39efc6ce617c07d672b287945cf7a46b">pw_map::pw_map_insert_new</a></div><div class="ttdeci">static uint32_t pw_map_insert_new(struct pw_map *map, void *data)</div><div class="ttdoc">Insert data in the map.</div><div class="ttdef"><b>Definition:</b> map.h:105</div></div> +<div class="ttc" id="unionpw__map__item_html_a5ab66a0f62ff9e5b8d6192f980658d38"><div class="ttname"><a href="unionpw__map__item.html#a5ab66a0f62ff9e5b8d6192f980658d38">pw_map_item::data</a></div><div class="ttdeci">void * data</div><div class="ttdoc">data of this item, must be an even address</div><div class="ttdef"><b>Definition:</b> map.h:46</div></div> +<div class="ttc" id="structpw__array_html_a3d468425a1a0084f98301e2fd9becc6b"><div class="ttname"><a href="structpw__array.html#a3d468425a1a0084f98301e2fd9becc6b">pw_array::size</a></div><div class="ttdeci">size_t size</div><div class="ttdoc">length of array in bytes</div><div class="ttdef"><b>Definition:</b> array.h:45</div></div> +<div class="ttc" id="structpw__map_html_a6fc621171dbc57de8c44d26f639d2f1b"><div class="ttname"><a href="structpw__map.html#a6fc621171dbc57de8c44d26f639d2f1b">pw_map::items</a></div><div class="ttdeci">struct pw_array items</div><div class="ttdoc">an array with the map items</div><div class="ttdef"><b>Definition:</b> map.h:51</div></div> +<div class="ttc" id="structdata_html"><div class="ttname"><a href="structdata.html">data</a></div><div class="ttdef"><b>Definition:</b> stream.c:69</div></div> +<div class="ttc" id="structpw__map_html"><div class="ttname"><a href="structpw__map.html">pw_map</a></div><div class="ttdoc">A map.</div><div class="ttdef"><b>Definition:</b> map.h:50</div></div> +</div><!-- fragment --></div><!-- contents --> +</div><!-- doc-content --> +<!-- start footer part --> +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> + <ul> + <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_7129a66c92fe7beef816c2ac906ef0b3.html">pipewire</a></li><li class="navelem"><a class="el" href="map_8h.html">map.h</a></li> + <li class="footer">Generated by + <a href="http://www.doxygen.org/index.html"> + <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> + </ul> +</div> +</body> +</html> |