diff options
Diffstat (limited to 'page_streams.html')
-rw-r--r-- | page_streams.html | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/page_streams.html b/page_streams.html new file mode 100644 index 00000000..a1d4aa89 --- /dev/null +++ b/page_streams.html @@ -0,0 +1,133 @@ +<!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: Media Streams</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('page_streams.html','');}); +/* @license-end */ +</script> +<div id="doc-content"> +<div class="PageDoc"><div class="header"> + <div class="headertitle"> +<div class="title">Media Streams </div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock"><h1><a class="anchor" id="sec_overview"></a> +Overview</h1> +<p>Media streams are used to exchange data with the PipeWire server. A stream is a wrapper around a proxy for a pw_client_node with just one port.</p> +<p>Streams can be used to:</p> +<ul> +<li>Consume a stream from PipeWire. This is a PW_DIRECTION_INPUT stream. </li> +<li>Produce a stream to PipeWire. This is a PW_DIRECTION_OUTPUT stream</li> +</ul> +<p>You can connect the stream port to a specific server port or let PipeWire choose a port for you.</p> +<p>For more complicated nodes such as filters or ports with multiple inputs and/or outputs you will need to create a <a class="el" href="classpw__node.html" title="PipeWire node class.">pw_node</a> yourself and export it with <a class="el" href="remote_8c.html#ad16e4bdd4e2d45ef70366adf85c3ab61">pw_remote_export</a>.</p> +<h1><a class="anchor" id="sec_create"></a> +Create</h1> +<p>Make a new stream with <a class="el" href="classpw__stream.html#a6f1606e27cc3bd9c522b92c9469a6f2f">pw_stream_new()</a>. You will need to specify a name for the stream and extra properties. You can use <a class="el" href="classpw__pipewire.html#a841dbb7608dc9cdda4a320d33fbbd39a">pw_fill_stream_properties()</a> to get a basic set of properties for the stream.</p> +<p>Once the stream is created, the state_changed event should be used to track the state of the stream.</p> +<h1><a class="anchor" id="sec_connect"></a> +Connect</h1> +<p>The stream is initially unconnected. To connect the stream, use <a class="el" href="classpw__stream.html#a0e12176f13e654e64e7f5689e7a6dd54">pw_stream_connect()</a>. Pass the desired direction as an argument.</p> +<h2><a class="anchor" id="ssec_stream_target"></a> +Stream target</h2> +<p>To make the newly connected stream automatically connect to an existing PipeWire node, use the <a class="el" href="stream_8h.html#a058907c2dffbb8fb5ede8a53d7604106ab648fa0c0c7adf6aa3139eddc3a9cd7c">PW_STREAM_FLAG_AUTOCONNECT</a> and the port_path argument while connecting.</p> +<h2><a class="anchor" id="ssec_stream_formats"></a> +Stream formats</h2> +<p>An array of possible formats that this stream can consume or provide must be specified.</p> +<h1><a class="anchor" id="sec_format"></a> +Format negotiation</h1> +<p>After connecting the stream, it will transition to the <a class="el" href="stream_8h.html#a9ceaca6fc9acd9a1af080258d763fb82a6d38d0ac9310b1822fcc98add8e4a8d2">PW_STREAM_STATE_CONFIGURE</a> state. In this state the format will be negotiated by the PipeWire server.</p> +<p>Once the format has been selected, the format_changed event is emited with the configured format as a parameter.</p> +<p>The client should now prepare itself to deal with the format and complete the negotiation procedure with a call to <a class="el" href="classpw__stream.html#abcd423c15a39666ea50abef5ff7a75bd">pw_stream_finish_format()</a>.</p> +<p>As arguments to <a class="el" href="classpw__stream.html#abcd423c15a39666ea50abef5ff7a75bd">pw_stream_finish_format()</a> an array of spa_param structures must be given. They contain parameters such as buffer size, number of buffers, required metadata and other parameters for the media buffers.</p> +<h1><a class="anchor" id="sec_buffers"></a> +Buffer negotiation</h1> +<p>After completing the format negotiation, PipeWire will allocate and notify the stream of the buffers that will be used to exchange data between client and server.</p> +<p>With the add_buffer event, a stream will be notified of a new buffer that can be used for data transport. You can attach user_data to these buffers.</p> +<p>Afer the buffers are negotiated, the stream will transition to the <a class="el" href="stream_8h.html#a9ceaca6fc9acd9a1af080258d763fb82a0537b5f9f722fb2faf7822cd09370825">PW_STREAM_STATE_PAUSED</a> state.</p> +<h1><a class="anchor" id="sec_streaming"></a> +Streaming</h1> +<p>From the <a class="el" href="stream_8h.html#a9ceaca6fc9acd9a1af080258d763fb82a0537b5f9f722fb2faf7822cd09370825">PW_STREAM_STATE_PAUSED</a> state, the stream can be set to the <a class="el" href="stream_8h.html#a9ceaca6fc9acd9a1af080258d763fb82af3c3b39039810d40a7c9e1ae3c6c905d">PW_STREAM_STATE_STREAMING</a> state by the PipeWire server when data transport is started.</p> +<p>Depending on how the stream was connected it will need to Produce or Consume data for/from PipeWire as explained in the following subsections.</p> +<h2><a class="anchor" id="ssec_consume"></a> +Consume data</h2> +<p>The process event is emited for each new buffer that can can be consumed.</p> +<p><a class="el" href="stream_8h.html#ab2ef0e28a1e91816f8015ef9814d18f7">pw_stream_dequeue_buffer()</a> should be used to get the data and metadata of the buffer.</p> +<p>When the buffer is no longer in use, call <a class="el" href="stream_8h.html#abe1c593f34080ea9c8c6231abe4e7386">pw_stream_queue_buffer()</a> to let PipeWire reuse the buffer.</p> +<h2><a class="anchor" id="ssec_produce"></a> +Produce data</h2> +<p><a class="el" href="stream_8h.html#ab2ef0e28a1e91816f8015ef9814d18f7">pw_stream_dequeue_buffer()</a> gives an empty buffer that can be filled.</p> +<p>Filled buffers should be queued with <a class="el" href="stream_8h.html#abe1c593f34080ea9c8c6231abe4e7386">pw_stream_queue_buffer()</a>.</p> +<p>The process event is emited when PipeWire has emptied a buffer that can now be refilled.</p> +<h1><a class="anchor" id="sec_stream_disconnect"></a> +Disconnect</h1> +<p>Use <a class="el" href="classpw__stream.html#aa727d7a41acb9d0ec574f93f01328d30">pw_stream_disconnect()</a> to disconnect a stream after use. </p> +</div></div><!-- PageDoc --> +</div><!-- contents --> +</div><!-- doc-content --> +<!-- start footer part --> +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> + <ul> + <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> |