int audio_size=0;
int main(int argc, char **argv){   int c;   int option_index = 0;   char *inFile, *outFile;   FILE *fin, *fout=NULL;   short out[MAX_FRAME_SIZE];   float output[MAX_FRAME_SIZE];   int frame_size=0;   void *st=NULL;   SpeexBits bits;   int packet_count=0;   int stream_init = 0;   struct option long_options[] =   {      {"help", no_argument, NULL, 0},      {"version", no_argument, NULL, 0},      {"enh", no_argument, NULL, 0},      {"no-enh", no_argument, NULL, 0},      {"pf", no_argument, NULL, 0},      {"no-pf", no_argument, NULL, 0},      {"force-nb", no_argument, NULL, 0},      {"force-wb", no_argument, NULL, 0},      {0, 0, 0, 0}   };   ogg_sync_state oy;   ogg_page       og;   ogg_packet     op;   ogg_stream_state os;   int enh_enabled;   int nframes=2;   int print_bitrate=0;   int close_in=0;   int eos=0;   int forceMode=-1;   enh_enabled = 0;   /*Process options*/   while(1)   {      c = getopt_long (argc, argv, "hvV",                       long_options, &option_index);      if (c==-1)         break;            switch(c)      {      case 0:         if (strcmp(long_options[option_index].name,"help")==0)         {            usage();            exit(0);         } else if (strcmp(long_options[option_index].name,"version")==0)         {            version();            exit(0);         } else if (strcmp(long_options[option_index].name,"enh")==0)         {            enh_enabled=1;         } else if (strcmp(long_options[option_index].name,"no-enh")==0)         {            enh_enabled=0;         } else if (strcmp(long_options[option_index].name,"pf")==0)         {            fprintf (stderr, "--pf is deprecated, use --enh instead\n");            enh_enabled=1;         } else if (strcmp(long_options[option_index].name,"no-pf")==0)         {            fprintf (stderr, "--no-pf is deprecated, use --no-enh instead\n");            enh_enabled=0;         } else if (strcmp(long_options[option_index].name,"force-nb")==0)         {            forceMode=0;         } else if (strcmp(long_options[option_index].name,"force-wb")==0)         {            forceMode=1;         }         break;      case 'h':         usage();         exit(0);         break;      case 'v':         version();         exit(0);         break;      case 'V':         print_bitrate=1;         break;      case '?':         usage();         exit(1);         break;      }   }   if (argc-optind!=2 && argc-optind!=1)   {      usage();      exit(1);   }   inFile=argv[optind];   if (argc-optind==2)      outFile=argv[optind+1];   else      outFile = "";   /*Open input file*/   if (strcmp(inFile, "-")==0)   {#if defined WIN32 || defined _WIN32      _setmode(_fileno(stdout), _O_BINARY);#endif      fin=stdin;   }   else    {#if defined WIN32 || defined _WIN32      fin = fopen(inFile, "rb");#else      fin = fopen(inFile, "r");#endif      if (!fin)      {         perror(inFile);         exit(1);      }      close_in=1;   }   /*Init Ogg data struct*/   ogg_sync_init(&oy);      speex_bits_init(&bits);   /*Main decoding loop*/   while (1)   {      char *data;      int i, j, nb_read;      /*Get the ogg buffer for writing*/      data = ogg_sync_buffer(&oy, 200);      /*Read bitstream from input file*/      nb_read = fread(data, sizeof(char), 200, fin);            ogg_sync_wrote(&oy, nb_read);      /*Loop for all complete pages we got (most likely only one)*/      while (ogg_sync_pageout(&oy, &og)==1)      {         if (stream_init == 0) {            ogg_stream_init(&os, ogg_page_serialno(&og));            stream_init = 1;         }         /*Add page to the bitstream*/         ogg_stream_pagein(&os, &og);         /*Extract all available packets*/         while (!eos && ogg_stream_packetout(&os, &op)==1)         {            /*If first packet, process as Speex header*/            if (packet_count==0)            {               int rate;               st = process_header(&op, enh_enabled, &frame_size, &rate, &nframes, forceMode);               if (!nframes)                  nframes=1;               if (!st)                  exit(1);               fout = out_file_open(outFile, rate);            } else if (packet_count==1){               fprintf (stderr, "File comments: ");               fwrite(op.packet, 1, op.bytes, stderr);               fprintf (stderr, "\n");            } else {               /*End of stream condition*/               if (op.e_o_s)                  eos=1;               /*Copy Ogg packet to Speex bitstream*/               speex_bits_read_from(&bits, (char*)op.packet, op.bytes);               for (j=0;j<nframes;j++)               {                  /*Decode frame*/                  speex_decode(st, &bits, output);                                 if (print_bitrate) {                     int tmp;                     char ch=13;                     speex_decoder_ctl(st, SPEEX_GET_BITRATE, &tmp);                     fputc (ch, stderr);                     fprintf (stderr, "Bitrate is use: %d bps     ", tmp);                  }                  /*PCM saturation (just in case)*/                  for (i=0;i<frame_size;i++)                  {                     if (output[i]>32000)                        output[i]=32000;                     else if (output[i]<-32000)                        output[i]=-32000;                  }                  /*Convert to short and save to output file*/                  for (i=0;i<frame_size;i++)                     out[i]=(short)le_short(output[i]);#if defined WIN32 || defined _WIN32                  if (strlen(outFile)==0)                      WIN_Play_Samples (out, sizeof(short) * frame_size);                  else#endif                  fwrite(out, sizeof(short), frame_size, fout);               }            }            packet_count++;         }      }      if (feof(fin))         break;   }   if (st)      speex_decoder_destroy(st);   speex_bits_destroy(&bits);   ogg_sync_clear(&oy);   ogg_stream_clear(&os);   if (close_in)      fclose(fin);   fclose(fout);   return 1;}