Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
eb7571c8
Commit
eb7571c8
authored
Oct 20, 2023
by
Ziqing Hui
Committed by
Alexandre Julliard
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Introduce find_element_factories.
parent
ebc8a459
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
24 deletions
+39
-24
unix_private.h
dlls/winegstreamer/unix_private.h
+4
-1
unixlib.c
dlls/winegstreamer/unixlib.c
+35
-23
No files found.
dlls/winegstreamer/unix_private.h
View file @
eb7571c8
...
...
@@ -35,7 +35,10 @@ extern NTSTATUS wg_init_gstreamer(void *args) DECLSPEC_HIDDEN;
extern
GstStreamType
stream_type_from_caps
(
GstCaps
*
caps
)
DECLSPEC_HIDDEN
;
extern
GstElement
*
create_element
(
const
char
*
name
,
const
char
*
plugin_set
)
DECLSPEC_HIDDEN
;
extern
GstElement
*
find_element
(
GstElementFactoryListType
type
,
GstCaps
*
src_caps
,
GstCaps
*
sink_caps
)
DECLSPEC_HIDDEN
;
extern
GList
*
find_element_factories
(
GstElementFactoryListType
type
,
GstRank
min_rank
,
GstCaps
*
element_sink_caps
,
GstCaps
*
element_src_caps
)
DECLSPEC_HIDDEN
;
extern
GstElement
*
find_element
(
GstElementFactoryListType
type
,
GstCaps
*
element_sink_caps
,
GstCaps
*
element_src_caps
)
DECLSPEC_HIDDEN
;
extern
bool
append_element
(
GstElement
*
container
,
GstElement
*
element
,
GstElement
**
first
,
GstElement
**
last
)
DECLSPEC_HIDDEN
;
extern
bool
link_src_to_sink
(
GstPad
*
src_pad
,
GstPad
*
sink_pad
)
DECLSPEC_HIDDEN
;
extern
bool
link_src_to_element
(
GstPad
*
src_pad
,
GstElement
*
element
)
DECLSPEC_HIDDEN
;
...
...
dlls/winegstreamer/unixlib.c
View file @
eb7571c8
...
...
@@ -78,32 +78,50 @@ GstElement *create_element(const char *name, const char *plugin_set)
return
element
;
}
GstElement
*
find_element
(
GstElementFactoryListType
type
,
GstCaps
*
src_caps
,
GstCaps
*
sink_caps
)
GList
*
find_element_factories
(
GstElementFactoryListType
type
,
GstRank
min_rank
,
GstCaps
*
element_sink_caps
,
GstCaps
*
element_src_caps
)
{
GstElement
*
element
=
NULL
;
GList
*
tmp
,
*
transforms
;
const
gchar
*
name
;
GList
*
tmp
,
*
factories
=
NULL
;
if
(
!
(
transforms
=
gst_element_factory_list_get_elements
(
type
,
GST_RANK_MARGINAL
)))
if
(
!
(
factories
=
gst_element_factory_list_get_elements
(
type
,
min_rank
)))
goto
done
;
if
(
src
_caps
)
if
(
element_sink
_caps
)
{
tmp
=
gst_element_factory_list_filter
(
transforms
,
src
_caps
,
GST_PAD_SINK
,
FALSE
);
gst_plugin_feature_list_free
(
transform
s
);
if
(
!
(
transform
s
=
tmp
))
tmp
=
gst_element_factory_list_filter
(
factories
,
element_sink
_caps
,
GST_PAD_SINK
,
FALSE
);
gst_plugin_feature_list_free
(
factorie
s
);
if
(
!
(
factorie
s
=
tmp
))
goto
done
;
}
if
(
sink
_caps
)
if
(
element_src
_caps
)
{
tmp
=
gst_element_factory_list_filter
(
transforms
,
sink
_caps
,
GST_PAD_SRC
,
FALSE
);
gst_plugin_feature_list_free
(
transform
s
);
if
(
!
(
transform
s
=
tmp
))
tmp
=
gst_element_factory_list_filter
(
factories
,
element_src
_caps
,
GST_PAD_SRC
,
FALSE
);
gst_plugin_feature_list_free
(
factorie
s
);
if
(
!
(
factorie
s
=
tmp
))
goto
done
;
}
transforms
=
g_list_sort
(
transforms
,
gst_plugin_feature_rank_compare_func
);
factories
=
g_list_sort
(
factories
,
gst_plugin_feature_rank_compare_func
);
done:
if
(
!
factories
)
GST_WARNING
(
"Failed to find any element factory matching "
"type %"
G_GUINT64_FORMAT
"x, caps %"
GST_PTR_FORMAT
" / %"
GST_PTR_FORMAT
"."
,
type
,
element_sink_caps
,
element_src_caps
);
return
factories
;
}
GstElement
*
find_element
(
GstElementFactoryListType
type
,
GstCaps
*
element_sink_caps
,
GstCaps
*
element_src_caps
)
{
GstElement
*
element
=
NULL
;
GList
*
tmp
,
*
transforms
;
const
gchar
*
name
;
if
(
!
(
transforms
=
find_element_factories
(
type
,
GST_RANK_MARGINAL
,
element_sink_caps
,
element_src_caps
)))
return
NULL
;
for
(
tmp
=
transforms
;
tmp
!=
NULL
&&
element
==
NULL
;
tmp
=
tmp
->
next
)
{
name
=
gst_plugin_feature_get_name
(
GST_PLUGIN_FEATURE
(
tmp
->
data
));
...
...
@@ -120,20 +138,14 @@ GstElement *find_element(GstElementFactoryListType type, GstCaps *src_caps, GstC
if
(
!
(
element
=
gst_element_factory_create
(
GST_ELEMENT_FACTORY
(
tmp
->
data
),
NULL
)))
GST_WARNING
(
"Failed to create %s element."
,
name
);
}
gst_plugin_feature_list_free
(
transforms
);
done:
if
(
element
)
{
GST_DEBUG
(
"Created %s element %p."
,
name
,
element
);
}
else
{
gchar
*
src_str
=
gst_caps_to_string
(
src_caps
),
*
sink_str
=
gst_caps_to_string
(
sink_caps
);
GST_WARNING
(
"Failed to create element matching caps %s / %s."
,
src_str
,
sink_str
);
g_free
(
sink_str
);
g_free
(
src_str
);
}
GST_WARNING
(
"Failed to create element matching caps %"
GST_PTR_FORMAT
" / %"
GST_PTR_FORMAT
"."
,
element_sink_caps
,
element_src_caps
);
return
element
;
}
...
...
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