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
106b62f4
Commit
106b62f4
authored
May 26, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
matroskaenc: write the channel mask for FLAC
parent
efcde917
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
Makefile
libavformat/Makefile
+1
-1
matroskaenc.c
libavformat/matroskaenc.c
+46
-1
No files found.
libavformat/Makefile
View file @
106b62f4
...
...
@@ -170,7 +170,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \
oggparsevorbis.o
vorbiscomment.o
OBJS-$(CONFIG_MATROSKA_MUXER)
+=
matroskaenc.o
matroska.o
\
isom.o
avc.o
hevc.o
\
flacenc_header.o
avlanguage.o
wv.o
flacenc_header.o
avlanguage.o
vorbiscomment.o
wv.o
OBJS-$(CONFIG_MD5_MUXER)
+=
md5enc.o
OBJS-$(CONFIG_MJPEG_DEMUXER)
+=
rawdec.o
OBJS-$(CONFIG_MJPEG_MUXER)
+=
rawenc.o
...
...
libavformat/matroskaenc.c
View file @
106b62f4
...
...
@@ -30,9 +30,11 @@
#include "isom.h"
#include "matroska.h"
#include "riff.h"
#include "vorbiscomment.h"
#include "wv.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
...
...
@@ -469,6 +471,49 @@ static int put_wv_codecpriv(AVIOContext *pb, AVCodecContext *codec)
return
0
;
}
static
int
put_flac_codecpriv
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
AVCodecContext
*
codec
)
{
int
write_comment
=
(
codec
->
channel_layout
&&
!
(
codec
->
channel_layout
&
~
0x3ffffULL
)
&&
!
ff_flac_is_native_layout
(
codec
->
channel_layout
));
int
ret
=
ff_flac_write_header
(
pb
,
codec
,
!
write_comment
);
if
(
ret
<
0
)
return
ret
;
if
(
write_comment
)
{
const
char
*
vendor
=
(
s
->
flags
&
AVFMT_FLAG_BITEXACT
)
?
"Libav"
:
LIBAVFORMAT_IDENT
;
AVDictionary
*
dict
=
NULL
;
uint8_t
buf
[
32
],
*
data
,
*
p
;
int
len
;
snprintf
(
buf
,
sizeof
(
buf
),
"0x%"
PRIx64
,
codec
->
channel_layout
);
av_dict_set
(
&
dict
,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK"
,
buf
,
0
);
len
=
ff_vorbiscomment_length
(
dict
,
vendor
);
data
=
av_malloc
(
len
+
4
);
if
(
!
data
)
{
av_dict_free
(
&
dict
);
return
AVERROR
(
ENOMEM
);
}
data
[
0
]
=
0x84
;
AV_WB24
(
data
+
1
,
len
);
p
=
data
+
4
;
ff_vorbiscomment_write
(
&
p
,
&
dict
,
vendor
);
avio_write
(
pb
,
data
,
len
+
4
);
av_freep
(
&
data
);
av_dict_free
(
&
dict
);
}
return
0
;
}
static
void
get_aac_sample_rates
(
AVFormatContext
*
s
,
AVCodecContext
*
codec
,
int
*
sample_rate
,
int
*
output_sample_rate
)
{
MPEG4AudioConfig
mp4ac
;
...
...
@@ -497,7 +542,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
if
(
codec
->
codec_id
==
AV_CODEC_ID_VORBIS
||
codec
->
codec_id
==
AV_CODEC_ID_THEORA
)
ret
=
put_xiph_codecpriv
(
s
,
dyn_cp
,
codec
);
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_FLAC
)
ret
=
ff_flac_write_header
(
dyn_cp
,
codec
,
1
);
ret
=
put_flac_codecpriv
(
s
,
dyn_cp
,
codec
);
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_WAVPACK
)
ret
=
put_wv_codecpriv
(
dyn_cp
,
codec
);
else
if
(
codec
->
codec_id
==
AV_CODEC_ID_H264
)
...
...
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