Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > fc3700f27bc4fc84fa885aa2f12d88a3 > files > 16

libcmml-devel-0.9.1-8.fc14.i686.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>libcmml: cmml-seek-utc.c</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.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>cmml-seek-utc.c</h1><p><b>Seeking to a utc time offset into a CMML file</b></p>
<p>Sometimes you'll need to seek to a temporal offset in utc into a CMML file. Note: The utc offset is calculated with respect to the utc and basetime attributes of the stream tag. libcmml provides an API for this functionality through the <a class="el" href="cmml_8h.html#a6137c87e4bcb21add600f304f4cd35e9">cmml_skip_to_utc()</a> function.</p>
<p>The procedure is illustrated in cmml-seek-utc.c, which seeks to an offset given in utc and prints out the descriptions of all the following clips:</p>
<div class="fragment"><pre class="fragment">
<span class="preprocessor">#include &lt;stdio.h&gt;</span>

<span class="preprocessor">#include &lt;<a class="code" href="cmml_8h.html">cmml.h</a>&gt;</span>

<span class="preprocessor">#define BUFSIZE 100000</span>
<span class="preprocessor"></span>
<span class="keyword">static</span> <span class="keywordtype">int</span>
<a name="a0"></a><a class="code" href="cmml-validate_8c.html#ac75b92ae4d99efa0356efdcc7a5158dc">read_clip</a> (<a name="a1"></a><a class="code" href="cmml_8h.html#a491c8a92ced84db6971ab15ae1848542">CMML</a> * cmml, <span class="keyword">const</span> <a name="_a2"></a><a class="code" href="structCMML__Clip.html">CMML_Clip</a> * clip, <span class="keywordtype">void</span> * user_data) {
  puts(clip-&gt;<a name="a3"></a><a class="code" href="structCMML__Clip.html#a75f9f83bb2a96aed53a3ab81099f054a">desc_text</a>);
  <span class="keywordflow">return</span> 0;
}

<span class="keywordtype">int</span> <a name="a4"></a><a class="code" href="cmml-validate_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])
{
  <span class="keywordtype">char</span> *filename = NULL;
  <a class="code" href="cmml_8h.html#a491c8a92ced84db6971ab15ae1848542">CMML</a> * doc;
  <span class="keywordtype">char</span> *utc = NULL;
  <span class="keywordtype">long</span> n = 0;

  <span class="keywordflow">if</span> (argc &lt; 2) {
    fprintf (stderr, <span class="stringliteral">&quot;Usage: %s &lt;CMMLfile&gt; &lt;utc&gt;\n&quot;</span>, argv[0]);
    exit (1);
  }
  filename = argv[1];
  utc = argv[2];

  doc = <a name="a5"></a><a class="code" href="cmml_8h.html#af679b1c64a2f1981a518e213d0e2e4fb">cmml_open</a>(filename);
 
  <span class="comment">/* seek to time offset; if not found, to file end */</span>
  <a name="a6"></a><a class="code" href="cmml_8h.html#a6137c87e4bcb21add600f304f4cd35e9">cmml_skip_to_utc</a> (doc, utc);

  <a name="a7"></a><a class="code" href="cmml_8h.html#af8219117da4dc4bfe24e7646e76862b3">cmml_set_read_callbacks</a> (doc, NULL, NULL, <a class="code" href="cmml-validate_8c.html#ac75b92ae4d99efa0356efdcc7a5158dc">read_clip</a>, NULL);
 
  <span class="keywordflow">while</span> (((n = <a name="a8"></a><a class="code" href="cmml_8h.html#aca01f6d6824a31128ce8b2d9aa691c1f">cmml_read</a> (doc, <a name="a9"></a><a class="code" href="cmml-validate_8c.html#aeca034f67218340ecb2261a22c2f3dcd">BUFSIZE</a>)) &gt; 0));
   
  <a name="a10"></a><a class="code" href="cmml_8h.html#a636131e3ade9aa216ddee09537214bb3">cmml_close</a>(doc);

  <span class="keywordflow">return</span> 0;
}
</pre></div> </div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>