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
45ecc7a2
Commit
45ecc7a2
authored
Jul 12, 2011
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support adpcm_ima_wav and adpcm_ms in caf.
parent
afa218f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
caf.c
libavformat/caf.c
+2
-0
cafenc.c
libavformat/cafenc.c
+6
-2
No files found.
libavformat/caf.c
View file @
45ecc7a2
...
...
@@ -39,6 +39,8 @@ const AVCodecTag ff_codec_caf_tags[] = {
/*{ CODEC_ID_DVAUDIO, MKBETAG('v','d','v','a') },*/
/*{ CODEC_ID_DVAUDIO, MKBETAG('d','v','c','a') },*/
{
CODEC_ID_ADPCM_IMA_QT
,
MKBETAG
(
'i'
,
'm'
,
'a'
,
'4'
)
},
{
CODEC_ID_ADPCM_IMA_WAV
,
MKBETAG
(
'm'
,
's'
,
0
,
17
)
},
{
CODEC_ID_ADPCM_MS
,
MKBETAG
(
'm'
,
's'
,
0
,
2
)
},
{
CODEC_ID_AMR_NB
,
MKBETAG
(
's'
,
'a'
,
'm'
,
'r'
)
},
{
CODEC_ID_GSM
,
MKBETAG
(
'a'
,
'g'
,
's'
,
'm'
)
},
{
CODEC_ID_GSM_MS
,
MKBETAG
(
'm'
,
's'
,
0
,
'1'
)
},
...
...
libavformat/cafenc.c
View file @
45ecc7a2
...
...
@@ -47,7 +47,7 @@ static uint32_t codec_flags(enum CodecID codec_id) {
}
}
static
uint32_t
samples_per_packet
(
enum
CodecID
codec_id
)
{
static
uint32_t
samples_per_packet
(
enum
CodecID
codec_id
,
int
channels
)
{
switch
(
codec_id
)
{
case
CODEC_ID_PCM_S8
:
case
CODEC_ID_PCM_S16LE
:
...
...
@@ -84,6 +84,10 @@ static uint32_t samples_per_packet(enum CodecID codec_id) {
case
CODEC_ID_ALAC
:
case
CODEC_ID_QDM2
:
return
4096
;
case
CODEC_ID_ADPCM_IMA_WAV
:
return
(
1024
-
4
*
channels
)
*
8
/
(
4
*
channels
)
+
1
;
case
CODEC_ID_ADPCM_MS
:
return
(
1024
-
7
*
channels
)
*
2
/
channels
+
2
;
default:
return
0
;
}
...
...
@@ -133,7 +137,7 @@ static int caf_write_header(AVFormatContext *s)
avio_wb32
(
pb
,
codec_tag
);
//< mFormatID
avio_wb32
(
pb
,
codec_flags
(
enc
->
codec_id
));
//< mFormatFlags
avio_wb32
(
pb
,
enc
->
block_align
);
//< mBytesPerPacket
avio_wb32
(
pb
,
samples_per_packet
(
enc
->
codec_id
));
//< mFramesPerPacket
avio_wb32
(
pb
,
samples_per_packet
(
enc
->
codec_id
,
enc
->
channels
));
//< mFramesPerPacket
avio_wb32
(
pb
,
enc
->
channels
);
//< mChannelsPerFrame
avio_wb32
(
pb
,
enc
->
bits_per_coded_sample
);
//< mBitsPerChannel
...
...
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