Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
e45a92dc
Commit
e45a92dc
authored
12 years ago
by
Nicolas George
Browse files
Options
Downloads
Patches
Plain Diff
audioconvert: implement av_bprint_channel_layout().
And reimplement av_get_channel_layout_string() on top of it.
parent
7a2b4291
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavutil/audioconvert.c
+18
-8
18 additions, 8 deletions
libavutil/audioconvert.c
libavutil/audioconvert.h
+6
-0
6 additions, 0 deletions
libavutil/audioconvert.h
with
24 additions
and
8 deletions
libavutil/audioconvert.c
+
18
−
8
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_
ge
t_channel_layout
_
str
ing
(
char
*
buf
,
int
buf_size
,
int
nb_channels
,
uint64_t
channel_layout
)
void
av_
bprin
t_channel_layout
(
str
uct
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_size
);
av_
bprintf
(
bp
,
"%s"
,
channel_layout_map
[
i
].
name
);
return
;
}
sn
printf
(
b
uf
,
buf_size
,
"%d channels"
,
nb_channels
);
av_b
printf
(
b
p
,
"%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
;
...
...
This diff is collapsed.
Click to expand it.
libavutil/audioconvert.h
+
6
−
0
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.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment