[xiph-commits] r3627 - in liboggz/trunk: . doc src/tools
conrad at svn.annodex.net
conrad at svn.annodex.net
Mon Jul 7 05:26:37 PDT 2008
Author: conrad
Date: 2008-07-07 05:26:34 -0700 (Mon, 07 Jul 2008)
New Revision: 3627
Added:
liboggz/trunk/doc/oggz-diff.1.sgml
liboggz/trunk/doc/oggz-dump.1.sgml
liboggz/trunk/doc/oggz-info.1.sgml
liboggz/trunk/doc/oggz-merge.1.sgml
liboggz/trunk/doc/oggz-rip.1.sgml
liboggz/trunk/src/tools/oggz-diff.in
liboggz/trunk/src/tools/oggz-dump.c
liboggz/trunk/src/tools/oggz-info.c
liboggz/trunk/src/tools/oggz-merge.c
liboggz/trunk/src/tools/oggz-rip.c
Removed:
liboggz/trunk/doc/oggzdiff.1.sgml
liboggz/trunk/doc/oggzdump.1.sgml
liboggz/trunk/doc/oggzinfo.1.sgml
liboggz/trunk/doc/oggzmerge.1.sgml
liboggz/trunk/doc/oggzrip.1.sgml
liboggz/trunk/src/tools/oggzdiff.in
liboggz/trunk/src/tools/oggzdump.c
liboggz/trunk/src/tools/oggzinfo.c
liboggz/trunk/src/tools/oggzmerge.c
liboggz/trunk/src/tools/oggzrip.c
Modified:
liboggz/trunk/configure.ac
liboggz/trunk/doc/Makefile.am
liboggz/trunk/src/tools/Makefile.am
Log:
Rename all tools to include a hyphen.
oggzdump -> oggz-dump
oggzdiff -> oggz-diff
oggzinfo -> oggz-info
oggzmerge -> oggz-merge
oggzrip -> oggz-rip
Modified: liboggz/trunk/configure.ac
===================================================================
--- liboggz/trunk/configure.ac 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/configure.ac 2008-07-07 12:26:34 UTC (rev 3627)
@@ -419,7 +419,7 @@
src/liboggz/Version_script
src/liboggz/Makefile
src/tools/Makefile
-src/tools/oggzdiff
+src/tools/oggz-diff
src/tools/oggz-chop/Makefile
src/tests/Makefile
src/examples/Makefile
Modified: liboggz/trunk/doc/Makefile.am
===================================================================
--- liboggz/trunk/doc/Makefile.am 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/doc/Makefile.am 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,8 +1,8 @@
docdir=$(prefix)/share/doc/@PACKAGE@
if HAVE_DOCBOOKTOMAN
-man_MANS = oggzdiff.1 oggzdump.1 oggzinfo.1 oggzmerge.1 oggz-chop.1 \
- oggz-sort.1 oggzrip.1 oggz-comment.1 oggz-scan.1 oggz-validate.1
+man_MANS = oggz-diff.1 oggz-dump.1 oggz-info.1 oggz-merge.1 oggz-chop.1 \
+ oggz-sort.1 oggz-rip.1 oggz-comment.1 oggz-scan.1 oggz-validate.1
else
man_MANS =
check:
@@ -13,16 +13,16 @@
EXTRA_DIST = $(man_MANS) Doxyfile.in \
forcefeed.fig forcefeed.eps forcefeed.png \
hungry.fig hungry.eps hungry.png \
- oggzdiff.1.sgml oggzdump.1.sgml oggzinfo.1.sgml oggzmerge.1.sgml \
- oggz-chop.1.sgml oggz-sort.1.sgml oggzrip.1.sgml oggz-comment.1.sgml \
+ oggz-diff.1.sgml oggz-dump.1.sgml oggz-info.1.sgml oggz-merge.1.sgml \
+ oggz-chop.1.sgml oggz-sort.1.sgml oggz-rip.1.sgml oggz-comment.1.sgml \
oggz-scan.1.sgml oggz-validate.1.sgml
# ensure doxygen-build.stamp is included, or else the documentation will
# not be built or distributed
noinst_DATA = doxygen-build.stamp
-html: oggzdiff.1.html oggzdump.1.html oggzinfo.1.html oggzmerge.1.html \
- oggz-chop.1.html oggz-sort.1.html oggzrip.1.html oggz-comment.1.html \
+html: oggz-diff.1.html oggz-dump.1.html oggz-info.1.html oggz-merge.1.html \
+ oggz-chop.1.html oggz-sort.1.html oggz-rip.1.html oggz-comment.1.html \
oggz-scan.1.html oggz-validate.1.html
if HAVE_DOCBOOKTOMAN
Copied: liboggz/trunk/doc/oggz-diff.1.sgml (from rev 3626, liboggz/trunk/doc/oggzdiff.1.sgml)
===================================================================
--- liboggz/trunk/doc/oggz-diff.1.sgml (rev 0)
+++ liboggz/trunk/doc/oggz-diff.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,388 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+ -->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
+ <!ENTITY dhsurname "<surname>Parker</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>November 17, 2003</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
+ <!ENTITY dhusername "CSIRO Australia">
+ <!ENTITY dhucpackage "<refentrytitle>oggz-diff</refentrytitle>">
+ <!ENTITY dhpackage "oggz-diff">
+ <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+]>
+
+<refentry id="oggz-diff">
+
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2003</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+
+ <refmeta>
+ &dhucpackage;
+ &dhsection;
+ </refmeta>
+
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+ <refpurpose>Hexdump the packets of two Ogg files and output differences
+ </refpurpose>
+ </refnamediv>
+
+ <!-- A warning of
+ "document type does not allow element "PARAMETER" here"
+ for all the <parameter> tags in the refsynopsisdiv.
+ Ignore them as the <parameter> tag still gets interpreted correctly in
+ the manpage. Deleting the tag however results in non-underlined
+ -->
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+
+ <arg choice="opt">options</arg>
+ <arg choice="opt">OGGZDUMP_OPTIONS</arg>
+ <arg choice="opt">DIFF_OPTIONS</arg>
+
+ <arg choice="plain">file1.ogg</arg>
+ <arg choice="plain">file2.ogg</arg>
+ </cmdsynopsis>
+
+ <cmdsynopsis>
+ <command><parameter>options:</parameter></command>
+
+ <group><arg choice="opt">--verbose</arg></group>
+ <group>
+ <arg choice="opt">-v</arg><arg choice="opt">--version</arg>
+ </group>
+ <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
+ </cmdsynopsis>
+
+ <cmdsynopsis>
+ <command><parameter>OGGZDUMP_OPTIONS:</parameter></command>
+
+ <group>
+ <arg choice="opt">-b</arg><arg choice="opt">--binary</arg>
+ </group>
+ <group>
+ <arg choice="opt">-x</arg><arg choice="opt">--hexadecimal</arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-c content-type</arg>
+ <arg choice="opt">--content-type content-type</arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-s serialno</arg>
+ <arg choice="opt">--serialno serialno</arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-O</arg><arg choice="opt">--hide-offset</arg>
+ </group>
+ <group>
+ <arg choice="opt">-S</arg><arg choice="opt">--hide-serialno</arg>
+ </group>
+ <group>
+ <arg choice="opt">-G</arg><arg choice="opt">--hide-granulepos</arg>
+ </group>
+ <group>
+ <arg choice="opt">-P</arg><arg choice="opt">--hide-packetno</arg>
+ </group>
+ </cmdsynopsis>
+
+ <cmdsynopsis>
+ <command><parameter>DIFF_OPTIONS:</parameter></command>
+
+ <group>
+ <arg choice="opt">-q</arg><arg choice="opt">--brief</arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-C NUM</arg>
+ <arg choice="opt">--context[=NUM]</arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-u</arg>
+ <arg choice="opt">-U NUM</arg>
+ <arg choice="opt">--unified[=NUM]</arg>
+ </group>
+
+ <group><arg choice="opt">-e</arg><arg choice="opt">--ed</arg></group>
+ <group><arg choice="opt">--normal</arg></group>
+ <group><arg choice="opt">--rcs</arg></group>
+ <group>
+ <arg choice="opt">-y</arg><arg choice="opt">--side-by-side</arg>
+ </group>
+ <group>
+ <arg choice="opt">-l</arg><arg choice="opt">--paginate</arg>
+ </group>
+ </cmdsynopsis>
+
+
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+ <para>
+ <command>&dhpackage;</command> is a <command>sh</command> script which
+ uses <command>oggzdump</command> to generate hexadecimal packet dumps
+ of each input file, then outputs the difference between these dumps
+ using <command>diff</command>.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+ <para>
+ <command>&dhpackage;</command> forwards a subset of options
+ accepted by <command>oggzdump</command> and <command>diff</command>.
+ See
+ <citerefentry>
+ <refentrytitle>oggzdump</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry> and
+ <citerefentry>
+ <refentrytitle>diff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry> for more detail.
+ </para>
+
+ <refsect2>
+ <title>oggzdump format options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>-b, --binary</term>
+ <listitem><para>Generate a binary dump of each packet
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-x, --hexadeciaml</term>
+ <listitem><para>Generate a hexadecimal dump of each packet
+ </para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>oggzdump filtering options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>-c <parameter>content-type</parameter>, --content-type <parameter>content-type</parameter></term>
+ <listitem><para>Dump only the logical bitstreams for a specific
+ <parameter>content-type</parameter>. The following codec names
+ are currently detected: "cmml", "flac", "theora", "speex", "vorbis"
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-s <parameter>serialno</parameter>, --serialno <parameter>serialno</parameter></term>
+ <listitem><para>Dump only the logical bitstream with specified
+ <parameter>serialno</parameter>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-O, --hide-offset</term>
+ <listitem><para>Hide the byte offset field of the preamble for
+ each packet dumped. This is particularly useful when comparing
+ Ogg bitstreams that differ only in page structure.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-S, --hide-serialno</term>
+ <listitem><para>Hide the serialno field of the preamble for
+ each packet dumped. This is particularly useful when comparing
+ Ogg bitstreams that differ only in serialno assignment.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-G, --hide-granulepos</term>
+ <listitem><para>Hide the granulepos field of the preamble for
+ each packet dumped.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-P, --hide-packetno</term>
+ <listitem><para>Hide the packetno field of the preamble for
+ each packet dumped.
+ </para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>diff options</title>
+ <para>The -w (--ignore-all-space) option to <command>diff</command>
+ is always implied.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term>-q, --brief</term>
+ <listitem><para>Output only whether files differ.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-C <parameter>NUM</parameter>, --context[=<parameter>NUM</parameter>]</term>
+ <listitem><para>Output NUM lines of copied context.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-u, -U <parameter>NUM</parameter>, --unified[=<parameter>NUM</parameter>]</term>
+ <listitem><para>Output NUM (default 3) lines of unified context.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-e, --ed</term>
+ <listitem><para>Output an ed script.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>--normal</term>
+ <listitem><para>Output a normal diff.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>--rcs</term>
+ <listitem><para>Output an RCS format diff.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-y, --side-by-side</term>
+ <listitem><para>Output in two columns.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-l, --paginate</term>
+ <listitem><para>Pass the output through <command>pr</command> to
+ paginate it.
+ </para></listitem>
+ </varlistentry>
+
+
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>Miscellaneous options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>--verbose</term>
+ <listitem>
+ <para>Display verbose messages.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-v, --version</term>
+ <listitem>
+ <para>Display version information and exit.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-h, --help</term>
+ <listitem>
+ <para>Display usage information and exit.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHOR</title>
+ <para>
+ <author>
+ &dhfirstname; &dhsurname;
+ </author>
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>COPYRIGHT</title>
+ <para>
+ Copyright © 2003 &dhusername;
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para>
+ <citerefentry>
+ <refentrytitle>oggzdump</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>diff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>patch</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
Copied: liboggz/trunk/doc/oggz-dump.1.sgml (from rev 3626, liboggz/trunk/doc/oggzdump.1.sgml)
===================================================================
--- liboggz/trunk/doc/oggz-dump.1.sgml (rev 0)
+++ liboggz/trunk/doc/oggz-dump.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,343 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+ -->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
+ <!ENTITY dhsurname "<surname>Parker</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>November 17, 2003</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
+ <!ENTITY dhusername "CSIRO Australia">
+ <!ENTITY dhucpackage "<refentrytitle>oggz-dump</refentrytitle>">
+ <!ENTITY dhpackage "oggz-dump">
+ <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+]>
+
+<refentry id="oggz-dump">
+
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2003</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+
+ <refmeta>
+ &dhucpackage;
+ &dhsection;
+ </refmeta>
+
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+ <refpurpose>Hexdump packets of an Ogg file, or revert an Ogg file from
+ such a hexdump
+ </refpurpose>
+ </refnamediv>
+
+ <!-- A warning of
+ "document type does not allow element "PARAMETER" here"
+ for all the <parameter> tags in the refsynopsisdiv.
+ Ignore them as the <parameter> tag still gets interpreted correctly in
+ the manpage. Deleting the tag however results in non-underlined
+ -->
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+
+ <group>
+ <arg choice="opt">-b</arg><arg choice="opt">--binary</arg>
+ </group>
+ <group>
+ <arg choice="opt">-x</arg><arg choice="opt">--hexadecimal</arg>
+ </group>
+ <group>
+ <arg choice="opt">-n</arg><arg choice="opt">--new</arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-o <parameter>filename</parameter></arg>
+ <arg choice="opt">--output <parameter>filename</parameter></arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-c <parameter>content-type</parameter></arg>
+ <arg choice="opt">--content-type <parameter>content-type</parameter></arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-s <parameter>serialno</parameter></arg>
+ <arg choice="opt">--serialno <parameter>serialno</parameter></arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-O</arg><arg choice="opt">--hide-offset</arg>
+ </group>
+ <group>
+ <arg choice="opt">-S</arg><arg choice="opt">--hide-serialno</arg>
+ </group>
+ <group>
+ <arg choice="opt">-G</arg><arg choice="opt">--hide-granulepos</arg>
+ </group>
+ <group>
+ <arg choice="opt">-P</arg><arg choice="opt">--hide-packetno</arg>
+ </group>
+
+ <arg choice="plain">filename</arg>
+ </cmdsynopsis>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+
+ <group>
+ <arg choice="opt">-r</arg><arg choice="opt">--revert</arg>
+ </group>
+
+ <group>
+ <arg choice="opt">-o <parameter>filename</parameter></arg>
+ <arg choice="opt">--output <parameter>filename</parameter></arg>
+ </group>
+
+ <arg choice="plain">filename</arg>
+ </cmdsynopsis>
+
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+ <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
+ <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
+ </cmdsynopsis>
+
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+ <para>
+ <command>&dhpackage;</command> generates a hexadecimal or binary dump
+ of packets in an Ogg file, or creates an Ogg file from a hexadecimal
+ oggz-dump file.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+ <para>
+ <command>&dhpackage;</command> accepts the following options:
+ </para>
+
+ <refsect2>
+ <title>Dump format options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>-b, --binary</term>
+ <listitem><para>Generate a binary dump of each packet
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-x, --hexadecimal</term>
+ <listitem><para>Generate a hexadecimal dump of each packet
+ </para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>Filtering options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>-n, --new</term>
+ <listitem><para>Only dump the first packet of each new logical
+ bitstream found; for correctly formed Ogg files, this dumps
+ only the beginning-of-stream packets.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-c <parameter>content-type</parameter>, --content-type <parameter>content-type</parameter></term>
+ <listitem><para>Dump only the logical bitstreams for a specific
+ <parameter>content-type</parameter>. The following codec names
+ are currently detected: "cmml", "flac", "theora", "speex", "vorbis"
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-s <parameter>serialno</parameter>, --serialno <parameter>serialno</parameter></term>
+ <listitem><para>Dump only the logical bitstream with specified
+ <parameter>serialno</parameter>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-O, --hide-offset</term>
+ <listitem><para>Hide the byte offset field of the preamble for
+ each packet dumped. This is particularly useful in
+ conjunction with
+ <citerefentry>
+ <refentrytitle>oggzdiff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry> when comparing Ogg bitstreams that differ
+ only in page structure.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-S, --hide-serialno</term>
+ <listitem><para>Hide the serialno field of the preamble for
+ each packet dumped. This is particularly useful in
+ conjunction with
+ <citerefentry>
+ <refentrytitle>oggzdiff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry> when comparing Ogg bitstreams that differ
+ only in serialno assignment.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-G, --hide-granulepos</term>
+ <listitem><para>Hide the granulepos field of the preamble for
+ each packet dumped.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-P, --hide-packetno</term>
+ <listitem><para>Hide the packetno field of the preamble for
+ each packet dumped.
+ </para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>Mode options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>-r, --revert</term>
+ <listitem>
+ <para>
+ Revert an oggz-dump. Generates an Ogg bitstream as prescribed
+ in the input oggz-dump.
+ </para>
+ <para>
+ The serialno, granulepos and packetno fields of the packet
+ preambles in the oggz-dump, as well as any bos or eos markers
+ if present, are used to structure the packets into logical
+ bitstreams. Hence it is advised that the original input
+ oggz-dump not be generated with any hiding filters.
+ </para>
+ <para>
+ Only the hexadecimal data columns of the input oggz-dump are
+ parsed when generating Ogg packet data; the printable character
+ representation is ignored.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>Miscellaneous options</title>
+ <variablelist>
+ <varlistentry>
+ <term>-o <parameter>filename</parameter>, --output <parameter>filename</parameter></term>
+ <listitem><para>Write output to the specified
+ <parameter>filename</parameter> instead of printing it to
+ standard output.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-h, --help</term>
+ <listitem><para>Display usage information and exit.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-v, --version</term>
+ <listitem><para>Output version information and exit.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHOR</title>
+ <para>
+ <author>
+ &dhfirstname; &dhsurname;
+ </author>
+ &dhdate
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>COPYRIGHT</title>
+ <para>
+ Copyright © 2003 &dhusername;
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para>
+ <citerefentry>
+ <refentrytitle>oggzdiff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>hogg</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ <citerefentry>
+ <refentrytitle>xxd</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>hexdump</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
Copied: liboggz/trunk/doc/oggz-info.1.sgml (from rev 3626, liboggz/trunk/doc/oggzinfo.1.sgml)
===================================================================
--- liboggz/trunk/doc/oggz-info.1.sgml (rev 0)
+++ liboggz/trunk/doc/oggz-info.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,269 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+ -->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
+ <!ENTITY dhsurname "<surname>Parker</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>March 10, 2005</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
+ <!ENTITY dhusername "CSIRO Australia">
+ <!ENTITY dhucpackage "<refentrytitle>oggz-info</refentrytitle>">
+ <!ENTITY dhpackage "oggz-info">
+ <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+]>
+
+<refentry id="oggz-info">
+
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2005</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+
+ <refmeta>
+ &dhucpackage;
+ &dhsection;
+ </refmeta>
+
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+ <refpurpose>Display information about one or more Ogg files and their bitstreams.
+ </refpurpose>
+ </refnamediv>
+
+ <!-- A warning of
+ "document type does not allow element "PARAMETER" here"
+ for all the <parameter> tags in the refsynopsisdiv.
+ Ignore them as the <parameter> tag still gets interpreted correctly in
+ the manpage. Deleting the tag however results in non-underlined
+ -->
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+ <group><arg choice="opt">-l</arg><arg choice="opt">--length</arg></group>
+ <group><arg choice="opt">-b</arg><arg choice="opt">--bitrate</arg></group>
+ <group><arg choice="opt">-g</arg><arg choice="opt">--page-stats</arg></group>
+ <group><arg choice="opt">-p</arg><arg choice="opt">--packet-stats</arg></group>
+ <group><arg choice="opt">-k</arg><arg choice="opt">--skeleton</arg></group>
+ <group><arg choice="opt">-a</arg><arg choice="opt">--all</arg></group>
+ <arg choice="plain" rep="repeat">filename</arg>
+ </cmdsynopsis>
+
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+ <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
+ <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
+ </cmdsynopsis>
+
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+ <para>
+ <command>&dhpackage;</command> displays information about one or more
+ Ogg files and their bitstreams.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+ <para>
+ <command>&dhpackage;</command> accepts the following options:
+ </para>
+
+ <refsect2>
+ <title>Display options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>-l, --length</term>
+ <listitem><para>Display content lengths.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-b, --bitrate</term>
+ <listitem><para>Display bitrate information.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-g, --page-stats</term>
+ <listitem><para>Display Ogg page statistics.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-p, --packet-stats</term>
+ <listitem><para>Display Ogg packet statistics.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-k, --skeleton</term>
+ <listitem><para>Display Extra data from OggSkeleton bitstream.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-a, --all</term>
+ <listitem><para>Display all information.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>Miscellaneous options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>-h, --help</term>
+ <listitem><para>Display usage information and exit.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-v, --version</term>
+ <listitem><para>Output version information and exit.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Units of measurement</title>
+
+ <para><command>&dhpackage;</command> displays information using the
+ following units:
+ </para>
+
+ <refsect2>
+ <title>Byte lengths</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>bytes</term>
+ <listitem><para>(8 bits)</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>kB</term>
+ <listitem><para>kilobytes (1024 bytes)</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>MB</term>
+ <listitem><para>megabytes (1024*1024 bytes)</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>GB</term>
+ <listitem><para>gigabytes (1024*1024*1024 bytes)</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>Bitrates</title>
+ <variablelist>
+
+ <varlistentry>
+ <term>bps</term>
+ <listitem><para>bits per second (bit/s)</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>kbps</term>
+ <listitem><para>kilobits per second (1000 bit/s)</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Mbps</term>
+ <listitem><para>megabits per second (1000000 bit/s)</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Gbps</term>
+ <listitem><para>gigabits per second (1000000000 bit/s)</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHOR</title>
+ <para>
+ <author>
+ &dhfirstname; &dhsurname;
+ </author>
+ &dhdate
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>COPYRIGHT</title>
+ <para>
+ Copyright © 2005 &dhusername;
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para>
+ <citerefentry>
+ <refentrytitle>oggzdump</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggzrip</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggzdiff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ <citerefentry>
+ <refentrytitle>hogg</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
Copied: liboggz/trunk/doc/oggz-merge.1.sgml (from rev 3626, liboggz/trunk/doc/oggzmerge.1.sgml)
===================================================================
--- liboggz/trunk/doc/oggz-merge.1.sgml (rev 0)
+++ liboggz/trunk/doc/oggz-merge.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,208 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+ -->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
+ <!ENTITY dhsurname "<surname>Parker</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>September 21, 2004</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
+ <!ENTITY dhusername "CSIRO Australia">
+ <!ENTITY dhucpackage "<refentrytitle>oggz-merge</refentrytitle>">
+ <!ENTITY dhpackage "oggz-merge">
+ <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+]>
+
+<refentry id="oggz-merge">
+
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2004</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+
+ <refmeta>
+ &dhucpackage;
+ &dhsection;
+ </refmeta>
+
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+ <refpurpose>Merge Ogg files together, interleaving pages in order of
+ presentation time.
+ </refpurpose>
+ </refnamediv>
+
+ <!-- A warning of
+ "document type does not allow element "PARAMETER" here"
+ for all the <parameter> tags in the refsynopsisdiv.
+ Ignore them as the <parameter> tag still gets interpreted correctly in
+ the manpage. Deleting the tag however results in non-underlined
+ -->
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+
+ <group>
+ <arg choice="opt">-o <parameter>filename</parameter></arg>
+ <arg choice="opt">--output <parameter>filename</parameter></arg>
+ </group>
+
+ <arg choice="plain" rep="repeat">filename</arg>
+ </cmdsynopsis>
+
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+ <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
+ <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
+ </cmdsynopsis>
+
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+ <para>
+ <command>&dhpackage;</command> merges Ogg files together, interleaving
+ pages in order of presentation time. It correctly interprets the
+ granulepos timestamps of Ogg Vorbis, Speex, FLAC and Theora bitstreams,
+ and all bitstreams of Annodex files.
+ </para>
+ <para>
+ For example, if you have an Ogg Theora video file, and its soundtrack
+ stored separately as an Ogg Speex audio file, and you can use
+ <command>&dhpackage;</command> to create a single Ogg file containing
+ the video and audio, interleaved together in parallel.
+ </para>
+ <para>
+ Similarly, using <command>&dhpackage;</command> on a collection of Ogg
+ Vorbis audio files will create a big Ogg file with all the songs in
+ parallel, ie. interleaved for simultaneous playback. Such a file is
+ proper Ogg, but not "Ogg Vorbis I" -- the Ogg Vorbis I specification
+ defines an Ogg Vorbis file as an Ogg file containing only one Vorbis
+ track at a time (ie. no parallel multiplexing). Many music players
+ (which use libvorbisfile) aren't designed to play multitrack Ogg files.
+ In general however, video players, and anything built on a multimedia
+ framework (like GStreamer, DirectShow etc.) will probably be able to
+ handle such files.
+ </para>
+ <para>
+ If you want to create a file containing some Ogg files sequenced one
+ after another, then you should simply concatenate them together using
+ <command>cat</command>. In Ogg this is called "chaining". If you cat
+ Ogg Vorbis I audio files together, then the result will also be a
+ compliant Ogg Vorbis file.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+ <para>
+ <command>&dhpackage;</command> accepts the following options:
+ </para>
+
+ <refsect2>
+ <title>Miscellaneous options</title>
+ <variablelist>
+ <varlistentry>
+ <term>-o <parameter>filename</parameter>, --output <parameter>filename</parameter></term>
+ <listitem><para>Write output to the specified
+ <parameter>filename</parameter> instead of printing it to
+ standard output.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-h, --help</term>
+ <listitem><para>Display usage information and exit.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-v, --version</term>
+ <listitem><para>Output version information and exit.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHOR</title>
+ <para>
+ <author>
+ &dhfirstname; &dhsurname;
+ </author>
+ &dhdate
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>COPYRIGHT</title>
+ <para>
+ Copyright © 2004 &dhusername;
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para>
+ <citerefentry>
+ <refentrytitle>cat</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggzrip</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggzdump</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggzdiff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>hogg</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
Copied: liboggz/trunk/doc/oggz-rip.1.sgml (from rev 3626, liboggz/trunk/doc/oggzrip.1.sgml)
===================================================================
--- liboggz/trunk/doc/oggz-rip.1.sgml (rev 0)
+++ liboggz/trunk/doc/oggz-rip.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,226 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+ -->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>David</firstname>">
+ <!ENTITY dhsurname "<surname>Kuehling</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>January 1, 2005</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
+ <!ENTITY dhusername "CSIRO Australia">
+ <!ENTITY dhucpackage "<refentrytitle>oggz-rip</refentrytitle>">
+ <!ENTITY dhpackage "oggz-rip">
+ <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+]>
+
+<refentry id="oggz-rip">
+
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2005</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+
+ <refmeta>
+ &dhucpackage;
+ &dhsection;
+ </refmeta>
+
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+ <refpurpose>Extract one or more logical bitstreams from an Ogg file.
+ </refpurpose>
+ </refnamediv>
+
+ <!-- A warning of
+ "document type does not allow element "PARAMETER" here"
+ for all the <parameter> tags in the refsynopsisdiv.
+ Ignore them as the <parameter> tag still gets interpreted correctly in
+ the manpage. Deleting the tag however results in non-underlined
+ -->
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+
+ <group>
+ <arg choice="opt">-o <parameter>filename</parameter></arg>
+ <arg choice="opt">--output <parameter>filename</parameter></arg>
+ </group>
+
+ <arg choice="plain">filename</arg>
+ </cmdsynopsis>
+
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+ <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
+ <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
+ </cmdsynopsis>
+
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+ <para>
+ <command>&dhpackage;</command> extracts one or more tracks
+ from an Ogg file.
+ In Ogg terminology, <command>&dhpackage;</command> extracts one or
+ more logical bitstreams.
+ </para>
+ <para>
+ For example, to extract just the vorbis audio track from any Ogg file:
+ </para>
+ <para><command>oggz-rip -c vorbis input.ogx > output.ogg</command>
+ </para>
+ </para>
+
+ <para>
+ This will removed any other tracks: Skeleton, Theora, image, etc.
+ The output will be a valid Ogg Vorbis I file, suitable for use on
+ hardware players that do not support multiplexed (ie. multi-track)
+ Ogg files. If the input file contains multiple Vorbis, the desired
+ once can be specified by serialno with the <command>-s</command>
+ option.
+ Use <command>oggzinfo</command> to view the serialno of
+ each track in a file.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+ <para>
+ <command>&dhpackage;</command> accepts the following options:
+ </para>
+
+ <refsect2>
+ <title>Miscellaneous options</title>
+ <variablelist>
+ <varlistentry>
+ <term>-o <parameter>filename</parameter>, --output <parameter>filename</parameter></term>
+ <listitem><para>Write output to the specified
+ <parameter>filename</parameter> instead of printing it to
+ standard output.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-h, --help</term>
+ <listitem><para>Display usage information and exit.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-v, --version</term>
+ <listitem><para>Output version information and exit.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+ <refsect2>
+ <title>Filter options</title>
+ <para>
+ These options can be used multiple times. Pages matching ANY of
+ the filter options will be included into the output.
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term>-s <parameter>serialno</parameter>, --serialno <parameter>serialno</parameter></term>
+ <listitem><para>Output streams with given serialno.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>-i <parameter>index</parameter>, --stream-index <parameter>index</parameter></term>
+ <listitem><para>Filter by stream index. These are assigned to
+ streams in the order of their BOS pages,
+ starting at 0.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>-c <parameter>content-type</parameter> --content-type <parameter>content-type</parameter></term>
+ <listitem><para>Filter by content-type. The following codec names
+ are currently detected: "cmml", "flac", "theora", "speex", "vorbis"
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect2>
+
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHOR</title>
+ <para>
+ <author>
+ &dhfirstname; &dhsurname;
+ </author>
+ &dhdate
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>COPYRIGHT</title>
+ <para>
+ Copyright © 2005 &dhusername;
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para>
+ <citerefentry>
+ <refentrytitle>oggzmerge</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggz-chop</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggzdump</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>oggzdiff</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ <citerefentry>
+ <refentrytitle>hogg</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
Deleted: liboggz/trunk/doc/oggzdiff.1.sgml
===================================================================
--- liboggz/trunk/doc/oggzdiff.1.sgml 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/doc/oggzdiff.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,388 +0,0 @@
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
-<!-- Process this file with docbook-to-man to generate an nroff manual
- page: `docbook-to-man manpage.sgml > manpage.1'. You may view
- the manual page with: `docbook-to-man manpage.sgml | nroff -man |
- less'. A typical entry in a Makefile or Makefile.am is:
-
-manpage.1: manpage.sgml
- docbook-to-man $< > $@
- -->
-
- <!-- Fill in your name for FIRSTNAME and SURNAME. -->
- <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
- <!ENTITY dhsurname "<surname>Parker</surname>">
- <!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>November 17, 2003</date>">
- <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
- allowed: see man(7), man(1). -->
- <!ENTITY dhsection "<manvolnum>1</manvolnum>">
- <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
- <!ENTITY dhusername "CSIRO Australia">
- <!ENTITY dhucpackage "<refentrytitle>oggzdiff</refentrytitle>">
- <!ENTITY dhpackage "oggzdiff">
- <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
- <!ENTITY gnu "<acronym>GNU</acronym>">
-]>
-
-<refentry id="oggzdiff">
-
- <refentryinfo>
- <address>
- &dhemail;
- </address>
- <author>
- &dhfirstname;
- &dhsurname;
- </author>
- <copyright>
- <year>2003</year>
- <holder>&dhusername;</holder>
- </copyright>
- &dhdate;
- </refentryinfo>
-
- <refmeta>
- &dhucpackage;
- &dhsection;
- </refmeta>
-
- <refnamediv>
- <refname>&dhpackage;</refname>
- <refpurpose>Hexdump the packets of two Ogg files and output differences
- </refpurpose>
- </refnamediv>
-
- <!-- A warning of
- "document type does not allow element "PARAMETER" here"
- for all the <parameter> tags in the refsynopsisdiv.
- Ignore them as the <parameter> tag still gets interpreted correctly in
- the manpage. Deleting the tag however results in non-underlined
- -->
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>&dhpackage;</command>
-
- <arg choice="opt">options</arg>
- <arg choice="opt">OGGZDUMP_OPTIONS</arg>
- <arg choice="opt">DIFF_OPTIONS</arg>
-
- <arg choice="plain">file1.ogg</arg>
- <arg choice="plain">file2.ogg</arg>
- </cmdsynopsis>
-
- <cmdsynopsis>
- <command><parameter>options:</parameter></command>
-
- <group><arg choice="opt">--verbose</arg></group>
- <group>
- <arg choice="opt">-v</arg><arg choice="opt">--version</arg>
- </group>
- <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
- </cmdsynopsis>
-
- <cmdsynopsis>
- <command><parameter>OGGZDUMP_OPTIONS:</parameter></command>
-
- <group>
- <arg choice="opt">-b</arg><arg choice="opt">--binary</arg>
- </group>
- <group>
- <arg choice="opt">-x</arg><arg choice="opt">--hexadecimal</arg>
- </group>
-
- <group>
- <arg choice="opt">-c content-type</arg>
- <arg choice="opt">--content-type content-type</arg>
- </group>
-
- <group>
- <arg choice="opt">-s serialno</arg>
- <arg choice="opt">--serialno serialno</arg>
- </group>
-
- <group>
- <arg choice="opt">-O</arg><arg choice="opt">--hide-offset</arg>
- </group>
- <group>
- <arg choice="opt">-S</arg><arg choice="opt">--hide-serialno</arg>
- </group>
- <group>
- <arg choice="opt">-G</arg><arg choice="opt">--hide-granulepos</arg>
- </group>
- <group>
- <arg choice="opt">-P</arg><arg choice="opt">--hide-packetno</arg>
- </group>
- </cmdsynopsis>
-
- <cmdsynopsis>
- <command><parameter>DIFF_OPTIONS:</parameter></command>
-
- <group>
- <arg choice="opt">-q</arg><arg choice="opt">--brief</arg>
- </group>
-
- <group>
- <arg choice="opt">-C NUM</arg>
- <arg choice="opt">--context[=NUM]</arg>
- </group>
-
- <group>
- <arg choice="opt">-u</arg>
- <arg choice="opt">-U NUM</arg>
- <arg choice="opt">--unified[=NUM]</arg>
- </group>
-
- <group><arg choice="opt">-e</arg><arg choice="opt">--ed</arg></group>
- <group><arg choice="opt">--normal</arg></group>
- <group><arg choice="opt">--rcs</arg></group>
- <group>
- <arg choice="opt">-y</arg><arg choice="opt">--side-by-side</arg>
- </group>
- <group>
- <arg choice="opt">-l</arg><arg choice="opt">--paginate</arg>
- </group>
- </cmdsynopsis>
-
-
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
- <para>
- <command>&dhpackage;</command> is a <command>sh</command> script which
- uses <command>oggzdump</command> to generate hexadecimal packet dumps
- of each input file, then outputs the difference between these dumps
- using <command>diff</command>.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Options</title>
- <para>
- <command>&dhpackage;</command> forwards a subset of options
- accepted by <command>oggzdump</command> and <command>diff</command>.
- See
- <citerefentry>
- <refentrytitle>oggzdump</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry> and
- <citerefentry>
- <refentrytitle>diff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry> for more detail.
- </para>
-
- <refsect2>
- <title>oggzdump format options</title>
- <variablelist>
-
- <varlistentry>
- <term>-b, --binary</term>
- <listitem><para>Generate a binary dump of each packet
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-x, --hexadeciaml</term>
- <listitem><para>Generate a hexadecimal dump of each packet
- </para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>oggzdump filtering options</title>
- <variablelist>
-
- <varlistentry>
- <term>-c <parameter>content-type</parameter>, --content-type <parameter>content-type</parameter></term>
- <listitem><para>Dump only the logical bitstreams for a specific
- <parameter>content-type</parameter>. The following codec names
- are currently detected: "cmml", "flac", "theora", "speex", "vorbis"
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-s <parameter>serialno</parameter>, --serialno <parameter>serialno</parameter></term>
- <listitem><para>Dump only the logical bitstream with specified
- <parameter>serialno</parameter>.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-O, --hide-offset</term>
- <listitem><para>Hide the byte offset field of the preamble for
- each packet dumped. This is particularly useful when comparing
- Ogg bitstreams that differ only in page structure.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-S, --hide-serialno</term>
- <listitem><para>Hide the serialno field of the preamble for
- each packet dumped. This is particularly useful when comparing
- Ogg bitstreams that differ only in serialno assignment.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-G, --hide-granulepos</term>
- <listitem><para>Hide the granulepos field of the preamble for
- each packet dumped.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-P, --hide-packetno</term>
- <listitem><para>Hide the packetno field of the preamble for
- each packet dumped.
- </para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>diff options</title>
- <para>The -w (--ignore-all-space) option to <command>diff</command>
- is always implied.
- </para>
-
- <variablelist>
-
- <varlistentry>
- <term>-q, --brief</term>
- <listitem><para>Output only whether files differ.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-C <parameter>NUM</parameter>, --context[=<parameter>NUM</parameter>]</term>
- <listitem><para>Output NUM lines of copied context.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-u, -U <parameter>NUM</parameter>, --unified[=<parameter>NUM</parameter>]</term>
- <listitem><para>Output NUM (default 3) lines of unified context.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-e, --ed</term>
- <listitem><para>Output an ed script.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>--normal</term>
- <listitem><para>Output a normal diff.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>--rcs</term>
- <listitem><para>Output an RCS format diff.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-y, --side-by-side</term>
- <listitem><para>Output in two columns.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-l, --paginate</term>
- <listitem><para>Pass the output through <command>pr</command> to
- paginate it.
- </para></listitem>
- </varlistentry>
-
-
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>Miscellaneous options</title>
- <variablelist>
-
- <varlistentry>
- <term>--verbose</term>
- <listitem>
- <para>Display verbose messages.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-v, --version</term>
- <listitem>
- <para>Display version information and exit.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-h, --help</term>
- <listitem>
- <para>Display usage information and exit.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
- </refsect1>
-
- <refsect1>
- <title>AUTHOR</title>
- <para>
- <author>
- &dhfirstname; &dhsurname;
- </author>
- </para>
- </refsect1>
-
- <refsect1>
- <title>COPYRIGHT</title>
- <para>
- Copyright © 2003 &dhusername;
- </para>
- </refsect1>
-
- <refsect1>
- <title>SEE ALSO</title>
- <para>
- <citerefentry>
- <refentrytitle>oggzdump</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>diff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>patch</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
-
-</refentry>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
Deleted: liboggz/trunk/doc/oggzdump.1.sgml
===================================================================
--- liboggz/trunk/doc/oggzdump.1.sgml 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/doc/oggzdump.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,343 +0,0 @@
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
-<!-- Process this file with docbook-to-man to generate an nroff manual
- page: `docbook-to-man manpage.sgml > manpage.1'. You may view
- the manual page with: `docbook-to-man manpage.sgml | nroff -man |
- less'. A typical entry in a Makefile or Makefile.am is:
-
-manpage.1: manpage.sgml
- docbook-to-man $< > $@
- -->
-
- <!-- Fill in your name for FIRSTNAME and SURNAME. -->
- <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
- <!ENTITY dhsurname "<surname>Parker</surname>">
- <!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>November 17, 2003</date>">
- <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
- allowed: see man(7), man(1). -->
- <!ENTITY dhsection "<manvolnum>1</manvolnum>">
- <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
- <!ENTITY dhusername "CSIRO Australia">
- <!ENTITY dhucpackage "<refentrytitle>oggzdump</refentrytitle>">
- <!ENTITY dhpackage "oggzdump">
- <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
- <!ENTITY gnu "<acronym>GNU</acronym>">
-]>
-
-<refentry id="oggzdump">
-
- <refentryinfo>
- <address>
- &dhemail;
- </address>
- <author>
- &dhfirstname;
- &dhsurname;
- </author>
- <copyright>
- <year>2003</year>
- <holder>&dhusername;</holder>
- </copyright>
- &dhdate;
- </refentryinfo>
-
- <refmeta>
- &dhucpackage;
- &dhsection;
- </refmeta>
-
- <refnamediv>
- <refname>&dhpackage;</refname>
- <refpurpose>Hexdump packets of an Ogg file, or revert an Ogg file from
- such a hexdump
- </refpurpose>
- </refnamediv>
-
- <!-- A warning of
- "document type does not allow element "PARAMETER" here"
- for all the <parameter> tags in the refsynopsisdiv.
- Ignore them as the <parameter> tag still gets interpreted correctly in
- the manpage. Deleting the tag however results in non-underlined
- -->
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>&dhpackage;</command>
-
- <group>
- <arg choice="opt">-b</arg><arg choice="opt">--binary</arg>
- </group>
- <group>
- <arg choice="opt">-x</arg><arg choice="opt">--hexadecimal</arg>
- </group>
- <group>
- <arg choice="opt">-n</arg><arg choice="opt">--new</arg>
- </group>
-
- <group>
- <arg choice="opt">-o <parameter>filename</parameter></arg>
- <arg choice="opt">--output <parameter>filename</parameter></arg>
- </group>
-
- <group>
- <arg choice="opt">-c <parameter>content-type</parameter></arg>
- <arg choice="opt">--content-type <parameter>content-type</parameter></arg>
- </group>
-
- <group>
- <arg choice="opt">-s <parameter>serialno</parameter></arg>
- <arg choice="opt">--serialno <parameter>serialno</parameter></arg>
- </group>
-
- <group>
- <arg choice="opt">-O</arg><arg choice="opt">--hide-offset</arg>
- </group>
- <group>
- <arg choice="opt">-S</arg><arg choice="opt">--hide-serialno</arg>
- </group>
- <group>
- <arg choice="opt">-G</arg><arg choice="opt">--hide-granulepos</arg>
- </group>
- <group>
- <arg choice="opt">-P</arg><arg choice="opt">--hide-packetno</arg>
- </group>
-
- <arg choice="plain">filename</arg>
- </cmdsynopsis>
- <cmdsynopsis>
- <command>&dhpackage;</command>
-
- <group>
- <arg choice="opt">-r</arg><arg choice="opt">--revert</arg>
- </group>
-
- <group>
- <arg choice="opt">-o <parameter>filename</parameter></arg>
- <arg choice="opt">--output <parameter>filename</parameter></arg>
- </group>
-
- <arg choice="plain">filename</arg>
- </cmdsynopsis>
-
- <cmdsynopsis>
- <command>&dhpackage;</command>
- <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
- <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
- </cmdsynopsis>
-
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
- <para>
- <command>&dhpackage;</command> generates a hexadecimal or binary dump
- of packets in an Ogg file, or creates an Ogg file from a hexadecimal
- oggzdump file.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Options</title>
- <para>
- <command>&dhpackage;</command> accepts the following options:
- </para>
-
- <refsect2>
- <title>Dump format options</title>
- <variablelist>
-
- <varlistentry>
- <term>-b, --binary</term>
- <listitem><para>Generate a binary dump of each packet
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-x, --hexadecimal</term>
- <listitem><para>Generate a hexadecimal dump of each packet
- </para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>Filtering options</title>
- <variablelist>
-
- <varlistentry>
- <term>-n, --new</term>
- <listitem><para>Only dump the first packet of each new logical
- bitstream found; for correctly formed Ogg files, this dumps
- only the beginning-of-stream packets.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-c <parameter>content-type</parameter>, --content-type <parameter>content-type</parameter></term>
- <listitem><para>Dump only the logical bitstreams for a specific
- <parameter>content-type</parameter>. The following codec names
- are currently detected: "cmml", "flac", "theora", "speex", "vorbis"
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-s <parameter>serialno</parameter>, --serialno <parameter>serialno</parameter></term>
- <listitem><para>Dump only the logical bitstream with specified
- <parameter>serialno</parameter>.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-O, --hide-offset</term>
- <listitem><para>Hide the byte offset field of the preamble for
- each packet dumped. This is particularly useful in
- conjunction with
- <citerefentry>
- <refentrytitle>oggzdiff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry> when comparing Ogg bitstreams that differ
- only in page structure.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-S, --hide-serialno</term>
- <listitem><para>Hide the serialno field of the preamble for
- each packet dumped. This is particularly useful in
- conjunction with
- <citerefentry>
- <refentrytitle>oggzdiff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry> when comparing Ogg bitstreams that differ
- only in serialno assignment.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-G, --hide-granulepos</term>
- <listitem><para>Hide the granulepos field of the preamble for
- each packet dumped.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-P, --hide-packetno</term>
- <listitem><para>Hide the packetno field of the preamble for
- each packet dumped.
- </para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>Mode options</title>
- <variablelist>
-
- <varlistentry>
- <term>-r, --revert</term>
- <listitem>
- <para>
- Revert an oggzdump. Generates an Ogg bitstream as prescribed
- in the input oggzdump.
- </para>
- <para>
- The serialno, granulepos and packetno fields of the packet
- preambles in the oggzdump, as well as any bos or eos markers
- if present, are used to structure the packets into logical
- bitstreams. Hence it is advised that the original input
- oggzdump not be generated with any hiding filters.
- </para>
- <para>
- Only the hexadecimal data columns of the input oggzdump are
- parsed when generating Ogg packet data; the printable character
- representation is ignored.
- </para>
- </listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>Miscellaneous options</title>
- <variablelist>
- <varlistentry>
- <term>-o <parameter>filename</parameter>, --output <parameter>filename</parameter></term>
- <listitem><para>Write output to the specified
- <parameter>filename</parameter> instead of printing it to
- standard output.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-h, --help</term>
- <listitem><para>Display usage information and exit.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-v, --version</term>
- <listitem><para>Output version information and exit.</para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
- </refsect1>
-
- <refsect1>
- <title>AUTHOR</title>
- <para>
- <author>
- &dhfirstname; &dhsurname;
- </author>
- &dhdate
- </para>
- </refsect1>
-
- <refsect1>
- <title>COPYRIGHT</title>
- <para>
- Copyright © 2003 &dhusername;
- </para>
- </refsect1>
-
- <refsect1>
- <title>SEE ALSO</title>
- <para>
- <citerefentry>
- <refentrytitle>oggzdiff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>hogg</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>xxd</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>hexdump</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
-
-</refentry>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
Deleted: liboggz/trunk/doc/oggzinfo.1.sgml
===================================================================
--- liboggz/trunk/doc/oggzinfo.1.sgml 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/doc/oggzinfo.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,269 +0,0 @@
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
-<!-- Process this file with docbook-to-man to generate an nroff manual
- page: `docbook-to-man manpage.sgml > manpage.1'. You may view
- the manual page with: `docbook-to-man manpage.sgml | nroff -man |
- less'. A typical entry in a Makefile or Makefile.am is:
-
-manpage.1: manpage.sgml
- docbook-to-man $< > $@
- -->
-
- <!-- Fill in your name for FIRSTNAME and SURNAME. -->
- <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
- <!ENTITY dhsurname "<surname>Parker</surname>">
- <!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>March 10, 2005</date>">
- <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
- allowed: see man(7), man(1). -->
- <!ENTITY dhsection "<manvolnum>1</manvolnum>">
- <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
- <!ENTITY dhusername "CSIRO Australia">
- <!ENTITY dhucpackage "<refentrytitle>oggzinfo</refentrytitle>">
- <!ENTITY dhpackage "oggzinfo">
- <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
- <!ENTITY gnu "<acronym>GNU</acronym>">
-]>
-
-<refentry id="oggzinfo">
-
- <refentryinfo>
- <address>
- &dhemail;
- </address>
- <author>
- &dhfirstname;
- &dhsurname;
- </author>
- <copyright>
- <year>2005</year>
- <holder>&dhusername;</holder>
- </copyright>
- &dhdate;
- </refentryinfo>
-
- <refmeta>
- &dhucpackage;
- &dhsection;
- </refmeta>
-
- <refnamediv>
- <refname>&dhpackage;</refname>
- <refpurpose>Display information about one or more Ogg files and their bitstreams.
- </refpurpose>
- </refnamediv>
-
- <!-- A warning of
- "document type does not allow element "PARAMETER" here"
- for all the <parameter> tags in the refsynopsisdiv.
- Ignore them as the <parameter> tag still gets interpreted correctly in
- the manpage. Deleting the tag however results in non-underlined
- -->
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>&dhpackage;</command>
- <group><arg choice="opt">-l</arg><arg choice="opt">--length</arg></group>
- <group><arg choice="opt">-b</arg><arg choice="opt">--bitrate</arg></group>
- <group><arg choice="opt">-g</arg><arg choice="opt">--page-stats</arg></group>
- <group><arg choice="opt">-p</arg><arg choice="opt">--packet-stats</arg></group>
- <group><arg choice="opt">-k</arg><arg choice="opt">--skeleton</arg></group>
- <group><arg choice="opt">-a</arg><arg choice="opt">--all</arg></group>
- <arg choice="plain" rep="repeat">filename</arg>
- </cmdsynopsis>
-
- <cmdsynopsis>
- <command>&dhpackage;</command>
- <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
- <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
- </cmdsynopsis>
-
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
- <para>
- <command>&dhpackage;</command> displays information about one or more
- Ogg files and their bitstreams.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Options</title>
- <para>
- <command>&dhpackage;</command> accepts the following options:
- </para>
-
- <refsect2>
- <title>Display options</title>
- <variablelist>
-
- <varlistentry>
- <term>-l, --length</term>
- <listitem><para>Display content lengths.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-b, --bitrate</term>
- <listitem><para>Display bitrate information.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-g, --page-stats</term>
- <listitem><para>Display Ogg page statistics.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-p, --packet-stats</term>
- <listitem><para>Display Ogg packet statistics.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-k, --skeleton</term>
- <listitem><para>Display Extra data from OggSkeleton bitstream.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-a, --all</term>
- <listitem><para>Display all information.</para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>Miscellaneous options</title>
- <variablelist>
-
- <varlistentry>
- <term>-h, --help</term>
- <listitem><para>Display usage information and exit.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-v, --version</term>
- <listitem><para>Output version information and exit.</para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- </refsect1>
-
- <refsect1>
- <title>Units of measurement</title>
-
- <para><command>&dhpackage;</command> displays information using the
- following units:
- </para>
-
- <refsect2>
- <title>Byte lengths</title>
- <variablelist>
-
- <varlistentry>
- <term>bytes</term>
- <listitem><para>(8 bits)</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>kB</term>
- <listitem><para>kilobytes (1024 bytes)</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>MB</term>
- <listitem><para>megabytes (1024*1024 bytes)</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>GB</term>
- <listitem><para>gigabytes (1024*1024*1024 bytes)</para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
-
- <refsect2>
- <title>Bitrates</title>
- <variablelist>
-
- <varlistentry>
- <term>bps</term>
- <listitem><para>bits per second (bit/s)</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>kbps</term>
- <listitem><para>kilobits per second (1000 bit/s)</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>Mbps</term>
- <listitem><para>megabits per second (1000000 bit/s)</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>Gbps</term>
- <listitem><para>gigabits per second (1000000000 bit/s)</para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
- </refsect1>
-
- <refsect1>
- <title>AUTHOR</title>
- <para>
- <author>
- &dhfirstname; &dhsurname;
- </author>
- &dhdate
- </para>
- </refsect1>
-
- <refsect1>
- <title>COPYRIGHT</title>
- <para>
- Copyright © 2005 &dhusername;
- </para>
- </refsect1>
-
- <refsect1>
- <title>SEE ALSO</title>
- <para>
- <citerefentry>
- <refentrytitle>oggzdump</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggzrip</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggzdiff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>hogg</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
-
-</refentry>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
Deleted: liboggz/trunk/doc/oggzmerge.1.sgml
===================================================================
--- liboggz/trunk/doc/oggzmerge.1.sgml 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/doc/oggzmerge.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,208 +0,0 @@
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
-<!-- Process this file with docbook-to-man to generate an nroff manual
- page: `docbook-to-man manpage.sgml > manpage.1'. You may view
- the manual page with: `docbook-to-man manpage.sgml | nroff -man |
- less'. A typical entry in a Makefile or Makefile.am is:
-
-manpage.1: manpage.sgml
- docbook-to-man $< > $@
- -->
-
- <!-- Fill in your name for FIRSTNAME and SURNAME. -->
- <!ENTITY dhfirstname "<firstname>Conrad</firstname>">
- <!ENTITY dhsurname "<surname>Parker</surname>">
- <!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>September 21, 2004</date>">
- <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
- allowed: see man(7), man(1). -->
- <!ENTITY dhsection "<manvolnum>1</manvolnum>">
- <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
- <!ENTITY dhusername "CSIRO Australia">
- <!ENTITY dhucpackage "<refentrytitle>oggzmerge</refentrytitle>">
- <!ENTITY dhpackage "oggzmerge">
- <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
- <!ENTITY gnu "<acronym>GNU</acronym>">
-]>
-
-<refentry id="oggzmerge">
-
- <refentryinfo>
- <address>
- &dhemail;
- </address>
- <author>
- &dhfirstname;
- &dhsurname;
- </author>
- <copyright>
- <year>2004</year>
- <holder>&dhusername;</holder>
- </copyright>
- &dhdate;
- </refentryinfo>
-
- <refmeta>
- &dhucpackage;
- &dhsection;
- </refmeta>
-
- <refnamediv>
- <refname>&dhpackage;</refname>
- <refpurpose>Merge Ogg files together, interleaving pages in order of
- presentation time.
- </refpurpose>
- </refnamediv>
-
- <!-- A warning of
- "document type does not allow element "PARAMETER" here"
- for all the <parameter> tags in the refsynopsisdiv.
- Ignore them as the <parameter> tag still gets interpreted correctly in
- the manpage. Deleting the tag however results in non-underlined
- -->
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>&dhpackage;</command>
-
- <group>
- <arg choice="opt">-o <parameter>filename</parameter></arg>
- <arg choice="opt">--output <parameter>filename</parameter></arg>
- </group>
-
- <arg choice="plain" rep="repeat">filename</arg>
- </cmdsynopsis>
-
- <cmdsynopsis>
- <command>&dhpackage;</command>
- <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
- <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
- </cmdsynopsis>
-
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
- <para>
- <command>&dhpackage;</command> merges Ogg files together, interleaving
- pages in order of presentation time. It correctly interprets the
- granulepos timestamps of Ogg Vorbis, Speex, FLAC and Theora bitstreams,
- and all bitstreams of Annodex files.
- </para>
- <para>
- For example, if you have an Ogg Theora video file, and its soundtrack
- stored separately as an Ogg Speex audio file, and you can use
- <command>&dhpackage;</command> to create a single Ogg file containing
- the video and audio, interleaved together in parallel.
- </para>
- <para>
- Similarly, using <command>&dhpackage;</command> on a collection of Ogg
- Vorbis audio files will create a big Ogg file with all the songs in
- parallel, ie. interleaved for simultaneous playback. Such a file is
- proper Ogg, but not "Ogg Vorbis I" -- the Ogg Vorbis I specification
- defines an Ogg Vorbis file as an Ogg file containing only one Vorbis
- track at a time (ie. no parallel multiplexing). Many music players
- (which use libvorbisfile) aren't designed to play multitrack Ogg files.
- In general however, video players, and anything built on a multimedia
- framework (like GStreamer, DirectShow etc.) will probably be able to
- handle such files.
- </para>
- <para>
- If you want to create a file containing some Ogg files sequenced one
- after another, then you should simply concatenate them together using
- <command>cat</command>. In Ogg this is called "chaining". If you cat
- Ogg Vorbis I audio files together, then the result will also be a
- compliant Ogg Vorbis file.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Options</title>
- <para>
- <command>&dhpackage;</command> accepts the following options:
- </para>
-
- <refsect2>
- <title>Miscellaneous options</title>
- <variablelist>
- <varlistentry>
- <term>-o <parameter>filename</parameter>, --output <parameter>filename</parameter></term>
- <listitem><para>Write output to the specified
- <parameter>filename</parameter> instead of printing it to
- standard output.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-h, --help</term>
- <listitem><para>Display usage information and exit.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-v, --version</term>
- <listitem><para>Output version information and exit.</para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
- </refsect1>
-
- <refsect1>
- <title>AUTHOR</title>
- <para>
- <author>
- &dhfirstname; &dhsurname;
- </author>
- &dhdate
- </para>
- </refsect1>
-
- <refsect1>
- <title>COPYRIGHT</title>
- <para>
- Copyright © 2004 &dhusername;
- </para>
- </refsect1>
-
- <refsect1>
- <title>SEE ALSO</title>
- <para>
- <citerefentry>
- <refentrytitle>cat</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggzrip</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggzdump</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggzdiff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>hogg</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
-
-</refentry>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
Deleted: liboggz/trunk/doc/oggzrip.1.sgml
===================================================================
--- liboggz/trunk/doc/oggzrip.1.sgml 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/doc/oggzrip.1.sgml 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,226 +0,0 @@
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
-<!-- Process this file with docbook-to-man to generate an nroff manual
- page: `docbook-to-man manpage.sgml > manpage.1'. You may view
- the manual page with: `docbook-to-man manpage.sgml | nroff -man |
- less'. A typical entry in a Makefile or Makefile.am is:
-
-manpage.1: manpage.sgml
- docbook-to-man $< > $@
- -->
-
- <!-- Fill in your name for FIRSTNAME and SURNAME. -->
- <!ENTITY dhfirstname "<firstname>David</firstname>">
- <!ENTITY dhsurname "<surname>Kuehling</surname>">
- <!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>January 1, 2005</date>">
- <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
- allowed: see man(7), man(1). -->
- <!ENTITY dhsection "<manvolnum>1</manvolnum>">
- <!ENTITY dhemail "<email>conrad.parker at csiro.au</email>">
- <!ENTITY dhusername "CSIRO Australia">
- <!ENTITY dhucpackage "<refentrytitle>oggzrip</refentrytitle>">
- <!ENTITY dhpackage "oggzrip">
- <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
- <!ENTITY gnu "<acronym>GNU</acronym>">
-]>
-
-<refentry id="oggzrip">
-
- <refentryinfo>
- <address>
- &dhemail;
- </address>
- <author>
- &dhfirstname;
- &dhsurname;
- </author>
- <copyright>
- <year>2005</year>
- <holder>&dhusername;</holder>
- </copyright>
- &dhdate;
- </refentryinfo>
-
- <refmeta>
- &dhucpackage;
- &dhsection;
- </refmeta>
-
- <refnamediv>
- <refname>&dhpackage;</refname>
- <refpurpose>Extract one or more logical bitstreams from an Ogg file.
- </refpurpose>
- </refnamediv>
-
- <!-- A warning of
- "document type does not allow element "PARAMETER" here"
- for all the <parameter> tags in the refsynopsisdiv.
- Ignore them as the <parameter> tag still gets interpreted correctly in
- the manpage. Deleting the tag however results in non-underlined
- -->
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>&dhpackage;</command>
-
- <group>
- <arg choice="opt">-o <parameter>filename</parameter></arg>
- <arg choice="opt">--output <parameter>filename</parameter></arg>
- </group>
-
- <arg choice="plain">filename</arg>
- </cmdsynopsis>
-
- <cmdsynopsis>
- <command>&dhpackage;</command>
- <group><arg choice="opt">-h</arg><arg choice="opt">--help</arg></group>
- <group><arg choice="opt">-v</arg><arg choice="opt">--version</arg></group>
- </cmdsynopsis>
-
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
- <para>
- <command>&dhpackage;</command> extracts one or more tracks
- from an Ogg file.
- In Ogg terminology, <command>&dhpackage;</command> extracts one or
- more logical bitstreams.
- </para>
- <para>
- For example, to extract just the vorbis audio track from any Ogg file:
- </para>
- <para><command>oggzrip -c vorbis input.ogx > output.ogg</command>
- </para>
- </para>
-
- <para>
- This will removed any other tracks: Skeleton, Theora, image, etc.
- The output will be a valid Ogg Vorbis I file, suitable for use on
- hardware players that do not support multiplexed (ie. multi-track)
- Ogg files. If the input file contains multiple Vorbis, the desired
- once can be specified by serialno with the <command>-s</command>
- option.
- Use <command>oggzinfo</command> to view the serialno of
- each track in a file.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Options</title>
- <para>
- <command>&dhpackage;</command> accepts the following options:
- </para>
-
- <refsect2>
- <title>Miscellaneous options</title>
- <variablelist>
- <varlistentry>
- <term>-o <parameter>filename</parameter>, --output <parameter>filename</parameter></term>
- <listitem><para>Write output to the specified
- <parameter>filename</parameter> instead of printing it to
- standard output.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-h, --help</term>
- <listitem><para>Display usage information and exit.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-v, --version</term>
- <listitem><para>Output version information and exit.</para></listitem>
- </varlistentry>
-
- </variablelist>
- </refsect2>
- <refsect2>
- <title>Filter options</title>
- <para>
- These options can be used multiple times. Pages matching ANY of
- the filter options will be included into the output.
- </para>
- <variablelist>
- <varlistentry>
- <term>-s <parameter>serialno</parameter>, --serialno <parameter>serialno</parameter></term>
- <listitem><para>Output streams with given serialno.</para></listitem>
- </varlistentry>
- <varlistentry>
- <term>-i <parameter>index</parameter>, --stream-index <parameter>index</parameter></term>
- <listitem><para>Filter by stream index. These are assigned to
- streams in the order of their BOS pages,
- starting at 0.
- </para></listitem>
- </varlistentry>
- <varlistentry>
- <term>-c <parameter>content-type</parameter> --content-type <parameter>content-type</parameter></term>
- <listitem><para>Filter by content-type. The following codec names
- are currently detected: "cmml", "flac", "theora", "speex", "vorbis"
- </para></listitem>
- </varlistentry>
- </variablelist>
- </refsect2>
-
- </refsect1>
-
- <refsect1>
- <title>AUTHOR</title>
- <para>
- <author>
- &dhfirstname; &dhsurname;
- </author>
- &dhdate
- </para>
- </refsect1>
-
- <refsect1>
- <title>COPYRIGHT</title>
- <para>
- Copyright © 2005 &dhusername;
- </para>
- </refsect1>
-
- <refsect1>
- <title>SEE ALSO</title>
- <para>
- <citerefentry>
- <refentrytitle>oggzmerge</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggz-chop</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggzdump</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>oggzdiff</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>hogg</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
-
-</refentry>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
Modified: liboggz/trunk/src/tools/Makefile.am
===================================================================
--- liboggz/trunk/src/tools/Makefile.am 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/src/tools/Makefile.am 2008-07-07 12:26:34 UTC (rev 3627)
@@ -2,9 +2,9 @@
SUBDIRS = oggz-chop
-EXTRA_DIST = oggzdiff
+EXTRA_DIST = oggz-diff
-bin_SCRIPTS = oggzdiff
+bin_SCRIPTS = oggz-diff
INCLUDES = -I$(top_builddir) -I$(top_builddir)/include \
-I$(top_srcdir)/include \
@@ -14,11 +14,11 @@
OGGZ_LIBS = $(OGGZDIR)/liboggz.la @OGG_LIBS@
if OGGZ_CONFIG_READ
-oggz_read_programs = oggzdump oggzinfo oggz-scan
+oggz_read_programs = oggz-dump oggz-info oggz-scan
oggz_read_noinst_programs =
if OGGZ_CONFIG_WRITE
-oggz_rw_programs = oggzmerge oggzrip oggz-validate oggz-comment oggz-sort
+oggz_rw_programs = oggz-merge oggz-rip oggz-validate oggz-comment oggz-sort
oggz_rw_noinst_programs = oggz-basetime
endif
@@ -30,20 +30,20 @@
bin_PROGRAMS = $(oggz_read_programs) $(oggz_rw_programs)
noinst_PROGRAMS = $(oggz_read_noinst_programs) $(oggz_rw_noinst_programs)
-oggzinfo_SOURCES = oggzinfo.c oggz_tools.c skeleton.c
-oggzinfo_LDADD = $(OGGZ_LIBS) -lm
+oggz_info_SOURCES = oggz-info.c oggz_tools.c skeleton.c
+oggz_info_LDADD = $(OGGZ_LIBS) -lm
oggz_comment_SOURCES = oggz-comment.c oggz_tools.c
oggz_comment_LDADD = $(OGGZ_LIBS)
-oggzdump_SOURCES = oggzdump.c oggz_tools.c
-oggzdump_LDADD = $(OGGZ_LIBS)
+oggz_dump_SOURCES = oggz-dump.c oggz_tools.c
+oggz_dump_LDADD = $(OGGZ_LIBS)
-oggzmerge_SOURCES = oggzmerge.c oggz_tools.c
-oggzmerge_LDADD = $(OGGZ_LIBS)
+oggz_merge_SOURCES = oggz-merge.c oggz_tools.c
+oggz_merge_LDADD = $(OGGZ_LIBS)
-oggzrip_SOURCES = oggzrip.c oggz_tools.c
-oggzrip_LDADD = $(OGGZ_LIBS)
+oggz_rip_SOURCES = oggz-rip.c oggz_tools.c
+oggz_rip_LDADD = $(OGGZ_LIBS)
oggz_validate_SOURCES = oggz-validate.c oggz_tools.c
oggz_validate_LDADD = $(OGGZ_LIBS)
Copied: liboggz/trunk/src/tools/oggz-diff.in (from rev 3626, liboggz/trunk/src/tools/oggzdiff.in)
===================================================================
--- liboggz/trunk/src/tools/oggz-diff.in (rev 0)
+++ liboggz/trunk/src/tools/oggz-diff.in 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,205 @@
+#!/bin/sh
+
+## Copyright (C) 2003 Commonwealth Scientific and Industrial Research
+## Organisation (CSIRO) Australia
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+##
+## - Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+##
+## - Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+##
+## - Neither the name of CSIRO Australia nor the names of its
+## contributors may be used to endorse or promote products derived from
+## this software without specific prior written permission.
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+## PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+## LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version () {
+ echo >&2 "oggz-diff version "@VERSION@
+ exit 1
+}
+
+usage () {
+ echo >&2 "oggz-diff, diff oggz-dumps of two Ogg files."
+ echo >&2
+ echo >&2 "Usage: oggz-diff [options] [OGGZDUMP_OPTIONS] [DIFF_OPTIONS] file1.ogg file2.ogg"
+ echo >&2
+ echo >&2 "options: [--verbose] [-v | --version] [-h | --help]"
+ echo >&2
+ echo >&2 "Supported oggz-dump and diff options:"
+ echo >&2
+ echo >&2 "OGGZDUMP_OPTIONS: [-b | --binary] [-x | --hexadecimal]"
+ echo >&2 " [-O | --hide-offset] [-S | --hide-serialno] [-G | --hide-granulepos]"
+ echo >&2 " [-P | --hide-packetno] [-s serialno | --serialno serialno]"
+ echo >&2 " [-c content-type | --content-type content-type]"
+ echo >&2
+ echo >&2 "DIFF_OPTIONS: [-q | --brief] [-C NUM | --context[=NUM]]"
+ echo >&2 " [-u | -U NUM | --unified[=NUM]] [-e | -ed] [--normal] [--rcs]"
+ echo >&2 " [-y | --side-by-side] [-l | --paginate]"
+ echo >&2
+ exit 1
+}
+
+GETOPTEST=`getopt --version`
+case $GETOPTEST in
+getopt*) # GNU getopt
+ TEMP=`getopt -l verbose -l version -l brief -l context:: -l unified:: -l ed -l normal -l rcs -l side-by-side -l paginate -l binary -l hexadecimal -l serialno: -l content-type: -l hide-offset -l hide-serialno -l hide-granulepos -l hide-packetno -l help -- +qC:uU:eylbxs:c:OSGPhv "$@"`
+ ;;
+*) # POSIX getopt ?
+ TEMP=`getopt qC:uU:eylbxs:c:OSGPhv "$@"`
+ ;;
+esac
+
+if test "$?" != "0"; then
+ usage
+fi
+
+eval set -- "$TEMP"
+
+DIFFOPTS="-w" # -w, --ignore-all-space
+DUMPOPTS=""
+VERBOSE=""
+
+while test "X$1" != "X--"; do
+ case "$1" in
+ -q|--brief)
+ DIFFOPTS=$DIFFOPTS" -q"
+ ;;
+ -C)
+ shift
+ DIFFOPTS=$DIFFOPTS" -C $1"
+ ;;
+ --context)
+ shift
+ if test "x$1" = "x"; then
+ DIFFOPTS=$DIFFOPTS" --context"
+ else
+ DIFFOPTS=$DIFFOPTS" --context=$1"
+ fi
+ ;;
+ -u)
+ DIFFOPTS=$DIFFOPTS" -u"
+ ;;
+ -U)
+ shift
+ DIFFOPTS=$DIFFOPTS" -U $1"
+ ;;
+ --unified)
+ shift
+ if test "x$1" = "x"; then
+ DIFFOPTS=$DIFFOPTS" --unified"
+ else
+ DIFFOPTS=$DIFFOPTS" --unified=$1"
+ fi
+ ;;
+ -e|--ed)
+ DIFFOPTS=$DIFFOPTS" -e"
+ ;;
+ --normal)
+ DIFFOPTS=$DIFFOPTS" --normal"
+ ;;
+ --rcs)
+ DIFFOPTS=$DIFFOPTS" --rcs"
+ ;;
+ -y|--side-by-side)
+ DIFFOPTS=$DIFFOPTS" -y"
+ ;;
+ -l|--paginate)
+ DIFFOPTS=$DIFFOPTS" -l"
+ ;;
+ -b|--binary)
+ DUMPOPTS=$DUMPOPTS" -b"
+ ;;
+ -x|--hexadecimal)
+ DUMPOPTS=$DUMPOPTS" -x"
+ ;;
+ -s|--serialno)
+ shift
+ DUMPOPTS=$DUMPOPTS" -s $1"
+ ;;
+ -c)
+ shift
+ DUMPOPTS=$DUMPOPTS" -c $1"
+ ;;
+ -O|--hide-offset)
+ DUMPOPTS=$DUMPOPTS" -O"
+ ;;
+ -S|--hide-serialno)
+ DUMPOPTS=$DUMPOPTS" -S"
+ ;;
+ -G|--hide-granulepos)
+ DUMPOPTS=$DUMPOPTS" -G"
+ ;;
+ -P|--hide-packetno)
+ DUMPOPTS=$DUMPOPTS" -P"
+ ;;
+ --verbose)
+ VERBOSE="y"
+ ;;
+ -v|--version)
+ version
+ ;;
+ -h|--help)
+ usage
+ ;;
+ esac
+ shift
+done
+
+# Check that all options parsed ok
+if test "x$1" != "x--"; then
+ usage
+fi
+shift #get rid of the '--'
+
+if test "x$1" = "x"; then
+ usage
+fi
+if test "x$2" = "x"; then
+ usage
+fi
+
+if test "x$VERBOSE" != "x"; then
+ echo >&2 "OGGZDUMP_OPTIONS: " $DUMPOPTS
+ echo >&2 "DIFF_OPTIONS: " $DIFFOPTS
+fi
+
+FIFO1="${TMPDIR:-/tmp}/`basename $1`.dump-1-$$"
+FIFO2="${TMPDIR:-/tmp}/`basename $2`.dump-2-$$"
+
+exec 5>$FIFO1
+exec 6>$FIFO2
+
+oggz-dump $DUMPOPTS $1 >&5
+if test "$?" != "0"; then
+ exit 1
+fi
+
+oggz-dump $DUMPOPTS $2 >&6
+if test "$?" != "0"; then
+ exit 1
+fi
+
+diff $DIFFOPTS $FIFO1 $FIFO2
+ret=$?
+
+rm $FIFO1 $FIFO2
+
+exit $ret
+
Copied: liboggz/trunk/src/tools/oggz-dump.c (from rev 3626, liboggz/trunk/src/tools/oggzdump.c)
===================================================================
--- liboggz/trunk/src/tools/oggz-dump.c (rev 0)
+++ liboggz/trunk/src/tools/oggz-dump.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,684 @@
+/*
+ Copyright (C) 2003 Commonwealth Scientific and Industrial Research
+ Organisation (CSIRO) Australia
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of CSIRO Australia nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef WIN32
+#include <strings.h>
+#endif
+#include <ctype.h>
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# define PRId64 "I64d"
+#endif
+
+#include <getopt.h>
+#include <errno.h>
+
+#include <oggz/oggz.h>
+#include "oggz_tools.h"
+
+/*#define DEBUG*/
+
+#ifdef WIN32
+#define strcasecmp _stricmp
+#endif
+
+#undef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+
+typedef struct {
+ OggzTable * serialno_table;
+ OggzTable * content_types_table;
+ OggzReadPacket read_packet;
+ int dump_bits;
+ int dump_char;
+ int hide_offset;
+ int hide_serialno;
+ int hide_granulepos;
+ int hide_packetno;
+} ODData;
+
+static char * progname;
+static FILE * outfile = NULL;
+static int truth = 1;
+
+static void
+usage (char * progname)
+{
+ printf ("Usage: %s [options] filename\n", progname);
+ printf ("Hexdump packets of an Ogg file, or revert an Ogg file from such a hexdump\n");
+ printf ("\nDump format options\n");
+ printf (" -b, --binary Generate a binary dump of each packet\n");
+ printf (" -x, --hexadecimal Generate a hexadecimal dump of each packet\n");
+ printf ("\nFiltering options\n");
+ printf (" -n, --new Only dump the first packet of each logical bitstream\n");
+ printf (" -c content-type, --content-type content-type\n");
+ printf (" Dump only the logical bitstreams for a specified\n");
+ printf (" content-type. The following codecs are currently\n");
+ printf (" detected: theora, vorbis, speex, cmml, kate\n");
+ printf (" -s serialno, --serialno serialno\n");
+ printf (" Dump only the logical bitstream with specified serialno\n");
+ printf (" -O, --hide-offset Hide the byte offset of each packet\n");
+ printf (" -S, --hide-serialno Hide the serialno field of each packet\n");
+ printf (" -G, --hide-granulepos Hide the granulepos field of each packet\n");
+ printf (" -P, --hide-packetno Hide the packetno field of each packet\n");
+ printf ("\nMode options\n");
+ printf (" -r, --revert Revert an oggz-dump. Generates an Ogg bitstream\n");
+ printf (" as prescribed in the input oggz-dump\n");
+ printf ("\nMiscellaneous options\n");
+ printf (" -o filename, --output filename\n");
+ printf (" Specify output filename\n");
+ printf (" -h, --help Display this help and exit\n");
+ printf (" -v, --version Output version information and exit\n");
+ printf ("\n");
+ printf ("Please report bugs to <ogg-dev at xiph.org>\n");
+}
+
+static ODData *
+oddata_new ()
+{
+ ODData * oddata = malloc (sizeof (ODData));
+ memset (oddata, 0, sizeof (ODData));
+
+ oddata->serialno_table = oggz_table_new ();
+ oddata->content_types_table = oggz_table_new ();
+
+ oddata->dump_bits = 0;
+ oddata->dump_char = 1;
+
+ oddata->hide_offset = 0;
+ oddata->hide_serialno = 0;
+ oddata->hide_granulepos = 0;
+ oddata->hide_packetno = 0;
+
+ return oddata;
+}
+
+static void
+oddata_delete (ODData * oddata)
+{
+ oggz_table_delete (oddata->serialno_table);
+ oggz_table_delete (oddata->content_types_table);
+
+ free (oddata);
+}
+
+static void
+dump_char_line (unsigned char * buf, long n)
+{
+ int i;
+
+ fprintf (outfile, " ");
+
+ for (i = 0; i < n; i++) {
+ if (isgraph(buf[i])) fprintf (outfile, "%c", buf[i]);
+ else if (isspace(buf[i])) fprintf (outfile, " ");
+ else fprintf (outfile, ".");
+ }
+}
+
+static void
+hex_dump (unsigned char * buf, long n, int dump_char)
+{
+ int i;
+ long remaining = n, count = 0;
+ long rowlen;
+
+ while (remaining > 0) {
+ rowlen = MIN (remaining, 16);
+
+ if (n > 0xffffff)
+ fprintf (outfile, "%08lx:", count);
+ else if (n > 0xffff)
+ fprintf (outfile, " %06lx:", count);
+ else
+ fprintf (outfile, " %04lx:", count);
+
+ for (i = 0; i < rowlen; i++) {
+ if (!(i%2)) fprintf (outfile, " ");
+ fprintf (outfile, "%02x", buf[i]);
+ }
+
+ for (; i < 16; i++) {
+ if (!(i%2)) fprintf (outfile, " ");
+ fprintf (outfile, " ");
+ }
+
+ if (dump_char)
+ dump_char_line (buf, rowlen);
+
+ fprintf(outfile, "\n");
+
+ remaining -= rowlen;
+ buf += rowlen;
+ count += rowlen;
+ }
+}
+
+static void
+bin_dump (unsigned char * buf, long n, int dump_char)
+{
+ int i, j;
+ long remaining = n, count = 0;
+ long rowlen;
+
+ while (remaining > 0) {
+ rowlen = MIN (remaining, 6);
+
+ if (n > 0xffffff)
+ fprintf (outfile, "%08lx:", count);
+ else if (n > 0xffff)
+ fprintf (outfile, " %06lx:", count);
+ else
+ fprintf (outfile, " %04lx:", count);
+
+ for (i = 0; i < rowlen; i++) {
+ fprintf (outfile, " ");
+#ifdef WORDS_BIGENDIAN
+ for (j = 0; j < 8; j++)
+#else
+ for (j = 7; j >= 0; j--)
+#endif
+ fprintf (outfile, "%c", (buf[i]&(1<<j)) ? '1' : '0');
+ }
+
+ for (; i < 6; i++) {
+ if (!(i%2)) fprintf (outfile, " ");
+ fprintf (outfile, " ");
+ }
+
+ if (dump_char)
+ dump_char_line (buf, rowlen);
+
+ printf("\n");
+
+ remaining -= rowlen;
+ buf += rowlen;
+ count += rowlen;
+ }
+}
+
+static int
+read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
+{
+ ODData * oddata = (ODData *) user_data;
+ ogg_int64_t units;
+ double time_offset;
+ ogg_int64_t calced_gp = oggz_tell_granulepos (oggz);
+
+ if (oddata->hide_offset) {
+ fprintf (outfile, "oOo");
+ } else {
+ units = oggz_tell_units (oggz);
+ if (units == -1) {
+ fprintf (outfile, "%" PRId64 "x", oggz_tell (oggz));
+ } else {
+ time_offset = (double)units / 1000.0;
+ ot_fprint_time (outfile, time_offset);
+ }
+ }
+
+ fprintf (outfile, ": serialno %010ld, ",
+ oddata->hide_serialno ? -1 : serialno);
+
+ if (oddata->hide_granulepos) {
+ fprintf (outfile, "granulepos gGg");
+ } else {
+ if (op->granulepos == -1) {
+ fprintf (outfile, "calc. gpos ");
+ } else {
+ fprintf (outfile, "granulepos ");
+ }
+ ot_fprint_granulepos (outfile, oggz, serialno, calced_gp);
+
+ if (op->granulepos != -1 && op->granulepos != calced_gp) {
+ fprintf (outfile, " ERR: file gp ");
+ ot_fprint_granulepos (outfile, oggz, serialno, op->granulepos);
+ }
+ }
+
+ fprintf (outfile, ", packetno %" PRId64,
+ oddata->hide_packetno ? -1 : op->packetno);
+
+ if (op->b_o_s) {
+ fprintf (outfile, " *** bos");
+ }
+
+ if (op->e_o_s) {
+ fprintf (outfile, " *** eos");
+ }
+
+ fprintf (outfile, ": ");
+ ot_fprint_bytes (outfile, op->bytes);
+ fputc ('\n', outfile);
+
+ if (oddata->dump_bits) {
+ bin_dump (op->packet, op->bytes, oddata->dump_char);
+ } else {
+ hex_dump (op->packet, op->bytes, oddata->dump_char);
+ }
+
+ fprintf (outfile, "\n");
+
+ return 0;
+}
+
+static int
+filter_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
+{
+ ODData * oddata = (ODData *) user_data;
+ const char * ident;
+ int i, n;
+
+ if (ogg_page_bos ((ogg_page *)og)) {
+ ident = ot_page_identify (oggz, og, NULL);
+ if (ident) {
+ n = oggz_table_size (oddata->content_types_table);
+ for (i = 0; i < n; i++) {
+ char * c = oggz_table_nth (oddata->content_types_table, i, NULL);
+ if (strcasecmp (c, ident) == 0) {
+ oggz_set_read_callback (oggz, serialno, oddata->read_packet, oddata);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int
+read_new_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
+{
+ if (op->b_o_s) {
+ read_packet (oggz, op, serialno, user_data);
+ return OGGZ_CONTINUE;
+ } else {
+ return OGGZ_STOP_OK;
+ }
+}
+
+static void
+revert_packet (OGGZ * oggz, ogg_packet * op, long serialno, int flush)
+{
+ unsigned char buf[1024];
+ long n;
+ int ret;
+
+#ifdef DEBUG
+ printf ("feeding packet (%010ld) %ld bytes %s, %s\n",
+ current_serialno, op->bytes,
+ op->b_o_s ? "bos" : "not bos",
+ op->e_o_s ? "eos" : "not eos");
+#endif
+ if ((ret = oggz_write_feed (oggz, op, serialno, flush, NULL)) != 0) {
+ fprintf (stderr, "%s: oggz_write_feed error %d\n", progname, ret);
+ }
+
+ while ((n = oggz_write_output (oggz, buf, 1024)) > 0) {
+ fwrite (buf, 1, n, outfile);
+ }
+}
+
+static void
+revert_file (char * infilename)
+{
+ OGGZ * oggz;
+ FILE * infile;
+ char line[120];
+ int hh, mm, ss;
+ unsigned int offset;
+ long current_serialno = -1, serialno;
+ ogg_int64_t granulepos, iframe, pframe, packetno;
+ int is_packetinfo = 0;
+ int bos = 0, eos = 0;
+
+ int line_offset = 0, consumed = 0;
+
+ unsigned char * packet = NULL;
+ long max_bytes = 0;
+
+ ogg_packet op;
+ int flush = 1;
+ char c;
+
+ if (strcmp (infilename, "-") == 0) {
+ infile = stdin;
+ } else {
+ infile = fopen (infilename, "rb");
+ }
+
+ oggz = oggz_new (OGGZ_WRITE|OGGZ_NONSTRICT|OGGZ_AUTO);
+
+ while (fgets (line, 120, infile)) {
+ line_offset = 0;
+
+ /* Skip time offsets, OR ensure line_offset is 0 */
+ if (sscanf (line, "%2d:%2d:%2d.%n", &hh, &mm, &ss, &line_offset) < 3)
+ line_offset = 0;
+
+ is_packetinfo = 0;
+ if (sscanf (&line[line_offset], "%x: serialno %ld, granulepos %" PRId64 ", packetno %" PRId64 "%n",
+ &offset, &serialno, &granulepos, &packetno,
+ &line_offset) >= 4) {
+ is_packetinfo = 1;
+ } else {
+ if (sscanf (&line[line_offset], "%x: serialno %ld, granulepos %" PRId64 "%" PRId64 ", packetno %" PRId64 "%n",
+ &offset, &serialno, &iframe, &pframe, &packetno,
+ &line_offset) >= 5) {
+ int granuleshift = oggz_get_granuleshift (oggz, serialno);
+ is_packetinfo = 1;
+ granulepos = (iframe<<granuleshift)+pframe;
+ }
+ }
+
+ if (is_packetinfo) {
+ /* flush any existing packets */
+ if (current_serialno != -1) {
+ revert_packet (oggz, &op, current_serialno, flush);
+ }
+
+ /* Start new packet */
+ bos = 0; eos = 0;
+ while ((c=line[line_offset++]) && c != '*');
+ if (c == '*') {
+ if (!strncmp (&line[line_offset], "** bos", 6)) {
+ bos = 1;
+ line_offset += 6;
+ }
+ if (!strncmp (&line[line_offset], "** eos", 6)) {
+ eos = 1;
+ line_offset += 6;
+ }
+ }
+
+ current_serialno = serialno;
+
+ op.packet = packet;
+ op.bytes = 0;
+ op.b_o_s = bos;
+ op.e_o_s = eos;
+ op.granulepos = granulepos;
+ op.packetno = packetno;
+
+ } else {
+ int nread = 0;
+ unsigned int val = 0;
+ unsigned int offset;
+
+ if (current_serialno != -1 &&
+ sscanf (line, "%x:%n", &offset, &line_offset) >= 1) {
+ /* NUL-terminate after hex data: don't scan char representation */
+ line[50] = '\0';
+ while (nread < 16 &&
+ (sscanf (&line[line_offset], "%2x%n", &val, &consumed) > 0)) {
+ op.bytes++;
+ if (op.bytes > max_bytes) {
+ unsigned char * new_packet;
+ size_t new_size;
+
+ if (max_bytes == 0) {
+ new_size = 128;
+ } else {
+ new_size = max_bytes * 2;
+ }
+
+ new_packet =
+ (unsigned char *) realloc ((void *)packet, new_size);
+ if (new_packet == NULL) {
+ fprintf (stderr,
+ "%s: error allocating memory for packet data\n",
+ progname);
+ exit (1);
+ } else {
+ max_bytes = (long)new_size;
+ packet = new_packet;
+ op.packet = packet;
+ }
+ }
+
+ packet[op.bytes-1] = (unsigned char) val;
+
+ line_offset += consumed;
+ nread++;
+ }
+ }
+ }
+ }
+
+ /* flush any existing packets */
+ if (current_serialno != -1) {
+ revert_packet (oggz, &op, current_serialno, flush);
+ }
+
+ fclose (infile);
+}
+
+int
+main (int argc, char ** argv)
+{
+ int show_version = 0;
+ int show_help = 0;
+
+ ODData * oddata;
+ OGGZ * oggz;
+ char * infilename = NULL, * outfilename = NULL;
+ int revert = 0;
+ long serialno;
+ int i, size;
+ long n;
+
+ int filter_serialnos = 0;
+ int filter_content_types = 0;
+
+ ot_init ();
+
+ progname = argv[0];
+
+ if (argc < 2) {
+ usage (progname);
+ return (1);
+ }
+
+ oddata = oddata_new ();
+
+ oddata->read_packet = read_packet;
+
+ while (1) {
+ char * optstring = "hvbxnro:s:c:OSGP";
+
+#ifdef HAVE_GETOPT_LONG
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {"binary", no_argument, 0, 'b'},
+ {"hexadecimal", no_argument, 0, 'x'},
+ {"new", no_argument, 0, 'n'},
+ {"revert", no_argument, 0, 'r'},
+ {"output", required_argument, 0, 'o'},
+ {"serialno", required_argument, 0, 's'},
+ {"content-type", required_argument, 0, 'c'},
+ {"hide-offset", no_argument, 0, 'O'},
+ {"hide-serialno", no_argument, 0, 'S'},
+ {"hide-granulepos", no_argument, 0, 'G'},
+ {"hide-packetno", no_argument, 0, 'P'},
+ {0,0,0,0}
+ };
+
+ i = getopt_long(argc, argv, optstring, long_options, NULL);
+#else
+ i = getopt (argc, argv, optstring);
+#endif
+ if (i == -1) break;
+ if (i == ':') {
+ usage (progname);
+ goto exit_err;
+ }
+
+ switch (i) {
+ case 'h': /* help */
+ show_help = 1;
+ break;
+ case 'v': /* version */
+ show_version = 1;
+ break;
+ case 'b': /* binary */
+ oddata->dump_bits = 1;
+ break;
+ case 'n': /* new */
+ oddata->read_packet = read_new_packet;
+ break;
+ case 'o': /* output */
+ outfilename = optarg;
+ break;
+ case 'r': /* revert */
+ revert = 1;
+ break;
+ case 's': /* serialno */
+ filter_serialnos = 1;
+ serialno = atol (optarg);
+ oggz_table_insert (oddata->serialno_table, serialno, &truth);
+ break;
+ case 'c': /* content-type */
+ filter_content_types = 1;
+ n = (long)oggz_table_size (oddata->content_types_table);
+ oggz_table_insert (oddata->content_types_table, (long)n, optarg);
+ break;
+ case 'O': /* hide offset */
+ oddata->hide_offset = 1;
+ break;
+ case 'S': /* hide serialno */
+ oddata->hide_serialno = 1;
+ break;
+ case 'G': /* hide granulepos */
+ oddata->hide_granulepos = 1;
+ break;
+ case 'P': /* hide packetno */
+ oddata->hide_packetno = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (show_version) {
+ printf ("%s version " VERSION "\n", progname);
+ }
+
+ if (show_help) {
+ usage (progname);
+ }
+
+ if (show_version || show_help) {
+ goto exit_ok;
+ }
+
+ if (optind >= argc) {
+ usage (progname);
+ goto exit_err;
+ }
+
+ infilename = argv[optind++];
+
+ if (outfilename == NULL) {
+ outfile = stdout;
+ } else {
+ outfile = fopen (outfilename, "wb");
+ if (outfile == NULL) {
+ fprintf (stderr, "%s: unable to open output file %s\n",
+ progname, outfilename);
+ goto exit_err;
+ }
+ }
+
+ if (revert) {
+ if (oddata->dump_bits) {
+ fprintf (stderr, "%s: Revert of binary dump not supported\n", progname);
+ goto exit_err;
+ }
+
+ revert_file (infilename);
+ } else {
+ errno = 0;
+
+ if (strcmp (infilename, "-") == 0) {
+ oggz = oggz_open_stdio (stdin, OGGZ_READ|OGGZ_AUTO);
+ } else {
+ oggz = oggz_open (infilename, OGGZ_READ|OGGZ_AUTO);
+ }
+
+ if (oggz == NULL) {
+ if (errno == 0) {
+ fprintf (stderr, "%s: %s: OGGZ error opening input file\n",
+ progname, infilename);
+ } else {
+ fprintf (stderr, "%s: %s: %s\n",
+ progname, infilename, strerror (errno));
+ }
+ goto exit_err;
+ }
+
+ if (!filter_serialnos && !filter_content_types) {
+ oggz_set_read_callback (oggz, -1, oddata->read_packet, oddata);
+ } else {
+ if (filter_serialnos) {
+ size = oggz_table_size (oddata->serialno_table);
+ for (i = 0; i < size; i++) {
+ oggz_table_nth (oddata->serialno_table, i, &serialno);
+ oggz_set_read_callback (oggz, serialno, oddata->read_packet, oddata);
+ }
+ }
+
+ if (filter_content_types) {
+ oggz_set_read_page (oggz, -1, filter_page, oddata);
+ }
+ }
+
+ oggz_run_set_blocksize (oggz, 1024*1024);
+ oggz_run (oggz);
+
+ oggz_close (oggz);
+ }
+
+ exit_ok:
+ oddata_delete (oddata);
+ exit (0);
+
+ exit_err:
+ oddata_delete (oddata);
+ exit (1);
+}
Copied: liboggz/trunk/src/tools/oggz-info.c (from rev 3626, liboggz/trunk/src/tools/oggzinfo.c)
===================================================================
--- liboggz/trunk/src/tools/oggz-info.c (rev 0)
+++ liboggz/trunk/src/tools/oggz-info.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,658 @@
+/*
+ Copyright (C) 2003 Commonwealth Scientific and Industrial Research
+ Organisation (CSIRO) Australia
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of CSIRO Australia nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h> /* LONG_MAX */
+#include <math.h>
+
+#include <getopt.h>
+#include <errno.h>
+
+#include <oggz/oggz.h>
+#include "oggz_tools.h"
+
+#include "skeleton.h"
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# define PRId64 "I64d"
+#endif
+
+#define READ_BLOCKSIZE 1024000
+
+static void
+usage (const char * progname)
+{
+ printf ("Usage: %s [options] filename ...\n", progname);
+ printf ("Display information about one or more Ogg files and their bitstreams\n");
+ printf ("\nDisplay options\n");
+ printf (" -l, --length Display content lengths\n");
+ printf (" -b, --bitrate Display bitrate information\n");
+ printf (" -g, --page-stats Display Ogg page statistics\n");
+ printf (" -p, --packet-stats Display Ogg packet statistics\n");
+ printf (" -k, --skeleton Display Extra data from OggSkeleton bitstream\n");
+ printf (" -a, --all Display all information\n");
+ printf ("\nMiscellaneous options\n");
+ printf (" -h, --help Display this help and exit\n");
+ printf (" -v, --version Output version information and exit\n");
+ printf ("\n");
+ printf ("Byte lengths are displayed using the following units:\n");
+ printf (" bytes (8 bits)\n");
+ printf (" kB kilobytes (1024 bytes)\n");
+ printf (" MB megabytes (1024*1024 bytes)\n");
+ printf (" GB gigabytes (1024*1024*1024 bytes)\n");
+ printf ("\n");
+ printf ("Bitrates are displayed using the following units:\n");
+ printf (" bps bits per second (bit/s)\n");
+ printf (" kbps kilobits per second (1000 bit/s)\n");
+ printf (" Mbps megabits per second (1000000 bit/s)\n");
+ printf (" Gbps gigabits per second (1000000000 bit/s)\n");
+ printf ("\n");
+ printf ("Please report bugs to <ogg-dev at xiph.org>\n");
+}
+
+#define SEP "------------------------------------------------------------"
+
+typedef struct _OI_Info OI_Info;
+typedef struct _OI_Stats OI_Stats;
+typedef struct _OI_TrackInfo OI_TrackInfo;
+
+/* Let's get functional */
+typedef void (*OI_TrackFunc) (OI_Info * info, OI_TrackInfo * oit, long serialno);
+
+struct _OI_Info {
+ OGGZ * oggz;
+ OggzTable * tracks;
+ ogg_int64_t duration;
+ long length_total;
+ long overhead_length_total;
+};
+
+struct _OI_Stats {
+ /* Pass 1 */
+ long count;
+ long length_total;
+ long length_min;
+ long length_max;
+ long overhead_length_total;
+
+ /* Pass 2 */
+ long length_avg;
+ ogg_int64_t length_deviation_total;
+ double length_stddev;
+};
+
+struct _OI_TrackInfo {
+ OI_Stats pages;
+ OI_Stats packets;
+ const char * codec_name;
+ char * codec_info;
+ int has_fishead;
+ int has_fisbone;
+ fishead_packet fhInfo;
+ fisbone_packet fbInfo;
+};
+
+static int show_length = 0;
+static int show_bitrate = 0;
+static int show_page_stats = 0;
+static int show_packet_stats = 0;
+static int show_extra_skeleton_info = 0;
+
+static void
+oggz_info_apply (OI_TrackFunc func, OI_Info * info)
+{
+ OI_TrackInfo * oit;
+ long serialno;
+ int n, i;
+
+ n = oggz_table_size (info->tracks);
+ for (i = 0; i < n; i++) {
+ oit = oggz_table_nth (info->tracks, i, &serialno);
+ if (oit) func (info, oit, serialno);
+ }
+}
+
+static void
+oi_stats_clear (OI_Stats * stats)
+{
+ stats->count = 0;
+
+ stats->length_total = 0;
+ stats->length_min = LONG_MAX;
+ stats->length_max = 0;
+ stats->overhead_length_total = 0;
+
+ stats->length_avg = 0;
+ stats->length_deviation_total = 0;
+ stats->length_stddev = 0;
+}
+
+static OI_TrackInfo *
+oggz_info_trackinfo_new (void)
+{
+ OI_TrackInfo * oit;
+
+ oit = malloc (sizeof (OI_TrackInfo));
+
+ oi_stats_clear (&oit->pages);
+ oi_stats_clear (&oit->packets);
+
+ oit->codec_name = NULL;
+ oit->codec_info = NULL;
+
+ oit->has_fishead = 0;
+ oit->has_fisbone = 0;
+
+ return oit;
+}
+
+static long
+oi_bitrate (long bytes, ogg_int64_t ms)
+{
+ if (ms == 0) return 0;
+ else return (long) (((ogg_int64_t)bytes * 8 * 1000) / ms);
+}
+
+static void
+oi_stats_print (OI_Info * info, OI_Stats * stats, char * label)
+{
+ printf ("\t%s-Length-Maximum: ", label);
+ ot_fprint_bytes (stdout, stats->length_max);
+ putchar ('\n');
+
+ printf ("\t%s-Length-StdDev: ", label);
+ ot_fprint_bytes (stdout, stats->length_stddev);
+ putchar ('\n');
+
+#if 0
+ printf ("\t%s-Length-Maximum: %ld bytes\n", label, stats->length_max);
+ /*printf ("\t%s-Length-Average: %ld bytes\n", label, stats->length_avg);*/
+ printf ("\t%s-Length-StdDev: %.0f bytes\n", label, stats->length_stddev);
+ /*
+ printf ("\tRange: [%ld - %ld] bytes, Std.Dev. %.3f bytes\n",
+ stats->length_min, stats->length_max, stats->length_stddev);
+ */
+#endif
+}
+
+static void
+ot_fishead_print(OI_TrackInfo *oit) {
+ if (oit->has_fishead) {
+ /*
+ printf("\tPresentation Time: %.2f\n", (double)oit->fhInfo.ptime_n/oit->fhInfo.ptime_d);
+ printf("\tBase Time: %.2f\n", (double)oit->fhInfo.btime_n/oit->fhInfo.btime_d);
+ */
+ printf("\tSkeleton version: %d.%d\n", oit->fhInfo.version_major, oit->fhInfo.version_minor);
+ /*printf("\tUTC: %s\n", oit->fhInfo.UTC);*/
+ }
+}
+
+static void
+ot_fisbone_print(OI_Info * info, OI_TrackInfo *oit) {
+
+ char *allocated, *messages, *token;
+
+ if (oit->has_fisbone) {
+ printf("\n\tExtra information from Ogg Skeleton track:\n");
+ /*printf("\tserialno: %010d\n", oit->fbInfo.serial_no);*/
+ printf("\tNumber of header packets: %d\n", oit->fbInfo.nr_header_packet);
+ printf("\tGranule rate: %.2f\n", (double)oit->fbInfo.granule_rate_n/oit->fbInfo.granule_rate_d);
+ printf("\tGranule shift: %d\n", (int)oit->fbInfo.granule_shift);
+ printf("\tStart granule: ");
+ ot_fprint_granulepos(stdout, info->oggz, oit->fbInfo.serial_no, oit->fbInfo.start_granule);
+ printf ("\n");
+ printf("\tPreroll: %d\n", oit->fbInfo.preroll);
+ allocated = messages = _ogg_calloc(oit->fbInfo.current_header_size+1, sizeof(char));
+ strcpy(messages, oit->fbInfo.message_header_fields);
+ printf("\tMessage Header Fields:\n");
+ while (1) {
+ token = strsep(&messages, "\n\r");
+ printf("\t %s", token);
+ if (messages == NULL)
+ break;
+ }
+ printf("\n");
+ _ogg_free(allocated);
+ }
+}
+
+/* oggz_info_trackinfo_print() */
+static void
+oit_print (OI_Info * info, OI_TrackInfo * oit, long serialno)
+{
+ if (oit->codec_name) {
+ printf ("\n%s: serialno %010ld\n", oit->codec_name, serialno);
+ } else {
+ printf ("\n???: serialno %010ld\n", serialno);
+ }
+ printf ("\t%ld packets in %ld pages, %.1f packets/page, %.3f%% Ogg overhead\n",
+ oit->packets.count, oit->pages.count,
+ (double)oit->packets.count / (double)oit->pages.count,
+ oit->pages.length_stddev == 0 ? 0.0 : 100.0*oit->pages.overhead_length_total/oit->pages.length_total);
+
+ if (show_length) {
+ fputs("\tContent-Length: ", stdout);
+ ot_fprint_bytes (stdout, oit->pages.length_total);
+ putchar ('\n');
+ }
+
+ if (show_bitrate) {
+ fputs ("\tContent-Bitrate-Average: ", stdout);
+ ot_print_bitrate (oi_bitrate (oit->pages.length_total, info->duration));
+ putchar ('\n');
+ }
+
+ if (oit->codec_info != NULL) {
+ fputs (oit->codec_info, stdout);
+ }
+
+ if (show_page_stats) {
+ oi_stats_print (info, &oit->pages, "Page");
+ }
+
+ if (show_packet_stats) {
+ oi_stats_print (info, &oit->packets, "Packet");
+ }
+
+ if (show_extra_skeleton_info && oit->has_fishead) {
+ ot_fishead_print(oit);
+ }
+ if (show_extra_skeleton_info && oit->has_fisbone) {
+ ot_fisbone_print(info, oit);
+ }
+
+ }
+
+static void
+oi_stats_average (OI_Stats * stats)
+{
+ if (stats->count > 0) {
+ stats->length_avg = stats->length_total / stats->count;
+ } else {
+ stats->length_avg = 0;
+ }
+}
+
+static void
+oit_calc_average (OI_Info * info, OI_TrackInfo * oit, long serialno)
+{
+ oi_stats_average (&oit->pages);
+ oi_stats_average (&oit->packets);
+}
+
+static void
+oi_stats_stddev (OI_Stats * stats)
+{
+ double variance;
+
+ if (stats->count <= 1) {
+ stats->length_stddev = 0.0;
+ }
+ else {
+ variance = (double)stats->length_deviation_total / (double)(stats->count - 1);
+ stats->length_stddev = sqrt (variance);
+ }
+}
+
+static void
+oit_calc_stddev (OI_Info * info, OI_TrackInfo * oit, long serialno)
+{
+ oi_stats_stddev (&oit->pages);
+ oi_stats_stddev (&oit->packets);
+}
+
+static int
+read_page_pass1 (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
+{
+ OI_Info * info = (OI_Info *)user_data;
+ OI_TrackInfo * oit;
+ long bytes;
+
+ oit = oggz_table_lookup (info->tracks, serialno);
+ if (oit == NULL) {
+ oit = oggz_info_trackinfo_new ();
+ oggz_table_insert (info->tracks, serialno, oit);
+ }
+
+ if (ogg_page_bos ((ogg_page *)og)) {
+ oit->codec_name = ot_page_identify (oggz, og, &oit->codec_info);
+ }
+
+ bytes = og->header_len + og->body_len;
+
+ /* Increment the total stream length */
+ info->length_total += bytes;
+ info->overhead_length_total += og->header_len;
+
+ /* Increment the page statistics */
+ oit->pages.count++;
+ oit->pages.length_total += bytes;
+ if (bytes < oit->pages.length_min)
+ oit->pages.length_min = bytes;
+ if (bytes > oit->pages.length_max)
+ oit->pages.length_max = bytes;
+ oit->pages.overhead_length_total += og->header_len;
+
+ return 0;
+}
+
+static int
+read_page_pass2 (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
+{
+ OI_Info * info = (OI_Info *)user_data;
+ OI_TrackInfo * oit;
+ long bytes, deviation;
+
+ oit = oggz_table_lookup (info->tracks, serialno);
+
+ /* Increment the page length deviation squared total */
+ bytes = og->header_len + og->body_len;
+ deviation = bytes - oit->pages.length_avg;
+ oit->pages.length_deviation_total += (deviation * deviation);
+
+ return 0;
+}
+
+static int
+read_packet_pass1 (OGGZ * oggz, ogg_packet * op, long serialno,
+ void * user_data)
+{
+ OI_Info * info = (OI_Info *)user_data;
+ OI_TrackInfo * oit;
+
+ oit = oggz_table_lookup (info->tracks, serialno);
+
+ /* Increment the packet statistics */
+ oit->packets.count++;
+ oit->packets.length_total += op->bytes;
+ if (op->bytes < oit->packets.length_min)
+ oit->packets.length_min = op->bytes;
+ if (op->bytes > oit->packets.length_max)
+ oit->packets.length_max = op->bytes;
+
+ if (!op->e_o_s && !memcmp(op->packet, FISBONE_IDENTIFIER, 8)) {
+ fisbone_packet fp;
+ int ret = fisbone_from_ogg(op, &fp);
+ if (ret<0) return ret;
+ oit = oggz_table_lookup (info->tracks, fp.serial_no);
+ if (oit) {
+ oit->has_fisbone = 1;
+ oit->fbInfo = fp;
+ }
+ else {
+ fprintf(stderr, "Warning: logical stream %08x referenced by skeleton was not found\n",fp.serial_no);
+ }
+ fisbone_clear(&fp);
+ } else if (!op->e_o_s && !memcmp(op->packet, FISHEAD_IDENTIFIER, 8)) {
+ fishead_packet fp;
+ int ret = fishead_from_ogg(op, &fp);
+ if (ret<0) return ret;
+ oit->has_fishead = 1;
+ oit->fhInfo = fp;
+ }
+
+ return 0;
+}
+
+static int
+read_packet_pass2 (OGGZ * oggz, ogg_packet * op, long serialno,
+ void * user_data)
+{
+ OI_Info * info = (OI_Info *)user_data;
+ OI_TrackInfo * oit;
+ long deviation;
+
+ oit = oggz_table_lookup (info->tracks, serialno);
+
+ /* Increment the packet length deviation squared total */
+ deviation = op->bytes - oit->packets.length_avg;
+ oit->packets.length_deviation_total += (deviation * deviation);
+
+ return 0;
+}
+
+static int
+oi_pass1 (OGGZ * oggz, OI_Info * info)
+{
+ long n, serialno;
+ int ntracks, i;
+ OI_TrackInfo * oit;
+
+ oggz_seek (oggz, 0, SEEK_SET);
+ oggz_set_read_page (oggz, -1, read_page_pass1, info);
+ oggz_set_read_callback (oggz, -1, read_packet_pass1, info);
+
+ while ((n = oggz_read (oggz, READ_BLOCKSIZE)) > 0);
+
+ oggz_info_apply (oit_calc_average, info);
+
+ /* Now we are at the end of the file, calculate the duration */
+ info->duration = oggz_tell_units (oggz);
+
+ /* Find the Skeleton track if present, and subtract the presentation time */
+ ntracks = oggz_table_size (info->tracks);
+ for (i = 0; i < ntracks; i++) {
+ oit = oggz_table_nth (info->tracks, i, &serialno);
+ if (oit->has_fishead) {
+ info->duration -= 1000 * oit->fhInfo.ptime_n / oit->fhInfo.ptime_d;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static int
+oi_pass2 (OGGZ * oggz, OI_Info * info)
+{
+ long n;
+
+ oggz_seek (oggz, 0, SEEK_SET);
+ oggz_set_read_page (oggz, -1, read_page_pass2, info);
+ oggz_set_read_callback (oggz, -1, read_packet_pass2, info);
+
+ while ((n = oggz_read (oggz, READ_BLOCKSIZE)) > 0);
+
+ oggz_info_apply (oit_calc_stddev, info);
+
+ return 0;
+}
+
+static void
+oit_delete (OI_Info * info, OI_TrackInfo * oit, long serialno)
+{
+ if (oit->codec_info) free (oit->codec_info);
+}
+
+int
+main (int argc, char ** argv)
+{
+ int show_version = 0;
+ int show_help = 0;
+
+ char * progname;
+ int i;
+ int show_all = 0;
+
+ int many_files = 0;
+ char * infilename;
+ OGGZ * oggz;
+ OI_Info info;
+
+ progname = argv[0];
+
+ if (argc < 2) {
+ usage (progname);
+ return (1);
+ }
+
+ while (1) {
+ char * optstring = "hvlbgpka";
+
+#ifdef HAVE_GETOPT_LONG
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {"length", no_argument, 0, 'l'},
+ {"bitrate", no_argument, 0, 'b'},
+ {"page-stats", no_argument, 0, 'g'},
+ {"packet-stats", no_argument, 0, 'p'},
+ {"skeleton", no_argument, 0, 'k'},
+ {"all", no_argument, 0, 'a'},
+ {0,0,0,0}
+ };
+
+ i = getopt_long (argc, argv, optstring, long_options, NULL);
+#else
+ i = getopt (argc, argv, optstring);
+#endif
+ if (i == -1) break;
+ if (i == ':') {
+ usage (progname);
+ goto exit_err;
+ }
+
+ switch (i) {
+ case 'h': /* help */
+ show_help = 1;
+ break;
+ case 'v': /* version */
+ show_version = 1;
+ break;
+ case 'l': /* length */
+ show_length = 1;
+ break;
+ case 'b': /* bitrate */
+ show_bitrate = 1;
+ break;
+ case 'g': /* page stats */
+ show_page_stats = 1;
+ break;
+ case 'p': /* packet stats */
+ show_packet_stats = 1;
+ break;
+ case 'k': /* extra skeleton info */
+ show_extra_skeleton_info = 1;
+ break;
+ case 'a':
+ show_all = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (show_version) {
+ printf ("%s version " VERSION "\n", progname);
+ }
+
+ if (show_help) {
+ usage (progname);
+ }
+
+ if (show_version || show_help) {
+ goto exit_ok;
+ }
+
+ if (optind >= argc) {
+ usage (progname);
+ goto exit_err;
+ }
+
+ if (show_all) {
+ show_length = 1;
+ show_bitrate = 1;
+ show_page_stats = 1;
+ show_packet_stats = 1;
+ show_extra_skeleton_info = 1;
+ }
+
+ if (argc > optind+1) {
+ many_files = 1;
+ }
+
+ while (optind < argc) {
+ infilename = argv[optind++];
+
+ if ((oggz = oggz_open (infilename, OGGZ_READ|OGGZ_AUTO)) == NULL) {
+ printf ("unable to open file %s\n", argv[1]);
+ return (1);
+ }
+
+ info.oggz = oggz;
+ info.tracks = oggz_table_new ();
+ info.length_total = 0;
+ info.overhead_length_total = 0;
+
+ oi_pass1 (oggz, &info);
+
+ oi_pass2 (oggz, &info);
+
+ /* Print summary information */
+ if (many_files)
+ printf ("Filename: %s\n", infilename);
+ fputs ("Content-Duration: ", stdout);
+ ot_fprint_time (stdout, (double)info.duration / 1000.0);
+ putchar ('\n');
+
+ if (show_length) {
+ fputs ("Content-Length: ", stdout);
+ ot_fprint_bytes (stdout, info.length_total);
+ putchar ('\n');
+ }
+
+ if (show_bitrate) {
+ fputs ("Content-Bitrate-Average: ", stdout);
+ ot_print_bitrate (oi_bitrate (info.length_total, info.duration));
+ putchar ('\n');
+ }
+
+ oggz_info_apply (oit_print, &info);
+
+ oggz_info_apply (oit_delete, &info);
+ oggz_table_delete (info.tracks);
+
+ oggz_close (oggz);
+
+ if (optind < argc) puts (SEP);
+ }
+
+ exit_ok:
+ exit (0);
+
+ exit_err:
+ exit (1);
+}
Copied: liboggz/trunk/src/tools/oggz-merge.c (from rev 3626, liboggz/trunk/src/tools/oggzmerge.c)
===================================================================
--- liboggz/trunk/src/tools/oggz-merge.c (rev 0)
+++ liboggz/trunk/src/tools/oggz-merge.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,437 @@
+/*
+ Copyright (C) 2003 Commonwealth Scientific and Industrial Research
+ Organisation (CSIRO) Australia
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of CSIRO Australia nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <getopt.h>
+#include <errno.h>
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# define PRId64 "I64d"
+#endif
+
+#include <oggz/oggz.h>
+#include "oggz_tools.h"
+
+#define READ_SIZE 4096
+
+#define ALL_VORBIS_WARNING \
+ "oggz-merge: WARNING: Merging Ogg Vorbis I files. The resulting file will\n" \
+ " contain %d tracks in parallel, interleaved for simultaneous playback.\n"\
+ " If you want to sequence these files one after another, use cat instead.\n"
+
+static void
+usage (char * progname)
+{
+ printf ("Usage: %s [options] filename ...\n", progname);
+ printf ("Merge Ogg files together, interleaving pages in order of presentation time.\n");
+ printf ("\nMiscellaneous options\n");
+ printf (" -o filename, --output filename\n");
+ printf (" Specify output filename\n");
+ printf (" -h, --help Display this help and exit\n");
+ printf (" -v, --version Output version information and exit\n");
+ printf (" -V, --verbose Verbose operation\n");
+ printf ("\n");
+ printf ("Please report bugs to <ogg-dev at xiph.org>\n");
+}
+
+typedef struct _OMData OMData;
+typedef struct _OMInput OMInput;
+typedef struct _OMITrack OMITrack;
+
+struct _OMData {
+ OggzTable * inputs;
+ int verbose;
+};
+
+struct _OMInput {
+ OMData * omdata;
+ OGGZ * reader;
+ const ogg_page * og;
+};
+
+struct _OMITrack {
+ long output_serialno;
+};
+
+static ogg_page *
+_ogg_page_copy (const ogg_page * og)
+{
+ ogg_page * new_og;
+
+ new_og = malloc (sizeof (*og));
+ new_og->header = malloc (og->header_len);
+ new_og->header_len = og->header_len;
+ memcpy (new_og->header, og->header, og->header_len);
+ new_og->body = malloc (og->body_len);
+ new_og->body_len = og->body_len;
+ memcpy (new_og->body, og->body, og->body_len);
+
+ return new_og;
+}
+
+static int
+_ogg_page_free (const ogg_page * og)
+{
+ free (og->header);
+ free (og->body);
+ free ((ogg_page *)og);
+ return 0;
+}
+
+static void
+ominput_delete (OMInput * input)
+{
+ oggz_close (input->reader);
+
+ free (input);
+}
+
+static OMData *
+omdata_new (void)
+{
+ OMData * omdata;
+
+ omdata = (OMData *) malloc (sizeof (OMData));
+
+ omdata->inputs = oggz_table_new ();
+ omdata->verbose = 0;
+
+ return omdata;
+}
+
+static void
+omdata_delete (OMData * omdata)
+{
+ OMInput * input;
+ int i, ninputs;
+
+ ninputs = oggz_table_size (omdata->inputs);
+ for (i = 0; i < ninputs; i++) {
+ input = (OMInput *) oggz_table_nth (omdata->inputs, i, NULL);
+ ominput_delete (input);
+ }
+ oggz_table_delete (omdata->inputs);
+
+ free (omdata);
+}
+
+static int
+read_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
+{
+ OMInput * input = (OMInput *) user_data;
+
+ input->og = _ogg_page_copy (og);
+
+ return OGGZ_STOP_OK;
+}
+
+static int
+omdata_add_input (OMData * omdata, FILE * infile)
+{
+ OMInput * input;
+ int nfiles;
+
+ input = (OMInput *) malloc (sizeof (OMInput));
+ if (input == NULL) return -1;
+
+ input->omdata = omdata;
+ input->reader = oggz_open_stdio (infile, OGGZ_READ|OGGZ_AUTO);
+ input->og = NULL;
+
+ oggz_set_read_page (input->reader, -1, read_page, input);
+
+ nfiles = oggz_table_size (omdata->inputs);
+ if (!oggz_table_insert (omdata->inputs, nfiles++, input)) {
+ ominput_delete (input);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
+oggz_merge (OMData * omdata, FILE * outfile)
+{
+ OMInput * input;
+ int ninputs, i, min_i;
+ long key, n;
+ ogg_int64_t units, min_units;
+ const ogg_page * og;
+ int active;
+
+ /* For theora+vorbis, ensure theora bos is first */
+ int careful_for_theora = 0;
+
+ /* If all input files are Ogg Vorbis I, warn that the output will not be
+ * a valid Ogg Vorbis I file as it will be multitrack. This is in response
+ * to Debian bug 280550: http://bugs.debian.org/280550
+ */
+ int v, warn_all_vorbis = 1;
+
+ if (oggz_table_size (omdata->inputs) == 2)
+ careful_for_theora = 1;
+
+ while ((ninputs = oggz_table_size (omdata->inputs)) > 0) {
+ min_units = -1;
+ min_i = -1;
+ active = 1;
+
+ if (omdata->verbose)
+ printf ("------------------------------------------------------------\n");
+
+ /* Reload all pages, and find the min (earliest) */
+ for (i = 0; active && i < oggz_table_size (omdata->inputs); i++) {
+ input = (OMInput *) oggz_table_nth (omdata->inputs, i, &key);
+ if (input != NULL) {
+ while (input && input->og == NULL) {
+ n = oggz_read (input->reader, READ_SIZE);
+ if (n == 0) {
+ oggz_table_remove (omdata->inputs, key);
+ ominput_delete (input);
+ input = NULL;
+ }
+ }
+ if (input && input->og) {
+ if (ogg_page_bos ((ogg_page *)input->og)) {
+ min_i = i;
+
+ if (careful_for_theora || warn_all_vorbis) {
+ const char * codec_name;
+ int is_vorbis = 0;
+
+ if ((codec_name =
+ ot_page_identify (input->reader, input->og, NULL)) != NULL)
+ is_vorbis = !strcmp (codec_name, "Vorbis");
+
+ if (i == 0 && is_vorbis)
+ careful_for_theora = 0;
+ else
+ active = 0;
+
+ if (!is_vorbis) warn_all_vorbis = 0;
+
+ } else {
+ active = 0;
+ }
+ } else if (warn_all_vorbis) {
+ int all_inputs_are_beyond_bos = 1;
+
+ /* All BOS pages seen so far are Ogg Vorbis. The following loop
+ * checks if all input files are single-track, ie. Ogg Vorbis I.
+ * We can only rely on this information if all inputs are beyond
+ * bos, ie. all BOS pages have been seen. */
+ for (v = 0; v < oggz_table_size (omdata->inputs); v++) {
+ OMInput * input_v;
+ OGGZ * oggz;
+
+ input_v = (OMInput *) oggz_table_nth (omdata->inputs, i, &key);
+ oggz = input_v->reader;
+
+ if (oggz_get_bos(oggz, -1)) all_inputs_are_beyond_bos = 0;
+ else if (oggz_get_numtracks(oggz) > 1) warn_all_vorbis = 0;
+ }
+
+ if (all_inputs_are_beyond_bos && warn_all_vorbis) {
+ fprintf (stderr, ALL_VORBIS_WARNING, v);
+ warn_all_vorbis = 0;
+ }
+ }
+ units = oggz_tell_units (input->reader);
+
+ if (omdata->verbose) {
+ ot_fprint_time (stdout, (double)units/1000);
+ printf (": Got index %d serialno %010d %" PRId64 " units: ",
+ i, ogg_page_serialno ((ogg_page *)input->og), units);
+ }
+
+ if (min_units == -1 || units == 0 ||
+ (units > -1 && units < min_units)) {
+ min_units = units;
+ min_i = i;
+ if (omdata->verbose)
+ printf ("Min\n");
+ } else {
+ if (omdata->verbose)
+ printf ("Moo\n");
+ }
+ } else if (omdata->verbose) {
+ if (input == NULL) {
+ printf ("*** index %d NULL\n", i);
+ } else {
+ printf ("*** No page from index %d\n", i);
+ }
+ }
+ }
+ }
+
+ if (omdata->verbose)
+ printf ("Min index %d\n", min_i);
+
+ /* Write the earliest page */
+ if (min_i != -1) {
+ input = (OMInput *) oggz_table_nth (omdata->inputs, min_i, &key);
+ og = input->og;
+ fwrite (og->header, 1, og->header_len, outfile);
+ fwrite (og->body, 1, og->body_len, outfile);
+
+ _ogg_page_free (og);
+ input->og = NULL;
+ }
+ }
+
+ return 0;
+}
+
+int
+main (int argc, char * argv[])
+{
+ int show_version = 0;
+ int show_help = 0;
+
+ char * progname;
+ char * infilename = NULL, * outfilename = NULL;
+ FILE * infile = NULL, * outfile = NULL;
+ OMData * omdata;
+ int i;
+
+ ot_init ();
+
+ progname = argv[0];
+
+ if (argc < 2) {
+ usage (progname);
+ return (1);
+ }
+
+ omdata = omdata_new();
+
+ while (1) {
+ char * optstring = "hvVo:";
+
+#ifdef HAVE_GETOPT_LONG
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {"verbose", no_argument, 0, 'V'},
+ {"output", required_argument, 0, 'o'},
+ {0,0,0,0}
+ };
+
+ i = getopt_long (argc, argv, optstring, long_options, NULL);
+#else
+ i = getopt (argc, argv, optstring);
+#endif
+ if (i == -1) break;
+ if (i == ':') {
+ usage (progname);
+ goto exit_err;
+ }
+
+ switch (i) {
+ case 'h': /* help */
+ show_help = 1;
+ break;
+ case 'v': /* version */
+ show_version = 1;
+ break;
+ case 'o': /* output */
+ outfilename = optarg;
+ break;
+ case 'V': /* verbose */
+ omdata->verbose = 1;
+ default:
+ break;
+ }
+ }
+
+ if (show_version) {
+ printf ("%s version " VERSION "\n", progname);
+ }
+
+ if (show_help) {
+ usage (progname);
+ }
+
+ if (show_version || show_help) {
+ goto exit_ok;
+ }
+
+ if (optind >= argc) {
+ usage (progname);
+ goto exit_err;
+ }
+
+ if (optind >= argc) {
+ usage (progname);
+ goto exit_err;
+ }
+
+ while (optind < argc) {
+ infilename = argv[optind++];
+ infile = fopen (infilename, "rb");
+ if (infile == NULL) {
+ fprintf (stderr, "%s: unable to open input file %s\n", progname,
+ infilename);
+ } else {
+ omdata_add_input (omdata, infile);
+ }
+ }
+
+ if (outfilename == NULL) {
+ outfile = stdout;
+ } else {
+ outfile = fopen (outfilename, "wb");
+ if (outfile == NULL) {
+ fprintf (stderr, "%s: unable to open output file %s\n",
+ progname, outfilename);
+ goto exit_err;
+ }
+ }
+
+ oggz_merge (omdata, outfile);
+
+ exit_ok:
+ omdata_delete (omdata);
+ exit (0);
+
+ exit_err:
+ omdata_delete (omdata);
+ exit (1);
+}
Copied: liboggz/trunk/src/tools/oggz-rip.c (from rev 3626, liboggz/trunk/src/tools/oggzrip.c)
===================================================================
--- liboggz/trunk/src/tools/oggz-rip.c (rev 0)
+++ liboggz/trunk/src/tools/oggz-rip.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -0,0 +1,426 @@
+/* -*- c-file-style: "gnu" -*- */
+/*
+ Copyright (C) 2005 Commonwealth Scientific and Industrial Research
+ Organisation (CSIRO) Australia
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of CSIRO Australia nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ Author: David Kuehling <dvdkhlng at gmx.de>
+ Created: 20041231
+*/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef WIN32
+#include <strings.h>
+#endif
+#include <fcntl.h>
+#include <assert.h>
+
+#include <getopt.h>
+#include <errno.h>
+
+#include <oggz/oggz.h>
+#include "oggz_tools.h"
+
+#ifdef WIN32
+#define strcasecmp _stricmp
+#endif
+
+#define READ_SIZE 4096
+#define WRITE_SIZE 4096
+
+typedef struct {
+ OGGZ *reader;
+ FILE *outfile;
+ int numwrite;
+ OggzTable *streams;
+ int verbose;
+ OggzTable *serialno_table;
+ OggzTable *stream_index_table;
+ OggzTable *content_types_table;
+} ORData;
+
+typedef struct {
+ long serialno;
+ int streamid;
+ const char *content_type;
+ int bos;
+} ORStream;
+
+static int streamid_count = 0;
+
+static void
+usage (char * progname)
+{
+ printf ("Usage: %s [options] filename ...\n", progname);
+ printf ("\nFilter options\n");
+ printf (" These options can be used multiple times. Pages matching ANY of\n");
+ printf (" the filter options will be included into the output.\n\n");
+ printf (" -s serialno, --serialno serialno\n");
+ printf (" Output streams with given serialno.\n");
+ printf (" -i index, --stream-index index\n");
+ printf (" Filter by stream index. These are assigned to\n");
+ printf (" streams in the order of their BOS pages,\n");
+ printf (" starting at 0.\n");
+ printf (" -c content-type --content-type content-type\n");
+ printf (" Filter by content-type. The following codec\n");
+ printf (" names are currently detected: \"theora\",\n");
+ printf (" \"vorbis\", \"speex\", \"cmml\", \"kate\"\n");
+ printf ("\nMiscellaneous options\n");
+ printf (" -o filename, --output filename\n");
+ printf (" Specify output filename\n");
+ printf (" -h, --help Display this help and exit\n");
+ printf (" -v, --version Output version information and exit\n");
+ printf (" -V, --verbose Verbose operation\n");
+ printf ("\n");
+ printf ("Please report bugs to <ogg-dev at xiph.org>\n");
+}
+
+static ORData *
+ordata_new ()
+{
+ ORData *ordata = malloc (sizeof (ORData));
+ assert (ordata != NULL);
+ memset (ordata, 0, sizeof (ORData));
+
+ ordata->streams = oggz_table_new ();
+ assert (ordata->streams != NULL);
+
+ ordata->serialno_table = oggz_table_new();
+ assert (ordata->serialno_table != NULL);
+
+ ordata->stream_index_table = oggz_table_new();
+ assert (ordata->stream_index_table != NULL);
+
+ ordata->content_types_table = oggz_table_new();
+ assert (ordata->content_types_table != NULL);
+
+ return ordata;
+}
+
+static void
+ordata_delete (ORData *ordata)
+{
+ oggz_table_delete (ordata->streams);
+ oggz_table_delete (ordata->serialno_table);
+ oggz_table_delete (ordata->stream_index_table);
+ oggz_table_delete (ordata->content_types_table);
+
+ if (ordata->reader)
+ oggz_close (ordata->reader);
+ if (ordata->outfile)
+ fclose (ordata->outfile);
+
+ free (ordata);
+}
+
+static int
+filter_stream_p (const ORData *ordata, ORStream *stream,
+ const ogg_page *og, long serialno)
+{
+ int i, n;
+
+ if (oggz_table_lookup (ordata->serialno_table, serialno) != NULL)
+ return 1;
+
+ if (stream == NULL)
+ return 0;
+
+ if (oggz_table_lookup (ordata->stream_index_table, (long)stream->streamid) != NULL)
+ return 1;
+
+ n = oggz_table_size (ordata->content_types_table);
+ for (i = 0; i < n; i++) {
+ char * c = oggz_table_nth (ordata->content_types_table, i, NULL);
+ if (strcasecmp (c, stream->content_type) == 0)
+ return 1;
+ }
+
+ return 0;
+}
+
+static ORStream *
+orstream_new (OGGZ *oggz, const ORData *ordata, const ogg_page *og,
+ long serialno)
+{
+ const char * ident;
+
+ ORStream *stream = malloc (sizeof (ORStream));
+ assert (stream != NULL);
+
+ stream->serialno = serialno;
+ stream->streamid = streamid_count++;
+ stream->content_type = "unknown";
+
+ ident = ot_page_identify (oggz, og, NULL);
+ if (ident != NULL) stream->content_type = ident;
+
+ if (ordata->verbose)
+ fprintf (stderr,
+ "New logical stream, serialno %li, id %i, codec %s, will be %s\n",
+ stream->serialno, stream->streamid, stream->content_type,
+ (filter_stream_p (ordata, stream, og, serialno) ?
+ "copied" :"dropped"));
+
+ return stream;
+}
+
+static void
+orstream_delete (ORData *ordata, ORStream *stream)
+{
+ if (ordata->verbose)
+ fprintf (stderr, "End of logical stream %li \n", stream->serialno);
+
+ free (stream);
+}
+
+static void
+checked_fwrite (const void *data, size_t size, size_t count, FILE *stream)
+{
+ int n = fwrite (data, size, count, stream);
+ if ((size_t)n != count) {
+ perror ("write failed");
+ exit (1);
+ }
+}
+
+static int
+rip_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
+{
+ ORData *ordata = (ORData *) user_data;
+ ORStream *stream = oggz_table_lookup (ordata->streams, serialno);
+
+ checked_fwrite (og->header, 1, og->header_len, ordata->outfile);
+ checked_fwrite (og->body, 1, og->body_len, ordata->outfile);
+
+ if (ogg_page_eos ((ogg_page *)og) && stream != NULL) {
+ oggz_table_remove (ordata->streams, serialno);
+ orstream_delete (ordata, stream);
+ }
+
+ return 0;
+}
+
+static int
+read_page (OGGZ *oggz, const ogg_page *og, long serialno, void *user_data)
+{
+ ORData *ordata = (ORData *) user_data;
+ ORStream *stream = oggz_table_lookup (ordata->streams, serialno);
+
+ if (ogg_page_bos ((ogg_page *)og)) {
+ stream = orstream_new (oggz, ordata, og, serialno);
+ stream = oggz_table_insert (ordata->streams, serialno, stream);
+ assert (stream != NULL);
+
+ if (filter_stream_p (ordata, stream, og, serialno)) {
+ oggz_set_read_page (oggz, serialno, rip_page, user_data);
+ rip_page (oggz, og, serialno, user_data);
+ }
+ }
+
+ return 0;
+}
+
+static int
+oggz_rip (ORData * ordata)
+{
+ long n;
+
+ oggz_set_read_page (ordata->reader, -1, read_page, ordata);
+
+ while ((n = oggz_read (ordata->reader, READ_SIZE))) {
+
+ if (n <= 0)
+ return n;
+
+ if (ordata->verbose) {
+ fprintf (stderr, "\r Read %li k, wrote %li k ...\r",
+ (long) (oggz_tell (ordata->reader)/1024),
+ (long) (ftell (ordata->outfile)/1024));
+ }
+ }
+
+ if (ordata->verbose)
+ fprintf (stderr, "\r Done. \n");
+
+ return 0;
+}
+
+static int
+or_get_long (const char *optarg, const char *currentopt,
+ long *value)
+{
+ char *tailptr;
+
+ *value = strtol (optarg, &tailptr, 10);
+
+ if (*tailptr != '\0') {
+ fprintf (stderr, "ERROR: non-integer argument to option `%s': %s\n",
+ currentopt, optarg);
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+main (int argc, char * argv[])
+{
+ int show_version = 0;
+ int show_help = 0;
+
+ char * progname;
+ char * infilename = NULL, * outfilename = NULL;
+ FILE * infile = NULL;
+ const char *currentopt = argv[1];
+ ORData * ordata;
+ long l;
+ int i, n;
+
+ ot_init();
+
+ progname = argv[0];
+
+ if (argc < 2) {
+ usage (progname);
+ return (1);
+ }
+
+ ordata = ordata_new ();
+
+ while (1) {
+ char * optstring = "hvVo:s:i:c:";
+
+#ifdef HAVE_GETOPT_LONG
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {"output", required_argument, 0, 'o'},
+ {"verbose", no_argument, 0, 'V'},
+ {"serialno", required_argument, 0, 's'},
+ {"stream-index", required_argument, 0, 'i'},
+ {"content-type", required_argument, 0, 'c'},
+ {0,0,0,0}
+ };
+
+ i = getopt_long (argc, argv, optstring, long_options, NULL);
+#else
+ i = getopt (argc, argv, optstring);
+#endif
+ if (i == -1) break;
+ if (i == ':') {
+ usage (progname);
+ goto exit_err;
+ }
+
+ switch (i) {
+ case 'h': /* help */
+ show_help = 1;
+ break;
+ case 'v': /* version */
+ show_version = 1;
+ break;
+ case 'o': /* output */
+ outfilename = optarg;
+ break;
+ case 'V': /* verbose */
+ ordata->verbose = 1;
+ break;
+ case 's': /* serialno */
+ if (or_get_long (optarg, currentopt, &l))
+ goto exit_err;
+ oggz_table_insert (ordata->serialno_table, l, (void *)0x7);
+ break;
+ case 'i': /* stream index */
+ if (or_get_long (optarg, currentopt, &l))
+ goto exit_err;
+ oggz_table_insert (ordata->stream_index_table, l, (void *)0x7);
+ break;
+ case 'c': /* content-type */
+ n = oggz_table_size (ordata->content_types_table);
+ oggz_table_insert (ordata->content_types_table, (long)n, optarg);
+ break;
+ default:
+ break;
+ }
+
+ currentopt = argv[optind];
+ }
+
+ if (show_version) {
+ printf ("%s version " VERSION "\n", progname);
+ }
+
+ if (show_help) {
+ usage (progname);
+ }
+
+ if (show_version || show_help) {
+ goto exit_ok;
+ }
+
+ if (optind != argc-1) {
+ usage (progname);
+ goto exit_err;
+ }
+
+ infilename = argv[optind];
+ infile = fopen (infilename, "rb");
+ if (infile == NULL) {
+ fprintf (stderr, "%s: unable to open input file %s : %s\n", progname,
+ infilename, strerror (errno));
+ goto exit_err;
+ } else {
+ ordata->reader = oggz_open_stdio (infile, OGGZ_READ|OGGZ_AUTO);
+ }
+
+ if (outfilename == NULL) {
+ ordata->outfile = stdout;
+ } else {
+ ordata->outfile = fopen (outfilename, "wb");
+ if (ordata->outfile == NULL) {
+ fprintf (stderr, "%s: unable to open output file %s : %s\n",
+ progname, outfilename, strerror (errno));
+ goto exit_err;
+ }
+ }
+
+ oggz_rip (ordata);
+
+ exit_ok:
+ ordata_delete (ordata);
+ exit (0);
+
+ exit_err:
+ ordata_delete (ordata);
+ exit (1);
+}
Deleted: liboggz/trunk/src/tools/oggzdiff.in
===================================================================
--- liboggz/trunk/src/tools/oggzdiff.in 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/src/tools/oggzdiff.in 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,205 +0,0 @@
-#!/bin/sh
-
-## Copyright (C) 2003 Commonwealth Scientific and Industrial Research
-## Organisation (CSIRO) Australia
-##
-## Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions
-## are met:
-##
-## - Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-##
-## - Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in the
-## documentation and/or other materials provided with the distribution.
-##
-## - Neither the name of CSIRO Australia nor the names of its
-## contributors may be used to endorse or promote products derived from
-## this software without specific prior written permission.
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-## PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
-## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-## LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-version () {
- echo >&2 "oggzdiff version "@VERSION@
- exit 1
-}
-
-usage () {
- echo >&2 "oggzdiff, diff oggzdumps of two Ogg files."
- echo >&2
- echo >&2 "Usage: oggzdiff [options] [OGGZDUMP_OPTIONS] [DIFF_OPTIONS] file1.ogg file2.ogg"
- echo >&2
- echo >&2 "options: [--verbose] [-v | --version] [-h | --help]"
- echo >&2
- echo >&2 "Supported oggzdump and diff options:"
- echo >&2
- echo >&2 "OGGZDUMP_OPTIONS: [-b | --binary] [-x | --hexadecimal]"
- echo >&2 " [-O | --hide-offset] [-S | --hide-serialno] [-G | --hide-granulepos]"
- echo >&2 " [-P | --hide-packetno] [-s serialno | --serialno serialno]"
- echo >&2 " [-c content-type | --content-type content-type]"
- echo >&2
- echo >&2 "DIFF_OPTIONS: [-q | --brief] [-C NUM | --context[=NUM]]"
- echo >&2 " [-u | -U NUM | --unified[=NUM]] [-e | -ed] [--normal] [--rcs]"
- echo >&2 " [-y | --side-by-side] [-l | --paginate]"
- echo >&2
- exit 1
-}
-
-GETOPTEST=`getopt --version`
-case $GETOPTEST in
-getopt*) # GNU getopt
- TEMP=`getopt -l verbose -l version -l brief -l context:: -l unified:: -l ed -l normal -l rcs -l side-by-side -l paginate -l binary -l hexadecimal -l serialno: -l content-type: -l hide-offset -l hide-serialno -l hide-granulepos -l hide-packetno -l help -- +qC:uU:eylbxs:c:OSGPhv "$@"`
- ;;
-*) # POSIX getopt ?
- TEMP=`getopt qC:uU:eylbxs:c:OSGPhv "$@"`
- ;;
-esac
-
-if test "$?" != "0"; then
- usage
-fi
-
-eval set -- "$TEMP"
-
-DIFFOPTS="-w" # -w, --ignore-all-space
-DUMPOPTS=""
-VERBOSE=""
-
-while test "X$1" != "X--"; do
- case "$1" in
- -q|--brief)
- DIFFOPTS=$DIFFOPTS" -q"
- ;;
- -C)
- shift
- DIFFOPTS=$DIFFOPTS" -C $1"
- ;;
- --context)
- shift
- if test "x$1" = "x"; then
- DIFFOPTS=$DIFFOPTS" --context"
- else
- DIFFOPTS=$DIFFOPTS" --context=$1"
- fi
- ;;
- -u)
- DIFFOPTS=$DIFFOPTS" -u"
- ;;
- -U)
- shift
- DIFFOPTS=$DIFFOPTS" -U $1"
- ;;
- --unified)
- shift
- if test "x$1" = "x"; then
- DIFFOPTS=$DIFFOPTS" --unified"
- else
- DIFFOPTS=$DIFFOPTS" --unified=$1"
- fi
- ;;
- -e|--ed)
- DIFFOPTS=$DIFFOPTS" -e"
- ;;
- --normal)
- DIFFOPTS=$DIFFOPTS" --normal"
- ;;
- --rcs)
- DIFFOPTS=$DIFFOPTS" --rcs"
- ;;
- -y|--side-by-side)
- DIFFOPTS=$DIFFOPTS" -y"
- ;;
- -l|--paginate)
- DIFFOPTS=$DIFFOPTS" -l"
- ;;
- -b|--binary)
- DUMPOPTS=$DUMPOPTS" -b"
- ;;
- -x|--hexadecimal)
- DUMPOPTS=$DUMPOPTS" -x"
- ;;
- -s|--serialno)
- shift
- DUMPOPTS=$DUMPOPTS" -s $1"
- ;;
- -c)
- shift
- DUMPOPTS=$DUMPOPTS" -c $1"
- ;;
- -O|--hide-offset)
- DUMPOPTS=$DUMPOPTS" -O"
- ;;
- -S|--hide-serialno)
- DUMPOPTS=$DUMPOPTS" -S"
- ;;
- -G|--hide-granulepos)
- DUMPOPTS=$DUMPOPTS" -G"
- ;;
- -P|--hide-packetno)
- DUMPOPTS=$DUMPOPTS" -P"
- ;;
- --verbose)
- VERBOSE="y"
- ;;
- -v|--version)
- version
- ;;
- -h|--help)
- usage
- ;;
- esac
- shift
-done
-
-# Check that all options parsed ok
-if test "x$1" != "x--"; then
- usage
-fi
-shift #get rid of the '--'
-
-if test "x$1" = "x"; then
- usage
-fi
-if test "x$2" = "x"; then
- usage
-fi
-
-if test "x$VERBOSE" != "x"; then
- echo >&2 "OGGZDUMP_OPTIONS: " $DUMPOPTS
- echo >&2 "DIFF_OPTIONS: " $DIFFOPTS
-fi
-
-FIFO1="${TMPDIR:-/tmp}/`basename $1`.dump-1-$$"
-FIFO2="${TMPDIR:-/tmp}/`basename $2`.dump-2-$$"
-
-exec 5>$FIFO1
-exec 6>$FIFO2
-
-oggzdump $DUMPOPTS $1 >&5
-if test "$?" != "0"; then
- exit 1
-fi
-
-oggzdump $DUMPOPTS $2 >&6
-if test "$?" != "0"; then
- exit 1
-fi
-
-diff $DIFFOPTS $FIFO1 $FIFO2
-ret=$?
-
-rm $FIFO1 $FIFO2
-
-exit $ret
-
Deleted: liboggz/trunk/src/tools/oggzdump.c
===================================================================
--- liboggz/trunk/src/tools/oggzdump.c 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/src/tools/oggzdump.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,684 +0,0 @@
-/*
- Copyright (C) 2003 Commonwealth Scientific and Industrial Research
- Organisation (CSIRO) Australia
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of CSIRO Australia nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifndef WIN32
-#include <strings.h>
-#endif
-#include <ctype.h>
-
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# define PRId64 "I64d"
-#endif
-
-#include <getopt.h>
-#include <errno.h>
-
-#include <oggz/oggz.h>
-#include "oggz_tools.h"
-
-/*#define DEBUG*/
-
-#ifdef WIN32
-#define strcasecmp _stricmp
-#endif
-
-#undef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
-typedef struct {
- OggzTable * serialno_table;
- OggzTable * content_types_table;
- OggzReadPacket read_packet;
- int dump_bits;
- int dump_char;
- int hide_offset;
- int hide_serialno;
- int hide_granulepos;
- int hide_packetno;
-} ODData;
-
-static char * progname;
-static FILE * outfile = NULL;
-static int truth = 1;
-
-static void
-usage (char * progname)
-{
- printf ("Usage: %s [options] filename\n", progname);
- printf ("Hexdump packets of an Ogg file, or revert an Ogg file from such a hexdump\n");
- printf ("\nDump format options\n");
- printf (" -b, --binary Generate a binary dump of each packet\n");
- printf (" -x, --hexadecimal Generate a hexadecimal dump of each packet\n");
- printf ("\nFiltering options\n");
- printf (" -n, --new Only dump the first packet of each logical bitstream\n");
- printf (" -c content-type, --content-type content-type\n");
- printf (" Dump only the logical bitstreams for a specified\n");
- printf (" content-type. The following codecs are currently\n");
- printf (" detected: theora, vorbis, speex, cmml, kate\n");
- printf (" -s serialno, --serialno serialno\n");
- printf (" Dump only the logical bitstream with specified serialno\n");
- printf (" -O, --hide-offset Hide the byte offset of each packet\n");
- printf (" -S, --hide-serialno Hide the serialno field of each packet\n");
- printf (" -G, --hide-granulepos Hide the granulepos field of each packet\n");
- printf (" -P, --hide-packetno Hide the packetno field of each packet\n");
- printf ("\nMode options\n");
- printf (" -r, --revert Revert an oggzdump. Generates an Ogg bitstream\n");
- printf (" as prescribed in the input oggzdump\n");
- printf ("\nMiscellaneous options\n");
- printf (" -o filename, --output filename\n");
- printf (" Specify output filename\n");
- printf (" -h, --help Display this help and exit\n");
- printf (" -v, --version Output version information and exit\n");
- printf ("\n");
- printf ("Please report bugs to <ogg-dev at xiph.org>\n");
-}
-
-static ODData *
-oddata_new ()
-{
- ODData * oddata = malloc (sizeof (ODData));
- memset (oddata, 0, sizeof (ODData));
-
- oddata->serialno_table = oggz_table_new ();
- oddata->content_types_table = oggz_table_new ();
-
- oddata->dump_bits = 0;
- oddata->dump_char = 1;
-
- oddata->hide_offset = 0;
- oddata->hide_serialno = 0;
- oddata->hide_granulepos = 0;
- oddata->hide_packetno = 0;
-
- return oddata;
-}
-
-static void
-oddata_delete (ODData * oddata)
-{
- oggz_table_delete (oddata->serialno_table);
- oggz_table_delete (oddata->content_types_table);
-
- free (oddata);
-}
-
-static void
-dump_char_line (unsigned char * buf, long n)
-{
- int i;
-
- fprintf (outfile, " ");
-
- for (i = 0; i < n; i++) {
- if (isgraph(buf[i])) fprintf (outfile, "%c", buf[i]);
- else if (isspace(buf[i])) fprintf (outfile, " ");
- else fprintf (outfile, ".");
- }
-}
-
-static void
-hex_dump (unsigned char * buf, long n, int dump_char)
-{
- int i;
- long remaining = n, count = 0;
- long rowlen;
-
- while (remaining > 0) {
- rowlen = MIN (remaining, 16);
-
- if (n > 0xffffff)
- fprintf (outfile, "%08lx:", count);
- else if (n > 0xffff)
- fprintf (outfile, " %06lx:", count);
- else
- fprintf (outfile, " %04lx:", count);
-
- for (i = 0; i < rowlen; i++) {
- if (!(i%2)) fprintf (outfile, " ");
- fprintf (outfile, "%02x", buf[i]);
- }
-
- for (; i < 16; i++) {
- if (!(i%2)) fprintf (outfile, " ");
- fprintf (outfile, " ");
- }
-
- if (dump_char)
- dump_char_line (buf, rowlen);
-
- fprintf(outfile, "\n");
-
- remaining -= rowlen;
- buf += rowlen;
- count += rowlen;
- }
-}
-
-static void
-bin_dump (unsigned char * buf, long n, int dump_char)
-{
- int i, j;
- long remaining = n, count = 0;
- long rowlen;
-
- while (remaining > 0) {
- rowlen = MIN (remaining, 6);
-
- if (n > 0xffffff)
- fprintf (outfile, "%08lx:", count);
- else if (n > 0xffff)
- fprintf (outfile, " %06lx:", count);
- else
- fprintf (outfile, " %04lx:", count);
-
- for (i = 0; i < rowlen; i++) {
- fprintf (outfile, " ");
-#ifdef WORDS_BIGENDIAN
- for (j = 0; j < 8; j++)
-#else
- for (j = 7; j >= 0; j--)
-#endif
- fprintf (outfile, "%c", (buf[i]&(1<<j)) ? '1' : '0');
- }
-
- for (; i < 6; i++) {
- if (!(i%2)) fprintf (outfile, " ");
- fprintf (outfile, " ");
- }
-
- if (dump_char)
- dump_char_line (buf, rowlen);
-
- printf("\n");
-
- remaining -= rowlen;
- buf += rowlen;
- count += rowlen;
- }
-}
-
-static int
-read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
-{
- ODData * oddata = (ODData *) user_data;
- ogg_int64_t units;
- double time_offset;
- ogg_int64_t calced_gp = oggz_tell_granulepos (oggz);
-
- if (oddata->hide_offset) {
- fprintf (outfile, "oOo");
- } else {
- units = oggz_tell_units (oggz);
- if (units == -1) {
- fprintf (outfile, "%" PRId64 "x", oggz_tell (oggz));
- } else {
- time_offset = (double)units / 1000.0;
- ot_fprint_time (outfile, time_offset);
- }
- }
-
- fprintf (outfile, ": serialno %010ld, ",
- oddata->hide_serialno ? -1 : serialno);
-
- if (oddata->hide_granulepos) {
- fprintf (outfile, "granulepos gGg");
- } else {
- if (op->granulepos == -1) {
- fprintf (outfile, "calc. gpos ");
- } else {
- fprintf (outfile, "granulepos ");
- }
- ot_fprint_granulepos (outfile, oggz, serialno, calced_gp);
-
- if (op->granulepos != -1 && op->granulepos != calced_gp) {
- fprintf (outfile, " ERR: file gp ");
- ot_fprint_granulepos (outfile, oggz, serialno, op->granulepos);
- }
- }
-
- fprintf (outfile, ", packetno %" PRId64,
- oddata->hide_packetno ? -1 : op->packetno);
-
- if (op->b_o_s) {
- fprintf (outfile, " *** bos");
- }
-
- if (op->e_o_s) {
- fprintf (outfile, " *** eos");
- }
-
- fprintf (outfile, ": ");
- ot_fprint_bytes (outfile, op->bytes);
- fputc ('\n', outfile);
-
- if (oddata->dump_bits) {
- bin_dump (op->packet, op->bytes, oddata->dump_char);
- } else {
- hex_dump (op->packet, op->bytes, oddata->dump_char);
- }
-
- fprintf (outfile, "\n");
-
- return 0;
-}
-
-static int
-filter_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
-{
- ODData * oddata = (ODData *) user_data;
- const char * ident;
- int i, n;
-
- if (ogg_page_bos ((ogg_page *)og)) {
- ident = ot_page_identify (oggz, og, NULL);
- if (ident) {
- n = oggz_table_size (oddata->content_types_table);
- for (i = 0; i < n; i++) {
- char * c = oggz_table_nth (oddata->content_types_table, i, NULL);
- if (strcasecmp (c, ident) == 0) {
- oggz_set_read_callback (oggz, serialno, oddata->read_packet, oddata);
- }
- }
- }
- }
-
- return 0;
-}
-
-static int
-read_new_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
-{
- if (op->b_o_s) {
- read_packet (oggz, op, serialno, user_data);
- return OGGZ_CONTINUE;
- } else {
- return OGGZ_STOP_OK;
- }
-}
-
-static void
-revert_packet (OGGZ * oggz, ogg_packet * op, long serialno, int flush)
-{
- unsigned char buf[1024];
- long n;
- int ret;
-
-#ifdef DEBUG
- printf ("feeding packet (%010ld) %ld bytes %s, %s\n",
- current_serialno, op->bytes,
- op->b_o_s ? "bos" : "not bos",
- op->e_o_s ? "eos" : "not eos");
-#endif
- if ((ret = oggz_write_feed (oggz, op, serialno, flush, NULL)) != 0) {
- fprintf (stderr, "%s: oggz_write_feed error %d\n", progname, ret);
- }
-
- while ((n = oggz_write_output (oggz, buf, 1024)) > 0) {
- fwrite (buf, 1, n, outfile);
- }
-}
-
-static void
-revert_file (char * infilename)
-{
- OGGZ * oggz;
- FILE * infile;
- char line[120];
- int hh, mm, ss;
- unsigned int offset;
- long current_serialno = -1, serialno;
- ogg_int64_t granulepos, iframe, pframe, packetno;
- int is_packetinfo = 0;
- int bos = 0, eos = 0;
-
- int line_offset = 0, consumed = 0;
-
- unsigned char * packet = NULL;
- long max_bytes = 0;
-
- ogg_packet op;
- int flush = 1;
- char c;
-
- if (strcmp (infilename, "-") == 0) {
- infile = stdin;
- } else {
- infile = fopen (infilename, "rb");
- }
-
- oggz = oggz_new (OGGZ_WRITE|OGGZ_NONSTRICT|OGGZ_AUTO);
-
- while (fgets (line, 120, infile)) {
- line_offset = 0;
-
- /* Skip time offsets, OR ensure line_offset is 0 */
- if (sscanf (line, "%2d:%2d:%2d.%n", &hh, &mm, &ss, &line_offset) < 3)
- line_offset = 0;
-
- is_packetinfo = 0;
- if (sscanf (&line[line_offset], "%x: serialno %ld, granulepos %" PRId64 ", packetno %" PRId64 "%n",
- &offset, &serialno, &granulepos, &packetno,
- &line_offset) >= 4) {
- is_packetinfo = 1;
- } else {
- if (sscanf (&line[line_offset], "%x: serialno %ld, granulepos %" PRId64 "%" PRId64 ", packetno %" PRId64 "%n",
- &offset, &serialno, &iframe, &pframe, &packetno,
- &line_offset) >= 5) {
- int granuleshift = oggz_get_granuleshift (oggz, serialno);
- is_packetinfo = 1;
- granulepos = (iframe<<granuleshift)+pframe;
- }
- }
-
- if (is_packetinfo) {
- /* flush any existing packets */
- if (current_serialno != -1) {
- revert_packet (oggz, &op, current_serialno, flush);
- }
-
- /* Start new packet */
- bos = 0; eos = 0;
- while ((c=line[line_offset++]) && c != '*');
- if (c == '*') {
- if (!strncmp (&line[line_offset], "** bos", 6)) {
- bos = 1;
- line_offset += 6;
- }
- if (!strncmp (&line[line_offset], "** eos", 6)) {
- eos = 1;
- line_offset += 6;
- }
- }
-
- current_serialno = serialno;
-
- op.packet = packet;
- op.bytes = 0;
- op.b_o_s = bos;
- op.e_o_s = eos;
- op.granulepos = granulepos;
- op.packetno = packetno;
-
- } else {
- int nread = 0;
- unsigned int val = 0;
- unsigned int offset;
-
- if (current_serialno != -1 &&
- sscanf (line, "%x:%n", &offset, &line_offset) >= 1) {
- /* NUL-terminate after hex data: don't scan char representation */
- line[50] = '\0';
- while (nread < 16 &&
- (sscanf (&line[line_offset], "%2x%n", &val, &consumed) > 0)) {
- op.bytes++;
- if (op.bytes > max_bytes) {
- unsigned char * new_packet;
- size_t new_size;
-
- if (max_bytes == 0) {
- new_size = 128;
- } else {
- new_size = max_bytes * 2;
- }
-
- new_packet =
- (unsigned char *) realloc ((void *)packet, new_size);
- if (new_packet == NULL) {
- fprintf (stderr,
- "%s: error allocating memory for packet data\n",
- progname);
- exit (1);
- } else {
- max_bytes = (long)new_size;
- packet = new_packet;
- op.packet = packet;
- }
- }
-
- packet[op.bytes-1] = (unsigned char) val;
-
- line_offset += consumed;
- nread++;
- }
- }
- }
- }
-
- /* flush any existing packets */
- if (current_serialno != -1) {
- revert_packet (oggz, &op, current_serialno, flush);
- }
-
- fclose (infile);
-}
-
-int
-main (int argc, char ** argv)
-{
- int show_version = 0;
- int show_help = 0;
-
- ODData * oddata;
- OGGZ * oggz;
- char * infilename = NULL, * outfilename = NULL;
- int revert = 0;
- long serialno;
- int i, size;
- long n;
-
- int filter_serialnos = 0;
- int filter_content_types = 0;
-
- ot_init ();
-
- progname = argv[0];
-
- if (argc < 2) {
- usage (progname);
- return (1);
- }
-
- oddata = oddata_new ();
-
- oddata->read_packet = read_packet;
-
- while (1) {
- char * optstring = "hvbxnro:s:c:OSGP";
-
-#ifdef HAVE_GETOPT_LONG
- static struct option long_options[] = {
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'v'},
- {"binary", no_argument, 0, 'b'},
- {"hexadecimal", no_argument, 0, 'x'},
- {"new", no_argument, 0, 'n'},
- {"revert", no_argument, 0, 'r'},
- {"output", required_argument, 0, 'o'},
- {"serialno", required_argument, 0, 's'},
- {"content-type", required_argument, 0, 'c'},
- {"hide-offset", no_argument, 0, 'O'},
- {"hide-serialno", no_argument, 0, 'S'},
- {"hide-granulepos", no_argument, 0, 'G'},
- {"hide-packetno", no_argument, 0, 'P'},
- {0,0,0,0}
- };
-
- i = getopt_long(argc, argv, optstring, long_options, NULL);
-#else
- i = getopt (argc, argv, optstring);
-#endif
- if (i == -1) break;
- if (i == ':') {
- usage (progname);
- goto exit_err;
- }
-
- switch (i) {
- case 'h': /* help */
- show_help = 1;
- break;
- case 'v': /* version */
- show_version = 1;
- break;
- case 'b': /* binary */
- oddata->dump_bits = 1;
- break;
- case 'n': /* new */
- oddata->read_packet = read_new_packet;
- break;
- case 'o': /* output */
- outfilename = optarg;
- break;
- case 'r': /* revert */
- revert = 1;
- break;
- case 's': /* serialno */
- filter_serialnos = 1;
- serialno = atol (optarg);
- oggz_table_insert (oddata->serialno_table, serialno, &truth);
- break;
- case 'c': /* content-type */
- filter_content_types = 1;
- n = (long)oggz_table_size (oddata->content_types_table);
- oggz_table_insert (oddata->content_types_table, (long)n, optarg);
- break;
- case 'O': /* hide offset */
- oddata->hide_offset = 1;
- break;
- case 'S': /* hide serialno */
- oddata->hide_serialno = 1;
- break;
- case 'G': /* hide granulepos */
- oddata->hide_granulepos = 1;
- break;
- case 'P': /* hide packetno */
- oddata->hide_packetno = 1;
- break;
- default:
- break;
- }
- }
-
- if (show_version) {
- printf ("%s version " VERSION "\n", progname);
- }
-
- if (show_help) {
- usage (progname);
- }
-
- if (show_version || show_help) {
- goto exit_ok;
- }
-
- if (optind >= argc) {
- usage (progname);
- goto exit_err;
- }
-
- infilename = argv[optind++];
-
- if (outfilename == NULL) {
- outfile = stdout;
- } else {
- outfile = fopen (outfilename, "wb");
- if (outfile == NULL) {
- fprintf (stderr, "%s: unable to open output file %s\n",
- progname, outfilename);
- goto exit_err;
- }
- }
-
- if (revert) {
- if (oddata->dump_bits) {
- fprintf (stderr, "%s: Revert of binary dump not supported\n", progname);
- goto exit_err;
- }
-
- revert_file (infilename);
- } else {
- errno = 0;
-
- if (strcmp (infilename, "-") == 0) {
- oggz = oggz_open_stdio (stdin, OGGZ_READ|OGGZ_AUTO);
- } else {
- oggz = oggz_open (infilename, OGGZ_READ|OGGZ_AUTO);
- }
-
- if (oggz == NULL) {
- if (errno == 0) {
- fprintf (stderr, "%s: %s: OGGZ error opening input file\n",
- progname, infilename);
- } else {
- fprintf (stderr, "%s: %s: %s\n",
- progname, infilename, strerror (errno));
- }
- goto exit_err;
- }
-
- if (!filter_serialnos && !filter_content_types) {
- oggz_set_read_callback (oggz, -1, oddata->read_packet, oddata);
- } else {
- if (filter_serialnos) {
- size = oggz_table_size (oddata->serialno_table);
- for (i = 0; i < size; i++) {
- oggz_table_nth (oddata->serialno_table, i, &serialno);
- oggz_set_read_callback (oggz, serialno, oddata->read_packet, oddata);
- }
- }
-
- if (filter_content_types) {
- oggz_set_read_page (oggz, -1, filter_page, oddata);
- }
- }
-
- oggz_run_set_blocksize (oggz, 1024*1024);
- oggz_run (oggz);
-
- oggz_close (oggz);
- }
-
- exit_ok:
- oddata_delete (oddata);
- exit (0);
-
- exit_err:
- oddata_delete (oddata);
- exit (1);
-}
Deleted: liboggz/trunk/src/tools/oggzinfo.c
===================================================================
--- liboggz/trunk/src/tools/oggzinfo.c 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/src/tools/oggzinfo.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,658 +0,0 @@
-/*
- Copyright (C) 2003 Commonwealth Scientific and Industrial Research
- Organisation (CSIRO) Australia
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of CSIRO Australia nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h> /* LONG_MAX */
-#include <math.h>
-
-#include <getopt.h>
-#include <errno.h>
-
-#include <oggz/oggz.h>
-#include "oggz_tools.h"
-
-#include "skeleton.h"
-
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# define PRId64 "I64d"
-#endif
-
-#define READ_BLOCKSIZE 1024000
-
-static void
-usage (const char * progname)
-{
- printf ("Usage: %s [options] filename ...\n", progname);
- printf ("Display information about one or more Ogg files and their bitstreams\n");
- printf ("\nDisplay options\n");
- printf (" -l, --length Display content lengths\n");
- printf (" -b, --bitrate Display bitrate information\n");
- printf (" -g, --page-stats Display Ogg page statistics\n");
- printf (" -p, --packet-stats Display Ogg packet statistics\n");
- printf (" -k, --skeleton Display Extra data from OggSkeleton bitstream\n");
- printf (" -a, --all Display all information\n");
- printf ("\nMiscellaneous options\n");
- printf (" -h, --help Display this help and exit\n");
- printf (" -v, --version Output version information and exit\n");
- printf ("\n");
- printf ("Byte lengths are displayed using the following units:\n");
- printf (" bytes (8 bits)\n");
- printf (" kB kilobytes (1024 bytes)\n");
- printf (" MB megabytes (1024*1024 bytes)\n");
- printf (" GB gigabytes (1024*1024*1024 bytes)\n");
- printf ("\n");
- printf ("Bitrates are displayed using the following units:\n");
- printf (" bps bits per second (bit/s)\n");
- printf (" kbps kilobits per second (1000 bit/s)\n");
- printf (" Mbps megabits per second (1000000 bit/s)\n");
- printf (" Gbps gigabits per second (1000000000 bit/s)\n");
- printf ("\n");
- printf ("Please report bugs to <ogg-dev at xiph.org>\n");
-}
-
-#define SEP "------------------------------------------------------------"
-
-typedef struct _OI_Info OI_Info;
-typedef struct _OI_Stats OI_Stats;
-typedef struct _OI_TrackInfo OI_TrackInfo;
-
-/* Let's get functional */
-typedef void (*OI_TrackFunc) (OI_Info * info, OI_TrackInfo * oit, long serialno);
-
-struct _OI_Info {
- OGGZ * oggz;
- OggzTable * tracks;
- ogg_int64_t duration;
- long length_total;
- long overhead_length_total;
-};
-
-struct _OI_Stats {
- /* Pass 1 */
- long count;
- long length_total;
- long length_min;
- long length_max;
- long overhead_length_total;
-
- /* Pass 2 */
- long length_avg;
- ogg_int64_t length_deviation_total;
- double length_stddev;
-};
-
-struct _OI_TrackInfo {
- OI_Stats pages;
- OI_Stats packets;
- const char * codec_name;
- char * codec_info;
- int has_fishead;
- int has_fisbone;
- fishead_packet fhInfo;
- fisbone_packet fbInfo;
-};
-
-static int show_length = 0;
-static int show_bitrate = 0;
-static int show_page_stats = 0;
-static int show_packet_stats = 0;
-static int show_extra_skeleton_info = 0;
-
-static void
-oggzinfo_apply (OI_TrackFunc func, OI_Info * info)
-{
- OI_TrackInfo * oit;
- long serialno;
- int n, i;
-
- n = oggz_table_size (info->tracks);
- for (i = 0; i < n; i++) {
- oit = oggz_table_nth (info->tracks, i, &serialno);
- if (oit) func (info, oit, serialno);
- }
-}
-
-static void
-oi_stats_clear (OI_Stats * stats)
-{
- stats->count = 0;
-
- stats->length_total = 0;
- stats->length_min = LONG_MAX;
- stats->length_max = 0;
- stats->overhead_length_total = 0;
-
- stats->length_avg = 0;
- stats->length_deviation_total = 0;
- stats->length_stddev = 0;
-}
-
-static OI_TrackInfo *
-oggzinfo_trackinfo_new (void)
-{
- OI_TrackInfo * oit;
-
- oit = malloc (sizeof (OI_TrackInfo));
-
- oi_stats_clear (&oit->pages);
- oi_stats_clear (&oit->packets);
-
- oit->codec_name = NULL;
- oit->codec_info = NULL;
-
- oit->has_fishead = 0;
- oit->has_fisbone = 0;
-
- return oit;
-}
-
-static long
-oi_bitrate (long bytes, ogg_int64_t ms)
-{
- if (ms == 0) return 0;
- else return (long) (((ogg_int64_t)bytes * 8 * 1000) / ms);
-}
-
-static void
-oi_stats_print (OI_Info * info, OI_Stats * stats, char * label)
-{
- printf ("\t%s-Length-Maximum: ", label);
- ot_fprint_bytes (stdout, stats->length_max);
- putchar ('\n');
-
- printf ("\t%s-Length-StdDev: ", label);
- ot_fprint_bytes (stdout, stats->length_stddev);
- putchar ('\n');
-
-#if 0
- printf ("\t%s-Length-Maximum: %ld bytes\n", label, stats->length_max);
- /*printf ("\t%s-Length-Average: %ld bytes\n", label, stats->length_avg);*/
- printf ("\t%s-Length-StdDev: %.0f bytes\n", label, stats->length_stddev);
- /*
- printf ("\tRange: [%ld - %ld] bytes, Std.Dev. %.3f bytes\n",
- stats->length_min, stats->length_max, stats->length_stddev);
- */
-#endif
-}
-
-static void
-ot_fishead_print(OI_TrackInfo *oit) {
- if (oit->has_fishead) {
- /*
- printf("\tPresentation Time: %.2f\n", (double)oit->fhInfo.ptime_n/oit->fhInfo.ptime_d);
- printf("\tBase Time: %.2f\n", (double)oit->fhInfo.btime_n/oit->fhInfo.btime_d);
- */
- printf("\tSkeleton version: %d.%d\n", oit->fhInfo.version_major, oit->fhInfo.version_minor);
- /*printf("\tUTC: %s\n", oit->fhInfo.UTC);*/
- }
-}
-
-static void
-ot_fisbone_print(OI_Info * info, OI_TrackInfo *oit) {
-
- char *allocated, *messages, *token;
-
- if (oit->has_fisbone) {
- printf("\n\tExtra information from Ogg Skeleton track:\n");
- /*printf("\tserialno: %010d\n", oit->fbInfo.serial_no);*/
- printf("\tNumber of header packets: %d\n", oit->fbInfo.nr_header_packet);
- printf("\tGranule rate: %.2f\n", (double)oit->fbInfo.granule_rate_n/oit->fbInfo.granule_rate_d);
- printf("\tGranule shift: %d\n", (int)oit->fbInfo.granule_shift);
- printf("\tStart granule: ");
- ot_fprint_granulepos(stdout, info->oggz, oit->fbInfo.serial_no, oit->fbInfo.start_granule);
- printf ("\n");
- printf("\tPreroll: %d\n", oit->fbInfo.preroll);
- allocated = messages = _ogg_calloc(oit->fbInfo.current_header_size+1, sizeof(char));
- strcpy(messages, oit->fbInfo.message_header_fields);
- printf("\tMessage Header Fields:\n");
- while (1) {
- token = strsep(&messages, "\n\r");
- printf("\t %s", token);
- if (messages == NULL)
- break;
- }
- printf("\n");
- _ogg_free(allocated);
- }
-}
-
-/* oggzinfo_trackinfo_print() */
-static void
-oit_print (OI_Info * info, OI_TrackInfo * oit, long serialno)
-{
- if (oit->codec_name) {
- printf ("\n%s: serialno %010ld\n", oit->codec_name, serialno);
- } else {
- printf ("\n???: serialno %010ld\n", serialno);
- }
- printf ("\t%ld packets in %ld pages, %.1f packets/page, %.3f%% Ogg overhead\n",
- oit->packets.count, oit->pages.count,
- (double)oit->packets.count / (double)oit->pages.count,
- oit->pages.length_stddev == 0 ? 0.0 : 100.0*oit->pages.overhead_length_total/oit->pages.length_total);
-
- if (show_length) {
- fputs("\tContent-Length: ", stdout);
- ot_fprint_bytes (stdout, oit->pages.length_total);
- putchar ('\n');
- }
-
- if (show_bitrate) {
- fputs ("\tContent-Bitrate-Average: ", stdout);
- ot_print_bitrate (oi_bitrate (oit->pages.length_total, info->duration));
- putchar ('\n');
- }
-
- if (oit->codec_info != NULL) {
- fputs (oit->codec_info, stdout);
- }
-
- if (show_page_stats) {
- oi_stats_print (info, &oit->pages, "Page");
- }
-
- if (show_packet_stats) {
- oi_stats_print (info, &oit->packets, "Packet");
- }
-
- if (show_extra_skeleton_info && oit->has_fishead) {
- ot_fishead_print(oit);
- }
- if (show_extra_skeleton_info && oit->has_fisbone) {
- ot_fisbone_print(info, oit);
- }
-
- }
-
-static void
-oi_stats_average (OI_Stats * stats)
-{
- if (stats->count > 0) {
- stats->length_avg = stats->length_total / stats->count;
- } else {
- stats->length_avg = 0;
- }
-}
-
-static void
-oit_calc_average (OI_Info * info, OI_TrackInfo * oit, long serialno)
-{
- oi_stats_average (&oit->pages);
- oi_stats_average (&oit->packets);
-}
-
-static void
-oi_stats_stddev (OI_Stats * stats)
-{
- double variance;
-
- if (stats->count <= 1) {
- stats->length_stddev = 0.0;
- }
- else {
- variance = (double)stats->length_deviation_total / (double)(stats->count - 1);
- stats->length_stddev = sqrt (variance);
- }
-}
-
-static void
-oit_calc_stddev (OI_Info * info, OI_TrackInfo * oit, long serialno)
-{
- oi_stats_stddev (&oit->pages);
- oi_stats_stddev (&oit->packets);
-}
-
-static int
-read_page_pass1 (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
-{
- OI_Info * info = (OI_Info *)user_data;
- OI_TrackInfo * oit;
- long bytes;
-
- oit = oggz_table_lookup (info->tracks, serialno);
- if (oit == NULL) {
- oit = oggzinfo_trackinfo_new ();
- oggz_table_insert (info->tracks, serialno, oit);
- }
-
- if (ogg_page_bos ((ogg_page *)og)) {
- oit->codec_name = ot_page_identify (oggz, og, &oit->codec_info);
- }
-
- bytes = og->header_len + og->body_len;
-
- /* Increment the total stream length */
- info->length_total += bytes;
- info->overhead_length_total += og->header_len;
-
- /* Increment the page statistics */
- oit->pages.count++;
- oit->pages.length_total += bytes;
- if (bytes < oit->pages.length_min)
- oit->pages.length_min = bytes;
- if (bytes > oit->pages.length_max)
- oit->pages.length_max = bytes;
- oit->pages.overhead_length_total += og->header_len;
-
- return 0;
-}
-
-static int
-read_page_pass2 (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
-{
- OI_Info * info = (OI_Info *)user_data;
- OI_TrackInfo * oit;
- long bytes, deviation;
-
- oit = oggz_table_lookup (info->tracks, serialno);
-
- /* Increment the page length deviation squared total */
- bytes = og->header_len + og->body_len;
- deviation = bytes - oit->pages.length_avg;
- oit->pages.length_deviation_total += (deviation * deviation);
-
- return 0;
-}
-
-static int
-read_packet_pass1 (OGGZ * oggz, ogg_packet * op, long serialno,
- void * user_data)
-{
- OI_Info * info = (OI_Info *)user_data;
- OI_TrackInfo * oit;
-
- oit = oggz_table_lookup (info->tracks, serialno);
-
- /* Increment the packet statistics */
- oit->packets.count++;
- oit->packets.length_total += op->bytes;
- if (op->bytes < oit->packets.length_min)
- oit->packets.length_min = op->bytes;
- if (op->bytes > oit->packets.length_max)
- oit->packets.length_max = op->bytes;
-
- if (!op->e_o_s && !memcmp(op->packet, FISBONE_IDENTIFIER, 8)) {
- fisbone_packet fp;
- int ret = fisbone_from_ogg(op, &fp);
- if (ret<0) return ret;
- oit = oggz_table_lookup (info->tracks, fp.serial_no);
- if (oit) {
- oit->has_fisbone = 1;
- oit->fbInfo = fp;
- }
- else {
- fprintf(stderr, "Warning: logical stream %08x referenced by skeleton was not found\n",fp.serial_no);
- }
- fisbone_clear(&fp);
- } else if (!op->e_o_s && !memcmp(op->packet, FISHEAD_IDENTIFIER, 8)) {
- fishead_packet fp;
- int ret = fishead_from_ogg(op, &fp);
- if (ret<0) return ret;
- oit->has_fishead = 1;
- oit->fhInfo = fp;
- }
-
- return 0;
-}
-
-static int
-read_packet_pass2 (OGGZ * oggz, ogg_packet * op, long serialno,
- void * user_data)
-{
- OI_Info * info = (OI_Info *)user_data;
- OI_TrackInfo * oit;
- long deviation;
-
- oit = oggz_table_lookup (info->tracks, serialno);
-
- /* Increment the packet length deviation squared total */
- deviation = op->bytes - oit->packets.length_avg;
- oit->packets.length_deviation_total += (deviation * deviation);
-
- return 0;
-}
-
-static int
-oi_pass1 (OGGZ * oggz, OI_Info * info)
-{
- long n, serialno;
- int ntracks, i;
- OI_TrackInfo * oit;
-
- oggz_seek (oggz, 0, SEEK_SET);
- oggz_set_read_page (oggz, -1, read_page_pass1, info);
- oggz_set_read_callback (oggz, -1, read_packet_pass1, info);
-
- while ((n = oggz_read (oggz, READ_BLOCKSIZE)) > 0);
-
- oggzinfo_apply (oit_calc_average, info);
-
- /* Now we are at the end of the file, calculate the duration */
- info->duration = oggz_tell_units (oggz);
-
- /* Find the Skeleton track if present, and subtract the presentation time */
- ntracks = oggz_table_size (info->tracks);
- for (i = 0; i < ntracks; i++) {
- oit = oggz_table_nth (info->tracks, i, &serialno);
- if (oit->has_fishead) {
- info->duration -= 1000 * oit->fhInfo.ptime_n / oit->fhInfo.ptime_d;
- break;
- }
- }
-
- return 0;
-}
-
-static int
-oi_pass2 (OGGZ * oggz, OI_Info * info)
-{
- long n;
-
- oggz_seek (oggz, 0, SEEK_SET);
- oggz_set_read_page (oggz, -1, read_page_pass2, info);
- oggz_set_read_callback (oggz, -1, read_packet_pass2, info);
-
- while ((n = oggz_read (oggz, READ_BLOCKSIZE)) > 0);
-
- oggzinfo_apply (oit_calc_stddev, info);
-
- return 0;
-}
-
-static void
-oit_delete (OI_Info * info, OI_TrackInfo * oit, long serialno)
-{
- if (oit->codec_info) free (oit->codec_info);
-}
-
-int
-main (int argc, char ** argv)
-{
- int show_version = 0;
- int show_help = 0;
-
- char * progname;
- int i;
- int show_all = 0;
-
- int many_files = 0;
- char * infilename;
- OGGZ * oggz;
- OI_Info info;
-
- progname = argv[0];
-
- if (argc < 2) {
- usage (progname);
- return (1);
- }
-
- while (1) {
- char * optstring = "hvlbgpka";
-
-#ifdef HAVE_GETOPT_LONG
- static struct option long_options[] = {
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'v'},
- {"length", no_argument, 0, 'l'},
- {"bitrate", no_argument, 0, 'b'},
- {"page-stats", no_argument, 0, 'g'},
- {"packet-stats", no_argument, 0, 'p'},
- {"skeleton", no_argument, 0, 'k'},
- {"all", no_argument, 0, 'a'},
- {0,0,0,0}
- };
-
- i = getopt_long (argc, argv, optstring, long_options, NULL);
-#else
- i = getopt (argc, argv, optstring);
-#endif
- if (i == -1) break;
- if (i == ':') {
- usage (progname);
- goto exit_err;
- }
-
- switch (i) {
- case 'h': /* help */
- show_help = 1;
- break;
- case 'v': /* version */
- show_version = 1;
- break;
- case 'l': /* length */
- show_length = 1;
- break;
- case 'b': /* bitrate */
- show_bitrate = 1;
- break;
- case 'g': /* page stats */
- show_page_stats = 1;
- break;
- case 'p': /* packet stats */
- show_packet_stats = 1;
- break;
- case 'k': /* extra skeleton info */
- show_extra_skeleton_info = 1;
- break;
- case 'a':
- show_all = 1;
- break;
- default:
- break;
- }
- }
-
- if (show_version) {
- printf ("%s version " VERSION "\n", progname);
- }
-
- if (show_help) {
- usage (progname);
- }
-
- if (show_version || show_help) {
- goto exit_ok;
- }
-
- if (optind >= argc) {
- usage (progname);
- goto exit_err;
- }
-
- if (show_all) {
- show_length = 1;
- show_bitrate = 1;
- show_page_stats = 1;
- show_packet_stats = 1;
- show_extra_skeleton_info = 1;
- }
-
- if (argc > optind+1) {
- many_files = 1;
- }
-
- while (optind < argc) {
- infilename = argv[optind++];
-
- if ((oggz = oggz_open (infilename, OGGZ_READ|OGGZ_AUTO)) == NULL) {
- printf ("unable to open file %s\n", argv[1]);
- return (1);
- }
-
- info.oggz = oggz;
- info.tracks = oggz_table_new ();
- info.length_total = 0;
- info.overhead_length_total = 0;
-
- oi_pass1 (oggz, &info);
-
- oi_pass2 (oggz, &info);
-
- /* Print summary information */
- if (many_files)
- printf ("Filename: %s\n", infilename);
- fputs ("Content-Duration: ", stdout);
- ot_fprint_time (stdout, (double)info.duration / 1000.0);
- putchar ('\n');
-
- if (show_length) {
- fputs ("Content-Length: ", stdout);
- ot_fprint_bytes (stdout, info.length_total);
- putchar ('\n');
- }
-
- if (show_bitrate) {
- fputs ("Content-Bitrate-Average: ", stdout);
- ot_print_bitrate (oi_bitrate (info.length_total, info.duration));
- putchar ('\n');
- }
-
- oggzinfo_apply (oit_print, &info);
-
- oggzinfo_apply (oit_delete, &info);
- oggz_table_delete (info.tracks);
-
- oggz_close (oggz);
-
- if (optind < argc) puts (SEP);
- }
-
- exit_ok:
- exit (0);
-
- exit_err:
- exit (1);
-}
Deleted: liboggz/trunk/src/tools/oggzmerge.c
===================================================================
--- liboggz/trunk/src/tools/oggzmerge.c 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/src/tools/oggzmerge.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,437 +0,0 @@
-/*
- Copyright (C) 2003 Commonwealth Scientific and Industrial Research
- Organisation (CSIRO) Australia
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of CSIRO Australia nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include <getopt.h>
-#include <errno.h>
-
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# define PRId64 "I64d"
-#endif
-
-#include <oggz/oggz.h>
-#include "oggz_tools.h"
-
-#define READ_SIZE 4096
-
-#define ALL_VORBIS_WARNING \
- "oggzmerge: WARNING: Merging Ogg Vorbis I files. The resulting file will\n" \
- " contain %d tracks in parallel, interleaved for simultaneous playback.\n"\
- " If you want to sequence these files one after another, use cat instead.\n"
-
-static void
-usage (char * progname)
-{
- printf ("Usage: %s [options] filename ...\n", progname);
- printf ("Merge Ogg files together, interleaving pages in order of presentation time.\n");
- printf ("\nMiscellaneous options\n");
- printf (" -o filename, --output filename\n");
- printf (" Specify output filename\n");
- printf (" -h, --help Display this help and exit\n");
- printf (" -v, --version Output version information and exit\n");
- printf (" -V, --verbose Verbose operation\n");
- printf ("\n");
- printf ("Please report bugs to <ogg-dev at xiph.org>\n");
-}
-
-typedef struct _OMData OMData;
-typedef struct _OMInput OMInput;
-typedef struct _OMITrack OMITrack;
-
-struct _OMData {
- OggzTable * inputs;
- int verbose;
-};
-
-struct _OMInput {
- OMData * omdata;
- OGGZ * reader;
- const ogg_page * og;
-};
-
-struct _OMITrack {
- long output_serialno;
-};
-
-static ogg_page *
-_ogg_page_copy (const ogg_page * og)
-{
- ogg_page * new_og;
-
- new_og = malloc (sizeof (*og));
- new_og->header = malloc (og->header_len);
- new_og->header_len = og->header_len;
- memcpy (new_og->header, og->header, og->header_len);
- new_og->body = malloc (og->body_len);
- new_og->body_len = og->body_len;
- memcpy (new_og->body, og->body, og->body_len);
-
- return new_og;
-}
-
-static int
-_ogg_page_free (const ogg_page * og)
-{
- free (og->header);
- free (og->body);
- free ((ogg_page *)og);
- return 0;
-}
-
-static void
-ominput_delete (OMInput * input)
-{
- oggz_close (input->reader);
-
- free (input);
-}
-
-static OMData *
-omdata_new (void)
-{
- OMData * omdata;
-
- omdata = (OMData *) malloc (sizeof (OMData));
-
- omdata->inputs = oggz_table_new ();
- omdata->verbose = 0;
-
- return omdata;
-}
-
-static void
-omdata_delete (OMData * omdata)
-{
- OMInput * input;
- int i, ninputs;
-
- ninputs = oggz_table_size (omdata->inputs);
- for (i = 0; i < ninputs; i++) {
- input = (OMInput *) oggz_table_nth (omdata->inputs, i, NULL);
- ominput_delete (input);
- }
- oggz_table_delete (omdata->inputs);
-
- free (omdata);
-}
-
-static int
-read_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
-{
- OMInput * input = (OMInput *) user_data;
-
- input->og = _ogg_page_copy (og);
-
- return OGGZ_STOP_OK;
-}
-
-static int
-omdata_add_input (OMData * omdata, FILE * infile)
-{
- OMInput * input;
- int nfiles;
-
- input = (OMInput *) malloc (sizeof (OMInput));
- if (input == NULL) return -1;
-
- input->omdata = omdata;
- input->reader = oggz_open_stdio (infile, OGGZ_READ|OGGZ_AUTO);
- input->og = NULL;
-
- oggz_set_read_page (input->reader, -1, read_page, input);
-
- nfiles = oggz_table_size (omdata->inputs);
- if (!oggz_table_insert (omdata->inputs, nfiles++, input)) {
- ominput_delete (input);
- return -1;
- }
-
- return 0;
-}
-
-static int
-oggz_merge (OMData * omdata, FILE * outfile)
-{
- OMInput * input;
- int ninputs, i, min_i;
- long key, n;
- ogg_int64_t units, min_units;
- const ogg_page * og;
- int active;
-
- /* For theora+vorbis, ensure theora bos is first */
- int careful_for_theora = 0;
-
- /* If all input files are Ogg Vorbis I, warn that the output will not be
- * a valid Ogg Vorbis I file as it will be multitrack. This is in response
- * to Debian bug 280550: http://bugs.debian.org/280550
- */
- int v, warn_all_vorbis = 1;
-
- if (oggz_table_size (omdata->inputs) == 2)
- careful_for_theora = 1;
-
- while ((ninputs = oggz_table_size (omdata->inputs)) > 0) {
- min_units = -1;
- min_i = -1;
- active = 1;
-
- if (omdata->verbose)
- printf ("------------------------------------------------------------\n");
-
- /* Reload all pages, and find the min (earliest) */
- for (i = 0; active && i < oggz_table_size (omdata->inputs); i++) {
- input = (OMInput *) oggz_table_nth (omdata->inputs, i, &key);
- if (input != NULL) {
- while (input && input->og == NULL) {
- n = oggz_read (input->reader, READ_SIZE);
- if (n == 0) {
- oggz_table_remove (omdata->inputs, key);
- ominput_delete (input);
- input = NULL;
- }
- }
- if (input && input->og) {
- if (ogg_page_bos ((ogg_page *)input->og)) {
- min_i = i;
-
- if (careful_for_theora || warn_all_vorbis) {
- const char * codec_name;
- int is_vorbis = 0;
-
- if ((codec_name =
- ot_page_identify (input->reader, input->og, NULL)) != NULL)
- is_vorbis = !strcmp (codec_name, "Vorbis");
-
- if (i == 0 && is_vorbis)
- careful_for_theora = 0;
- else
- active = 0;
-
- if (!is_vorbis) warn_all_vorbis = 0;
-
- } else {
- active = 0;
- }
- } else if (warn_all_vorbis) {
- int all_inputs_are_beyond_bos = 1;
-
- /* All BOS pages seen so far are Ogg Vorbis. The following loop
- * checks if all input files are single-track, ie. Ogg Vorbis I.
- * We can only rely on this information if all inputs are beyond
- * bos, ie. all BOS pages have been seen. */
- for (v = 0; v < oggz_table_size (omdata->inputs); v++) {
- OMInput * input_v;
- OGGZ * oggz;
-
- input_v = (OMInput *) oggz_table_nth (omdata->inputs, i, &key);
- oggz = input_v->reader;
-
- if (oggz_get_bos(oggz, -1)) all_inputs_are_beyond_bos = 0;
- else if (oggz_get_numtracks(oggz) > 1) warn_all_vorbis = 0;
- }
-
- if (all_inputs_are_beyond_bos && warn_all_vorbis) {
- fprintf (stderr, ALL_VORBIS_WARNING, v);
- warn_all_vorbis = 0;
- }
- }
- units = oggz_tell_units (input->reader);
-
- if (omdata->verbose) {
- ot_fprint_time (stdout, (double)units/1000);
- printf (": Got index %d serialno %010d %" PRId64 " units: ",
- i, ogg_page_serialno ((ogg_page *)input->og), units);
- }
-
- if (min_units == -1 || units == 0 ||
- (units > -1 && units < min_units)) {
- min_units = units;
- min_i = i;
- if (omdata->verbose)
- printf ("Min\n");
- } else {
- if (omdata->verbose)
- printf ("Moo\n");
- }
- } else if (omdata->verbose) {
- if (input == NULL) {
- printf ("*** index %d NULL\n", i);
- } else {
- printf ("*** No page from index %d\n", i);
- }
- }
- }
- }
-
- if (omdata->verbose)
- printf ("Min index %d\n", min_i);
-
- /* Write the earliest page */
- if (min_i != -1) {
- input = (OMInput *) oggz_table_nth (omdata->inputs, min_i, &key);
- og = input->og;
- fwrite (og->header, 1, og->header_len, outfile);
- fwrite (og->body, 1, og->body_len, outfile);
-
- _ogg_page_free (og);
- input->og = NULL;
- }
- }
-
- return 0;
-}
-
-int
-main (int argc, char * argv[])
-{
- int show_version = 0;
- int show_help = 0;
-
- char * progname;
- char * infilename = NULL, * outfilename = NULL;
- FILE * infile = NULL, * outfile = NULL;
- OMData * omdata;
- int i;
-
- ot_init ();
-
- progname = argv[0];
-
- if (argc < 2) {
- usage (progname);
- return (1);
- }
-
- omdata = omdata_new();
-
- while (1) {
- char * optstring = "hvVo:";
-
-#ifdef HAVE_GETOPT_LONG
- static struct option long_options[] = {
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'v'},
- {"verbose", no_argument, 0, 'V'},
- {"output", required_argument, 0, 'o'},
- {0,0,0,0}
- };
-
- i = getopt_long (argc, argv, optstring, long_options, NULL);
-#else
- i = getopt (argc, argv, optstring);
-#endif
- if (i == -1) break;
- if (i == ':') {
- usage (progname);
- goto exit_err;
- }
-
- switch (i) {
- case 'h': /* help */
- show_help = 1;
- break;
- case 'v': /* version */
- show_version = 1;
- break;
- case 'o': /* output */
- outfilename = optarg;
- break;
- case 'V': /* verbose */
- omdata->verbose = 1;
- default:
- break;
- }
- }
-
- if (show_version) {
- printf ("%s version " VERSION "\n", progname);
- }
-
- if (show_help) {
- usage (progname);
- }
-
- if (show_version || show_help) {
- goto exit_ok;
- }
-
- if (optind >= argc) {
- usage (progname);
- goto exit_err;
- }
-
- if (optind >= argc) {
- usage (progname);
- goto exit_err;
- }
-
- while (optind < argc) {
- infilename = argv[optind++];
- infile = fopen (infilename, "rb");
- if (infile == NULL) {
- fprintf (stderr, "%s: unable to open input file %s\n", progname,
- infilename);
- } else {
- omdata_add_input (omdata, infile);
- }
- }
-
- if (outfilename == NULL) {
- outfile = stdout;
- } else {
- outfile = fopen (outfilename, "wb");
- if (outfile == NULL) {
- fprintf (stderr, "%s: unable to open output file %s\n",
- progname, outfilename);
- goto exit_err;
- }
- }
-
- oggz_merge (omdata, outfile);
-
- exit_ok:
- omdata_delete (omdata);
- exit (0);
-
- exit_err:
- omdata_delete (omdata);
- exit (1);
-}
Deleted: liboggz/trunk/src/tools/oggzrip.c
===================================================================
--- liboggz/trunk/src/tools/oggzrip.c 2008-07-04 09:53:12 UTC (rev 3626)
+++ liboggz/trunk/src/tools/oggzrip.c 2008-07-07 12:26:34 UTC (rev 3627)
@@ -1,426 +0,0 @@
-/* -*- c-file-style: "gnu" -*- */
-/*
- Copyright (C) 2005 Commonwealth Scientific and Industrial Research
- Organisation (CSIRO) Australia
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of CSIRO Australia nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Author: David Kuehling <dvdkhlng at gmx.de>
- Created: 20041231
-*/
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifndef WIN32
-#include <strings.h>
-#endif
-#include <fcntl.h>
-#include <assert.h>
-
-#include <getopt.h>
-#include <errno.h>
-
-#include <oggz/oggz.h>
-#include "oggz_tools.h"
-
-#ifdef WIN32
-#define strcasecmp _stricmp
-#endif
-
-#define READ_SIZE 4096
-#define WRITE_SIZE 4096
-
-typedef struct {
- OGGZ *reader;
- FILE *outfile;
- int numwrite;
- OggzTable *streams;
- int verbose;
- OggzTable *serialno_table;
- OggzTable *stream_index_table;
- OggzTable *content_types_table;
-} ORData;
-
-typedef struct {
- long serialno;
- int streamid;
- const char *content_type;
- int bos;
-} ORStream;
-
-static int streamid_count = 0;
-
-static void
-usage (char * progname)
-{
- printf ("Usage: %s [options] filename ...\n", progname);
- printf ("\nFilter options\n");
- printf (" These options can be used multiple times. Pages matching ANY of\n");
- printf (" the filter options will be included into the output.\n\n");
- printf (" -s serialno, --serialno serialno\n");
- printf (" Output streams with given serialno.\n");
- printf (" -i index, --stream-index index\n");
- printf (" Filter by stream index. These are assigned to\n");
- printf (" streams in the order of their BOS pages,\n");
- printf (" starting at 0.\n");
- printf (" -c content-type --content-type content-type\n");
- printf (" Filter by content-type. The following codec\n");
- printf (" names are currently detected: \"theora\",\n");
- printf (" \"vorbis\", \"speex\", \"cmml\", \"kate\"\n");
- printf ("\nMiscellaneous options\n");
- printf (" -o filename, --output filename\n");
- printf (" Specify output filename\n");
- printf (" -h, --help Display this help and exit\n");
- printf (" -v, --version Output version information and exit\n");
- printf (" -V, --verbose Verbose operation\n");
- printf ("\n");
- printf ("Please report bugs to <ogg-dev at xiph.org>\n");
-}
-
-static ORData *
-ordata_new ()
-{
- ORData *ordata = malloc (sizeof (ORData));
- assert (ordata != NULL);
- memset (ordata, 0, sizeof (ORData));
-
- ordata->streams = oggz_table_new ();
- assert (ordata->streams != NULL);
-
- ordata->serialno_table = oggz_table_new();
- assert (ordata->serialno_table != NULL);
-
- ordata->stream_index_table = oggz_table_new();
- assert (ordata->stream_index_table != NULL);
-
- ordata->content_types_table = oggz_table_new();
- assert (ordata->content_types_table != NULL);
-
- return ordata;
-}
-
-static void
-ordata_delete (ORData *ordata)
-{
- oggz_table_delete (ordata->streams);
- oggz_table_delete (ordata->serialno_table);
- oggz_table_delete (ordata->stream_index_table);
- oggz_table_delete (ordata->content_types_table);
-
- if (ordata->reader)
- oggz_close (ordata->reader);
- if (ordata->outfile)
- fclose (ordata->outfile);
-
- free (ordata);
-}
-
-static int
-filter_stream_p (const ORData *ordata, ORStream *stream,
- const ogg_page *og, long serialno)
-{
- int i, n;
-
- if (oggz_table_lookup (ordata->serialno_table, serialno) != NULL)
- return 1;
-
- if (stream == NULL)
- return 0;
-
- if (oggz_table_lookup (ordata->stream_index_table, (long)stream->streamid) != NULL)
- return 1;
-
- n = oggz_table_size (ordata->content_types_table);
- for (i = 0; i < n; i++) {
- char * c = oggz_table_nth (ordata->content_types_table, i, NULL);
- if (strcasecmp (c, stream->content_type) == 0)
- return 1;
- }
-
- return 0;
-}
-
-static ORStream *
-orstream_new (OGGZ *oggz, const ORData *ordata, const ogg_page *og,
- long serialno)
-{
- const char * ident;
-
- ORStream *stream = malloc (sizeof (ORStream));
- assert (stream != NULL);
-
- stream->serialno = serialno;
- stream->streamid = streamid_count++;
- stream->content_type = "unknown";
-
- ident = ot_page_identify (oggz, og, NULL);
- if (ident != NULL) stream->content_type = ident;
-
- if (ordata->verbose)
- fprintf (stderr,
- "New logical stream, serialno %li, id %i, codec %s, will be %s\n",
- stream->serialno, stream->streamid, stream->content_type,
- (filter_stream_p (ordata, stream, og, serialno) ?
- "copied" :"dropped"));
-
- return stream;
-}
-
-static void
-orstream_delete (ORData *ordata, ORStream *stream)
-{
- if (ordata->verbose)
- fprintf (stderr, "End of logical stream %li \n", stream->serialno);
-
- free (stream);
-}
-
-static void
-checked_fwrite (const void *data, size_t size, size_t count, FILE *stream)
-{
- int n = fwrite (data, size, count, stream);
- if ((size_t)n != count) {
- perror ("write failed");
- exit (1);
- }
-}
-
-static int
-rip_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
-{
- ORData *ordata = (ORData *) user_data;
- ORStream *stream = oggz_table_lookup (ordata->streams, serialno);
-
- checked_fwrite (og->header, 1, og->header_len, ordata->outfile);
- checked_fwrite (og->body, 1, og->body_len, ordata->outfile);
-
- if (ogg_page_eos ((ogg_page *)og) && stream != NULL) {
- oggz_table_remove (ordata->streams, serialno);
- orstream_delete (ordata, stream);
- }
-
- return 0;
-}
-
-static int
-read_page (OGGZ *oggz, const ogg_page *og, long serialno, void *user_data)
-{
- ORData *ordata = (ORData *) user_data;
- ORStream *stream = oggz_table_lookup (ordata->streams, serialno);
-
- if (ogg_page_bos ((ogg_page *)og)) {
- stream = orstream_new (oggz, ordata, og, serialno);
- stream = oggz_table_insert (ordata->streams, serialno, stream);
- assert (stream != NULL);
-
- if (filter_stream_p (ordata, stream, og, serialno)) {
- oggz_set_read_page (oggz, serialno, rip_page, user_data);
- rip_page (oggz, og, serialno, user_data);
- }
- }
-
- return 0;
-}
-
-static int
-oggz_rip (ORData * ordata)
-{
- long n;
-
- oggz_set_read_page (ordata->reader, -1, read_page, ordata);
-
- while ((n = oggz_read (ordata->reader, READ_SIZE))) {
-
- if (n <= 0)
- return n;
-
- if (ordata->verbose) {
- fprintf (stderr, "\r Read %li k, wrote %li k ...\r",
- (long) (oggz_tell (ordata->reader)/1024),
- (long) (ftell (ordata->outfile)/1024));
- }
- }
-
- if (ordata->verbose)
- fprintf (stderr, "\r Done. \n");
-
- return 0;
-}
-
-static int
-or_get_long (const char *optarg, const char *currentopt,
- long *value)
-{
- char *tailptr;
-
- *value = strtol (optarg, &tailptr, 10);
-
- if (*tailptr != '\0') {
- fprintf (stderr, "ERROR: non-integer argument to option `%s': %s\n",
- currentopt, optarg);
- return -1;
- }
-
- return 0;
-}
-
-int
-main (int argc, char * argv[])
-{
- int show_version = 0;
- int show_help = 0;
-
- char * progname;
- char * infilename = NULL, * outfilename = NULL;
- FILE * infile = NULL;
- const char *currentopt = argv[1];
- ORData * ordata;
- long l;
- int i, n;
-
- ot_init();
-
- progname = argv[0];
-
- if (argc < 2) {
- usage (progname);
- return (1);
- }
-
- ordata = ordata_new ();
-
- while (1) {
- char * optstring = "hvVo:s:i:c:";
-
-#ifdef HAVE_GETOPT_LONG
- static struct option long_options[] = {
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'v'},
- {"output", required_argument, 0, 'o'},
- {"verbose", no_argument, 0, 'V'},
- {"serialno", required_argument, 0, 's'},
- {"stream-index", required_argument, 0, 'i'},
- {"content-type", required_argument, 0, 'c'},
- {0,0,0,0}
- };
-
- i = getopt_long (argc, argv, optstring, long_options, NULL);
-#else
- i = getopt (argc, argv, optstring);
-#endif
- if (i == -1) break;
- if (i == ':') {
- usage (progname);
- goto exit_err;
- }
-
- switch (i) {
- case 'h': /* help */
- show_help = 1;
- break;
- case 'v': /* version */
- show_version = 1;
- break;
- case 'o': /* output */
- outfilename = optarg;
- break;
- case 'V': /* verbose */
- ordata->verbose = 1;
- break;
- case 's': /* serialno */
- if (or_get_long (optarg, currentopt, &l))
- goto exit_err;
- oggz_table_insert (ordata->serialno_table, l, (void *)0x7);
- break;
- case 'i': /* stream index */
- if (or_get_long (optarg, currentopt, &l))
- goto exit_err;
- oggz_table_insert (ordata->stream_index_table, l, (void *)0x7);
- break;
- case 'c': /* content-type */
- n = oggz_table_size (ordata->content_types_table);
- oggz_table_insert (ordata->content_types_table, (long)n, optarg);
- break;
- default:
- break;
- }
-
- currentopt = argv[optind];
- }
-
- if (show_version) {
- printf ("%s version " VERSION "\n", progname);
- }
-
- if (show_help) {
- usage (progname);
- }
-
- if (show_version || show_help) {
- goto exit_ok;
- }
-
- if (optind != argc-1) {
- usage (progname);
- goto exit_err;
- }
-
- infilename = argv[optind];
- infile = fopen (infilename, "rb");
- if (infile == NULL) {
- fprintf (stderr, "%s: unable to open input file %s : %s\n", progname,
- infilename, strerror (errno));
- goto exit_err;
- } else {
- ordata->reader = oggz_open_stdio (infile, OGGZ_READ|OGGZ_AUTO);
- }
-
- if (outfilename == NULL) {
- ordata->outfile = stdout;
- } else {
- ordata->outfile = fopen (outfilename, "wb");
- if (ordata->outfile == NULL) {
- fprintf (stderr, "%s: unable to open output file %s : %s\n",
- progname, outfilename, strerror (errno));
- goto exit_err;
- }
- }
-
- oggz_rip (ordata);
-
- exit_ok:
- ordata_delete (ordata);
- exit (0);
-
- exit_err:
- ordata_delete (ordata);
- exit (1);
-}
More information about the commits
mailing list