~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjmedia/include/pjmedia/wave.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: wave.h 3553 2011-05-05 06:14:19Z nanang $ */
2
 
/*
3
 
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
 
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or
9
 
 * (at your option) any later version.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * GNU General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 
 */
20
 
#ifndef __PJMEDIA_WAVE_H__
21
 
#define __PJMEDIA_WAVE_H__
22
 
 
23
 
 
24
 
/**
25
 
 * @file wave.h
26
 
 * @brief WAVE file manipulation.
27
 
 */
28
 
#include <pjmedia/types.h>
29
 
 
30
 
/**
31
 
 * @defgroup PJMEDIA_FILE_FORMAT File Formats
32
 
 * @brief Supported file formats
33
 
 */
34
 
 
35
 
 
36
 
/**
37
 
 * @defgroup PJMEDIA_WAVE WAVE Header
38
 
 * @ingroup PJMEDIA_FILE_FORMAT
39
 
 * @brief Representation of RIFF/WAVE file format
40
 
 * @{
41
 
 *
42
 
 * This the the low level representation of RIFF/WAVE file format. For
43
 
 * higher abstraction, please see \ref PJMEDIA_FILE_PLAY and
44
 
 * \ref PJMEDIA_FILE_REC.
45
 
 */
46
 
 
47
 
 
48
 
PJ_BEGIN_DECL
49
 
 
50
 
/**
51
 
 * Standard RIFF tag to identify RIFF file format in the WAVE header.
52
 
 */
53
 
#define PJMEDIA_RIFF_TAG        ('F'<<24|'F'<<16|'I'<<8|'R')
54
 
 
55
 
/**
56
 
 * Standard WAVE tag to identify WAVE header.
57
 
 */
58
 
#define PJMEDIA_WAVE_TAG        ('E'<<24|'V'<<16|'A'<<8|'W')
59
 
 
60
 
/**
61
 
 * Standard FMT tag to identify format chunks.
62
 
 */
63
 
#define PJMEDIA_FMT_TAG         (' '<<24|'t'<<16|'m'<<8|'f')
64
 
 
65
 
/**
66
 
 * Standard DATA tag to identify data chunks.
67
 
 */
68
 
#define PJMEDIA_DATA_TAG        ('a'<<24|'t'<<16|'a'<<8|'d')
69
 
 
70
 
/**
71
 
 * Standard FACT tag to identify fact chunks.
72
 
 */
73
 
#define PJMEDIA_FACT_TAG        ('t'<<24|'c'<<16|'a'<<8|'f')
74
 
 
75
 
 
76
 
/**
77
 
 * Enumeration of format compression tag.
78
 
 */
79
 
typedef enum {
80
 
    PJMEDIA_WAVE_FMT_TAG_PCM    = 1,
81
 
    PJMEDIA_WAVE_FMT_TAG_ALAW   = 6,
82
 
    PJMEDIA_WAVE_FMT_TAG_ULAW   = 7
83
 
} pjmedia_wave_fmt_tag;
84
 
 
85
 
 
86
 
/**
87
 
 * This file describes the simpler/canonical version of a WAVE file.
88
 
 * It does not support the full RIFF format specification.
89
 
 */
90
 
#pragma pack(2)
91
 
struct pjmedia_wave_hdr
92
 
{
93
 
    /** This structure describes RIFF WAVE file header */
94
 
    struct {
95
 
        pj_uint32_t riff;               /**< "RIFF" ASCII tag.          */
96
 
        pj_uint32_t file_len;           /**< File length minus 8 bytes  */
97
 
        pj_uint32_t wave;               /**< "WAVE" ASCII tag.          */
98
 
    } riff_hdr;
99
 
 
100
 
    /** This structure describes format chunks/header  */
101
 
    struct {
102
 
        pj_uint32_t fmt;                /**< "fmt " ASCII tag.          */
103
 
        pj_uint32_t len;                /**< 16 for PCM.                */
104
 
        pj_uint16_t fmt_tag;            /**< 1 for PCM                  */
105
 
        pj_uint16_t nchan;              /**< Number of channels.        */
106
 
        pj_uint32_t sample_rate;        /**< Sampling rate.             */
107
 
        pj_uint32_t bytes_per_sec;      /**< Average bytes per second.  */
108
 
        pj_uint16_t block_align;        /**< nchannels * bits / 8       */
109
 
        pj_uint16_t bits_per_sample;    /**< Bits per sample.           */
110
 
    } fmt_hdr;
111
 
 
112
 
    /** The data header preceeds the actual data in the file. */
113
 
    struct {
114
 
        pj_uint32_t data;               /**< "data" ASCII tag.          */
115
 
        pj_uint32_t len;                /**< Data length.               */
116
 
    } data_hdr;
117
 
};
118
 
#pragma pack()
119
 
 
120
 
/**
121
 
 * @see pjmedia_wave_hdr
122
 
 */
123
 
typedef struct pjmedia_wave_hdr pjmedia_wave_hdr;
124
 
 
125
 
/**
126
 
 * This structure describes generic RIFF subchunk header.
127
 
 */
128
 
typedef struct pjmedia_wave_subchunk
129
 
{
130
 
    pj_uint32_t     id;                 /**< Subchunk ASCII tag.            */
131
 
    pj_uint32_t     len;                /**< Length following this field    */
132
 
} pjmedia_wave_subchunk;
133
 
 
134
 
 
135
 
/**
136
 
 * Normalize subchunk header from little endian (the representation of
137
 
 * RIFF file) into host's endian.
138
 
 */
139
 
#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0
140
 
#   define PJMEDIA_WAVE_NORMALIZE_SUBCHUNK(ch)  \
141
 
            do { \
142
 
                (ch)->id = pj_swap32((ch)->id); \
143
 
                (ch)->len = pj_swap32((ch)->len); \
144
 
            } while (0)
145
 
#else
146
 
#   define PJMEDIA_WAVE_NORMALIZE_SUBCHUNK(ch)
147
 
#endif
148
 
 
149
 
 
150
 
/**
151
 
 * On big-endian hosts, this function swaps the byte order of the values
152
 
 * in the WAVE header fields. On little-endian hosts, this function does
153
 
 * nothing.
154
 
 *
155
 
 * Application SHOULD call this function after reading the WAVE header
156
 
 * chunks from a file.
157
 
 *
158
 
 * @param hdr       The WAVE header.
159
 
 */
160
 
PJ_DECL(void) pjmedia_wave_hdr_file_to_host( pjmedia_wave_hdr *hdr );
161
 
 
162
 
 
163
 
/**
164
 
 * On big-endian hosts, this function swaps the byte order of the values
165
 
 * in the WAVE header fields. On little-endian hosts, this function does
166
 
 * nothing.
167
 
 *
168
 
 * Application SHOULD call this function before writing the WAVE header
169
 
 * to a file.
170
 
 *
171
 
 * @param hdr       The WAVE header.
172
 
 */
173
 
PJ_DECL(void) pjmedia_wave_hdr_host_to_file( pjmedia_wave_hdr *hdr );
174
 
 
175
 
 
176
 
PJ_END_DECL
177
 
 
178
 
/**
179
 
 * @}
180
 
 */
181
 
 
182
 
 
183
 
#endif  /* __PJMEDIA_WAVE_H__ */