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
359fa0fe
Commit
359fa0fe
authored
Nov 06, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cbr audio muxing fix
Originally committed as revision 3661 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
70122f29
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
39 deletions
+41
-39
pcm.c
libavcodec/pcm.c
+17
-0
avienc.c
libavformat/avienc.c
+21
-36
wav.c
libavformat/wav.c
+1
-1
libav.regression.ref
tests/libav.regression.ref
+2
-2
No files found.
libavcodec/pcm.c
View file @
359fa0fe
...
@@ -127,6 +127,23 @@ static int pcm_encode_init(AVCodecContext *avctx)
...
@@ -127,6 +127,23 @@ static int pcm_encode_init(AVCodecContext *avctx)
break
;
break
;
}
}
switch
(
avctx
->
codec
->
id
)
{
case
CODEC_ID_PCM_S16LE
:
case
CODEC_ID_PCM_S16BE
:
case
CODEC_ID_PCM_U16LE
:
case
CODEC_ID_PCM_U16BE
:
avctx
->
block_align
=
2
*
avctx
->
channels
;
break
;
case
CODEC_ID_PCM_S8
:
case
CODEC_ID_PCM_U8
:
case
CODEC_ID_PCM_MULAW
:
case
CODEC_ID_PCM_ALAW
:
avctx
->
block_align
=
avctx
->
channels
;
break
;
default:
break
;
}
avctx
->
coded_frame
=
avcodec_alloc_frame
();
avctx
->
coded_frame
=
avcodec_alloc_frame
();
avctx
->
coded_frame
->
key_frame
=
1
;
avctx
->
coded_frame
->
key_frame
=
1
;
...
...
libavformat/avienc.c
View file @
359fa0fe
...
@@ -251,33 +251,24 @@ void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags
...
@@ -251,33 +251,24 @@ void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags
put_byte
(
pb
,
0
);
put_byte
(
pb
,
0
);
}
}
static
void
parse_specific_params
(
AVCodecContext
*
stream
,
int
*
au_
byte
rate
,
int
*
au_ssize
,
int
*
au_scale
)
static
void
parse_specific_params
(
AVCodecContext
*
stream
,
int
*
au_rate
,
int
*
au_ssize
,
int
*
au_scale
)
{
{
switch
(
stream
->
codec_id
)
{
int
gcd
;
case
CODEC_ID_PCM_S16LE
:
*
au_scale
=
*
au_ssize
=
2
*
stream
->
channels
;
*
au_ssize
=
stream
->
block_align
;
*
au_byterate
=
*
au_ssize
*
stream
->
sample_rate
;
if
(
stream
->
frame_size
&&
stream
->
sample_rate
){
break
;
*
au_scale
=
stream
->
frame_size
;
case
CODEC_ID_PCM_U8
:
*
au_rate
=
stream
->
sample_rate
;
case
CODEC_ID_PCM_ALAW
:
}
else
if
(
stream
->
codec_type
==
CODEC_TYPE_VIDEO
){
case
CODEC_ID_PCM_MULAW
:
*
au_scale
=
stream
->
frame_rate_base
;
*
au_scale
=
*
au_ssize
=
stream
->
channels
;
*
au_rate
=
stream
->
frame_rate
;
*
au_byterate
=
*
au_ssize
*
stream
->
sample_rate
;
}
else
{
break
;
*
au_scale
=
stream
->
block_align
?
stream
->
block_align
*
8
:
8
;
case
CODEC_ID_MP2
:
*
au_rate
=
stream
->
bit_rate
;
*
au_ssize
=
1
;
}
*
au_scale
=
1
;
gcd
=
ff_gcd
(
*
au_scale
,
*
au_rate
);
*
au_byterate
=
stream
->
bit_rate
/
8
;
*
au_scale
/=
gcd
;
case
CODEC_ID_MP3
:
*
au_rate
/=
gcd
;
*
au_ssize
=
1
;
*
au_scale
=
1
;
*
au_byterate
=
stream
->
bit_rate
/
8
;
default:
*
au_ssize
=
1
;
*
au_scale
=
1
;
*
au_byterate
=
stream
->
bit_rate
/
8
;
break
;
}
}
}
static
offset_t
avi_start_new_riff
(
AVIContext
*
avi
,
ByteIOContext
*
pb
,
static
offset_t
avi_start_new_riff
(
AVIContext
*
avi
,
ByteIOContext
*
pb
,
...
@@ -595,21 +586,15 @@ static int avi_write_idx1(AVFormatContext *s)
...
@@ -595,21 +586,15 @@ static int avi_write_idx1(AVFormatContext *s)
if
(
avi
->
frames_hdr_strm
[
n
]
!=
0
)
{
if
(
avi
->
frames_hdr_strm
[
n
]
!=
0
)
{
stream
=
&
s
->
streams
[
n
]
->
codec
;
stream
=
&
s
->
streams
[
n
]
->
codec
;
url_fseek
(
pb
,
avi
->
frames_hdr_strm
[
n
],
SEEK_SET
);
url_fseek
(
pb
,
avi
->
frames_hdr_strm
[
n
],
SEEK_SET
);
if
(
stream
->
codec_type
==
CODEC_TYPE_VIDEO
)
{
parse_specific_params
(
stream
,
&
au_byterate
,
&
au_ssize
,
&
au_scale
);
put_le32
(
pb
,
stream
->
frame_number
);
if
(
au_ssize
==
0
)
{
if
(
nb_frames
<
stream
->
frame_number
)
nb_frames
=
stream
->
frame_number
;
}
else
{
if
(
stream
->
codec_id
==
CODEC_ID_MP2
||
stream
->
codec_id
==
CODEC_ID_MP3
)
{
put_le32
(
pb
,
stream
->
frame_number
);
put_le32
(
pb
,
stream
->
frame_number
);
nb_frames
+=
stream
->
frame_number
;
nb_frames
+=
stream
->
frame_number
;
}
else
{
}
else
{
parse_specific_params
(
stream
,
&
au_byterate
,
&
au_ssize
,
&
au_scale
);
put_le32
(
pb
,
avi
->
audio_strm_length
[
n
]
/
au_ssize
);
put_le32
(
pb
,
avi
->
audio_strm_length
[
n
]
/
au_ssize
);
}
}
}
}
}
}
}
if
(
avi
->
frames_hdr_all
!=
0
)
{
if
(
avi
->
frames_hdr_all
!=
0
)
{
url_fseek
(
pb
,
avi
->
frames_hdr_all
,
SEEK_SET
);
url_fseek
(
pb
,
avi
->
frames_hdr_all
,
SEEK_SET
);
put_le32
(
pb
,
nb_frames
);
put_le32
(
pb
,
nb_frames
);
...
...
libavformat/wav.c
View file @
359fa0fe
...
@@ -71,7 +71,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
...
@@ -71,7 +71,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
}
}
if
(
enc
->
codec_id
==
CODEC_ID_MP2
||
enc
->
codec_id
==
CODEC_ID_MP3
)
{
if
(
enc
->
codec_id
==
CODEC_ID_MP2
||
enc
->
codec_id
==
CODEC_ID_MP3
)
{
blkalign
=
1
;
blkalign
=
enc
->
frame_size
;
//this is wrong, but seems many demuxers dont work if this is set correctly
//blkalign = 144 * enc->bit_rate/enc->sample_rate;
//blkalign = 144 * enc->bit_rate/enc->sample_rate;
}
else
if
(
enc
->
block_align
!=
0
)
{
/* specified by the codec */
}
else
if
(
enc
->
block_align
!=
0
)
{
/* specified by the codec */
blkalign
=
enc
->
block_align
;
blkalign
=
enc
->
block_align
;
...
...
tests/libav.regression.ref
View file @
359fa0fe
ffmpeg regression test
ffmpeg regression test
580b53ca26eb2184b928967b8e7d18a7
*./data/b-libav.avi
8517e7c83227074b8d632477fda310d5
*./data/b-libav.avi
342282 ./data/b-libav.avi
342282 ./data/b-libav.avi
./data/b-libav.avi CRC=001a3415
./data/b-libav.avi CRC=001a3415
80f85b6dce1da8310a49bb4607a34f0
6 *./data/b-libav.asf
c83444a0e8ef47b6af1d868d1bb2169
6 *./data/b-libav.asf
342967 ./data/b-libav.asf
342967 ./data/b-libav.asf
./data/b-libav.asf CRC=750f18c7
./data/b-libav.asf CRC=750f18c7
1cbf838e659d7fc3d3e33f4187b91f6c *./data/b-libav.rm
1cbf838e659d7fc3d3e33f4187b91f6c *./data/b-libav.rm
...
...
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