Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e45a92dc
Commit
e45a92dc
authored
Jun 03, 2012
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audioconvert: implement av_bprint_channel_layout().
And reimplement av_get_channel_layout_string() on top of it.
parent
7a2b4291
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
audioconvert.c
libavutil/audioconvert.c
+18
-8
audioconvert.h
libavutil/audioconvert.h
+6
-0
No files found.
libavutil/audioconvert.c
View file @
e45a92dc
...
...
@@ -26,6 +26,7 @@
#include "avstring.h"
#include "avutil.h"
#include "audioconvert.h"
#include "bprint.h"
static
const
char
*
const
channel_names
[]
=
{
[
0
]
=
"FL"
,
/* front left */
...
...
@@ -136,8 +137,8 @@ uint64_t av_get_channel_layout(const char *name)
return
layout
;
}
void
av_
get_channel_layout_string
(
char
*
buf
,
int
buf_size
,
int
nb_channels
,
uint64_t
channel_layout
)
void
av_
bprint_channel_layout
(
struct
AVBPrint
*
bp
,
int
nb_channels
,
uint64_t
channel_layout
)
{
int
i
;
...
...
@@ -147,29 +148,38 @@ void av_get_channel_layout_string(char *buf, int buf_size,
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
channel_layout_map
);
i
++
)
if
(
nb_channels
==
channel_layout_map
[
i
].
nb_channels
&&
channel_layout
==
channel_layout_map
[
i
].
layout
)
{
av_
strlcpy
(
buf
,
channel_layout_map
[
i
].
name
,
buf_siz
e
);
av_
bprintf
(
bp
,
"%s"
,
channel_layout_map
[
i
].
nam
e
);
return
;
}
snprintf
(
buf
,
buf_size
,
"%d channels"
,
nb_channels
);
av_bprintf
(
bp
,
"%d channels"
,
nb_channels
);
if
(
channel_layout
)
{
int
i
,
ch
;
av_
strlcat
(
buf
,
" ("
,
buf_size
);
av_
bprintf
(
bp
,
" ("
);
for
(
i
=
0
,
ch
=
0
;
i
<
64
;
i
++
)
{
if
((
channel_layout
&
(
UINT64_C
(
1
)
<<
i
)))
{
const
char
*
name
=
get_channel_name
(
i
);
if
(
name
)
{
if
(
ch
>
0
)
av_
strlcat
(
buf
,
"+"
,
buf_size
);
av_
strlcat
(
buf
,
name
,
buf_siz
e
);
av_
bprintf
(
bp
,
"+"
);
av_
bprintf
(
bp
,
"%s"
,
nam
e
);
}
ch
++
;
}
}
av_
strlcat
(
buf
,
")"
,
buf_size
);
av_
bprintf
(
bp
,
")"
);
}
}
void
av_get_channel_layout_string
(
char
*
buf
,
int
buf_size
,
int
nb_channels
,
uint64_t
channel_layout
)
{
AVBPrint
bp
;
av_bprint_init_for_buffer
(
&
bp
,
buf
,
buf_size
);
av_bprint_channel_layout
(
&
bp
,
nb_channels
,
channel_layout
);
}
int
av_get_channel_layout_nb_channels
(
uint64_t
channel_layout
)
{
int
count
;
...
...
libavutil/audioconvert.h
View file @
e45a92dc
...
...
@@ -133,6 +133,12 @@ uint64_t av_get_channel_layout(const char *name);
*/
void
av_get_channel_layout_string
(
char
*
buf
,
int
buf_size
,
int
nb_channels
,
uint64_t
channel_layout
);
struct
AVBPrint
;
/**
* Append a description of a channel layout to a bprint buffer.
*/
void
av_bprint_channel_layout
(
struct
AVBPrint
*
bp
,
int
nb_channels
,
uint64_t
channel_layout
);
/**
* Return the number of channels in the channel layout.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment