I have been working VOIP software for some time now. I have a 88MW300 (ARM CORTEX M4) micro controller and i was wondering if i could implement SIP Protocol in the controller So that I may be able to use that device as a IP Phone to make and receive calls.
This Controller uses FreeRTOS OS and thus if there is any way to build SIP stacks would also be helpful.
I am very much new to Micro controllers and building firmware into it.So any kind of help will be appreciated.
I Tried using PJSIP source Code to compile in the board. But it is not fully compatible and gives quite a few errors. Reason being PJSIP does not have config for freertos. and also PJSIP is very large compared to the flash memory of the board. I am focusing on reducing the size later but want to successfully built it first.
The basic config file for any os is something like this.
#ifndef __PJ_COMPAT_OS_LINUX_H__
#define __PJ_COMPAT_OS_LINUX_H__
/**
* #file os_linux.h
* #brief Describes Linux operating system specifics.
*/
#define PJ_OS_NAME "linux"
#define PJ_HAS_ARPA_INET_H 1
#define PJ_HAS_ASSERT_H 1
#define PJ_HAS_CTYPE_H 1
#define PJ_HAS_ERRNO_H 1
#define PJ_HAS_LINUX_SOCKET_H 0
#define PJ_HAS_MALLOC_H 1
#define PJ_HAS_NETDB_H 1
#define PJ_HAS_NETINET_IN_H 1
#define PJ_HAS_SETJMP_H 1
#define PJ_HAS_STDARG_H 1
#define PJ_HAS_STDDEF_H 1
#define PJ_HAS_STDIO_H 1
#define PJ_HAS_STDLIB_H 1
#define PJ_HAS_STRING_H 1
#define PJ_HAS_SYS_IOCTL_H 1
#define PJ_HAS_SYS_SELECT_H 1
#define PJ_HAS_SYS_SOCKET_H 1
#define PJ_HAS_SYS_TIME_H 1
#define PJ_HAS_SYS_TIMEB_H 1
#define PJ_HAS_SYS_TYPES_H 1
#define PJ_HAS_TIME_H 1
#define PJ_HAS_UNISTD_H 1
#define PJ_HAS_SEMAPHORE_H 1
#define PJ_HAS_MSWSOCK_H 0
#define PJ_HAS_WINSOCK_H 0
#define PJ_HAS_WINSOCK2_H 0
#define PJ_HAS_LOCALTIME_R 1
#define PJ_SOCK_HAS_INET_ATON 1
/* Set 1 if native sockaddr_in has sin_len member.
* Default: 0
*/
#define PJ_SOCKADDR_HAS_LEN 0
/**
* If this macro is set, it tells select I/O Queue that select() needs to
* be given correct value of nfds (i.e. largest fd + 1). This requires
* select ioqueue to re-scan the descriptors on each registration and
* unregistration.
* If this macro is not set, then ioqueue will always give FD_SETSIZE for
* nfds argument when calling select().
*
* Default: 0
*/
#define PJ_SELECT_NEEDS_NFDS 0
/* Is errno a good way to retrieve OS errors?
*/
#define PJ_HAS_ERRNO_VAR 1
/* When this macro is set, getsockopt(SOL_SOCKET, SO_ERROR) will return
* the status of non-blocking connect() operation.
*/
#define PJ_HAS_SO_ERROR 1
/* This value specifies the value set in errno by the OS when a non-blocking
* socket recv() can not return immediate daata.
*/
#define PJ_BLOCKING_ERROR_VAL EAGAIN
/* This value specifies the value set in errno by the OS when a non-blocking
* socket connect() can not get connected immediately.
*/
#define PJ_BLOCKING_CONNECT_ERROR_VAL EINPROGRESS
/* Default threading is enabled, unless it's overridden. */
#ifndef PJ_HAS_THREADS
# define PJ_HAS_THREADS (1)
#endif
#define PJ_HAS_HIGH_RES_TIMER 1
#define PJ_HAS_MALLOC 1
#ifndef PJ_OS_HAS_CHECK_STACK
# define PJ_OS_HAS_CHECK_STACK 0
#endif
#define PJ_NATIVE_STRING_IS_UNICODE 0
#define PJ_ATOMIC_VALUE_TYPE long
/* If 1, use Read/Write mutex emulation for platforms that don't support it */
#define PJ_EMULATE_RWMUTEX 0
/* If 1, pj_thread_create() should enforce the stack size when creating
* threads.
* Default: 0 (let OS decide the thread's stack size).
*/
#define PJ_THREAD_SET_STACK_SIZE 0
/* If 1, pj_thread_create() should allocate stack from the pool supplied.
* Default: 0 (let OS allocate memory for thread's stack).
*/
#define PJ_THREAD_ALLOCATE_STACK 0
/* Linux has socklen_t */
#define PJ_HAS_SOCKLEN_T 1
#endif /* __PJ_COMPAT_OS_LINUX_H__ */
Again i am a little blurry as to what parameters should i put for FREERTOS.
Another error i get is in error generation.
the Error generation file (errorno.h) is given as.
#ifndef __PJ_COMPAT_ERRNO_H__
#define __PJ_COMPAT_ERRNO_H__
#if defined(PJ_WIN32) && PJ_WIN32 != 0 || \
defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0 || \
defined(PJ_WIN64) && PJ_WIN64 != 0
typedef unsigned long pj_os_err_type;
# define pj_get_native_os_error() GetLastError()
# define pj_get_native_netos_error() WSAGetLastError()
#elif defined(PJ_HAS_ERRNO_VAR) && PJ_HAS_ERRNO_VAR!= 0
typedef int pj_os_err_type;
# define pj_get_native_os_error() (errno)
# define pj_get_native_netos_error() (errno)
#else
# error "Please define how to get errno for this platform here!"
#endif
#endif /* __PJ_COMPAT_ERRNO_H__ */
I have no idea what parameters do i add for my platform.
These are the few errors i get while compiling, After that i think i will succesfully build it.
Any kind of help will be helpful.
Thank you
Related
In my code i am using the variable PATH_MAX for a buffer size. I had a problem when i was including the library who is supposed to define it #include <limits.h>. When i use this library my IDE doesn't recognize the variable as being define but when I include the library like #include <linux/limits.h> there is no problem and the variable is define. My question is what is the difference between both of them and will it cause problem when I will cross-compile my project ?
Thank you for all answer!
The limits.h header is a standard header that all implementations are required to supply. This contains numerical limits such as INT_MIN and INT_MAX among others. PATH_MAX is not part of this file.
The linux/limits.h header is specific to Linux. It is here that PATH_MAX is defined.
linux/limits.h is a very small header file:
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H
#define NR_OPEN 1024
#define NGROUPS_MAX 65536 /* supplemental group IDs are available */
#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
#define LINK_MAX 127 /* # links a file may have */
#define MAX_CANON 255 /* size of the canonical input queue */
#define MAX_INPUT 255 /* size of the type-ahead buffer */
#define NAME_MAX 255 /* # chars in a file name */
#define PATH_MAX 4096 /* # chars in a path name including nul */
#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */
#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */
#define RTSIG_MAX 32
#endif
And this file is defining PATH_MAX in Linux.
limits.h is a C standard header defining language (not system) related macros.
i'm using macros to define static size for some arrays in my code, i have defined a config macro variable at the top of my code and some macro variables depend on said macro variable. i can make a function that takes that value and returns the required size of the array but that would execute in runtime and i'll need to use VLAs.
example below shows macro for SIZE of a number (with no repeating digits) and whether that number can begin with a zero ("0123" vs "1234").
code to calculate LIMIT in runtime:
int limit(int size, int npz){
l = npz ? 9 : 10;
for(int i = 1; i < size; i++)
l *= 10 - i;
return l;
}
i manually calculated the amount of said numbers for all values. is there a work around?
#define SIZE 4 // 1 .. 10
#define NO_PADDING_ZERO 1 // 1 | 0
#if NO_PADDING_ZERO
#if SIZE == 1
#define LIMIT 9
#elif SIZE == 2
#define LIMIT 81
#elif SIZE == 3
#define LIMIT 648
#elif SIZE == 4
#define LIMIT 4536
#elif SIZE == 5
#define LIMIT 27216
#elif SIZE == 6
#define LIMIT 136080
#elif SIZE == 7
#define LIMIT 544320
#elif SIZE == 8
#define LIMIT 1632960
#else
#define LIMIT 3265920
#endif
#else
#if SIZE == 1
#define LIMIT 10
#elif SIZE == 2
#define LIMIT 90
#elif SIZE == 3
#define LIMIT 720
#elif SIZE == 4
#define LIMIT 5040
#elif SIZE == 5
#define LIMIT 30240
#elif SIZE == 6
#define LIMIT 151200
#elif SIZE == 7
#define LIMIT 604800
#elif SIZE == 8
#define LIMIT 1814400
#else
#define LIMIT 3628800
#endif
#endif
The workaround could be to generate C code from something else.
Consider learning more, using GPP or your own C code generator (perhaps using GNU bison and in some simple cases GNU gawk or GNU autoconf).
Observe that on Linux or POSIX, you could generate C code, compile it as a plugin, and dlopen(3) that plugin. For a useless example, see manydl.c. For useful (but obsolete) example, see my old GCC MELT.
Another approach (GCC specific) might be to extend your compiler with GCC plugins. See bismon.
You can also generate machine code (in your program) using GNU lightning or (in C++) asmjit. Then read the Dragon book and this answer.
Read some books by Jacques Pitrat explaining that metaprogramming approach (reused in RefPerSys)
The concepts related to partial evaluation are relevant.
It's this some kind of the factorial?
(10 - NO_PADDING_ZERO) * 9 * 8 * ... * (10 - LIMIT)
You can use this in the loop expression in a macro or an inline function and the optimizing compiler will compute it at compile time.
#include <bool.h>
inline int limit(int size, bool npz){
int l = 10 - npz;
for(int i = 1; i < size; i++)
l *= 10 - i;
return l;
}
#define LIMIT (limit(SIZE, NO_PADDING_ZERO))
If you wish you may define a precomputed array and use
#define LIMIT (array[SIZE][NO_PADDING_ZERO])
I write a bootloader for an AVR XMega Microcontroller and the bootloader got configured by a configuration file:
Config_Bootloader.h
#ifndef CONFIG_BOOTLOADER_H_
#define CONFIG_BOOTLOADER_H_
#include <avr/io.h>
#define BOOTLOADER_INTERFACE &USARTE0
#define BOOTLOADER_BAUD 115200
#define BOOTLOADER_TX 3
#endif /* CONFIG_BOOTLOADER_H_ */
This configuration file is should be preprocessed by another include file to get some register values etc.
Bootloader_Preprocessing.h
#ifndef BOOTLOADER_PREPROCESSING_H_
#define BOOTLOADER_PREPROCESSING_H_
#include <avr/io.h>
#ifdef USARTE0
#if(BOOTLOADER_INTERFACE == &USARTE0)
#define BOOTLOADER_PORT &PORTE
#else
#error "Invalid bootloader interface!"
#endif
#endif
#if(BOOTLOADER_BAUD == 9600)
#define BOOTLOADER_BRREG_VALUE 12
#define BOOTLOADER_SCALE_VALUE 0
#elif(BOOTLOADER_BAUD == 19200)
#define BOOTLOADER_BRREG_VALUE 11
#define BOOTLOADER_SCALE_VALUE -1
#elif(BOOTLOADER_BAUD == 38400)
#define BOOTLOADER_BRREG_VALUE 9
#define BOOTLOADER_SCALE_VALUE -2
#elif(BOOTLOADER_BAUD == 57600)
#define BOOTLOADER_BRREG_VALUE 75
#define BOOTLOADER_SCALE_VALUE -6
#elif(BOOTLOADER_BAUD == 115200)
#define BOOTLOADER_BRREG_VALUE 11
#define BOOTLOADER_SCALE_VALUE -7
#else
#error "Invalid baud rate for bootloader!"
#endif
#endif /* BOOTLOADER_PREPROCESSING_H_ */
I include both files into my Bootloader.h
#ifndef BOOTLOADER_H_
#define BOOTLOADER_H_
#include "Config_Bootloader.h"
#include "Bootloader_Preprocessing.h"
#endif /* BOOTLOADER_H_ */
And I get this errors and warnings:
> #define BOOTLOADER_INTERFACE &USARTE0
operator '&' has no left operand
> #if(BOOTLOADER_INTERFACE == &USARTE0)
in expansion of macro 'BOOTLOADER_INTERFACE'
#error "Invalid bootloader interface!"
So why does the compare of the address doesn´t work?
There is no such thing as an "address" in the preprocessor, therefore they cannot be compared in an #if preprocessor instruction.
See the GCC docs for #IF for details on what it can and can't do. Consult the documentation for the preprocessor you are using, additional/different restrictions may apply (you tagged this as AVR).
It seems that your preprocessor concluded that the operator & has to be the bitwise operator &, which is a binary operator and therefore requires a left operand.
Okay, I have a solution after struggeling with the C preprocessor.
I define the symbol BOOTLOADER_INTERFACE=E,0 in my config and process the input:
#define CATENATE(Prefix, Name) Prefix##Name
#define FIRST_ARG(A, B) A
#define SECOND_ARG(A, B) B
#define MAKE_USART_NAME(Uart) CATENATE(USART, Uart)
#define MAKE_PORT_NAME(Port) CATENATE(PORT, Port)
#define USART_NAME(Name) MAKE_USART_NAME(CATENATE(Name))
#define PORT_NAME(Name) MAKE_PORT_NAME(FIRST_ARG(Name))
The result is the address of the PORT- and USART-Structure, depending on the given USART interface.
Most POSIX-compatible systems provide a function to get or set one of high-resolution timers:
int clock_gettime(clockid_t clock_id, struct timespec *tp);
Documentation for each system usually lists several symbolic names as possible clock_id values, but actual numeric values are never mentioned. It turns out that not only the numeric values are different across various systems, but symbolic names are also not the same for the same meaning. Even more so, not all the clocks actually supported by a system are defined in time.h (bits/time.h) — some are only defined in, let's say, linux/time.h.
That is, in a Linux system we may have:
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID 3
#define CLOCK_MONOTONIC_RAW 4
#define CLOCK_REALTIME_COARSE 5
#define CLOCK_MONOTONIC_COARSE 6
#define CLOCK_BOOTTIME 7
#define CLOCK_REALTIME_ALARM 8
#define CLOCK_BOOTTIME_ALARM 9
#define CLOCK_SGI_CYCLE 10 // In linux/time.h only.
#define CLOCK_TAI 11 // In linux/time.h only.
In Cygwin environment (not a verbatim excerpt):
#define CLOCK_REALTIME 1 // Means CLOCK_MONOTONIC?
#define CLOCK_MONOTONIC 4 // Means CLOCK_MONOTONIC_RAW?
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID 3
In FreeBSD:
#define CLOCK_REALTIME 0
#define CLOCK_VIRTUAL 1
#define CLOCK_PROF 2
#define CLOCK_MONOTONIC 4
#define CLOCK_UPTIME 5 // Synonymous to CLOCK_BOOTTIME?
#define CLOCK_UPTIME_PRECISE 7
#define CLOCK_UPTIME_FAST 8
#define CLOCK_REALTIME_PRECISE 9 // Same as CLOCK_REALTIME?
#define CLOCK_REALTIME_FAST 10 // Synonymous to CLOCK_REALTIME_COARSE?
#define CLOCK_MONOTONIC_PRECISE 11 // Same as CLOCK_MONOTONIC?
#define CLOCK_MONOTONIC_FAST 12 // Synonymous to CLOCK_MONOTONIC_COARSE?
#define CLOCK_SECOND 13
#define CLOCK_THREAD_CPUTIME_ID 14
#define CLOCK_PROCESS_CPUTIME_ID 15
In AIX:
#define CLOCK_REALTIME ...
#define CLOCK_MONOTONIC ...
#define CLOCK_PROCESS_CPUTIME_ID ...
#define CLOCK_THREAD_CPUTIME_ID ...
In SunOS:
#define CLOCK_REALTIME ...
#define CLOCK_HIGHRES ... // Synonymous to CLOCK_MONOTONIC_RAW?
In QNX:
#define CLOCK_REALTIME ...
#define CLOCK_SOFTTIME ...
#define CLOCK_MONOTONIC ...
And so on.
This makes me wonder how to use clock_gettime() with the first argument other than CLOCK_REALTIME in a portable way. For example, if I want to use CLOCK_MONOTONIC_COARSE or CLOCK_BOOTTIME, how do I know that BSD calls them CLOCK_MONOTONIC_FAST and CLOCK_UPTIME, respectively, instead?
Is it wise to make assumptions based on numeric values of the first 4 symbolic names? Such as:
#define POSIX_CLOCK_REALTIME 0
#define POSIX_CLOCK_MONOTONIC 1
#define POSIX_CLOCK_PROCESS_CPUTIME_ID 2
#define POSIX_CLOCK_THREAD_CPUTIME_ID 3
#define POSIX_CLOCK_MONOTONIC_RAW 4
#if CLOCK_REALTIME == POSIX_CLOCK_MONOTONIC
#warning This platform has monotonic realtime clock.
#end if
#if CLOCK_MONOTONIC == POSIX_CLOCK_MONOTONIC_RAW
#warning This platform has undisciplined monotonic clock.
#end if
If a system actually supports CLOCK_TAI but does not define it in time.h, how can I check and use that, taking into account that the same numeric value 11 may stand for CLOCK_MONOTONIC_PRECISE or whatever in other systems?
If I was trying to write a maximally-portable program, I would limit myself to the symbolic values defined in the relevant Standard. (From what you say, it sounds like CLOCK_REALTIME -- and perhaps only that value -- is standard.)
If some systems implement useful extensions that I wanted to use, I would test for them by saying
#ifdef CLOCK_MONOTONIC_COARSE
... my code calling clock_gettime(CLOCK_MONOTONIC_COARSE, &ts) ...
#endif
And if it's really true that there are systems out there where the same symbolic values end up meaning distinctly different things, I would throw up my hands and declare that to be a portability nightmare, the kind that I, at least, try to stay far away from.
In answer to your other questions, (1) no, it's not wise to make assumptions about the symbolic values, and (2) there's no good way to use a clock that somehow does exist but is not defined in time.h (though this situation would hopefully be quite rare).
Also, are you assuming that just because the numeric value 1 is used for CLOCK_MONOTONIC on Linux but for CLOCK_REALTIME under Cygwin means that those clocks might somehow be the same? That's probably not the case. The numbers are arbitrary and you shouldn't care about them; that's why the symbolic constants exist!
I keep having a strange issue lately.
Depending on how I set up my audio configuration in windows ( stereo/quad/5.1 ), a ffmpeg call to avcodec_open2() fails with error -22 or just works.
Not being able to find much about that error, I thought I should ask about it here.
The main flow goes like this:
c = st->codec;
avformat_alloc_output_context2(&oc, NULL, NULL, "video.mpeg");
oc->fmt->audio_codec = AV_CODEC_ID_MP2;
AVDictionary* dict = NULL;
ret = av_dict_set(&dict, "ac", "2", 0);
c->request_channels = 2;
ret = avcodec_open2(c, codec, &dict); //HERE IT FAILS WITH -22 if speaker configuration is not stereo
The codec context 'c' is set up like this in a stream:
st = avformat_new_stream(oc, *codec);
c = st->codec;
c->channels = 2;
c->channel_layout = AV_CH_LAYOUT_STEREO;
c->sample_fmt = AV_SAMPLE_FMT_S16;
c->codec_id = codec_id;
Most of it is copied from their one of the muxing examples found in the documentation.
Everything works as expected if in windows I have set the output to stereo.
If I set my speaker configuration to 5.1 ( 6 channels ), avcodec_open2 fails with error -22.
So I have a hard time understanding what am I doing wrong. Normally it should not be any relationship between my speaker configuration and the result of avcodec_open2.
Are there some other parameters that I need to set ?
Here is the header for file libavcodec\avcodec.h taken from How can I find out what this ffmpeg error code means?
#if EINVAL > 0
#define AVERROR(e) (-(e)) /**< Returns a negative error code from a POSIX error code, to return from library functions. */
#define AVUNERROR(e) (-(e)) /**< Returns a POSIX error code from a library function error return value. */
#else
/* Some platforms have E* and errno already negated. */
#define AVERROR(e) (e)
#define AVUNERROR(e) (e)
#endif
#define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */
#define AVERROR_IO AVERROR(EIO) /**< I/O error */
#define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< Number syntax expected in filename. */
#define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */
#define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */
#define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */
#define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< Operation not supported. */
#define AVERROR_NOENT AVERROR(ENOENT) /**< No such file or directory. */
#define AVERROR_EOF AVERROR(EPIPE) /**< End of file. */
#define AVERROR_PATCHWELCOME -MKTAG('P','A','W','E') /**< Not yet implemented in FFmpeg. Patches welcome. */
then
errno.h header file for the EINVAL
#define EINVAL 22 /* Invalid argument */
P.S. AVERROR means (-(-22)) = 22
LAYOUT for channels header channel_layout.h header file
/**
* #file
* audio conversion routines
*/
/* Audio channel masks */
#define AV_CH_FRONT_LEFT 0x00000001
#define AV_CH_FRONT_RIGHT 0x00000002
#define AV_CH_FRONT_CENTER 0x00000004
#define AV_CH_LOW_FREQUENCY 0x00000008
#define AV_CH_BACK_LEFT 0x00000010
#define AV_CH_BACK_RIGHT 0x00000020
#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
#define AV_CH_BACK_CENTER 0x00000100
#define AV_CH_SIDE_LEFT 0x00000200
#define AV_CH_SIDE_RIGHT 0x00000400
#define AV_CH_TOP_CENTER 0x00000800
#define AV_CH_TOP_FRONT_LEFT 0x00001000
#define AV_CH_TOP_FRONT_CENTER 0x00002000
#define AV_CH_TOP_FRONT_RIGHT 0x00004000
#define AV_CH_TOP_BACK_LEFT 0x00008000
#define AV_CH_TOP_BACK_CENTER 0x00010000
#define AV_CH_TOP_BACK_RIGHT 0x00020000
#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
/** Channel mask value used for AVCodecContext.request_channel_layout
to indicate that the user requests the channel order of the decoder output
to be the native codec channel order. */
#define AV_CH_LAYOUT_NATIVE 0x8000000000000000LL
/* Audio channel convenience macros */
#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)