File: ex_opus.h

package info (click to toggle)
asterisk-opus 13.7%2B20161113-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 216 kB
  • sloc: ansic: 1,263; makefile: 54
file content (38 lines) | stat: -rw-r--r-- 941 bytes parent folder | download | duplicates (3)
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
/*! \file
 * \brief 8-bit data
 *
 * Copyright (C) 2014, Lorenzo Miniero
 *
 * Distributed under the terms of the GNU General Public License
 *
 */

#include "asterisk/format_cache.h"      /* for ast_format_opus */
#include "asterisk/frame.h"             /* for ast_frame, etc */

/* Opus, a 20ms sample */
static uint8_t ex_opus[] = {
	0x4b, 0x41, 0x25, 0x0b, 0xe4, 0x55, 0xc6, 0x74,
	0xda, 0xbb, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

static struct ast_frame *opus_sample(void)
{
	static struct ast_frame f = {
		.frametype = AST_FRAME_VOICE,
		.datalen = sizeof(ex_opus),
		.samples = OPUS_SAMPLES,
		.mallocd = 0,
		.offset = 0,
		.src = __PRETTY_FUNCTION__,
		.data.ptr = ex_opus,
	};

	f.subclass.format = ast_format_opus;

	return &f;
}