FFmpeg
Macros | Functions | Variables
channel_layout.c File Reference
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/error.h"
#include "libavutil/internal.h"
#include "libavutil/macros.h"
#include "libavutil/mem.h"

Go to the source code of this file.

Macros

#define BPRINT_ARGS1(bp, ...)   (bp), __VA_ARGS__
 
#define BPRINT_ARGS0(bp, ...)   __VA_ARGS__, (bp)
 
#define ORD_ARGS1(str, size, ...)   (str), (size), __VA_ARGS__
 
#define ORD_ARGS0(str, size, ...)   __VA_ARGS__, (str), (size)
 
#define CMP_BPRINT_AND_NONBPRINT(bp, func_name, ARG_ORDER, ...)
 
#define CHANNEL_NAME(x)
 
#define CHANNEL_DESCRIPTION(x)
 
#define CHANNEL_FROM_STRING(x)   printf("With %-38s %8d\n", AV_STRINGIFY(x)":", av_channel_from_string(x))
 
#define CHANNEL_LAYOUT_FROM_MASK(x)   channel_layout_from_mask(&layout, &bp, (x));
 
#define CHANNEL_LAYOUT_FROM_STRING(x)
 
#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(l, x)
 
#define CHANNEL_LAYOUT_SUBSET(l, xstr, x)
 
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(l, x)
 
#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(l, x)
 
#define CHANNEL_LAYOUT_INDEX_FROM_STRING(l, x)
 

Functions

static void channel_name (AVBPrint *bp, enum AVChannel channel)
 
static void channel_description (AVBPrint *bp, enum AVChannel channel)
 
static void channel_layout_from_mask (AVChannelLayout *layout, AVBPrint *bp, uint64_t channel_layout)
 
static void channel_layout_from_string (AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
 
static void describe_type (AVBPrint *bp, AVChannelLayout *layout)
 
static const char * channel_layout_retype (AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
 
int main (void)
 

Variables

static const char * channel_order_names [] = {"UNSPEC", "NATIVE", "CUSTOM", "AMBI"}
 

Macro Definition Documentation

◆ BPRINT_ARGS1

#define BPRINT_ARGS1 (   bp,
  ... 
)    (bp), __VA_ARGS__

Definition at line 32 of file channel_layout.c.

◆ BPRINT_ARGS0

#define BPRINT_ARGS0 (   bp,
  ... 
)    __VA_ARGS__, (bp)

Definition at line 33 of file channel_layout.c.

◆ ORD_ARGS1

#define ORD_ARGS1 (   str,
  size,
  ... 
)    (str), (size), __VA_ARGS__

Definition at line 34 of file channel_layout.c.

◆ ORD_ARGS0

#define ORD_ARGS0 (   str,
  size,
  ... 
)    __VA_ARGS__, (str), (size)

Definition at line 35 of file channel_layout.c.

◆ CMP_BPRINT_AND_NONBPRINT

#define CMP_BPRINT_AND_NONBPRINT (   bp,
  func_name,
  ARG_ORDER,
  ... 
)

Definition at line 38 of file channel_layout.c.

◆ CHANNEL_NAME

#define CHANNEL_NAME (   x)
Value:
channel_name(&bp, (x)); \
printf("With %-32s %14s\n", AV_STRINGIFY(x)":", bp.str)

Definition at line 164 of file channel_layout.c.

◆ CHANNEL_DESCRIPTION

#define CHANNEL_DESCRIPTION (   x)
Value:
channel_description(&bp, (x)); \
printf("With %-23s %23s\n", AV_STRINGIFY(x)":", bp.str);

Definition at line 168 of file channel_layout.c.

◆ CHANNEL_FROM_STRING

#define CHANNEL_FROM_STRING (   x)    printf("With %-38s %8d\n", AV_STRINGIFY(x)":", av_channel_from_string(x))

Definition at line 172 of file channel_layout.c.

◆ CHANNEL_LAYOUT_FROM_MASK

#define CHANNEL_LAYOUT_FROM_MASK (   x)    channel_layout_from_mask(&layout, &bp, (x));

Definition at line 175 of file channel_layout.c.

◆ CHANNEL_LAYOUT_FROM_STRING

#define CHANNEL_LAYOUT_FROM_STRING (   x)
Value:
printf("With \"%s\":%*s %32s\n", x, strlen(x) > 32 ? 0 : 32 - (int)strlen(x), "", bp.str);

Definition at line 178 of file channel_layout.c.

◆ CHANNEL_LAYOUT_CHANNEL_FROM_INDEX

#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX (   l,
 
)
Value:
if (ret < 0) \
ret = -1; \
printf("On \"%s\" layout with %2d: %8d\n", l, x, ret)

Definition at line 182 of file channel_layout.c.

◆ CHANNEL_LAYOUT_SUBSET

#define CHANNEL_LAYOUT_SUBSET (   l,
  xstr,
 
)
Value:
printf("On \"%s\" layout with %-22s 0x%"PRIx64"\n", l, xstr, mask)

Definition at line 188 of file channel_layout.c.

◆ CHANNEL_LAYOUT_INDEX_FROM_CHANNEL

#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL (   l,
 
)
Value:
if (ret < 0) \
ret = -1; \
printf("On \"%s\" layout with %-23s %3d\n", l, AV_STRINGIFY(x)":", ret)

Definition at line 192 of file channel_layout.c.

◆ CHANNEL_LAYOUT_CHANNEL_FROM_STRING

#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING (   l,
 
)
Value:
if (ret < 0) \
ret = -1; \
printf("On \"%s\" layout with %-21s %3d\n", bp.str, AV_STRINGIFY(x)":", ret);

Definition at line 198 of file channel_layout.c.

◆ CHANNEL_LAYOUT_INDEX_FROM_STRING

#define CHANNEL_LAYOUT_INDEX_FROM_STRING (   l,
 
)
Value:
if (ret < 0) \
ret = -1; \
printf("On \"%s\" layout with %-20s %3d\n", l, AV_STRINGIFY(x)":", ret);

Definition at line 204 of file channel_layout.c.

Function Documentation

◆ channel_name()

static void channel_name ( AVBPrint *  bp,
enum AVChannel  channel 
)
static

Definition at line 81 of file channel_layout.c.

◆ channel_description()

static void channel_description ( AVBPrint *  bp,
enum AVChannel  channel 
)
static

Definition at line 87 of file channel_layout.c.

◆ channel_layout_from_mask()

static void channel_layout_from_mask ( AVChannelLayout layout,
AVBPrint *  bp,
uint64_t  channel_layout 
)
static

Definition at line 93 of file channel_layout.c.

◆ channel_layout_from_string()

static void channel_layout_from_string ( AVChannelLayout layout,
AVBPrint *  bp,
const char *  channel_layout 
)
static

Definition at line 105 of file channel_layout.c.

◆ describe_type()

static void describe_type ( AVBPrint *  bp,
AVChannelLayout layout 
)
static

Definition at line 119 of file channel_layout.c.

Referenced by channel_layout_retype().

◆ channel_layout_retype()

static const char* channel_layout_retype ( AVChannelLayout layout,
AVBPrint *  bp,
const char *  channel_layout 
)
static

Definition at line 130 of file channel_layout.c.

Referenced by main().

◆ main()

int main ( void  )

Definition at line 210 of file channel_layout.c.

Variable Documentation

◆ channel_order_names

const char* channel_order_names[] = {"UNSPEC", "NATIVE", "CUSTOM", "AMBI"}
static

Definition at line 117 of file channel_layout.c.

Referenced by channel_layout_retype(), and describe_type().

av_channel_layout_channel_from_index
enum AVChannel av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx)
Get the channel with the given index in a channel layout.
Definition: channel_layout.c:664
channel_name
static void channel_name(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:81
mask
static const uint16_t mask[17]
Definition: lzw.c:38
av_channel_layout_index_from_string
int av_channel_layout_index_from_string(const AVChannelLayout *channel_layout, const char *str)
Get the index in a channel layout of a channel described by the given string.
Definition: channel_layout.c:738
channel_description
static void channel_description(AVBPrint *bp, enum AVChannel channel)
Definition: channel_layout.c:87
channel_layout_from_string
static void channel_layout_from_string(AVChannelLayout *layout, AVBPrint *bp, const char *channel_layout)
Definition: channel_layout.c:105
layout
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
Definition: filter_design.txt:18
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition: macros.h:66
ret
ret
Definition: filter_design.txt:187
av_channel_layout_subset
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, uint64_t mask)
Find out what channels from a given set are present in a channel layout, without regard for their pos...
Definition: channel_layout.c:856
av_channel_layout_channel_from_string
enum AVChannel av_channel_layout_channel_from_string(const AVChannelLayout *channel_layout, const char *str)
Get a channel described by the given string.
Definition: channel_layout.c:693
av_channel_layout_index_from_channel
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
Definition: channel_layout.c:704