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
563e1df5
Commit
563e1df5
authored
Apr 16, 2020
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/formats: add ff_formats_pixdesc_filter().
parent
aef670cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
formats.c
libavfilter/formats.c
+41
-0
formats.h
libavfilter/formats.h
+10
-0
No files found.
libavfilter/formats.c
View file @
563e1df5
...
...
@@ -373,6 +373,47 @@ const int64_t avfilter_all_channel_layouts[] = {
-
1
};
int
ff_formats_pixdesc_filter
(
AVFilterFormats
**
rfmts
,
unsigned
want
,
unsigned
rej
)
{
unsigned
nb_formats
,
fmt
,
flags
;
AVFilterFormats
*
formats
=
NULL
;
while
(
1
)
{
nb_formats
=
0
;
for
(
fmt
=
0
;;
fmt
++
)
{
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
fmt
);
if
(
!
desc
)
break
;
flags
=
desc
->
flags
;
if
(
!
(
desc
->
flags
&
AV_PIX_FMT_FLAG_HWACCEL
)
&&
!
(
desc
->
flags
&
AV_PIX_FMT_FLAG_PLANAR
)
&&
(
desc
->
log2_chroma_w
||
desc
->
log2_chroma_h
))
flags
|=
FF_PIX_FMT_FLAG_SW_FLAT_SUB
;
if
((
flags
&
(
want
|
rej
))
!=
want
)
continue
;
if
(
formats
)
formats
->
formats
[
nb_formats
]
=
fmt
;
nb_formats
++
;
}
if
(
formats
)
{
av_assert0
(
formats
->
nb_formats
==
nb_formats
);
*
rfmts
=
formats
;
return
0
;
}
formats
=
av_mallocz
(
sizeof
(
*
formats
));
if
(
!
formats
)
return
AVERROR
(
ENOMEM
);
formats
->
nb_formats
=
nb_formats
;
if
(
nb_formats
)
{
formats
->
formats
=
av_malloc_array
(
nb_formats
,
sizeof
(
*
formats
->
formats
));
if
(
!
formats
->
formats
)
{
av_freep
(
&
formats
);
return
AVERROR
(
ENOMEM
);
}
}
}
}
// AVFilterFormats *avfilter_make_all_channel_layouts(void)
// {
// return avfilter_make_format64_list(avfilter_all_channel_layouts);
...
...
libavfilter/formats.h
View file @
563e1df5
...
...
@@ -221,6 +221,16 @@ int ff_add_format(AVFilterFormats **avff, int64_t fmt);
av_warn_unused_result
AVFilterFormats
*
ff_all_formats
(
enum
AVMediaType
type
);
/**
* Construct a formats list containing all pixel formats with certain
* properties
*/
av_warn_unused_result
int
ff_formats_pixdesc_filter
(
AVFilterFormats
**
rfmts
,
unsigned
want
,
unsigned
rej
);
//* format is software, non-planar with sub-sampling
#define FF_PIX_FMT_FLAG_SW_FLAT_SUB (1 << 24)
/**
* Construct a formats list containing all planar sample formats.
*/
...
...
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