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
aac63cef
Commit
aac63cef
authored
Feb 19, 2012
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: unbreak compilation
Update api so it will compile again.
parent
e04ca1d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
19 deletions
+9
-19
api-example.c
libavcodec/api-example.c
+4
-7
output-example.c
libavformat/output-example.c
+5
-12
No files found.
libavcodec/api-example.c
View file @
aac63cef
...
...
@@ -74,7 +74,7 @@ static void audio_encode_example(const char *filename)
c
->
channels
=
2
;
/* open it */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
if
(
avcodec_open
2
(
c
,
codec
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"could not open codec
\n
"
);
exit
(
1
);
}
...
...
@@ -139,7 +139,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
c
=
avcodec_alloc_context3
(
codec
);
/* open it */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
if
(
avcodec_open
2
(
c
,
codec
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"could not open codec
\n
"
);
exit
(
1
);
}
...
...
@@ -242,7 +242,7 @@ static void video_encode_example(const char *filename)
c
->
pix_fmt
=
PIX_FMT_YUV420P
;
/* open it */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
if
(
avcodec_open
2
(
c
,
codec
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"could not open codec
\n
"
);
exit
(
1
);
}
...
...
@@ -369,7 +369,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
available in the bitstream. */
/* open it */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
if
(
avcodec_open
2
(
c
,
codec
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"could not open codec
\n
"
);
exit
(
1
);
}
...
...
@@ -456,9 +456,6 @@ int main(int argc, char **argv)
{
const
char
*
filename
;
/* must be called before using avcodec lib */
avcodec_init
();
/* register all the codecs */
avcodec_register_all
();
...
...
libavformat/output-example.c
View file @
aac63cef
...
...
@@ -65,7 +65,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
AVCodecContext
*
c
;
AVStream
*
st
;
st
=
av
_new_stream
(
oc
,
1
);
st
=
av
format_new_stream
(
oc
,
NULL
);
if
(
!
st
)
{
fprintf
(
stderr
,
"Could not alloc stream
\n
"
);
exit
(
1
);
...
...
@@ -103,7 +103,7 @@ static void open_audio(AVFormatContext *oc, AVStream *st)
}
/* open it */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
if
(
avcodec_open
2
(
c
,
codec
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"could not open codec
\n
"
);
exit
(
1
);
}
...
...
@@ -164,7 +164,7 @@ 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_audio2
(
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
);
...
...
@@ -275,7 +275,7 @@ static void open_video(AVFormatContext *oc, AVStream *st)
}
/* open the codec */
if
(
avcodec_open
(
c
,
codec
)
<
0
)
{
if
(
avcodec_open
2
(
c
,
codec
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"could not open codec
\n
"
);
exit
(
1
);
}
...
...
@@ -482,13 +482,6 @@ int main(int argc, char **argv)
audio_st
=
add_audio_stream
(
oc
,
fmt
->
audio_codec
);
}
/* set the output parameters (must be done even if no
parameters). */
if
(
av_set_parameters
(
oc
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"Invalid output format parameters
\n
"
);
return
1
;
}
av_dump_format
(
oc
,
0
,
filename
,
1
);
/* now that all the parameters are set, we can open the audio and
...
...
@@ -507,7 +500,7 @@ int main(int argc, char **argv)
}
/* write the stream header, if any */
av
_write_header
(
oc
);
av
format_write_header
(
oc
,
NULL
);
for
(;;)
{
/* compute current audio and video time */
...
...
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