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
ce62b35c
Commit
ce62b35c
authored
Apr 30, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output_example: use avformat_alloc_output_context()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
7d727f13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
22 deletions
+5
-22
output-example.c
libavformat/output-example.c
+5
-22
No files found.
libavformat/output-example.c
View file @
ce62b35c
...
@@ -442,26 +442,16 @@ int main(int argc, char **argv)
...
@@ -442,26 +442,16 @@ int main(int argc, char **argv)
filename
=
argv
[
1
];
filename
=
argv
[
1
];
/* auto detect the output format from the name. default is
/* allocate the output media context */
mpeg. */
oc
=
avformat_alloc_output_context
(
NULL
,
NULL
,
filename
);
fmt
=
av_guess_format
(
NULL
,
filename
,
NULL
);
if
(
!
oc
)
{
if
(
!
fmt
)
{
printf
(
"Could not deduce output format from file extension: using MPEG.
\n
"
);
printf
(
"Could not deduce output format from file extension: using MPEG.
\n
"
);
fmt
=
av_guess_format
(
"mpeg"
,
NULL
,
NULL
);
oc
=
avformat_alloc_output_context
(
"mpeg"
,
NULL
,
filename
);
}
}
if
(
!
fmt
)
{
fprintf
(
stderr
,
"Could not find suitable output format
\n
"
);
exit
(
1
);
}
/* allocate the output media context */
oc
=
avformat_alloc_context
();
if
(
!
oc
)
{
if
(
!
oc
)
{
fprintf
(
stderr
,
"Memory error
\n
"
);
exit
(
1
);
exit
(
1
);
}
}
oc
->
oformat
=
fmt
;
fmt
=
oc
->
oformat
;
snprintf
(
oc
->
filename
,
sizeof
(
oc
->
filename
),
"%s"
,
filename
);
/* add the audio and video streams using the default format codecs
/* add the audio and video streams using the default format codecs
and initialize the codecs */
and initialize the codecs */
...
@@ -474,13 +464,6 @@ int main(int argc, char **argv)
...
@@ -474,13 +464,6 @@ int main(int argc, char **argv)
audio_st
=
add_audio_stream
(
oc
,
fmt
->
audio_codec
);
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
"
);
exit
(
1
);
}
av_dump_format
(
oc
,
0
,
filename
,
1
);
av_dump_format
(
oc
,
0
,
filename
,
1
);
/* now that all the parameters are set, we can open the audio and
/* now that all the parameters are set, we can open the audio and
...
...
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