File: lqt_audiocodec.c

package info (click to toggle)
libquicktime 2%3A0.9.7-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,824 kB
  • ctags: 4,320
  • sloc: ansic: 45,467; sh: 8,613; makefile: 480
file content (133 lines) | stat: -rw-r--r-- 4,162 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include "funcprotos.h"
#include <quicktime/lqt.h>
#include <quicktime/lqt_codecapi.h>

/* Let's define prototypes here */

void quicktime_init_codec_ima4(quicktime_audio_map_t *atrack);
void quicktime_init_codec_rawaudio(quicktime_audio_map_t *atrack);
void quicktime_init_codec_twos(quicktime_audio_map_t *atrack);
void quicktime_init_codec_ulaw(quicktime_audio_map_t *atrack);
void quicktime_init_codec_sowt(quicktime_audio_map_t *atrack);

static char * fourccs_ima4[]  = { QUICKTIME_IMA4, (char*)0 };
static char * fourccs_raw[]   = { QUICKTIME_RAW,  (char*)0 };
static char * fourccs_twos[]  = { QUICKTIME_TWOS, (char*)0 };
static char * fourccs_ulaw[]  = { QUICKTIME_ULAW, (char*)0 };
static char * fourccs_sowt[]  = { "sowt",         (char*)0 };

static lqt_codec_info_static_t codec_info_ima4 =
  {
    name:                "ima4",
    long_name:           "ima4",
    description:         "The IMA4 compressor reduces 16 bit audio data to 1/4\
 size, with very good quality",
    fourccs:             fourccs_ima4,
    wav_ids:             (int[]){ 0x11, LQT_WAV_ID_NONE },
    type:                LQT_CODEC_AUDIO,
    direction:           LQT_DIRECTION_BOTH,
    encoding_parameters: (lqt_parameter_info_static_t*)0,
    decoding_parameters: (lqt_parameter_info_static_t*)0
  };

static lqt_codec_info_static_t codec_info_raw =
  {
    name:                "rawaudio",
    long_name:           "Raw 8 bit audio",
    description:         "Don't use this for anything better than telephone \
quality",
    fourccs:             fourccs_raw,
    type:                LQT_CODEC_AUDIO,
    direction:           LQT_DIRECTION_BOTH,
    encoding_parameters: (lqt_parameter_info_static_t*)0,
    decoding_parameters: (lqt_parameter_info_static_t*)0
  };

static lqt_codec_info_static_t codec_info_twos =
  {
    name:         "twos",
    long_name:    "Twos",
    description:  "Twos is the preferred encoding for uncompressed audio",
    fourccs:      fourccs_twos,
    type:         LQT_CODEC_AUDIO,
    direction:    LQT_DIRECTION_BOTH,
    encoding_parameters: (lqt_parameter_info_static_t*)0,
    decoding_parameters: (lqt_parameter_info_static_t*)0
  };

static lqt_codec_info_static_t codec_info_ulaw =
  {
    name:         "ulaw",
    long_name:    "Ulaw",     /* Long name of the codec */
    description:  "Ulaw",      /* Description            */
    fourccs:      fourccs_ulaw,
    wav_ids:      (int[]){ 0x07, LQT_WAV_ID_NONE },
    type:         LQT_CODEC_AUDIO,
    direction:    LQT_DIRECTION_BOTH,
    encoding_parameters: (lqt_parameter_info_static_t*)0,
    decoding_parameters: (lqt_parameter_info_static_t*)0
  };

static lqt_codec_info_static_t codec_info_sowt =
  {
    name:         "sowt",
    long_name:    "Sowt",
    description:  "8/16/24 bit PCM Little endian",
    fourccs:      fourccs_sowt,
    wav_ids:      (int[]){ 0x01, LQT_WAV_ID_NONE },
    type:         LQT_CODEC_AUDIO,
    direction:    LQT_DIRECTION_BOTH,
    encoding_parameters: (lqt_parameter_info_static_t*)0,
    decoding_parameters: (lqt_parameter_info_static_t*)0
  };

/* These are called from the plugin loader */

extern int get_num_codecs() { return 5; }

extern lqt_codec_info_static_t * get_codec_info(int index)
  {
  switch(index)
    {
    case 0: /* ima4 */
      return &codec_info_ima4;
      break;
    case 1: /* raw */
      return &codec_info_raw;
      break;
    case 2: /* Twos */
      return &codec_info_twos;
      break;
    case 3: /* Ulaw */
      return &codec_info_ulaw;
      break;
    case 4: /* Sowt */
      return &codec_info_sowt;
      break;
    }
  
  return (lqt_codec_info_static_t*)0;
  }
     
extern lqt_init_audio_codec_func_t get_audio_codec(int index)
  {
  switch(index)
    {
    case 0: /* ima4 */
      return quicktime_init_codec_ima4;
      break;
    case 1: /* raw */
      return quicktime_init_codec_rawaudio;
      break;
    case 2: /* Twos */
      return quicktime_init_codec_twos;
      break;
    case 3: /* Ulaw */
      return quicktime_init_codec_ulaw;
      break;
    case 4: /* Sowt */
      return quicktime_init_codec_sowt;
      break;
    }
  return (lqt_init_audio_codec_func_t)0;
  }