Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > dc9b9eb224888fd532330fad8ee0ffc5 > files > 368

audacious-devel-2.4.5-1.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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"/>
<title>Audacious: probe-buffer.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Audacious&#160;<span id="projectnumber">$Id:Doxyfile42802007-03-2104:39:00Znenolod$</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>probe-buffer.c</h1>  </div>
</div>
<div class="contents">
<a href="probe-buffer_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * probe-buffer.c</span>
<a name="l00003"></a>00003 <span class="comment"> * Copyright 2010 John Lindgren</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * This file is part of Audacious.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Audacious is free software: you can redistribute it and/or modify it under</span>
<a name="l00008"></a>00008 <span class="comment"> * the terms of the GNU General Public License as published by the Free Software</span>
<a name="l00009"></a>00009 <span class="comment"> * Foundation, version 2 or version 3 of the License.</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * Audacious is distributed in the hope that it will be useful, but WITHOUT ANY</span>
<a name="l00012"></a>00012 <span class="comment"> * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR</span>
<a name="l00013"></a>00013 <span class="comment"> * A PARTICULAR PURPOSE. See the GNU General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU General Public License along with</span>
<a name="l00016"></a>00016 <span class="comment"> * Audacious. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * The Audacious team does not consider modular code linking to Audacious or</span>
<a name="l00019"></a>00019 <span class="comment"> * using our public API to be a derived work.</span>
<a name="l00020"></a>00020 <span class="comment"> */</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="probe-buffer_8h.html">probe-buffer.h</a>&quot;</span>
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="structProbeBuffer.html">00028</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030     <span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>, * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>;
<a name="l00031"></a><a class="code" href="structProbeBuffer.html#a257c168b3b3620a5fae83fb44b280d07">00031</a>     <a class="code" href="structVFSFile.html">VFSFile</a> * file;
<a name="l00032"></a><a class="code" href="structProbeBuffer.html#a8f08e41314c305c1aeebfe5f2d7c2669">00032</a>     guchar <a class="code" href="misc-api_8h.html#ada24e48da456beff68f6bcd1a60934f8">buffer</a>[16384];
<a name="l00033"></a><a class="code" href="structProbeBuffer.html#ab463c107dd2bdcab903b830c26e412d1">00033</a>     <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> filled, <a class="code" href="playlist-api_8h.html#af5e8b5caf7672073a7b6cc7131d1d809">at</a>;
<a name="l00034"></a><a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">00034</a>     <span class="keyword">const</span> gchar * read_warned, * seek_warned;
<a name="l00035"></a><a class="code" href="structProbeBuffer.html#aa0a69b8387d9393691d40ad1b8fd9566">00035</a> }
<a name="l00036"></a>00036 <a class="code" href="structProbeBuffer.html">ProbeBuffer</a>;
<a name="l00037"></a>00037 
<a name="l00038"></a><a class="code" href="probe-buffer_8c.html#a8ee91d7c1eb1fdd6405abd36392ac4d7">00038</a> <span class="keyword">static</span> <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> <a class="code" href="probe-buffer_8c.html#a8ee91d7c1eb1fdd6405abd36392ac4d7">probe_buffer_fclose</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040     <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> ret = <a class="code" href="vfs_8c.html#aef1161802df682c9d8e0b68bce9f6988" title="Closes a VFS stream and destroys a VFSFile object.">vfs_fclose</a> (((<a class="code" href="structProbeBuffer.html">ProbeBuffer</a> *) file-&gt;handle)-&gt;file);
<a name="l00041"></a>00041     g_free (file-&gt;handle);
<a name="l00042"></a>00042     <span class="keywordflow">return</span> ret;
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044 
<a name="l00045"></a><a class="code" href="probe-buffer_8c.html#af4580b963654c81b55fc23b1d3841881">00045</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="probe-buffer_8c.html#af4580b963654c81b55fc23b1d3841881">increase_buffer</a> (<a class="code" href="structProbeBuffer.html">ProbeBuffer</a> * p, gint64 size)
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047     size = (size + 0xFF) &amp; ~0xFF;
<a name="l00048"></a>00048 
<a name="l00049"></a>00049     <span class="keywordflow">if</span> (size &gt; <span class="keyword">sizeof</span> p-&gt;<a class="code" href="structProbeBuffer.html#ab463c107dd2bdcab903b830c26e412d1">buffer</a>)
<a name="l00050"></a>00050     {
<a name="l00051"></a>00051         <span class="keywordflow">if</span> (p-&gt;<a class="code" href="structProbeBuffer.html#ae7180d69a9241e592171e42e9ae2da3d">read_warned</a> != p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a>)
<a name="l00052"></a>00052         {
<a name="l00053"></a>00053             fprintf (stderr, <span class="stringliteral">&quot;%s tried to read past end of buffer while &quot;</span>
<a name="l00054"></a>00054              <span class="stringliteral">&quot;probing %s.\n&quot;</span>, p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a>, p-&gt;<a class="code" href="structProbeBuffer.html#a257c168b3b3620a5fae83fb44b280d07">filename</a>);
<a name="l00055"></a>00055             p-&gt;<a class="code" href="structProbeBuffer.html#ae7180d69a9241e592171e42e9ae2da3d">read_warned</a> = p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a>;
<a name="l00056"></a>00056         }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058         size = <span class="keyword">sizeof</span> p-&gt;<a class="code" href="structProbeBuffer.html#ab463c107dd2bdcab903b830c26e412d1">buffer</a>;
<a name="l00059"></a>00059     }
<a name="l00060"></a>00060 
<a name="l00061"></a>00061     <span class="keywordflow">if</span> (p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a> &lt; size)
<a name="l00062"></a>00062         p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a> += <a class="code" href="vfs_8c.html#af6053b3415c8cee9443c181278bdf630" title="Reads from a VFS stream.">vfs_fread</a> (p-&gt;<a class="code" href="structProbeBuffer.html#ab463c107dd2bdcab903b830c26e412d1">buffer</a> + p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a>, 1, size - p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a>,
<a name="l00063"></a>00063          p-&gt;<a class="code" href="structProbeBuffer.html#a8f08e41314c305c1aeebfe5f2d7c2669">file</a>);
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065 
<a name="l00066"></a><a class="code" href="probe-buffer_8c.html#a84eef078f5f9c95bdc66cd5a5e2c3d24">00066</a> <span class="keyword">static</span> gint64 <a class="code" href="probe-buffer_8c.html#a84eef078f5f9c95bdc66cd5a5e2c3d24">probe_buffer_fread</a> (<span class="keywordtype">void</span> * <a class="code" href="misc-api_8h.html#ada24e48da456beff68f6bcd1a60934f8">buffer</a>, gint64 size, gint64 <a class="code" href="misc-api_8h.html#ac0c64a48f21e0d91f7340acdb9cc6409">count</a>,
<a name="l00067"></a>00067  <a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069     <a class="code" href="structProbeBuffer.html">ProbeBuffer</a> * p = file-&gt;handle;
<a name="l00070"></a>00070 
<a name="l00071"></a>00071     <a class="code" href="probe-buffer_8c.html#af4580b963654c81b55fc23b1d3841881">increase_buffer</a> (p, p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a> + size * count);
<a name="l00072"></a>00072     <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> readed = (size &gt; 0) ? MIN (count, (p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a> - p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a>) / size) : 0;
<a name="l00073"></a>00073     memcpy (buffer, p-&gt;<a class="code" href="structProbeBuffer.html#ab463c107dd2bdcab903b830c26e412d1">buffer</a> + p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a>, size * readed);
<a name="l00074"></a>00074 
<a name="l00075"></a>00075     p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a> += size * readed;
<a name="l00076"></a>00076     <span class="keywordflow">return</span> readed;
<a name="l00077"></a>00077 }
<a name="l00078"></a>00078 
<a name="l00079"></a><a class="code" href="probe-buffer_8c.html#a78ea9ec8dbc9f5da575b243077d78f53">00079</a> <span class="keyword">static</span> gint64 <a class="code" href="probe-buffer_8c.html#a78ea9ec8dbc9f5da575b243077d78f53">probe_buffer_fwrite</a> (<span class="keyword">const</span> <span class="keywordtype">void</span> * <a class="code" href="misc-api_8h.html#a2a40119722f785a93d720b769541a543">data</a>, gint64 size, gint64 <a class="code" href="misc-api_8h.html#ac0c64a48f21e0d91f7340acdb9cc6409">count</a>,
<a name="l00080"></a>00080  <a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082     <span class="comment">/* not implemented */</span>
<a name="l00083"></a>00083     <span class="keywordflow">return</span> 0;
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 
<a name="l00086"></a><a class="code" href="probe-buffer_8c.html#a0de6dc8bf70a6cbcd0c91a7822df58f2">00086</a> <span class="keyword">static</span> <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> <a class="code" href="probe-buffer_8c.html#a0de6dc8bf70a6cbcd0c91a7822df58f2">probe_buffer_getc</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00087"></a>00087 {
<a name="l00088"></a>00088     guchar c;
<a name="l00089"></a>00089     <span class="keywordflow">return</span> (<a class="code" href="probe-buffer_8c.html#a84eef078f5f9c95bdc66cd5a5e2c3d24">probe_buffer_fread</a> (&amp; c, 1, 1, file) == 1) ? c : EOF;
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091 
<a name="l00092"></a><a class="code" href="probe-buffer_8c.html#a5bb0f32ddd75be1b19a932e889922a51">00092</a> <span class="keyword">static</span> <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> <a class="code" href="probe-buffer_8c.html#a5bb0f32ddd75be1b19a932e889922a51">probe_buffer_fseek</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file, gint64 offset, <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> whence)
<a name="l00093"></a>00093 {
<a name="l00094"></a>00094     <a class="code" href="structProbeBuffer.html">ProbeBuffer</a> * p = file-&gt;handle;
<a name="l00095"></a>00095 
<a name="l00096"></a>00096     <span class="keywordflow">if</span> (whence == SEEK_END)
<a name="l00097"></a>00097     {
<a name="l00098"></a>00098         <span class="keywordflow">if</span> (p-&gt;<a class="code" href="structProbeBuffer.html#aa0a69b8387d9393691d40ad1b8fd9566">seek_warned</a> != p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a>)
<a name="l00099"></a>00099         {
<a name="l00100"></a>00100             fprintf (stderr, <span class="stringliteral">&quot;%s tried to seek to end of file while probing &quot;</span>
<a name="l00101"></a>00101              <span class="stringliteral">&quot;%s.\n&quot;</span>, p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a>, p-&gt;<a class="code" href="structProbeBuffer.html#a257c168b3b3620a5fae83fb44b280d07">filename</a>);
<a name="l00102"></a>00102             p-&gt;<a class="code" href="structProbeBuffer.html#aa0a69b8387d9393691d40ad1b8fd9566">seek_warned</a> = p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a>;
<a name="l00103"></a>00103         }
<a name="l00104"></a>00104 
<a name="l00105"></a>00105         <span class="keywordflow">return</span> -1;
<a name="l00106"></a>00106     }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108     <span class="keywordflow">if</span> (whence == SEEK_CUR)
<a name="l00109"></a>00109         offset += p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a>;
<a name="l00110"></a>00110 
<a name="l00111"></a>00111     g_return_val_if_fail (offset &gt;= 0, -1);
<a name="l00112"></a>00112     <a class="code" href="probe-buffer_8c.html#af4580b963654c81b55fc23b1d3841881">increase_buffer</a> (p, offset);
<a name="l00113"></a>00113 
<a name="l00114"></a>00114     <span class="keywordflow">if</span> (offset &gt; p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a>)
<a name="l00115"></a>00115         <span class="keywordflow">return</span> -1;
<a name="l00116"></a>00116 
<a name="l00117"></a>00117     p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a> = offset;
<a name="l00118"></a>00118     <span class="keywordflow">return</span> 0;
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120 
<a name="l00121"></a><a class="code" href="probe-buffer_8c.html#af37c6b0a52360475e82fdb354ad453e2">00121</a> <span class="keyword">static</span> <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> <a class="code" href="probe-buffer_8c.html#af37c6b0a52360475e82fdb354ad453e2">probe_buffer_ungetc</a> (<a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> c, <a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00122"></a>00122 {
<a name="l00123"></a>00123     <span class="keywordflow">return</span> (! <a class="code" href="probe-buffer_8c.html#a5bb0f32ddd75be1b19a932e889922a51">probe_buffer_fseek</a> (file, -1, SEEK_CUR)) ? c : EOF;
<a name="l00124"></a>00124 }
<a name="l00125"></a>00125 
<a name="l00126"></a><a class="code" href="probe-buffer_8c.html#ab002e1af467893740a25c5cbf0db4b19">00126</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="probe-buffer_8c.html#ab002e1af467893740a25c5cbf0db4b19">probe_buffer_rewind</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00127"></a>00127 {
<a name="l00128"></a>00128     <a class="code" href="probe-buffer_8c.html#a5bb0f32ddd75be1b19a932e889922a51">probe_buffer_fseek</a> (file, 0, SEEK_SET);
<a name="l00129"></a>00129 }
<a name="l00130"></a>00130 
<a name="l00131"></a><a class="code" href="probe-buffer_8c.html#ad7f4f3aee50b7083596371e047582906">00131</a> <span class="keyword">static</span> gint64 <a class="code" href="probe-buffer_8c.html#ad7f4f3aee50b7083596371e047582906">probe_buffer_ftell</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00132"></a>00132 {
<a name="l00133"></a>00133     <span class="keywordflow">return</span> ((<a class="code" href="structProbeBuffer.html">ProbeBuffer</a> *) file-&gt;handle)-&gt;at;
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 
<a name="l00136"></a><a class="code" href="probe-buffer_8c.html#abc407f16f8f2eeebb0669206620b70a9">00136</a> <span class="keyword">static</span> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="probe-buffer_8c.html#abc407f16f8f2eeebb0669206620b70a9">probe_buffer_feof</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138     <a class="code" href="structProbeBuffer.html">ProbeBuffer</a> * p = file-&gt;handle;
<a name="l00139"></a>00139     <span class="keywordflow">return</span> (p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a> &lt; p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a>) ? FALSE : <a class="code" href="vfs_8c.html#a08c8a6aed713546f36413c8ed1c72b4f" title="Returns whether or not the VFS stream has reached EOF.">vfs_feof</a> (p-&gt;<a class="code" href="structProbeBuffer.html#a8f08e41314c305c1aeebfe5f2d7c2669">file</a>);
<a name="l00140"></a>00140 }
<a name="l00141"></a>00141 
<a name="l00142"></a><a class="code" href="probe-buffer_8c.html#a34dd2c6ed07b8abbf9ea751841ce1933">00142</a> <span class="keyword">static</span> <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> <a class="code" href="probe-buffer_8c.html#a34dd2c6ed07b8abbf9ea751841ce1933">probe_buffer_ftruncate</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file, gint64 size)
<a name="l00143"></a>00143 {
<a name="l00144"></a>00144     <span class="comment">/* not implemented */</span>
<a name="l00145"></a>00145     <span class="keywordflow">return</span> -1;
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147 
<a name="l00148"></a><a class="code" href="probe-buffer_8c.html#a80751bc0ac35c19ef93b651c6dcbc961">00148</a> <span class="keyword">static</span> gint64 <a class="code" href="probe-buffer_8c.html#a80751bc0ac35c19ef93b651c6dcbc961">probe_buffer_fsize</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file)
<a name="l00149"></a>00149 {
<a name="l00150"></a>00150     <span class="keywordflow">return</span> <a class="code" href="vfs_8c.html#a7b06817cffbf1040dc5f7e65b5af3db0" title="Returns size of the file.">vfs_fsize</a> (((<a class="code" href="structProbeBuffer.html">ProbeBuffer</a> *) file-&gt;handle)-&gt;file);
<a name="l00151"></a>00151 }
<a name="l00152"></a>00152 
<a name="l00153"></a><a class="code" href="probe-buffer_8c.html#ae58d7bb8f9e07681c0a5b484e7123d24">00153</a> <span class="keyword">static</span> gchar * <a class="code" href="probe-buffer_8c.html#ae58d7bb8f9e07681c0a5b484e7123d24">probe_buffer_get_metadata</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file, <span class="keyword">const</span> gchar * field)
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155     <span class="keywordflow">return</span> <a class="code" href="vfs_8c.html#acbd26807b5b752558de0a288b9fa66ac" title="Returns metadata about the stream.">vfs_get_metadata</a> (((<a class="code" href="structProbeBuffer.html">ProbeBuffer</a> *) file-&gt;handle)-&gt;file, field);
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a><a class="code" href="probe-buffer_8c.html#a639512637308ddeeda5c20914afb46de">00158</a> <span class="keyword">static</span> <a class="code" href="structVFSConstructor.html">VFSConstructor</a> <a class="code" href="probe-buffer_8c.html#a639512637308ddeeda5c20914afb46de">probe_buffer_table</a> =
<a name="l00159"></a>00159 {
<a name="l00160"></a>00160         .uri_id = NULL,
<a name="l00161"></a>00161         .vfs_fopen_impl = NULL,
<a name="l00162"></a>00162         .vfs_fclose_impl = <a class="code" href="probe-buffer_8c.html#a8ee91d7c1eb1fdd6405abd36392ac4d7">probe_buffer_fclose</a>,
<a name="l00163"></a>00163         .vfs_fread_impl = <a class="code" href="probe-buffer_8c.html#a84eef078f5f9c95bdc66cd5a5e2c3d24">probe_buffer_fread</a>,
<a name="l00164"></a>00164         .vfs_fwrite_impl = <a class="code" href="probe-buffer_8c.html#a78ea9ec8dbc9f5da575b243077d78f53">probe_buffer_fwrite</a>,
<a name="l00165"></a>00165         .vfs_getc_impl = <a class="code" href="probe-buffer_8c.html#a0de6dc8bf70a6cbcd0c91a7822df58f2">probe_buffer_getc</a>,
<a name="l00166"></a>00166         .vfs_ungetc_impl = <a class="code" href="probe-buffer_8c.html#af37c6b0a52360475e82fdb354ad453e2">probe_buffer_ungetc</a>,
<a name="l00167"></a>00167         .vfs_fseek_impl = <a class="code" href="probe-buffer_8c.html#a5bb0f32ddd75be1b19a932e889922a51">probe_buffer_fseek</a>,
<a name="l00168"></a>00168         .vfs_rewind_impl = <a class="code" href="probe-buffer_8c.html#ab002e1af467893740a25c5cbf0db4b19">probe_buffer_rewind</a>,
<a name="l00169"></a>00169         .vfs_ftell_impl = <a class="code" href="probe-buffer_8c.html#ad7f4f3aee50b7083596371e047582906">probe_buffer_ftell</a>,
<a name="l00170"></a>00170         .vfs_feof_impl = <a class="code" href="probe-buffer_8c.html#abc407f16f8f2eeebb0669206620b70a9">probe_buffer_feof</a>,
<a name="l00171"></a>00171         .vfs_ftruncate_impl = <a class="code" href="probe-buffer_8c.html#a34dd2c6ed07b8abbf9ea751841ce1933">probe_buffer_ftruncate</a>,
<a name="l00172"></a>00172         .vfs_fsize_impl = <a class="code" href="probe-buffer_8c.html#a80751bc0ac35c19ef93b651c6dcbc961">probe_buffer_fsize</a>,
<a name="l00173"></a>00173         .vfs_get_metadata_impl = <a class="code" href="probe-buffer_8c.html#ae58d7bb8f9e07681c0a5b484e7123d24">probe_buffer_get_metadata</a>,
<a name="l00174"></a>00174 };
<a name="l00175"></a>00175 
<a name="l00176"></a><a class="code" href="probe-buffer_8h.html#a48fb49b46923fe3070458c2937f265da">00176</a> <a class="code" href="structVFSFile.html">VFSFile</a> * <a class="code" href="probe-buffer_8c.html#a48fb49b46923fe3070458c2937f265da">probe_buffer_new</a> (<span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>)
<a name="l00177"></a>00177 {
<a name="l00178"></a>00178     <a class="code" href="structVFSFile.html">VFSFile</a> * file = <a class="code" href="vfs_8c.html#a8b782c3531a5a5c4526232c3130a86de" title="Opens a stream from a VFS transport using one of the registered VFSConstructor handlers.">vfs_fopen</a> (filename, <span class="stringliteral">&quot;r&quot;</span>);
<a name="l00179"></a>00179 
<a name="l00180"></a>00180     <span class="keywordflow">if</span> (! file)
<a name="l00181"></a>00181         <span class="keywordflow">return</span> NULL;
<a name="l00182"></a>00182 
<a name="l00183"></a>00183     <a class="code" href="structProbeBuffer.html">ProbeBuffer</a> * p = g_malloc (<span class="keyword">sizeof</span> (<a class="code" href="structProbeBuffer.html">ProbeBuffer</a>));
<a name="l00184"></a>00184     p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a> = NULL;
<a name="l00185"></a>00185     p-&gt;<a class="code" href="structProbeBuffer.html#a257c168b3b3620a5fae83fb44b280d07">filename</a> = <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>;
<a name="l00186"></a>00186     p-&gt;<a class="code" href="structProbeBuffer.html#a8f08e41314c305c1aeebfe5f2d7c2669">file</a> = file;
<a name="l00187"></a>00187     p-&gt;<a class="code" href="structProbeBuffer.html#a4029460070e7e18c9d4ff27387c7aa78">filled</a> = 0;
<a name="l00188"></a>00188     p-&gt;<a class="code" href="structProbeBuffer.html#ad3891cbb79a7e4a2478810b4c48b887f">at</a> = 0;
<a name="l00189"></a>00189     p-&gt;<a class="code" href="structProbeBuffer.html#ae7180d69a9241e592171e42e9ae2da3d">read_warned</a> = NULL;
<a name="l00190"></a>00190     p-&gt;<a class="code" href="structProbeBuffer.html#aa0a69b8387d9393691d40ad1b8fd9566">seek_warned</a> = NULL;
<a name="l00191"></a>00191 
<a name="l00192"></a>00192     <a class="code" href="structVFSFile.html">VFSFile</a> * file2 = g_malloc (<span class="keyword">sizeof</span> (<a class="code" href="structVFSFile.html">VFSFile</a>));
<a name="l00193"></a>00193     file2-&gt;base = &amp; <a class="code" href="probe-buffer_8c.html#a639512637308ddeeda5c20914afb46de">probe_buffer_table</a>;
<a name="l00194"></a>00194     file2-&gt;handle = p;
<a name="l00195"></a>00195     file2-&gt;uri = g_strdup (filename);
<a name="l00196"></a>00196     file2-&gt;ref = 1;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198     <span class="keywordflow">return</span> file2;
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 
<a name="l00201"></a><a class="code" href="probe-buffer_8h.html#ab926f87572f6ee95e912e12faa5ffd81">00201</a> <span class="keywordtype">void</span> <a class="code" href="probe-buffer_8c.html#ab926f87572f6ee95e912e12faa5ffd81">probe_buffer_set_decoder</a> (<a class="code" href="structVFSFile.html">VFSFile</a> * file, <span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>)
<a name="l00202"></a>00202 {
<a name="l00203"></a>00203     <a class="code" href="structProbeBuffer.html">ProbeBuffer</a> * p = file-&gt;handle;
<a name="l00204"></a>00204     p-&gt;<a class="code" href="structProbeBuffer.html#a0838eb9256acad15a1b18b1986053f02">decoder</a> = <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>;
<a name="l00205"></a>00205 }
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Apr 17 2011 for Audacious by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>