[xiph-commits] r3634 - in liboggz/trunk: doc src/tools

conrad at svn.annodex.net conrad at svn.annodex.net
Wed Jul 9 02:55:41 PDT 2008


Author: conrad
Date: 2008-07-09 02:55:41 -0700 (Wed, 09 Jul 2008)
New Revision: 3634

Added:
   liboggz/trunk/doc/oggz-known-codecs.1.sgml
   liboggz/trunk/src/tools/oggz-known-codecs.c
Modified:
   liboggz/trunk/doc/Makefile.am
   liboggz/trunk/src/tools/Makefile.am
Log:
Add oggz-known-codecs tool, which simply lists the content-types names which
are valid arguments to -c for other oggz commands


Modified: liboggz/trunk/doc/Makefile.am
===================================================================
--- liboggz/trunk/doc/Makefile.am	2008-07-09 09:55:27 UTC (rev 3633)
+++ liboggz/trunk/doc/Makefile.am	2008-07-09 09:55:41 UTC (rev 3634)
@@ -1,7 +1,7 @@
 docdir=$(prefix)/share/doc/@PACKAGE@
 
 if HAVE_DOCBOOKTOMAN
-man_MANS = oggz-diff.1 oggz-dump.1 oggz-info.1 oggz-merge.1 oggz-chop.1 \
+man_MANS = oggz-diff.1 oggz-dump.1 oggz-info.1 oggz-known-codecs.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 =
@@ -13,7 +13,7 @@
 EXTRA_DIST = $(man_MANS) Doxyfile.in \
 	forcefeed.fig forcefeed.eps forcefeed.png \
 	hungry.fig hungry.eps hungry.png \
-	oggz-diff.1.sgml oggz-dump.1.sgml oggz-info.1.sgml oggz-merge.1.sgml \
+	oggz-diff.1.sgml oggz-dump.1.sgml oggz-info.1.sgml oggz-known-codecs.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
 
@@ -21,8 +21,8 @@
 # not be built or distributed
 noinst_DATA = doxygen-build.stamp
 
-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 \
+html: oggz.1.html oggz-diff.1.html oggz-dump.1.html oggz-info.1.html oggz-known-codecs.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

Added: liboggz/trunk/doc/oggz-known-codecs.1.sgml
===================================================================
--- liboggz/trunk/doc/oggz-known-codecs.1.sgml	                        (rev 0)
+++ liboggz/trunk/doc/oggz-known-codecs.1.sgml	2008-07-09 09:55:41 UTC (rev 3634)
@@ -0,0 +1,157 @@
+<!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>July  9, 2008</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 at annodex.net</email>">
+  <!ENTITY dhusername  "Annodex Association">
+  <!ENTITY dhucpackage "<refentrytitle>oggz-known-codecs</refentrytitle>">
+  <!ENTITY dhpackage   "oggz-known-codecs">
+                                                                                 <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+]>
+
+<refentry id="oggz-known-codecs">
+
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2008</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+
+  <refmeta>
+    &dhucpackage;
+    &dhsection;
+  </refmeta>
+
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+    <refpurpose>List codecs known by this version of Oggz
+    </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">-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> lists the names of codecs for which oggz can
+      interpret timestamps and report general information. These codec names are
+      valid arguments to the <parameter>-c</parameter>, <parameter>--content-type</parameter>
+      arguments to other <command>oggz</command> commands.
+    </para>
+  </refsect1>
+  
+  <refsect1>
+    <title>Options</title>
+    <para>
+      <command>&dhpackage;</command> accepts the following options:
+    </para>
+            
+    <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>AUTHOR</title>
+    <para>
+      <author>
+	&dhfirstname; &dhsurname;
+      </author>
+      &dhdate
+    </para>
+  </refsect1>
+
+  <refsect1>
+    <title>COPYRIGHT</title>
+    <para>
+      Copyright &copy; 2008 &dhusername;
+    </para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+    <para>
+      <citerefentry>
+	<refentrytitle>oggz</refentrytitle>
+	<manvolnum>1</manvolnum>
+      </citerefentry>,
+      <citerefentry>
+	<refentrytitle>oggz-info</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-09 09:55:27 UTC (rev 3633)
+++ liboggz/trunk/src/tools/Makefile.am	2008-07-09 09:55:41 UTC (rev 3634)
@@ -13,7 +13,7 @@
 OGGZDIR = ../liboggz
 OGGZ_LIBS = $(OGGZDIR)/liboggz.la @OGG_LIBS@
 
-oggz_any_programs = oggz
+oggz_any_programs = oggz oggz-known-codecs
 
 if OGGZ_CONFIG_READ
 oggz_read_programs = oggz-dump oggz-info oggz-scan
@@ -35,6 +35,9 @@
 oggz_SOURCES = oggz.c
 oggz_LDADD =
 
+oggz_known_codecs_SOURCES = oggz-known-codecs.c
+oggz_known_codecs_LDADD = $(OGGZ_LIBS)
+
 oggz_info_SOURCES = oggz-info.c oggz_tools.c skeleton.c
 oggz_info_LDADD = $(OGGZ_LIBS) -lm
 

Added: liboggz/trunk/src/tools/oggz-known-codecs.c
===================================================================
--- liboggz/trunk/src/tools/oggz-known-codecs.c	                        (rev 0)
+++ liboggz/trunk/src/tools/oggz-known-codecs.c	2008-07-09 09:55:41 UTC (rev 3634)
@@ -0,0 +1,120 @@
+/*
+   Copyright (C) 2008 Annodex Association
+
+   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 the Annodex Association 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 <unistd.h>
+
+#include <oggz/oggz.h>
+
+/* #define DEBUG */
+
+int
+usage (char * progname)
+{
+  printf ("Usage: oggz-known-codecs [options]\n\n");
+
+  printf ("List codecs known by this version of oggz\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 ("Please report bugs to <ogg-dev at xiph.org>\n");
+
+  return 0;
+}
+
+static int
+cmpstringp (const char **p1, const char **p2)
+{
+   /* The actual arguments to this function are "pointers to
+      pointers to char", but strcmp(3) arguments are "pointers
+      to char", hence the following cast plus dereference */
+
+   if (!(*p1)) return -1;
+   if (!(*p2)) return 1;
+
+   return strcmp(* (char * const *) p1, * (char * const *) p2);
+}
+
+int
+main (int argc, char ** argv)
+{
+  OggzStreamContent content;
+  char * content_types[OGGZ_CONTENT_UNKNOWN];
+
+  char * progname = argv[0];
+
+  if (argc == 2) {
+    if (!strncmp (argv[1], "-v", 2) || !strncmp (argv[1], "--version", 9)) {
+      printf ("%s version " VERSION "\n", progname);
+      exit (0);
+    } else if (!strncmp (argv[1], "-h", 2) || !strncmp (argv[1], "--help", 6)) {
+      usage (progname);
+      exit (0);
+    } else {
+      usage (progname);
+      exit (1);
+    }
+  } else if (argc > 2) {
+    usage (progname);
+    exit (1);
+  }
+  
+  /* Collect the content type names, filtering out deprecated and
+     duplicates ones */
+  for (content = 0; content < OGGZ_CONTENT_UNKNOWN; content++) {
+    switch (content) {
+      case OGGZ_CONTENT_FLAC0:
+      case OGGZ_CONTENT_ANXDATA:
+        content_types[content] = NULL;
+        break;
+      default:
+        content_types[content] = oggz_content_type (content);
+        break;
+    }
+  }
+
+  /* Sort them */
+  qsort (content_types, OGGZ_CONTENT_UNKNOWN, sizeof (char *), cmpstringp);
+
+  /* Print them */
+  for (content = 0; content < OGGZ_CONTENT_UNKNOWN; content++) {
+    if (content_types[content])
+      puts (content_types[content]);
+  }
+
+  exit (0);
+}



More information about the commits mailing list