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
c617d7b8
Commit
c617d7b8
authored
Jul 27, 2011
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/muxing.c: apply misc style fixes
parent
90b043a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
muxing.c
doc/examples/muxing.c
+17
-17
No files found.
doc/examples/muxing.c
View file @
c617d7b8
...
...
@@ -81,7 +81,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
c
->
channels
=
2
;
// some formats want stream headers to be separate
if
(
oc
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
if
(
oc
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
c
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
return
st
;
...
...
@@ -144,7 +144,7 @@ static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
int16_t
*
q
;
q
=
samples
;
for
(
j
=
0
;
j
<
frame_size
;
j
++
)
{
for
(
j
=
0
;
j
<
frame_size
;
j
++
)
{
v
=
(
int
)(
sin
(
t
)
*
10000
);
for
(
i
=
0
;
i
<
nb_channels
;
i
++
)
*
q
++
=
v
;
...
...
@@ -163,13 +163,13 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
get_audio_frame
(
samples
,
audio_input_frame_size
,
c
->
channels
);
pkt
.
size
=
avcodec_encode_audio
(
c
,
audio_outbuf
,
audio_outbuf_size
,
samples
);
pkt
.
size
=
avcodec_encode_audio
(
c
,
audio_outbuf
,
audio_outbuf_size
,
samples
);
if
(
c
->
coded_frame
&&
c
->
coded_frame
->
pts
!=
AV_NOPTS_VALUE
)
pkt
.
pts
=
av_rescale_q
(
c
->
coded_frame
->
pts
,
c
->
time_base
,
st
->
time_base
);
pkt
.
flags
|=
AV_PKT_FLAG_KEY
;
pkt
.
stream_index
=
st
->
index
;
pkt
.
data
=
audio_outbuf
;
pkt
.
stream_index
=
st
->
index
;
pkt
.
data
=
audio_outbuf
;
/* write the compressed frame in the media file */
if
(
av_interleaved_write_frame
(
oc
,
&
pkt
)
!=
0
)
{
...
...
@@ -233,7 +233,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
c
->
mb_decision
=
2
;
}
// some formats want stream headers to be separate
if
(
oc
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
if
(
oc
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
c
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
return
st
;
...
...
@@ -319,15 +319,15 @@ static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height
i
=
frame_index
;
/* Y */
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
pict
->
data
[
0
][
y
*
pict
->
linesize
[
0
]
+
x
]
=
x
+
y
+
i
*
3
;
}
}
/* Cb and Cr */
for
(
y
=
0
;
y
<
height
/
2
;
y
++
)
{
for
(
x
=
0
;
x
<
width
/
2
;
x
++
)
{
for
(
y
=
0
;
y
<
height
/
2
;
y
++
)
{
for
(
x
=
0
;
x
<
width
/
2
;
x
++
)
{
pict
->
data
[
1
][
y
*
pict
->
linesize
[
1
]
+
x
]
=
128
+
y
+
i
*
2
;
pict
->
data
[
2
][
y
*
pict
->
linesize
[
2
]
+
x
]
=
64
+
x
+
i
*
5
;
}
...
...
@@ -377,9 +377,9 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
av_init_packet
(
&
pkt
);
pkt
.
flags
|=
AV_PKT_FLAG_KEY
;
pkt
.
stream_index
=
st
->
index
;
pkt
.
data
=
(
uint8_t
*
)
picture
;
pkt
.
size
=
sizeof
(
AVPicture
);
pkt
.
stream_index
=
st
->
index
;
pkt
.
data
=
(
uint8_t
*
)
picture
;
pkt
.
size
=
sizeof
(
AVPicture
);
ret
=
av_interleaved_write_frame
(
oc
,
&
pkt
);
}
else
{
...
...
@@ -394,9 +394,9 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
pkt
.
pts
=
av_rescale_q
(
c
->
coded_frame
->
pts
,
c
->
time_base
,
st
->
time_base
);
if
(
c
->
coded_frame
->
key_frame
)
pkt
.
flags
|=
AV_PKT_FLAG_KEY
;
pkt
.
stream_index
=
st
->
index
;
pkt
.
data
=
video_outbuf
;
pkt
.
size
=
out_size
;
pkt
.
stream_index
=
st
->
index
;
pkt
.
data
=
video_outbuf
;
pkt
.
size
=
out_size
;
/* write the compressed frame in the media file */
ret
=
av_interleaved_write_frame
(
oc
,
&
pkt
);
...
...
@@ -458,7 +458,7 @@ int main(int argc, char **argv)
if
(
!
oc
)
{
exit
(
1
);
}
fmt
=
oc
->
oformat
;
fmt
=
oc
->
oformat
;
/* add the audio and video streams using the default format codecs
and initialize the codecs */
...
...
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