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
7d727f13
Commit
7d727f13
authored
Apr 30, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LAVFAPI: avformat_alloc_output_context() / simplify usage of muxers.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
a2eef3e9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
21 deletions
+55
-21
ffmpeg.c
ffmpeg.c
+3
-20
avformat.h
libavformat/avformat.h
+8
-1
utils.c
libavformat/utils.c
+44
-0
No files found.
ffmpeg.c
View file @
7d727f13
...
...
@@ -3779,30 +3779,13 @@ static void opt_output_file(const char *filename)
if
(
!
strcmp
(
filename
,
"-"
))
filename
=
"pipe:"
;
oc
=
avformat_alloc_context
();
oc
=
avformat_alloc_output_context
(
last_asked_format
,
NULL
,
filename
);
last_asked_format
=
NULL
;
if
(
!
oc
)
{
print_error
(
filename
,
AVERROR
(
ENOMEM
));
ffmpeg_exit
(
1
);
}
if
(
last_asked_format
)
{
file_oformat
=
av_guess_format
(
last_asked_format
,
NULL
,
NULL
);
if
(
!
file_oformat
)
{
fprintf
(
stderr
,
"Requested output format '%s' is not a suitable output format
\n
"
,
last_asked_format
);
ffmpeg_exit
(
1
);
}
last_asked_format
=
NULL
;
}
else
{
file_oformat
=
av_guess_format
(
NULL
,
filename
,
NULL
);
if
(
!
file_oformat
)
{
fprintf
(
stderr
,
"Unable to find a suitable output format for '%s'
\n
"
,
filename
);
ffmpeg_exit
(
1
);
}
}
oc
->
oformat
=
file_oformat
;
av_strlcpy
(
oc
->
filename
,
filename
,
sizeof
(
oc
->
filename
));
file_oformat
=
oc
->
oformat
;
if
(
!
strcmp
(
file_oformat
->
name
,
"ffm"
)
&&
av_strstart
(
filename
,
"http:"
,
NULL
))
{
...
...
libavformat/avformat.h
View file @
7d727f13
...
...
@@ -1047,6 +1047,13 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
*/
AVFormatContext
*
avformat_alloc_context
(
void
);
/**
* Allocate an AVFormatContext.
* avformat_free_context() can be used to free the context and everything
* allocated by the framework within it.
*/
AVFormatContext
*
avformat_alloc_output_context
(
const
char
*
format
,
AVOutputFormat
*
oformat
,
const
char
*
filename
);
/**
* Read packets of a media file to get stream information. This
* is useful for file formats with no headers such as MPEG. This
...
...
@@ -1295,7 +1302,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index,
/**
* media file output
*/
int
av_set_parameters
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
);
attribute_deprecated
int
av_set_parameters
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
);
/**
* Split a URL string into components.
...
...
libavformat/utils.c
View file @
7d727f13
...
...
@@ -2719,6 +2719,50 @@ int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)
return
0
;
}
AVFormatContext
*
avformat_alloc_output_context
(
const
char
*
format
,
AVOutputFormat
*
oformat
,
const
char
*
filename
){
AVFormatContext
*
s
=
avformat_alloc_context
();
if
(
!
s
)
goto
nomem
;
if
(
!
oformat
){
if
(
format
)
{
oformat
=
av_guess_format
(
format
,
NULL
,
NULL
);
if
(
!
oformat
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Requested output format '%s' is not a suitable output format
\n
"
,
format
);
goto
error
;
}
}
else
{
oformat
=
av_guess_format
(
NULL
,
filename
,
NULL
);
if
(
!
oformat
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to find a suitable output format for '%s'
\n
"
,
filename
);
goto
error
;
}
}
}
s
->
oformat
=
oformat
;
if
(
s
->
oformat
->
priv_data_size
>
0
)
{
s
->
priv_data
=
av_mallocz
(
s
->
oformat
->
priv_data_size
);
if
(
!
s
->
priv_data
)
goto
nomem
;
if
(
s
->
oformat
->
priv_class
)
{
*
(
const
AVClass
**
)
s
->
priv_data
=
s
->
oformat
->
priv_class
;
av_opt_set_defaults
(
s
->
priv_data
);
}
}
else
s
->
priv_data
=
NULL
;
if
(
filename
)
av_strlcpy
(
s
->
filename
,
filename
,
sizeof
(
s
->
filename
));
return
s
;
nomem
:
av_log
(
s
,
AV_LOG_ERROR
,
"Out of memory
\n
"
);
error
:
avformat_free_context
(
s
);
return
NULL
;
}
static
int
validate_codec_tag
(
AVFormatContext
*
s
,
AVStream
*
st
)
{
const
AVCodecTag
*
avctag
;
...
...
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