blob: 34bb4595453e63bab4d627df1025076fb06aaa03 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cairooverlay: GStreamer Good Plugins 1.0 Plugins Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GStreamer Good Plugins 1.0 Plugins Reference Manual">
<link rel="up" href="ch01.html" title="gst-plugins-good Elements">
<link rel="prev" href="gst-plugins-good-plugins-cacasink.html" title="cacasink">
<link rel="next" href="gst-plugins-good-plugins-capssetter.html" title="capssetter">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#gst-plugins-good-plugins-cairooverlay.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#gst-plugins-good-plugins-cairooverlay.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_signals">  <span class="dim">|</span> 
<a href="#gst-plugins-good-plugins-cairooverlay.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gst-plugins-good-plugins-cacasink.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gst-plugins-good-plugins-capssetter.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gst-plugins-good-plugins-cairooverlay"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gst-plugins-good-plugins-cairooverlay.top_of_page"></a>cairooverlay</span></h2>
<p>cairooverlay</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gst-plugins-good-plugins-cairooverlay.signals"></a><h2>Signals</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="signals_return">
<col width="300px" class="signals_name">
<col width="200px" class="signals_flags">
</colgroup>
<tbody>
<tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="gst-plugins-good-plugins-cairooverlay.html#GstCairoOverlay-caps-changed" title="The “caps-changed” signal">caps-changed</a></td>
<td class="signal_flags"> </td>
</tr>
<tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="gst-plugins-good-plugins-cairooverlay.html#GstCairoOverlay-draw" title="The “draw” signal">draw</a></td>
<td class="signal_flags"> </td>
</tr>
</tbody>
</table></div>
</div>
<a name="GstCairoOverlay"></a><div class="refsect1">
<a name="gst-plugins-good-plugins-cairooverlay.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="gst-plugins-good-plugins-cairooverlay.html#GstCairoOverlay-struct" title="struct GstCairoOverlay">GstCairoOverlay</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gst-plugins-good-plugins-cairooverlay.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobjectgobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobjectgobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0GstObject.html#GstObject-struct">GstObject</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0GstElement.html#GstElement-struct">GstElement</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-libs-1.0GstBaseTransform.html#GstBaseTransform-struct">GstBaseTransform</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gst-plugins-base-libs-1.0gst-plugins-base-libs-gstvideofilter.html#GstVideoFilter-struct">GstVideoFilter</a>
<span class="lineart">╰──</span> GstCairoOverlay
</pre>
</div>
<div class="refsect1">
<a name="gst-plugins-good-plugins-cairooverlay.description"></a><h2>Description</h2>
<p>cairooverlay renders an overlay using a application provided render function.</p>
<p>The full example can be found in tests/examples/cairo/cairo_overlay.c</p>
<div class="refsect2">
<a name="id-1.2.38.7.4"></a><h3>Example code</h3>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include &lt;gst/gst.h&gt;</span>
<span class="gtkdoc ppc">#include &lt;gst/video/video.h&gt;</span>
<span class="gtkdoc opt">...</span>
<span class="gtkdoc kwc">typedef</span> <span class="gtkdoc kwb">struct</span> <span class="gtkdoc opt">{</span>
gboolean valid<span class="gtkdoc opt">;</span>
<span class="gtkdoc kwb">int</span> width<span class="gtkdoc opt">;</span>
<span class="gtkdoc kwb">int</span> height<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span> CairoOverlayState<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">...</span>
<span class="gtkdoc kwb">static void</span>
<span class="function">prepare_overlay</span> <span class="gtkdoc opt">(</span>GstElement <span class="gtkdoc opt">*</span> overlay<span class="gtkdoc opt">,</span> GstCaps <span class="gtkdoc opt">*</span> caps<span class="gtkdoc opt">,</span> gpointer user_data<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
CairoOverlayState <span class="gtkdoc opt">*</span>state <span class="gtkdoc opt">= (</span>CairoOverlayState <span class="gtkdoc opt">*)</span>user_data<span class="gtkdoc opt">;</span>
<span class="function">gst_video_format_parse_caps</span> <span class="gtkdoc opt">(</span>caps<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">, &amp;</span>state<span class="gtkdoc opt">-&gt;</span>width<span class="gtkdoc opt">, &amp;</span>state<span class="gtkdoc opt">-&gt;</span>height<span class="gtkdoc opt">);</span>
state<span class="gtkdoc opt">-&gt;</span>valid <span class="gtkdoc opt">=</span> TRUE<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span>
<span class="gtkdoc kwb">static void</span>
<span class="function">draw_overlay</span> <span class="gtkdoc opt">(</span>GstElement <span class="gtkdoc opt">*</span> overlay<span class="gtkdoc opt">,</span> cairo_t <span class="gtkdoc opt">*</span> cr<span class="gtkdoc opt">,</span> guint64 timestamp<span class="gtkdoc opt">,</span>
guint64 duration<span class="gtkdoc opt">,</span> gpointer user_data<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
CairoOverlayState <span class="gtkdoc opt">*</span>s <span class="gtkdoc opt">= (</span>CairoOverlayState <span class="gtkdoc opt">*)</span>user_data<span class="gtkdoc opt">;</span>
<span class="gtkdoc kwb">double</span> scale<span class="gtkdoc opt">;</span>
<span class="keyword">if</span> <span class="gtkdoc opt">(!</span>s<span class="gtkdoc opt">-&gt;</span>valid<span class="gtkdoc opt">)</span>
<span class="keyword">return</span><span class="gtkdoc opt">;</span>
scale <span class="gtkdoc opt">=</span> <span class="number">2</span><span class="gtkdoc opt">*(((</span>timestamp<span class="gtkdoc opt">/(</span><span class="gtkdoc kwb">int</span><span class="gtkdoc opt">)</span><span class="number">1</span>e7<span class="gtkdoc opt">) %</span> <span class="number">70</span><span class="gtkdoc opt">)+</span><span class="number">30</span><span class="gtkdoc opt">)/</span><span class="number">100.0</span><span class="gtkdoc opt">;</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-Transformations.html#cairo-translate">cairo_translate</a></span><span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">,</span> s<span class="gtkdoc opt">-&gt;</span>width<span class="gtkdoc opt">/</span><span class="number">2</span><span class="gtkdoc opt">, (</span>s<span class="gtkdoc opt">-&gt;</span>height<span class="gtkdoc opt">/</span><span class="number">2</span><span class="gtkdoc opt">)-</span><span class="number">30</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-Transformations.html#cairo-scale">cairo_scale</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">,</span> scale<span class="gtkdoc opt">,</span> scale<span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-Paths.html#cairo-move-to">cairo_move_to</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-Paths.html#cairo-curve-to">cairo_curve_to</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,-</span><span class="number">30</span><span class="gtkdoc opt">, -</span><span class="number">50</span><span class="gtkdoc opt">,-</span><span class="number">30</span><span class="gtkdoc opt">, -</span><span class="number">50</span><span class="gtkdoc opt">,</span><span class="number">0</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-Paths.html#cairo-curve-to">cairo_curve_to</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">, -</span><span class="number">50</span><span class="gtkdoc opt">,</span><span class="number">30</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span><span class="number">35</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span><span class="number">60</span> <span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-Paths.html#cairo-curve-to">cairo_curve_to</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span><span class="number">35</span><span class="gtkdoc opt">,</span> <span class="number">50</span><span class="gtkdoc opt">,</span><span class="number">30</span><span class="gtkdoc opt">,</span> <span class="number">50</span><span class="gtkdoc opt">,</span><span class="number">0</span> <span class="gtkdoc opt">); *</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-Paths.html#cairo-curve-to">cairo_curve_to</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">,</span> <span class="number">50</span><span class="gtkdoc opt">,-</span><span class="number">30</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,-</span><span class="number">30</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span><span class="number">0</span> <span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-cairo-t.html#cairo-set-source-rgba">cairo_set_source_rgba</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">,</span> <span class="number">0.9</span><span class="gtkdoc opt">,</span> <span class="number">0.0</span><span class="gtkdoc opt">,</span> <span class="number">0.1</span><span class="gtkdoc opt">,</span> <span class="number">0.7</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/cairocairo-cairo-t.html#cairo-fill">cairo_fill</a></span> <span class="gtkdoc opt">(</span>cr<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span>
<span class="gtkdoc opt">...</span>
cairo_overlay <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;cairooverlay&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;overlay&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/gobjectgobject-Signals.html#g-signal-connect">g_signal_connect</a></span> <span class="gtkdoc opt">(</span>cairo_overlay<span class="gtkdoc opt">,</span> <span class="string">&quot;draw&quot;</span><span class="gtkdoc opt">,</span> <span class="function"><a href="/usr/share/gtk-doc/html/gobjectgobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span> <span class="gtkdoc opt">(</span>draw_overlay<span class="gtkdoc opt">),</span>
overlay_state<span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/gobjectgobject-Signals.html#g-signal-connect">g_signal_connect</a></span> <span class="gtkdoc opt">(</span>cairo_overlay<span class="gtkdoc opt">,</span> <span class="string">&quot;caps-changed&quot;</span><span class="gtkdoc opt">,</span>
<span class="function"><a href="/usr/share/gtk-doc/html/gobjectgobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span> <span class="gtkdoc opt">(</span>prepare_overlay<span class="gtkdoc opt">),</span> overlay_state<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">...</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="refsect2">
<a name="id-1.2.38.7.5.1"></a><h3>Element Information</h3>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">plugin</span></p></td>
<td>
<a class="link" href="gst-plugins-good-plugins-plugin-cairo.html#plugin-cairo">cairo</a>
</td>
</tr>
<tr>
<td><p><span class="term">author</span></p></td>
<td>Jon Nordby &lt;jononor@gmail.com&gt;</td>
</tr>
<tr>
<td><p><span class="term">class</span></p></td>
<td>Filter/Editor/Video</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="id-1.2.38.7.5.2"></a><h3>Element Pads</h3>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">name</span></p></td>
<td>sink</td>
</tr>
<tr>
<td><p><span class="term">direction</span></p></td>
<td>sink</td>
</tr>
<tr>
<td><p><span class="term">presence</span></p></td>
<td>always</td>
</tr>
<tr>
<td><p><span class="term">details</span></p></td>
<td>video/x-raw, format=(string){ BGRx, BGRA, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
</tr>
</tbody>
</table></div>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">name</span></p></td>
<td>src</td>
</tr>
<tr>
<td><p><span class="term">direction</span></p></td>
<td>source</td>
</tr>
<tr>
<td><p><span class="term">presence</span></p></td>
<td>always</td>
</tr>
<tr>
<td><p><span class="term">details</span></p></td>
<td>video/x-raw, format=(string){ BGRx, BGRA, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="gst-plugins-good-plugins-cairooverlay.functions_details"></a><h2>Functions</h2>
<p></p>
</div>
<div class="refsect1">
<a name="gst-plugins-good-plugins-cairooverlay.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GstCairoOverlay-struct"></a><h3>struct GstCairoOverlay</h3>
<pre class="programlisting">struct GstCairoOverlay;</pre>
</div>
</div>
<div class="refsect1">
<a name="gst-plugins-good-plugins-cairooverlay.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GstCairoOverlay-caps-changed"></a><h3>The <code class="literal">“caps-changed”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="gst-plugins-good-plugins-cairooverlay.html#GstCairoOverlay"><span class="type">GstCairoOverlay</span></a> *overlay,
<a href="/usr/share/gtk-doc/html/gstreamer-1.0GstCaps.html#GstCaps-struct"><span class="type">GstCaps</span></a> *caps,
<a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
<p>This signal is emitted when the caps of the element has changed.</p>
<div class="refsect3">
<a name="GstCairoOverlay-caps-changed.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>overlay</p></td>
<td class="parameter_description"><p>Overlay element emitting the signal.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>caps</p></td>
<td class="parameter_description"><p>The <a href="/usr/share/gtk-doc/html/gstreamer-1.0GstCaps.html#GstCaps-struct"><span class="type">GstCaps</span></a> of the element.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GstCairoOverlay-draw"></a><h3>The <code class="literal">“draw”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="gst-plugins-good-plugins-cairooverlay.html#GstCairoOverlay"><span class="type">GstCairoOverlay</span></a> *overlay,
<span class="type">CairoContext</span> *cr,
<a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> timestamp,
<a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> duration,
<a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
<p>This signal is emitted when the overlay should be drawn.</p>
<div class="refsect3">
<a name="GstCairoOverlay-draw.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>overlay</p></td>
<td class="parameter_description"><p>Overlay element emitting the signal.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cr</p></td>
<td class="parameter_description"><p>Cairo context to draw to.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>timestamp</p></td>
<td class="parameter_description"><p>Timestamp (see <a href="/usr/share/gtk-doc/html/gstreamer-1.0GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a>) of the current buffer.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>duration</p></td>
<td class="parameter_description"><p>Duration (see <a href="/usr/share/gtk-doc/html/gstreamer-1.0GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a>) of the current buffer.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>