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
1acb5ca0
Commit
1acb5ca0
authored
May 30, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve frame size calculation in caf muxer to fix adpcm_ms remuxing.
Fixes ticket #3645.
parent
772d46d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
cafenc.c
libavformat/cafenc.c
+5
-5
No files found.
libavformat/cafenc.c
View file @
1acb5ca0
...
...
@@ -51,7 +51,7 @@ static uint32_t codec_flags(enum AVCodecID codec_id) {
}
}
static
uint32_t
samples_per_packet
(
enum
AVCodecID
codec_id
,
int
channels
)
{
static
uint32_t
samples_per_packet
(
enum
AVCodecID
codec_id
,
int
channels
,
int
block_align
)
{
switch
(
codec_id
)
{
case
AV_CODEC_ID_PCM_S8
:
case
AV_CODEC_ID_PCM_S16LE
:
...
...
@@ -91,9 +91,9 @@ static uint32_t samples_per_packet(enum AVCodecID codec_id, int channels) {
case
AV_CODEC_ID_ALAC
:
return
4096
;
case
AV_CODEC_ID_ADPCM_IMA_WAV
:
return
(
1024
-
4
*
channels
)
*
8
/
(
4
*
channels
)
+
1
;
return
(
block_align
-
4
*
channels
)
*
8
/
(
4
*
channels
)
+
1
;
case
AV_CODEC_ID_ADPCM_MS
:
return
(
1024
-
7
*
channels
)
*
2
/
channels
+
2
;
return
(
block_align
-
7
*
channels
)
*
2
/
channels
+
2
;
default:
return
0
;
}
...
...
@@ -146,7 +146,7 @@ static int caf_write_header(AVFormatContext *s)
}
if
(
enc
->
codec_id
!=
AV_CODEC_ID_MP3
||
frame_size
!=
576
)
frame_size
=
samples_per_packet
(
enc
->
codec_id
,
enc
->
channels
);
frame_size
=
samples_per_packet
(
enc
->
codec_id
,
enc
->
channels
,
enc
->
block_align
);
ffio_wfourcc
(
pb
,
"caff"
);
//< mFileType
avio_wb16
(
pb
,
1
);
//< mFileVersion
...
...
@@ -259,7 +259,7 @@ static int caf_write_trailer(AVFormatContext *s)
ffio_wfourcc
(
pb
,
"pakt"
);
avio_wb64
(
pb
,
caf
->
size_entries_used
+
24
);
avio_wb64
(
pb
,
caf
->
packets
);
///< mNumberPackets
avio_wb64
(
pb
,
caf
->
packets
*
samples_per_packet
(
enc
->
codec_id
,
enc
->
channels
));
///< mNumberValidFrames
avio_wb64
(
pb
,
caf
->
packets
*
samples_per_packet
(
enc
->
codec_id
,
enc
->
channels
,
enc
->
block_align
));
///< mNumberValidFrames
avio_wb32
(
pb
,
0
);
///< mPrimingFrames
avio_wb32
(
pb
,
0
);
///< mRemainderFrames
avio_write
(
pb
,
caf
->
pkt_sizes
,
caf
->
size_entries_used
);
...
...
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