Sophie

Sophie

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

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.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.c</h1>  </div>
</div>
<div class="contents">
<a href="probe_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.c</span>
<a name="l00003"></a>00003 <span class="comment"> * Copyright 2009-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;string.h&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;libaudcore/audstrings.h&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="debug_8h.html">debug.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;<a class="code" href="misc_8h.html">misc.h</a>&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;<a class="code" href="playlist_8h.html">playlist.h</a>&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="plugin_8h.html" title="Main Audacious plugin API header file.">plugin.h</a>&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="plugins_8h.html">plugins.h</a>&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;<a class="code" href="probe-buffer_8h.html">probe-buffer.h</a>&quot;</span>
<a name="l00033"></a>00033 
<a name="l00034"></a><a class="code" href="structProbeState.html">00034</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00035"></a>00035 {
<a name="l00036"></a><a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">00036</a>     gchar * <a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>;
<a name="l00037"></a><a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">00037</a>     <a class="code" href="structVFSFile.html">VFSFile</a> * <a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a>;
<a name="l00038"></a><a class="code" href="structProbeState.html#a4a06c757d10677446d8c313a4a6c41a3">00038</a>     <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="structProbeState.html#a4a06c757d10677446d8c313a4a6c41a3">buffered</a>;
<a name="l00039"></a><a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">00039</a>     <a class="code" href="structPluginHandle.html">PluginHandle</a> * <a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a>;
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 <a class="code" href="structProbeState.html">ProbeState</a>;
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="probe_8c.html#ad1b1635799ffb15fbcbb131b08313a3b">00043</a> <span class="keyword">static</span> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="probe_8c.html#ad1b1635799ffb15fbcbb131b08313a3b">check_opened</a> (<a class="code" href="structProbeState.html">ProbeState</a> * state)
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045     <span class="keywordflow">if</span> (state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a> != NULL)
<a name="l00046"></a>00046         <span class="keywordflow">return</span> TRUE;
<a name="l00047"></a>00047 
<a name="l00048"></a>00048     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Opening %s.\n&quot;</span>, state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>);
<a name="l00049"></a>00049     <span class="keywordflow">if</span> ((state-&gt;<a class="code" href="structProbeState.html#a4a06c757d10677446d8c313a4a6c41a3">buffered</a> = <a class="code" href="vfs_8c.html#a8cd90cf7614f234bacbb9f918b37ecb8" title="Tests if a path is remote uri.">vfs_is_remote</a> (state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>)))
<a name="l00050"></a>00050         state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a> = <a class="code" href="probe-buffer_8c.html#a48fb49b46923fe3070458c2937f265da">probe_buffer_new</a> (state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>);
<a name="l00051"></a>00051     <span class="keywordflow">else</span>
<a name="l00052"></a>00052         state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a> = <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> (state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>, <span class="stringliteral">&quot;r&quot;</span>);
<a name="l00053"></a>00053 
<a name="l00054"></a>00054     <span class="keywordflow">if</span> (state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a> != NULL)
<a name="l00055"></a>00055         <span class="keywordflow">return</span> TRUE;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;FAILED.\n&quot;</span>);
<a name="l00058"></a>00058     <span class="keywordflow">return</span> FALSE;
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 
<a name="l00061"></a><a class="code" href="probe_8c.html#ac37f753c95ae1341873886dce095a951">00061</a> <span class="keyword">static</span> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="probe_8c.html#ac37f753c95ae1341873886dce095a951">probe_func</a> (<a class="code" href="structPluginHandle.html">PluginHandle</a> * plugin, <a class="code" href="structProbeState.html">ProbeState</a> * state)
<a name="l00062"></a>00062 {
<a name="l00063"></a>00063     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Trying %s.\n&quot;</span>, <a class="code" href="plugin-registry_8c.html#a31d73ec558ec1e46ad6baed8c5beb88d">plugin_get_name</a> (plugin));
<a name="l00064"></a>00064     InputPlugin * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a> = <a class="code" href="plugin-registry_8c.html#aa9f011539a9eab34d41d5e82b21fe81f">plugin_get_header</a> (plugin);
<a name="l00065"></a>00065     <span class="keywordflow">if</span> (decoder == NULL)
<a name="l00066"></a>00066         <span class="keywordflow">return</span> TRUE;
<a name="l00067"></a>00067 
<a name="l00068"></a>00068     <span class="keywordflow">if</span> (decoder-&gt;is_our_file_from_vfs != NULL)
<a name="l00069"></a>00069     {
<a name="l00070"></a>00070         <span class="keywordflow">if</span> (! <a class="code" href="probe_8c.html#ad1b1635799ffb15fbcbb131b08313a3b">check_opened</a> (state))
<a name="l00071"></a>00071             <span class="keywordflow">return</span> FALSE;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073         <span class="keywordflow">if</span> (state-&gt;<a class="code" href="structProbeState.html#a4a06c757d10677446d8c313a4a6c41a3">buffered</a>)
<a name="l00074"></a>00074             <a class="code" href="probe-buffer_8c.html#ab926f87572f6ee95e912e12faa5ffd81">probe_buffer_set_decoder</a> (state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a>, <a class="code" href="plugin-registry_8c.html#a31d73ec558ec1e46ad6baed8c5beb88d">plugin_get_name</a> (plugin));
<a name="l00075"></a>00075 
<a name="l00076"></a>00076         <span class="keywordflow">if</span> (decoder-&gt;is_our_file_from_vfs (state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>, state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a>))
<a name="l00077"></a>00077         {
<a name="l00078"></a>00078             state-&gt;<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> = plugin;
<a name="l00079"></a>00079             <span class="keywordflow">return</span> FALSE;
<a name="l00080"></a>00080         }
<a name="l00081"></a>00081 
<a name="l00082"></a>00082         <span class="keywordflow">if</span> (<a class="code" href="vfs_8c.html#afa299d74abcbf03120ba174b8673a7a0" title="Performs a seek in given VFS stream.">vfs_fseek</a> (state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a>, 0, SEEK_SET) &lt; 0)
<a name="l00083"></a>00083             <span class="keywordflow">return</span> FALSE;
<a name="l00084"></a>00084     }
<a name="l00085"></a>00085     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (decoder-&gt;is_our_file != NULL)
<a name="l00086"></a>00086     {
<a name="l00087"></a>00087         <span class="keywordflow">if</span> (decoder-&gt;is_our_file (state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>))
<a name="l00088"></a>00088         {
<a name="l00089"></a>00089             state-&gt;<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> = plugin;
<a name="l00090"></a>00090             <span class="keywordflow">return</span> FALSE;
<a name="l00091"></a>00091         }
<a name="l00092"></a>00092     }
<a name="l00093"></a>00093 
<a name="l00094"></a>00094     <span class="keywordflow">return</span> TRUE;
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="comment">/* Optimization: If we have found plugins with a key match, assume that at least</span>
<a name="l00098"></a>00098 <span class="comment"> * one of them will succeed.  This means that we need not check the very last</span>
<a name="l00099"></a>00099 <span class="comment"> * plugin.  (If there is only one, we do not need to check it at all.)  This is</span>
<a name="l00100"></a>00100 <span class="comment"> * implemented as follows:</span>
<a name="l00101"></a>00101 <span class="comment"> *</span>
<a name="l00102"></a>00102 <span class="comment"> * 1. On the first call, assume until further notice the plugin passed is the</span>
<a name="l00103"></a>00103 <span class="comment"> *    last one and will therefore succeed.</span>
<a name="l00104"></a>00104 <span class="comment"> * 2. On a subsequent call, think twice and probe the plugin we assumed would</span>
<a name="l00105"></a>00105 <span class="comment"> *    succeed.  If it does in fact succeed, then we are done.  If not, assume</span>
<a name="l00106"></a>00106 <span class="comment"> *    similarly that the plugin passed in this call is the last one.</span>
<a name="l00107"></a>00107 <span class="comment"> */</span>
<a name="l00108"></a>00108 
<a name="l00109"></a><a class="code" href="probe_8c.html#abe1454dfe24a3a8a145b6682d7914907">00109</a> <span class="keyword">static</span> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="probe_8c.html#abe1454dfe24a3a8a145b6682d7914907">probe_func_fast</a> (<a class="code" href="structPluginHandle.html">PluginHandle</a> * plugin, <a class="code" href="structProbeState.html">ProbeState</a> * state)
<a name="l00110"></a>00110 {
<a name="l00111"></a>00111     <span class="keywordflow">if</span> (state-&gt;<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> != NULL)
<a name="l00112"></a>00112     {
<a name="l00113"></a>00113         <a class="code" href="structPluginHandle.html">PluginHandle</a> * prev = state-&gt;<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a>;
<a name="l00114"></a>00114         state-&gt;<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> = NULL;
<a name="l00115"></a>00115 
<a name="l00116"></a>00116         <span class="keywordflow">if</span> (prev != NULL &amp;&amp; ! <a class="code" href="probe_8c.html#ac37f753c95ae1341873886dce095a951">probe_func</a> (prev, state))
<a name="l00117"></a>00117             <span class="keywordflow">return</span> FALSE;
<a name="l00118"></a>00118     }
<a name="l00119"></a>00119 
<a name="l00120"></a>00120     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Guessing %s.\n&quot;</span>, <a class="code" href="plugin-registry_8c.html#a31d73ec558ec1e46ad6baed8c5beb88d">plugin_get_name</a> (plugin));
<a name="l00121"></a>00121     state-&gt;<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> = plugin;
<a name="l00122"></a>00122     <span class="keywordflow">return</span> TRUE;
<a name="l00123"></a>00123 }
<a name="l00124"></a>00124 
<a name="l00125"></a><a class="code" href="probe_8c.html#abe361878e7225829ebb0c33c14db600c">00125</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="probe_8c.html#abe361878e7225829ebb0c33c14db600c">probe_by_scheme</a> (<a class="code" href="structProbeState.html">ProbeState</a> * state)
<a name="l00126"></a>00126 {
<a name="l00127"></a>00127     gchar * s = strstr (state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>, <span class="stringliteral">&quot;://&quot;</span>);
<a name="l00128"></a>00128     gchar c;
<a name="l00129"></a>00129 
<a name="l00130"></a>00130     <span class="keywordflow">if</span> (s == NULL)
<a name="l00131"></a>00131         <span class="keywordflow">return</span>;
<a name="l00132"></a>00132 
<a name="l00133"></a>00133     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Probing by scheme.\n&quot;</span>);
<a name="l00134"></a>00134     c = s[3];
<a name="l00135"></a>00135     s[3] = 0;
<a name="l00136"></a>00136     <a class="code" href="plugin-registry_8c.html#a76c9501f0af75773187e70aa7f476298">input_plugin_for_key</a> (INPUT_KEY_SCHEME, state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>, (<a class="code" href="plugins_8h.html#aca40a3a62c5957dc9ac52e5cbd131016">PluginForEachFunc</a>)
<a name="l00137"></a>00137      <a class="code" href="probe_8c.html#abe1454dfe24a3a8a145b6682d7914907">probe_func_fast</a>, state);
<a name="l00138"></a>00138     s[3] = c;
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140 
<a name="l00141"></a><a class="code" href="probe_8c.html#ae4f02f93bb2583593bd62c46ff0bee67">00141</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="probe_8c.html#ae4f02f93bb2583593bd62c46ff0bee67">probe_by_extension</a> (<a class="code" href="structProbeState.html">ProbeState</a> * state)
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143     gchar * s = strrchr (state-&gt;<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>, <span class="charliteral">&#39;.&#39;</span>);
<a name="l00144"></a>00144 
<a name="l00145"></a>00145     <span class="keywordflow">if</span> (s == NULL)
<a name="l00146"></a>00146         <span class="keywordflow">return</span>;
<a name="l00147"></a>00147 
<a name="l00148"></a>00148     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Probing by extension.\n&quot;</span>);
<a name="l00149"></a>00149     s = g_ascii_strdown (s + 1, -1);
<a name="l00150"></a>00150 
<a name="l00151"></a>00151     gchar * q = strrchr (s, <span class="charliteral">&#39;?&#39;</span>);
<a name="l00152"></a>00152     <span class="keywordflow">if</span> (q != NULL)
<a name="l00153"></a>00153         * q = 0;
<a name="l00154"></a>00154 
<a name="l00155"></a>00155     <a class="code" href="plugin-registry_8c.html#a76c9501f0af75773187e70aa7f476298">input_plugin_for_key</a> (INPUT_KEY_EXTENSION, s, (<a class="code" href="plugins_8h.html#aca40a3a62c5957dc9ac52e5cbd131016">PluginForEachFunc</a>)
<a name="l00156"></a>00156      <a class="code" href="probe_8c.html#abe1454dfe24a3a8a145b6682d7914907">probe_func_fast</a>, state);
<a name="l00157"></a>00157     g_free (s);
<a name="l00158"></a>00158 }
<a name="l00159"></a>00159 
<a name="l00160"></a><a class="code" href="probe_8c.html#acf2f45d3f163cbf72b3abeecd3241ff3">00160</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="probe_8c.html#acf2f45d3f163cbf72b3abeecd3241ff3">probe_by_mime</a> (<a class="code" href="structProbeState.html">ProbeState</a> * state)
<a name="l00161"></a>00161 {
<a name="l00162"></a>00162     gchar * mime;
<a name="l00163"></a>00163 
<a name="l00164"></a>00164     <span class="keywordflow">if</span> (! <a class="code" href="probe_8c.html#ad1b1635799ffb15fbcbb131b08313a3b">check_opened</a> (state))
<a name="l00165"></a>00165         <span class="keywordflow">return</span>;
<a name="l00166"></a>00166 
<a name="l00167"></a>00167     <span class="keywordflow">if</span> ((mime = <a class="code" href="vfs_8c.html#acbd26807b5b752558de0a288b9fa66ac" title="Returns metadata about the stream.">vfs_get_metadata</a> (state-&gt;<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a>, <span class="stringliteral">&quot;content-type&quot;</span>)) == NULL)
<a name="l00168"></a>00168         <span class="keywordflow">return</span>;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Probing by MIME type.\n&quot;</span>);
<a name="l00171"></a>00171     <a class="code" href="plugin-registry_8c.html#a76c9501f0af75773187e70aa7f476298">input_plugin_for_key</a> (INPUT_KEY_MIME, mime, (<a class="code" href="plugins_8h.html#aca40a3a62c5957dc9ac52e5cbd131016">PluginForEachFunc</a>)
<a name="l00172"></a>00172      <a class="code" href="probe_8c.html#abe1454dfe24a3a8a145b6682d7914907">probe_func_fast</a>, state);
<a name="l00173"></a>00173     g_free (mime);
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175 
<a name="l00176"></a><a class="code" href="probe_8c.html#a8b3670633b60082e398cc8d794dc51ea">00176</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="probe_8c.html#a8b3670633b60082e398cc8d794dc51ea">probe_by_content</a> (<a class="code" href="structProbeState.html">ProbeState</a> * state)
<a name="l00177"></a>00177 {
<a name="l00178"></a>00178     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Probing by content.\n&quot;</span>);
<a name="l00179"></a>00179     <a class="code" href="plugins-api_8h.html#a44440e265b01aa10c482838cca1ef5e2">plugin_for_enabled</a> (<a class="code" href="plugins_8h.html#a16af7b253440dadd46a80a4b9fddba4da90ccc132a4f44b46e7b671831fc62359">PLUGIN_TYPE_INPUT</a>, (<a class="code" href="plugins_8h.html#aca40a3a62c5957dc9ac52e5cbd131016">PluginForEachFunc</a>) <a class="code" href="probe_8c.html#ac37f753c95ae1341873886dce095a951">probe_func</a>, state);
<a name="l00180"></a>00180 }
<a name="l00181"></a>00181 
<a name="l00182"></a><a class="code" href="probe_8c.html#a0dd86be34459404cdcc5a332df5a8080">00182</a> InputPlugin * <a class="code" href="misc-api_8h.html#a6769ae60103bd67203a66c2eceeccffc">file_find_decoder</a> (<span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>, <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> fast)
<a name="l00183"></a>00183 {
<a name="l00184"></a>00184     <a class="code" href="structProbeState.html">ProbeState</a> state;
<a name="l00185"></a>00185 
<a name="l00186"></a>00186     <a class="code" href="log_8h.html#aebed521e655fa60b64f7323bc418c088" title="Debug message macro and transitional aliases.">AUDDBG</a> (<span class="stringliteral">&quot;Probing %s.\n&quot;</span>, filename);
<a name="l00187"></a>00187     state.<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> = NULL;
<a name="l00188"></a>00188     state.<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a> = <a class="code" href="audstrings_8c.html#a1f7caed89cb5e7fd8271645662f73526" title="Given file path/URI contains ending indicating subtune number &amp;quot;?&amp;lt;number&amp;gt;&amp;quot;, splits the string into filename without subtune value.">filename_split_subtune</a> (filename, NULL);
<a name="l00189"></a>00189     state.<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a> = NULL;
<a name="l00190"></a>00190 
<a name="l00191"></a>00191     <a class="code" href="probe_8c.html#abe361878e7225829ebb0c33c14db600c">probe_by_scheme</a> (&amp; state);
<a name="l00192"></a>00192 
<a name="l00193"></a>00193     <span class="keywordflow">if</span> (state.<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> != NULL)
<a name="l00194"></a>00194         <span class="keywordflow">goto</span> DONE;
<a name="l00195"></a>00195 
<a name="l00196"></a>00196     <a class="code" href="probe_8c.html#ae4f02f93bb2583593bd62c46ff0bee67">probe_by_extension</a> (&amp; state);
<a name="l00197"></a>00197 
<a name="l00198"></a>00198     <span class="keywordflow">if</span> (state.<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> != NULL || fast)
<a name="l00199"></a>00199         <span class="keywordflow">goto</span> DONE;
<a name="l00200"></a>00200 
<a name="l00201"></a>00201     <a class="code" href="probe_8c.html#acf2f45d3f163cbf72b3abeecd3241ff3">probe_by_mime</a> (&amp; state);
<a name="l00202"></a>00202 
<a name="l00203"></a>00203     <span class="keywordflow">if</span> (state.<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> != NULL)
<a name="l00204"></a>00204         <span class="keywordflow">goto</span> DONE;
<a name="l00205"></a>00205 
<a name="l00206"></a>00206     <a class="code" href="probe_8c.html#a8b3670633b60082e398cc8d794dc51ea">probe_by_content</a> (&amp; state);
<a name="l00207"></a>00207 
<a name="l00208"></a>00208 DONE:
<a name="l00209"></a>00209     g_free (state.<a class="code" href="structProbeState.html#ad2eb731705ffc3e9fcb471d27d14f454">filename</a>);
<a name="l00210"></a>00210 
<a name="l00211"></a>00211     <span class="keywordflow">if</span> (state.<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a> != NULL)
<a name="l00212"></a>00212         <a class="code" href="vfs_8c.html#aef1161802df682c9d8e0b68bce9f6988" title="Closes a VFS stream and destroys a VFSFile object.">vfs_fclose</a> (state.<a class="code" href="structProbeState.html#a854950ec686d57ac3cb9c53836babc78">handle</a>);
<a name="l00213"></a>00213 
<a name="l00214"></a>00214     <span class="keywordflow">return</span> (state.<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a> != NULL) ? <a class="code" href="plugin-registry_8c.html#aa9f011539a9eab34d41d5e82b21fe81f">plugin_get_header</a> (state.<a class="code" href="structProbeState.html#a05729c22a05d786bff14893c542b5c6b">plugin</a>) : NULL;
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 
<a name="l00217"></a><a class="code" href="probe_8c.html#a3c90d498d5e9bbbc70b99210f22faefa">00217</a> <a class="code" href="structTuple.html" title="Structure for holding and passing around miscellaneous track metadata.">Tuple</a> * <a class="code" href="probe_8c.html#a3c90d498d5e9bbbc70b99210f22faefa">file_read_tuple</a> (<span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>, InputPlugin * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>)
<a name="l00218"></a>00218 {
<a name="l00219"></a>00219     <span class="keywordflow">if</span> (decoder-&gt;get_song_tuple != NULL)
<a name="l00220"></a>00220         <span class="keywordflow">return</span> decoder-&gt;get_song_tuple (filename);
<a name="l00221"></a>00221 
<a name="l00222"></a>00222     <span class="keywordflow">if</span> (decoder-&gt;probe_for_tuple != NULL)
<a name="l00223"></a>00223     {
<a name="l00224"></a>00224         <a class="code" href="structVFSFile.html">VFSFile</a> * handle = <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="l00225"></a>00225         <a class="code" href="structTuple.html" title="Structure for holding and passing around miscellaneous track metadata.">Tuple</a> * tuple;
<a name="l00226"></a>00226 
<a name="l00227"></a>00227         <span class="keywordflow">if</span> (handle == NULL)
<a name="l00228"></a>00228             <span class="keywordflow">return</span> NULL;
<a name="l00229"></a>00229 
<a name="l00230"></a>00230         tuple = decoder-&gt;probe_for_tuple (filename, handle);
<a name="l00231"></a>00231         <a class="code" href="vfs_8c.html#aef1161802df682c9d8e0b68bce9f6988" title="Closes a VFS stream and destroys a VFSFile object.">vfs_fclose</a> (handle);
<a name="l00232"></a>00232         <span class="keywordflow">return</span> tuple;
<a name="l00233"></a>00233     }
<a name="l00234"></a>00234 
<a name="l00235"></a>00235     <span class="keywordflow">return</span> NULL;
<a name="l00236"></a>00236 }
<a name="l00237"></a>00237 
<a name="l00238"></a><a class="code" href="probe_8c.html#a5e8c94487329461fc1877868f7e6d785">00238</a> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="misc-api_8h.html#ad2da1714ca0577920aab9fb9ca340e19">file_read_image</a> (<span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>, InputPlugin * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>,
<a name="l00239"></a>00239  <span class="keywordtype">void</span> * * <a class="code" href="misc-api_8h.html#a2a40119722f785a93d720b769541a543">data</a>, <a class="code" href="misc-api_8h.html#acf599c059f43e0cca83145eb6b0c93cd">gint</a> * size)
<a name="l00240"></a>00240 {
<a name="l00241"></a>00241     <a class="code" href="structVFSFile.html">VFSFile</a> * handle;
<a name="l00242"></a>00242     <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> success;
<a name="l00243"></a>00243 
<a name="l00244"></a>00244     <span class="keywordflow">if</span> (decoder-&gt;get_song_image == NULL)
<a name="l00245"></a>00245         <span class="keywordflow">return</span> FALSE;
<a name="l00246"></a>00246 
<a name="l00247"></a>00247     handle = <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="l00248"></a>00248     success = decoder-&gt;get_song_image (filename, handle, data, size);
<a name="l00249"></a>00249 
<a name="l00250"></a>00250     <span class="keywordflow">if</span> (handle != NULL)
<a name="l00251"></a>00251         <a class="code" href="vfs_8c.html#aef1161802df682c9d8e0b68bce9f6988" title="Closes a VFS stream and destroys a VFSFile object.">vfs_fclose</a> (handle);
<a name="l00252"></a>00252 
<a name="l00253"></a>00253     <span class="keywordflow">return</span> success;
<a name="l00254"></a>00254 }
<a name="l00255"></a>00255 
<a name="l00256"></a><a class="code" href="probe_8c.html#a8c79e20cfd3973ee54cc12180f092397">00256</a> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="probe_8c.html#a8c79e20cfd3973ee54cc12180f092397">file_can_write_tuple</a> (<span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>, InputPlugin * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>)
<a name="l00257"></a>00257 {
<a name="l00258"></a>00258     <span class="keywordflow">return</span> (decoder-&gt;update_song_tuple != NULL);
<a name="l00259"></a>00259 }
<a name="l00260"></a>00260 
<a name="l00261"></a><a class="code" href="probe_8c.html#aa71870803af8231ccd9cc31065cb13d9">00261</a> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="misc-api_8h.html#a9d096385e40cb34312565a7bda6b0c1b">file_write_tuple</a> (<span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>, InputPlugin * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>,
<a name="l00262"></a>00262  <span class="keyword">const</span> <a class="code" href="structTuple.html" title="Structure for holding and passing around miscellaneous track metadata.">Tuple</a> * tuple)
<a name="l00263"></a>00263 {
<a name="l00264"></a>00264     <a class="code" href="structVFSFile.html">VFSFile</a> * handle;
<a name="l00265"></a>00265     <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> success;
<a name="l00266"></a>00266 
<a name="l00267"></a>00267     <span class="keywordflow">if</span> (decoder-&gt;update_song_tuple == NULL)
<a name="l00268"></a>00268         <span class="keywordflow">return</span> FALSE;
<a name="l00269"></a>00269 
<a name="l00270"></a>00270     handle = <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="l00271"></a>00271 
<a name="l00272"></a>00272     <span class="keywordflow">if</span> (handle == NULL)
<a name="l00273"></a>00273         <span class="keywordflow">return</span> FALSE;
<a name="l00274"></a>00274 
<a name="l00275"></a>00275     success = decoder-&gt;update_song_tuple (tuple, handle);
<a name="l00276"></a>00276     <a class="code" href="vfs_8c.html#aef1161802df682c9d8e0b68bce9f6988" title="Closes a VFS stream and destroys a VFSFile object.">vfs_fclose</a> (handle);
<a name="l00277"></a>00277 
<a name="l00278"></a>00278     <span class="keywordflow">if</span> (success)
<a name="l00279"></a>00279         <a class="code" href="playlist-new_8c.html#a3c7b19ef8575edb97aa6051327299c64">playlist_rescan_file</a> (filename);
<a name="l00280"></a>00280 
<a name="l00281"></a>00281     <span class="keywordflow">return</span> success;
<a name="l00282"></a>00282 }
<a name="l00283"></a>00283 
<a name="l00284"></a><a class="code" href="probe_8c.html#a1fcaca759af7f059239ab94da99e60d3">00284</a> <a class="code" href="configdb-api_8h.html#a3ac4dad7ee7fd2890139bff9a134ee9a">gboolean</a> <a class="code" href="probe_8c.html#a1fcaca759af7f059239ab94da99e60d3">custom_infowin</a> (<span class="keyword">const</span> gchar * <a class="code" href="misc-api_8h.html#a820d8643bcfa9e2641dd6377f804de20">filename</a>, InputPlugin * <a class="code" href="misc-api_8h.html#a223c76d43f12031a46d1f35c744332fa">decoder</a>)
<a name="l00285"></a>00285 {
<a name="l00286"></a>00286     <span class="keywordflow">if</span> (decoder-&gt;file_info_box == NULL)
<a name="l00287"></a>00287         <span class="keywordflow">return</span> FALSE;
<a name="l00288"></a>00288 
<a name="l00289"></a>00289     decoder-&gt;file_info_box (filename);
<a name="l00290"></a>00290     <span class="keywordflow">return</span> TRUE;
<a name="l00291"></a>00291 }
</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>