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
cb750e33
Commit
cb750e33
authored
Aug 08, 2003
by
Fabrice Bellard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added get_audio_frame()
Originally committed as revision 2116 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
12f996ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
output_example.c
output_example.c
+20
-8
No files found.
output_example.c
View file @
cb750e33
...
...
@@ -115,21 +115,33 @@ void open_audio(AVFormatContext *oc, AVStream *st)
samples
=
malloc
(
audio_input_frame_size
*
2
*
c
->
channels
);
}
/* prepare a 16 bit dummy audio frame of 'frame_size' samples and
'nb_channels' channels */
void
get_audio_frame
(
int16_t
*
samples
,
int
frame_size
,
int
nb_channels
)
{
int
j
,
i
,
v
;
int16_t
*
q
;
q
=
samples
;
for
(
j
=
0
;
j
<
frame_size
;
j
++
)
{
v
=
(
int
)(
sin
(
t
)
*
10000
);
for
(
i
=
0
;
i
<
nb_channels
;
i
++
)
*
q
++
=
v
;
t
+=
tincr
;
tincr
+=
tincr2
;
}
}
void
write_audio_frame
(
AVFormatContext
*
oc
,
AVStream
*
st
)
{
int
j
,
out_size
;
int
out_size
;
AVCodecContext
*
c
;
c
=
&
st
->
codec
;
for
(
j
=
0
;
j
<
audio_input_frame_size
;
j
++
)
{
samples
[
2
*
j
]
=
(
int
)(
sin
(
t
)
*
10000
);
samples
[
2
*
j
+
1
]
=
samples
[
2
*
j
];
t
+=
tincr
;
tincr
+=
tincr2
;
}
get_audio_frame
(
samples
,
audio_input_frame_size
,
c
->
channels
);
out_size
=
avcodec_encode_audio
(
c
,
audio_outbuf
,
audio_outbuf_size
,
samples
);
/* write the compressed frame in the media file */
...
...
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