view libaf/af_mp.c @ 8607:d6f40a06867b

Changes includes: - Improved runtime control system - 3 New filter panning, compressor/limiter and a noise gate - The compressor/limiter and the noise gate are not yet finished - The panning filter does combined mixing and channel routing and can be used to down-mix from stereo to mono (for example) - Improvements to volume and channel - volume now has a very good soft clipping using sin() - channel can handle generic routing of audio data - Conversion of all filters to handle floating point data - Cleanup of message printing - Fix for the sig 11 bug reported by Denes
author anders
date Sat, 28 Dec 2002 13:59:53 +0000
parents 1205e37a3ab2
children 2369087bb777
line wrap: on
line source

#include "af.h"

/* Decodes the format from mplayer format to libaf format */
int af_format_decode(int ifmt)
{
  int ofmt = ~0;
  // Check input ifmt
  switch(ifmt){
  case(AFMT_U8):
    ofmt = AF_FORMAT_LE|AF_FORMAT_US; break;
  case(AFMT_S8):
    ofmt = AF_FORMAT_LE|AF_FORMAT_SI; break;
  case(AFMT_S16_LE):
    ofmt = AF_FORMAT_LE|AF_FORMAT_SI; break;
  case(AFMT_S16_BE):
    ofmt = AF_FORMAT_BE|AF_FORMAT_SI; break;
  case(AFMT_U16_LE):	
    ofmt = AF_FORMAT_LE|AF_FORMAT_US; break;
  case(AFMT_U16_BE):	
    ofmt = AF_FORMAT_BE|AF_FORMAT_US; break;
  case(AFMT_S32_LE):
    ofmt = AF_FORMAT_LE|AF_FORMAT_SI; break;
  case(AFMT_S32_BE):	
    ofmt = AF_FORMAT_BE|AF_FORMAT_SI; break;
  case(AFMT_IMA_ADPCM):
    ofmt = AF_FORMAT_IMA_ADPCM; break;
  case(AFMT_MU_LAW):
    ofmt = AF_FORMAT_MU_LAW; break;
  case(AFMT_A_LAW):
    ofmt = AF_FORMAT_A_LAW; break;
  case(AFMT_MPEG):
    ofmt = AF_FORMAT_MPEG2; break;
  case(AFMT_AC3):
    ofmt = AF_FORMAT_AC3; break;
  case(AFMT_FLOAT):
    ofmt = AF_FORMAT_F; break;
  default: 
    //This can not happen .... 
    af_msg(AF_MSG_FATAL,"Unrecognized input audio format %i\n",ifmt);
    break;
  }
  return ofmt;
}