File: codec_compat.c

package info (click to toggle)
rat 4.2.22-2.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,896 kB
  • ctags: 3,717
  • sloc: ansic: 36,542; tcl: 2,740; sh: 2,675; makefile: 295
file content (52 lines) | stat: -rw-r--r-- 1,323 bytes parent folder | download | duplicates (5)
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
/*
 * FILE:    codec_compat.c
 * AUTHORS: Orion Hodson
 *
 * Copyright (c) 1998-2001 University College London
 * All rights reserved.
 */
 
#ifndef HIDE_SOURCE_STRINGS
static const char cvsid[] = 
	"$Id: codec_compat.c,v 1.3 2001/01/08 20:29:55 ucaccsp Exp $";
#endif /* HIDE_SOURCE_STRINGS */

#include <config_unix.h>
#include <config_win32.h>

#include "codec_compat.h"

/* Backward compatibility name mapping for earlier MBONE audio applications */

struct s_compat_entry {
        const char *newname;
        const char *oldname;
};

static struct s_compat_entry name_map[] = {
        {"PCMU-8K-MONO", "pcm"},
        {"PCMU-8K-MONO", "pcmu"},
        {"PCMU-8K-MONO", "ulaw"},
        {"PCMA-8K-MONO", "pcma"},
        {"PCMU-8K-MONO", "alaw"},
        {"DVI-8K-MONO",  "dvi"},
        {"GSM-8K-MONO",  "gsm"},
        {"LPC-8K-MONO",  "lpc"},
        {"L16-8K-MONO",  "l16"}
};

#define NUM_COMPAT_NAMES sizeof(name_map)/sizeof(name_map[0])

const char *
codec_get_compatible_name(const char *name)
{
        uint16_t i;
        if (name != NULL) {
                for (i = 0; i < NUM_COMPAT_NAMES; i++) {
                        if (!strcasecmp(name, name_map[i].oldname)) {
                                return name_map[i].newname;
                        }
                }
        }
        return name;
}