~ubuntu-branches/ubuntu/hardy/speex/hardy-security

« back to all changes in this revision

Viewing changes to src/speexenc.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2005-12-07 23:22:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051207232221-nme7vf9m182p7dpe
Tags: 1.1.11.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
#include "wav_io.h"
51
51
#include <speex/speex_header.h>
52
52
#include <speex/speex_stereo.h>
53
 
#include "misc.h"
54
53
#include <speex/speex_preprocess.h>
55
54
 
56
 
#ifdef DISABLE_GLOBAL_POINTERS
57
 
#include <speex/speex_noglobals.h>
58
 
#endif
59
 
 
60
55
#if defined WIN32 || defined _WIN32
61
56
#include "getopt_win.h"
62
57
/* We need the following two to set stdout to binary */
152
147
void version()
153
148
{
154
149
   printf ("speexenc (Speex encoder) version " SPEEX_VERSION " (compiled " __DATE__ ")\n");
155
 
   printf ("Copyright (C) 2002-2003 Jean-Marc Valin\n");
 
150
   printf ("Copyright (C) 2002-2005 Jean-Marc Valin\n");
156
151
}
157
152
 
158
153
void version_short()
159
154
{
160
155
   printf ("speexenc version " SPEEX_VERSION "\n");
161
 
   printf ("Copyright (C) 2002-2003 Jean-Marc Valin\n");
 
156
   printf ("Copyright (C) 2002-2005 Jean-Marc Valin\n");
162
157
}
163
158
 
164
159
void usage()
228
223
   int dtx_enabled=0;
229
224
   int nbBytes;
230
225
   const SpeexMode *mode=NULL;
231
 
   int modeID = 0;
 
226
   int modeID = -1;
232
227
   void *st;
233
228
   SpeexBits bits;
234
229
   char cbits[MAX_FRAME_BYTES];
475
470
      }
476
471
   }
477
472
 
478
 
   if (!mode && !rate)
 
473
   if (modeID==-1 && !rate)
479
474
   {
480
475
      /* By default, use narrowband/8 kHz */
481
476
      modeID = SPEEX_MODEID_NB;
482
477
      rate=8000;
483
 
   } else if (mode && rate)
 
478
   } else if (modeID!=-1 && rate)
484
479
   {
485
480
      if (rate>48000)
486
481
      {
508
503
         fprintf (stderr, "Error: sampling rate too low: %d Hz\n", rate);
509
504
         exit(1);
510
505
      }
511
 
   } else if (!mode)
 
506
   } else if (modeID==-1)
512
507
   {
513
508
      if (rate>48000)
514
509
      {
541
536
      if (rate!=8000 && rate!=16000 && rate!=32000)
542
537
         fprintf (stderr, "Warning: Speex is only optimized for 8, 16 and 32 kHz. It will still work at %d Hz but your mileage may vary\n", rate); 
543
538
 
544
 
#ifdef DISABLE_GLOBAL_POINTERS
545
 
   mode = speex_mode_new (modeID);
546
 
#else
547
 
   mode = speex_mode_list[modeID];
548
 
#endif
 
539
   mode = speex_lib_get_mode (modeID);
549
540
 
550
541
   speex_init_header(&header, rate, 1, mode);
551
542
   header.frames_per_packet=nframes;
794
785
         bytes_written += ret;
795
786
   }
796
787
 
797
 
#ifdef DISABLE_GLOBAL_POINTERS
798
 
   speex_mode_destroy (mode);
799
 
#endif   
800
 
 
801
788
   speex_encoder_destroy(st);
802
789
   speex_bits_destroy(&bits);
803
790
   ogg_stream_clear(&os);