[xiph-commits] r3344 - libfishsound/branches/1.0-stable/src/examples

conrad at svn.annodex.net conrad at svn.annodex.net
Fri Jan 11 19:44:59 PST 2008


Author: conrad
Date: 2008-01-11 19:44:59 -0800 (Fri, 11 Jan 2008)
New Revision: 3344

Modified:
   libfishsound/branches/1.0-stable/src/examples/fishsound-decode.c
   libfishsound/branches/1.0-stable/src/examples/fishsound-encdec.c
   libfishsound/branches/1.0-stable/src/examples/fishsound-encode.c
   libfishsound/branches/1.0-stable/src/examples/fishsound-identify.c
   libfishsound/branches/1.0-stable/src/examples/fishsound-info.c
Log:
use and document FLAC in all example programs, and use .oga as expected
extension in fishsound-decode


Modified: libfishsound/branches/1.0-stable/src/examples/fishsound-decode.c
===================================================================
--- libfishsound/branches/1.0-stable/src/examples/fishsound-decode.c	2008-01-12 02:48:16 UTC (rev 3343)
+++ libfishsound/branches/1.0-stable/src/examples/fishsound-decode.c	2008-01-12 03:44:59 UTC (rev 3344)
@@ -95,7 +95,7 @@
   if (argc < 3) {
     printf ("usage: %s infilename outfilename\n", argv[0]);
     printf ("*** FishSound example program. ***\n");
-    printf ("Decodes an Ogg Speex or Ogg Vorbis file producing a PCM wav file.\n");
+    printf ("Decodes an Ogg FLAC, Speex or Ogg Vorbis file producing a PCM wav file.\n");
     exit (1);
   }
 

Modified: libfishsound/branches/1.0-stable/src/examples/fishsound-encdec.c
===================================================================
--- libfishsound/branches/1.0-stable/src/examples/fishsound-encdec.c	2008-01-12 02:48:16 UTC (rev 3343)
+++ libfishsound/branches/1.0-stable/src/examples/fishsound-encdec.c	2008-01-12 03:44:59 UTC (rev 3344)
@@ -59,8 +59,9 @@
   printf ("Duplicates a PCM sound file by encoding and decoding\n");
   printf ("Usage: %s [options] infile outfile\n\n", progname);
   printf ("Options:\n");
+  printf ("  --flac                    Use FLAC as intermediate codec\n");
+  printf ("  --speex                   Use Speex as intermediate codec\n");
   printf ("  --vorbis                  Use Vorbis as intermediate codec\n");
-  printf ("  --speex                   Use Speex as intermediate codec\n");
   exit (1);
 }
 
@@ -160,13 +161,16 @@
   }
 
   /* Set the default intermediate format based on what's available */
-  format = HAVE_VORBIS ? FISH_SOUND_VORBIS : FISH_SOUND_SPEEX;
+  format = HAVE_VORBIS ? FISH_SOUND_VORBIS :
+           HAVE_FLAC ? FISH_SOUND_FLAC : FISH_SOUND_SPEEX;
 
   for (i = 1; i < argc; i++) {
     if (!strcmp (argv[i], "--vorbis")) {
       format = FISH_SOUND_VORBIS;
     } else if (!strcmp (argv[i], "--speex")) {
       format = FISH_SOUND_SPEEX;
+    } else if (!strcmp (argv[i], "--flac")) {
+      format = FISH_SOUND_FLAC;
     } else if (!strcmp (argv[i], "--help") || !strcmp (argv[i], "-h")) {
       usage(argv[0]);
     } else if (argv[i] && argv[i][0] != '-') {
@@ -196,6 +200,15 @@
     }
   }
 
+  if (format == FISH_SOUND_FLAC) {
+    if (HAVE_FLAC) {
+      printf ("Using FLAC as the intermediate codec\n");
+    } else {
+      fprintf (stderr, "Error: FLAC support disabled\n");
+      exit (1);
+    }
+  }
+
   ed = fs_encdec_new (infilename, outfilename, format, blocksize);
 
   while ((n = sf_readf_float (ed->sndfile_in, ed->pcm, blocksize)) > 0) {

Modified: libfishsound/branches/1.0-stable/src/examples/fishsound-encode.c
===================================================================
--- libfishsound/branches/1.0-stable/src/examples/fishsound-encode.c	2008-01-12 02:48:16 UTC (rev 3343)
+++ libfishsound/branches/1.0-stable/src/examples/fishsound-encode.c	2008-01-12 03:44:59 UTC (rev 3344)
@@ -88,7 +88,7 @@
   if (argc < 3) {
     printf ("usage: %s infile outfile\n", argv[0]);
     printf ("*** FishSound example program. ***\n");
-    printf ("Opens a pcm audio file and encodes it to an Ogg Vorbis or Speex file.\n");
+    printf ("Opens a PCM audio file and encodes it to an Ogg FLAC, Speex or Ogg Vorbis file.\n");
     exit (1);
   }
 
@@ -109,7 +109,7 @@
   ext = strrchr (outfilename, '.');
   if (ext && !strncasecmp (ext, ".spx", 4))
     format = FISH_SOUND_SPEEX;
-  else if (ext && !strncasecmp (ext, ".flc", 4))
+  else if (ext && !strncasecmp (ext, ".oga", 4))
     format = FISH_SOUND_FLAC;   
   else
     format = FISH_SOUND_VORBIS;

Modified: libfishsound/branches/1.0-stable/src/examples/fishsound-identify.c
===================================================================
--- libfishsound/branches/1.0-stable/src/examples/fishsound-identify.c	2008-01-12 02:48:16 UTC (rev 3343)
+++ libfishsound/branches/1.0-stable/src/examples/fishsound-identify.c	2008-01-12 03:44:59 UTC (rev 3344)
@@ -52,7 +52,7 @@
   switch (format) {
   case FISH_SOUND_VORBIS: printf ("Vorbis\n"); break;
   case FISH_SOUND_SPEEX: printf ("Speex\n"); break;
-  case FISH_SOUND_FLAC: printf ("Flac\n"); break;
+  case FISH_SOUND_FLAC: printf ("FLAC\n"); break;
   default: printf ("Unknown\n");
   }
 
@@ -86,7 +86,8 @@
 
   if (argc < 2) {
     printf ("usage: %s filename\n", argv[0]);
-    printf ("Checks whether a file is a speex or a vorbis file.\n");
+    printf ("*** FishSound example program. ***\n");
+    printf ("Checks whether a file is an Ogg FLAC, Speex or Ogg Vorbis file.\n");
     exit (1);
   }
 

Modified: libfishsound/branches/1.0-stable/src/examples/fishsound-info.c
===================================================================
--- libfishsound/branches/1.0-stable/src/examples/fishsound-info.c	2008-01-12 02:48:16 UTC (rev 3343)
+++ libfishsound/branches/1.0-stable/src/examples/fishsound-info.c	2008-01-12 03:44:59 UTC (rev 3344)
@@ -99,7 +99,7 @@
   if (argc < 2) {
     printf ("usage: %s infilename\n", argv[0]);
     printf ("*** FishSound example program. ***\n");
-    printf ("Display information about an Ogg Speex or Ogg Vorbis file.\n");
+    printf ("Display information about an Ogg FLAC, Speex or Ogg Vorbis file.\n");
     exit (1);
   }
 



More information about the commits mailing list