/usr/share/doc/libdvdnav-dev/html/firstprog.html is in libdvdnav-doc 6.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | <!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libdvdnav: A first libdvdnav program</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="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">libdvdnav
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">A first libdvdnav program </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="compiling"></a>
Compiling a libdvdnav program</h1>
<p>Below is a simple <code>libdvdnav</code> program. Type/copy it and save it into the file 'dvdtest.c'.</p>
<pre class="fragment">#include <stdio.h>
#include <dvdnav/dvdnav.h>
#include <dvdnav/dvdnav_events.h>
#include <sys/types.h>
int main(int argc, char **argv) {
dvdnav_t *dvdnav;
int finished, len, event;
uint8_t buf[2050];
/* Open the DVD */
dvdnav_open(&dvdnav, "/dev/dvd");
fprintf(stderr, "Reading...\n");
finished = 0;
while(!finished) {
int result = dvdnav_get_next_block(dvdnav, buf,
&event, &len);
if(result == DVDNAV_STATUS_ERR) {
fprintf(stderr, "Error getting next block (%s)\n",
dvdnav_err_to_string(dvdnav));
exit(1);
}
switch(event) {
case DVDNAV_BLOCK_OK:
/* Write output to stdout */
fwrite(buf, len, 1, stdout);
break;
case DVDNAV_STILL_FRAME:
{
fprintf(stderr, "Skipping still frame\n");
dvdnav_still_skip(dvdnav);
}
break;
case DVDNAV_STOP:
{
finished = 1;
}
default:
fprintf(stderr, "Unhandled event (%i)\n", event);
finished = 1;
break;
}
}
dvdnav_close(dvdnav);
return 0;
}
</pre><p>If you have correctly installled <code>libdvdnav</code>, you should have the command 'dvdnav-config' in your path. If so you can compile this program with </p><pre class="fragment"> gcc -o dvdtest dvdtest.c `dvdnav-config --cflags --libs`
</pre><p>If all goes well, this should generate the 'dvdtest' program in your current working directory. You can now start saving a MPEG 2 stream directly off your DVD with </p><pre class="fragment"> ./dvdtest 2>error.log >out.mpeg
</pre><p>If the command fails, check the error.log file for details.</p>
<h1><a class="anchor" id="walkthrorugh"></a>
Line-by-line walk through</h1>
<pre class="fragment"> include <stdio.h>
include <dvdnav/dvdnav.h>
include <dvdnav/dvdnav_events.h>
include <sys/types.h>
</pre><p>These lines include the necessary headers. Almost all <code>libdvdnav</code> programs will only need to include the dvdnav.h and dvdnav_events.h header files from the dvdnav directory.</p>
<pre class="fragment"> dvdnav_open(&dvdnav, "/dev/dvd");
</pre><p>The <code>libdvdnav</code> uses <code>libdvdread</code> for its DVD I/O. <code>libdvdread</code> accesses the DVD-device directly so dvdnav_open() needs to be passed the location of the DVD device. <code>libdvdread</code> can also open DVD images/mounted DVDs. Read the <code>libdvdread</code> documentation for more information.</p>
<pre class="fragment"> int result = dvdnav_get_next_block(dvdnav, buf,
&event, &len);
</pre><p>Return to <a class="el" href="tutorial.html">A libdvdnav Tutorial</a>. </p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
|