Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
54ed488b
Commit
54ed488b
authored
May 25, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flac muxer: write WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag for multichannel files
parent
d6b9ce99
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
flacenc.c
libavformat/flacenc.c
+18
-0
flacenc.h
libavformat/flacenc.h
+2
-0
flacenc_header.c
libavformat/flacenc_header.c
+16
-0
No files found.
libavformat/flacenc.c
View file @
54ed488b
...
...
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavcodec/flac.h"
#include "avformat.h"
...
...
@@ -83,6 +84,23 @@ static int flac_write_header(struct AVFormatContext *s)
if
(
ret
)
return
ret
;
/* add the channel layout tag */
if
(
codec
->
channel_layout
&&
!
(
codec
->
channel_layout
&
~
0x3ffffULL
)
&&
!
ff_flac_is_native_layout
(
codec
->
channel_layout
))
{
AVDictionaryEntry
*
chmask
=
av_dict_get
(
s
->
metadata
,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK"
,
NULL
,
0
);
if
(
chmask
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"A WAVEFORMATEXTENSIBLE_CHANNEL_MASK is "
"already present, this muxer will not overwrite it.
\n
"
);
}
else
{
uint8_t
buf
[
32
];
snprintf
(
buf
,
sizeof
(
buf
),
"0x%"
PRIx64
,
codec
->
channel_layout
);
av_dict_set
(
&
s
->
metadata
,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK"
,
buf
,
0
);
}
}
ret
=
flac_write_block_comment
(
s
->
pb
,
&
s
->
metadata
,
0
,
s
->
flags
&
AVFMT_FLAG_BITEXACT
);
if
(
ret
)
...
...
libavformat/flacenc.h
View file @
54ed488b
...
...
@@ -29,4 +29,6 @@
int
ff_flac_write_header
(
AVIOContext
*
pb
,
AVCodecContext
*
codec
,
int
last_block
);
int
ff_flac_is_native_layout
(
uint64_t
channel_layout
);
#endif
/* AVFORMAT_FLACENC_H */
libavformat/flacenc_header.c
View file @
54ed488b
...
...
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavcodec/flac.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
...
...
@@ -45,3 +47,17 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
return
0
;
}
int
ff_flac_is_native_layout
(
uint64_t
channel_layout
)
{
if
(
channel_layout
==
AV_CH_LAYOUT_MONO
||
channel_layout
==
AV_CH_LAYOUT_STEREO
||
channel_layout
==
AV_CH_LAYOUT_SURROUND
||
channel_layout
==
AV_CH_LAYOUT_QUAD
||
channel_layout
==
AV_CH_LAYOUT_5POINT0
||
channel_layout
==
AV_CH_LAYOUT_5POINT1
||
channel_layout
==
AV_CH_LAYOUT_6POINT1
||
channel_layout
==
AV_CH_LAYOUT_7POINT1
)
return
1
;
return
0
;
}
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