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
2503928a
Commit
2503928a
authored
Jan 07, 2014
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/decoding_encoding: fix style nits
parent
b0517467
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
decoding_encoding.c
doc/examples/decoding_encoding.c
+14
-14
No files found.
doc/examples/decoding_encoding.c
View file @
2503928a
...
...
@@ -191,7 +191,7 @@ static void audio_encode_example(const char *filename)
/* encode a single tone sound */
t
=
0
;
tincr
=
2
*
M_PI
*
440
.
0
/
c
->
sample_rate
;
for
(
i
=
0
;
i
<
200
;
i
++
)
{
for
(
i
=
0
;
i
<
200
;
i
++
)
{
av_init_packet
(
&
pkt
);
pkt
.
data
=
NULL
;
// packet data will be allocated by the encoder
pkt
.
size
=
0
;
...
...
@@ -369,12 +369,12 @@ static void video_encode_example(const char *filename, int codec_id)
c
->
width
=
352
;
c
->
height
=
288
;
/* frames per second */
c
->
time_base
=
(
AVRational
){
1
,
25
};
c
->
time_base
=
(
AVRational
){
1
,
25
};
c
->
gop_size
=
10
;
/* emit one intra frame every ten frames */
c
->
max_b_frames
=
1
;
c
->
max_b_frames
=
1
;
c
->
pix_fmt
=
AV_PIX_FMT_YUV420P
;
if
(
codec_id
==
AV_CODEC_ID_H264
)
if
(
codec_id
==
AV_CODEC_ID_H264
)
av_opt_set
(
c
->
priv_data
,
"preset"
,
"slow"
,
0
);
/* open it */
...
...
@@ -408,7 +408,7 @@ static void video_encode_example(const char *filename, int codec_id)
}
/* encode 1 second of video */
for
(
i
=
0
;
i
<
25
;
i
++
)
{
for
(
i
=
0
;
i
<
25
;
i
++
)
{
av_init_packet
(
&
pkt
);
pkt
.
data
=
NULL
;
// packet data will be allocated by the encoder
pkt
.
size
=
0
;
...
...
@@ -416,15 +416,15 @@ static void video_encode_example(const char *filename, int codec_id)
fflush
(
stdout
);
/* prepare a dummy image */
/* Y */
for
(
y
=
0
;
y
<
c
->
height
;
y
++
)
{
for
(
x
=
0
;
x
<
c
->
width
;
x
++
)
{
for
(
y
=
0
;
y
<
c
->
height
;
y
++
)
{
for
(
x
=
0
;
x
<
c
->
width
;
x
++
)
{
frame
->
data
[
0
][
y
*
frame
->
linesize
[
0
]
+
x
]
=
x
+
y
+
i
*
3
;
}
}
/* Cb and Cr */
for
(
y
=
0
;
y
<
c
->
height
/
2
;
y
++
)
{
for
(
x
=
0
;
x
<
c
->
width
/
2
;
x
++
)
{
for
(
y
=
0
;
y
<
c
->
height
/
2
;
y
++
)
{
for
(
x
=
0
;
x
<
c
->
width
/
2
;
x
++
)
{
frame
->
data
[
1
][
y
*
frame
->
linesize
[
1
]
+
x
]
=
128
+
y
+
i
*
2
;
frame
->
data
[
2
][
y
*
frame
->
linesize
[
2
]
+
x
]
=
64
+
x
+
i
*
5
;
}
...
...
@@ -484,10 +484,10 @@ static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize,
FILE
*
f
;
int
i
;
f
=
fopen
(
filename
,
"w"
);
fprintf
(
f
,
"P5
\n
%d %d
\n
%d
\n
"
,
xsize
,
ysize
,
255
);
for
(
i
=
0
;
i
<
ysize
;
i
++
)
fwrite
(
buf
+
i
*
wrap
,
1
,
xsize
,
f
);
f
=
fopen
(
filename
,
"w"
);
fprintf
(
f
,
"P5
\n
%d %d
\n
%d
\n
"
,
xsize
,
ysize
,
255
);
for
(
i
=
0
;
i
<
ysize
;
i
++
)
fwrite
(
buf
+
i
*
wrap
,
1
,
xsize
,
f
);
fclose
(
f
);
}
...
...
@@ -575,7 +575,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
}
frame_count
=
0
;
for
(;;)
{
for
(;;)
{
avpkt
.
size
=
fread
(
inbuf
,
1
,
INBUF_SIZE
,
f
);
if
(
avpkt
.
size
==
0
)
break
;
...
...
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