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
cf3fccce
Commit
cf3fccce
authored
Mar 18, 2014
by
Daniel Verkamp
Committed by
Michael Niedermayer
Mar 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ff_put_wav_header: remove manual byte counting
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
7c8bf09e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
riffenc.c
libavformat/riffenc.c
+3
-7
No files found.
libavformat/riffenc.c
View file @
cf3fccce
...
...
@@ -54,7 +54,8 @@ void ff_end_tag(AVIOContext *pb, int64_t start)
int
ff_put_wav_header
(
AVIOContext
*
pb
,
AVCodecContext
*
enc
)
{
int
bps
,
blkalign
,
bytespersec
,
frame_size
;
int
hdrsize
=
18
;
int
hdrsize
;
int64_t
hdrstart
=
avio_tell
(
pb
);
int
waveformatextensible
;
uint8_t
temp
[
256
];
uint8_t
*
riff_extradata
=
temp
;
...
...
@@ -135,14 +136,12 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
avio_wl16
(
pb
,
blkalign
);
/* block align */
avio_wl16
(
pb
,
bps
);
/* bits per sample */
if
(
enc
->
codec_id
==
AV_CODEC_ID_MP3
)
{
hdrsize
+=
12
;
bytestream_put_le16
(
&
riff_extradata
,
1
);
/* wID */
bytestream_put_le32
(
&
riff_extradata
,
2
);
/* fdwFlags */
bytestream_put_le16
(
&
riff_extradata
,
1152
);
/* nBlockSize */
bytestream_put_le16
(
&
riff_extradata
,
1
);
/* nFramesPerBlock */
bytestream_put_le16
(
&
riff_extradata
,
1393
);
/* nCodecDelay */
}
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_MP2
)
{
hdrsize
+=
22
;
/* fwHeadLayer */
bytestream_put_le16
(
&
riff_extradata
,
2
);
/* dwHeadBitrate */
...
...
@@ -160,23 +159,19 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
/* dwPTSHigh */
bytestream_put_le32
(
&
riff_extradata
,
0
);
}
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_G723_1
)
{
hdrsize
+=
20
;
bytestream_put_le32
(
&
riff_extradata
,
0x9ace0002
);
/* extradata needed for msacm g723.1 codec */
bytestream_put_le32
(
&
riff_extradata
,
0xaea2f732
);
bytestream_put_le16
(
&
riff_extradata
,
0xacde
);
}
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_GSM_MS
||
enc
->
codec_id
==
AV_CODEC_ID_ADPCM_IMA_WAV
)
{
hdrsize
+=
2
;
/* wSamplesPerBlock */
bytestream_put_le16
(
&
riff_extradata
,
frame_size
);
}
else
if
(
enc
->
extradata_size
)
{
riff_extradata_start
=
enc
->
extradata
;
riff_extradata
=
enc
->
extradata
+
enc
->
extradata_size
;
hdrsize
+=
enc
->
extradata_size
;
}
/* write WAVEFORMATEXTENSIBLE extensions */
if
(
waveformatextensible
)
{
hdrsize
+=
22
;
/* 22 is WAVEFORMATEXTENSIBLE size */
avio_wl16
(
pb
,
riff_extradata
-
riff_extradata_start
+
22
);
/* ValidBitsPerSample || SamplesPerBlock || Reserved */
...
...
@@ -196,6 +191,7 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
avio_wl16
(
pb
,
riff_extradata
-
riff_extradata_start
);
/* cbSize */
}
avio_write
(
pb
,
riff_extradata_start
,
riff_extradata
-
riff_extradata_start
);
hdrsize
=
avio_tell
(
pb
)
-
hdrstart
;
if
(
hdrsize
&
1
)
{
hdrsize
++
;
avio_w8
(
pb
,
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