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
0694d870
Commit
0694d870
authored
Jan 21, 2018
by
Josh de Kock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: add new API for iterating muxers and demuxers
parent
598d5f85
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
567 additions
and
421 deletions
+567
-421
Makefile
Makefile
+2
-1
configure
configure
+4
-2
APIchanges
doc/APIchanges
+6
-1
.gitignore
libavformat/.gitignore
+2
-0
allformats.c
libavformat/allformats.c
+513
-355
avformat.h
libavformat/avformat.h
+31
-0
format.c
libavformat/format.c
+6
-62
version.h
libavformat/version.h
+3
-0
No files found.
Makefile
View file @
0694d870
...
...
@@ -143,7 +143,8 @@ distclean:: clean
ffbuild/.config ffbuild/config.
*
libavutil/avconfig.h
\
version.h libavutil/ffversion.h libavcodec/codec_names.h
\
libavcodec/bsf_list.c libavformat/protocol_list.c
\
libavcodec/codec_list.c libavcodec/parser_list.c
libavcodec/codec_list.c libavcodec/parser_list.c
\
libavformat/muxer_list.c libavformat/demuxer_list.c
ifeq
($(SRC_LINK),src)
$(RM)
src
endif
...
...
configure
View file @
0694d870
...
...
@@ -3525,8 +3525,6 @@ find_things(){
sed
-n
"s/^[^#]*
$pattern
.*([^,]*, *
\(
[^,]*
\)\(
,.*
\)
*).*/
\1
_
$thing
/p"
"
$file
"
}
MUXER_LIST
=
$(
find_things muxer _MUX libavformat/allformats.c
)
DEMUXER_LIST
=
$(
find_things demuxer DEMUX libavformat/allformats.c
)
OUTDEV_LIST
=
$(
find_things outdev OUTDEV libavdevice/alldevices.c
)
INDEV_LIST
=
$(
find_things indev _IN libavdevice/alldevices.c
)
FILTER_LIST
=
$(
find_things filter FILTER libavfilter/allfilters.c
)
...
...
@@ -3538,6 +3536,8 @@ find_things_extern(){
sed
-n
"s/^[^#]*extern.*
$pattern
*ff_
\(
[^ ]*
\)
_
$thing
;/
\1
_
$thing
/p"
"
$file
"
}
MUXER_LIST
=
$(
find_things_extern muxer AVOutputFormat libavformat/allformats.c
)
DEMUXER_LIST
=
$(
find_things_extern demuxer AVInputFormat libavformat/allformats.c
)
ENCODER_LIST
=
$(
find_things_extern encoder AVCodec libavcodec/allcodecs.c
)
DECODER_LIST
=
$(
find_things_extern decoder AVCodec libavcodec/allcodecs.c
)
CODEC_LIST
=
"
...
...
@@ -7036,6 +7036,8 @@ print_enabled_components(){
print_enabled_components libavcodec/codec_list.c AVCodec codec_list
$CODEC_LIST
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list
$PARSER_LIST
print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters
$BSF_LIST
print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list
$DEMUXER_LIST
print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list
$MUXER_LIST
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols
$PROTOCOL_LIST
# Settings for pkg-config files
...
...
doc/APIchanges
View file @
0694d870
...
...
@@ -15,7 +15,12 @@ libavutil: 2017-10-21
API changes, most recent first:
2018-01-xx - xxxxxxx - lavc 58.9.100 - avcodec.h
2018-xx-xx - xxxxxxx - lavf 58.9.100 - avformat.h
Deprecate use of av_register_input_format(), av_register_output_format(),
avformat_register_all(), av_iformat_next(), av_oformat_next().
Add av_demuxer_iterate(), and av_muxer_iterate().
2018-xx-xx - xxxxxxx - lavc 58.9.100 - avcodec.h
Deprecate use of avcodec_register(), avcodec_register_all(), and
av_codec_next(). Add av_codec_iterate().
...
...
libavformat/.gitignore
View file @
0694d870
/protocol_list.c
/muxer_list.c
/demuxer_list.c
libavformat/allformats.c
View file @
0694d870
This diff is collapsed.
Click to expand it.
libavformat/avformat.h
View file @
0694d870
...
...
@@ -2011,6 +2011,7 @@ const char *avformat_configuration(void);
*/
const
char
*
avformat_license
(
void
);
#if FF_API_NEXT
/**
* Initialize libavformat and register all the muxers, demuxers and
* protocols. If you do not call this function, then you can select
...
...
@@ -2019,10 +2020,14 @@ const char *avformat_license(void);
* @see av_register_input_format()
* @see av_register_output_format()
*/
attribute_deprecated
void
av_register_all
(
void
);
attribute_deprecated
void
av_register_input_format
(
AVInputFormat
*
format
);
attribute_deprecated
void
av_register_output_format
(
AVOutputFormat
*
format
);
#endif
/**
* Do global initialization of network libraries. This is optional,
...
...
@@ -2046,11 +2051,13 @@ int avformat_network_init(void);
*/
int
avformat_network_deinit
(
void
);
#if FF_API_NEXT
/**
* If f is NULL, returns the first registered input format,
* if f is non-NULL, returns the next registered input format after f
* or NULL if f is the last one.
*/
attribute_deprecated
AVInputFormat
*
av_iformat_next
(
const
AVInputFormat
*
f
);
/**
...
...
@@ -2058,7 +2065,31 @@ AVInputFormat *av_iformat_next(const AVInputFormat *f);
* if f is non-NULL, returns the next registered output format after f
* or NULL if f is the last one.
*/
attribute_deprecated
AVOutputFormat
*
av_oformat_next
(
const
AVOutputFormat
*
f
);
#endif
/**
* Iterate over all registered muxers.
*
* @param opaque a pointer where libavformat will store the iteration state. Must
* point to NULL to start the iteration.
*
* @return the next registered muxer or NULL when the iteration is
* finished
*/
const
AVOutputFormat
*
av_muxer_iterate
(
void
**
opaque
);
/**
* Iterate over all registered demuxers.
*
* @param opaque a pointer where libavformat will store the iteration state. Must
* point to NULL to start the iteration.
*
* @return the next registered demuxer or NULL when the iteration is
* finished
*/
const
AVInputFormat
*
av_demuxer_iterate
(
void
**
opaque
);
/**
* Allocate an AVFormatContext.
...
...
libavformat/format.c
View file @
0694d870
...
...
@@ -34,65 +34,6 @@
* @file
* Format register and lookup
*/
/** head of registered input format linked list */
static
AVInputFormat
*
first_iformat
=
NULL
;
/** head of registered output format linked list */
static
AVOutputFormat
*
first_oformat
=
NULL
;
static
AVInputFormat
**
last_iformat
=
&
first_iformat
;
static
AVOutputFormat
**
last_oformat
=
&
first_oformat
;
AVInputFormat
*
av_iformat_next
(
const
AVInputFormat
*
f
)
{
if
(
f
)
return
f
->
next
;
else
return
first_iformat
;
}
AVOutputFormat
*
av_oformat_next
(
const
AVOutputFormat
*
f
)
{
if
(
f
)
return
f
->
next
;
else
return
first_oformat
;
}
static
AVMutex
iformat_register_mutex
=
AV_MUTEX_INITIALIZER
;
void
av_register_input_format
(
AVInputFormat
*
format
)
{
AVInputFormat
**
p
;
ff_mutex_lock
(
&
iformat_register_mutex
);
p
=
last_iformat
;
while
(
*
p
)
p
=
&
(
*
p
)
->
next
;
*
p
=
format
;
format
->
next
=
NULL
;
last_iformat
=
&
format
->
next
;
ff_mutex_unlock
(
&
iformat_register_mutex
);
}
static
AVMutex
oformat_register_mutex
=
AV_MUTEX_INITIALIZER
;
void
av_register_output_format
(
AVOutputFormat
*
format
)
{
AVOutputFormat
**
p
;
ff_mutex_lock
(
&
oformat_register_mutex
);
p
=
last_oformat
;
while
(
*
p
)
p
=
&
(
*
p
)
->
next
;
*
p
=
format
;
format
->
next
=
NULL
;
last_oformat
=
&
format
->
next
;
ff_mutex_unlock
(
&
oformat_register_mutex
);
}
int
av_match_ext
(
const
char
*
filename
,
const
char
*
extensions
)
{
...
...
@@ -111,6 +52,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
const
char
*
mime_type
)
{
AVOutputFormat
*
fmt
=
NULL
,
*
fmt_found
;
void
*
i
=
0
;
int
score_max
,
score
;
/* specific test for image sequences */
...
...
@@ -124,7 +66,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
/* Find the proper file type. */
fmt_found
=
NULL
;
score_max
=
0
;
while
((
fmt
=
av_
oformat_next
(
fmt
)))
{
while
((
fmt
=
av_
muxer_iterate
(
&
i
)))
{
score
=
0
;
if
(
fmt
->
name
&&
short_name
&&
av_match_name
(
short_name
,
fmt
->
name
))
score
+=
100
;
...
...
@@ -176,7 +118,8 @@ enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
AVInputFormat
*
av_find_input_format
(
const
char
*
short_name
)
{
AVInputFormat
*
fmt
=
NULL
;
while
((
fmt
=
av_iformat_next
(
fmt
)))
void
*
i
=
0
;
while
((
fmt
=
av_demuxer_iterate
(
&
i
)))
if
(
av_match_name
(
short_name
,
fmt
->
name
))
return
fmt
;
return
NULL
;
...
...
@@ -188,6 +131,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
AVProbeData
lpd
=
*
pd
;
AVInputFormat
*
fmt1
=
NULL
,
*
fmt
;
int
score
,
score_max
=
0
;
void
*
i
=
0
;
const
static
uint8_t
zerobuffer
[
AVPROBE_PADDING_SIZE
];
enum
nodat
{
NO_ID3
,
...
...
@@ -213,7 +157,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
}
fmt
=
NULL
;
while
((
fmt1
=
av_
iformat_next
(
fmt1
)))
{
while
((
fmt1
=
av_
demuxer_iterate
(
&
i
)))
{
if
(
!
is_opened
==
!
(
fmt1
->
flags
&
AVFMT_NOFILE
)
&&
strcmp
(
fmt1
->
name
,
"image2"
))
continue
;
score
=
0
;
...
...
libavformat/version.h
View file @
0694d870
...
...
@@ -91,6 +91,9 @@
#ifndef FF_API_OLD_RTSP_OPTIONS
#define FF_API_OLD_RTSP_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_NEXT
#define FF_API_NEXT (LIBAVFORMAT_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_R_FRAME_RATE
...
...
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