view libao2/afmt.c @ 9009:f2d4324561b2

1) Removed the code to remove {} from sub_read_line_ssa 2) Put this code in a separated function: sub_pp_ssa 3) After recoding added a call to sub_pp_ssa. To be more acqurate: I added a pointer to function to hold a postprocessing function to be invoked after using iconv. There are one pointer for each format, if this pointer isn.t NULL the post processing function is called. patch by Salvador Eduardo Tropea <salvador@inti.gov.ar> help by <hephooey@fastmail.fm>
author arpi
date Sun, 19 Jan 2003 00:54:55 +0000
parents c8677169cc2c
children 131b6c682863
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>

#include "../config.h"
#include "afmt.h"

char *audio_out_format_name(int format)
{
    switch (format)
    {
	case AFMT_MU_LAW:
	    return("Mu-Law");
	case AFMT_A_LAW:
	    return("A-Law");
	case AFMT_IMA_ADPCM:
	    return("Ima-ADPCM");
	case AFMT_S8:
	    return("Signed 8-bit");
	case AFMT_U8:
	    return("Unsigned 8-bit");
	case AFMT_U16_LE:
	    return("Unsigned 16-bit (Little-Endian)");
	case AFMT_U16_BE: 
	    return("Unsigned 16-bit (Big-Endian)");
	case AFMT_S16_LE:
	    return("Signed 16-bit (Little-Endian)");
	case AFMT_S16_BE:
	    return("Signed 16-bit (Big-Endian)");
	case AFMT_MPEG:
	    return("MPEG (2) audio");
	case AFMT_AC3:
	    return("AC3");
/*
  the following two formats are not available with old linux kernel
  headers (e.g. in 2.2.16)
*/
#ifdef AFMT_S32_LE
	case AFMT_S32_LE:
	    return("Signed 32-bit (Little-Endian)");
#endif
#ifdef AFMT_S32_BE
	case AFMT_S32_BE:
	    return("Signed 32-bit (Big-Endian)");
#endif
	case AFMT_FLOAT:
	    return("Floating Point");
    }
    return("Unknown");
}

// return number of bits for 1 sample in one channel, or 8 bits for compressed
int audio_out_format_bits(int format){
    switch (format)
    {
	case AFMT_S16_LE:
	case AFMT_S16_BE:
	case AFMT_U16_LE:
	case AFMT_U16_BE: 
	return 16;//16 bits

/*
  the following two formats are not available with old linux kernel
  headers (e.g. in 2.2.16)
*/
#ifdef AFMT_S32_LE
	case AFMT_S32_LE:
	return 32;
#endif
#ifdef AFMT_S32_BE
	case AFMT_S32_BE:
	return 32;
#endif
	case AFMT_FLOAT:
	return 32;
	
	case AFMT_MU_LAW:
	case AFMT_A_LAW:
	case AFMT_IMA_ADPCM:
	case AFMT_S8:
	case AFMT_U8:
	case AFMT_MPEG:
	case AFMT_AC3:
	default:
	    return 8;//default 1 byte
	
    }
    return 8;
}